Commit 61544e23 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Drop action that display monitor links in a listbox

   It is broken, unused, and it is saves no time in general. It is better rely directly on sync to get all information on monitoring, or improve Support Request UI itself.
parent 515598d1
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_report</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_report</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>support_request_monitor_link</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>10.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Support Request Monitor Link</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SupportRequestModule_viewSupportRequestMonitorLinkListReport</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from Products.PythonScripts.standard import Object
portal = context.getPortalObject()
support_request_list = portal.portal_catalog(
portal_type="Support Request",
simulation_state=["validated", "suspended"],
)
instance_tree_list = []
for support_request in support_request_list:
instance_tree_list.append(
support_request.getAggregateValue(portal_type="Instance Tree"))
monitor_instance_list = []
for instance_tree in instance_tree_list:
if instance_tree is None:
continue
if instance_tree.getSlapState() == 'destroy_requested':
continue
instance = instance_tree.getSuccessorValue()
if instance is None or instance.getSlapState() in ('destroy_requested', 'stop_requested'):
continue
parameter_dict = instance.getConnectionXmlAsDict()
url_string = parameter_dict.get('monitor_setup_url', '') or parameter_dict.get('monitor-setup-url', '')
if url_string:
param_list = url_string.split('#')
if len(param_list) != 2:
# bad or unknown url
continue
monitor_instance_list.append(
Object(uid="uid_%s" % instance.getId(),
title=instance.getTitle(),
monitor_url=url_string))
return monitor_instance_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_getMonitoringUrlList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequestModule_viewSupportRequestMonitorLinkListReport</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SupportRequestModule_viewSupportRequestMonitorLinkListReport</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>report_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Monitoring Links</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequest_getMonitorUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
import transaction import transaction
from erp5.component.test.SlapOSTestCaseMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
SlapOSTestCaseMixin,SlapOSTestCaseMixinWithAbort, TemporaryAlarmScript SlapOSTestCaseMixin,SlapOSTestCaseMixinWithAbort
from Products.ERP5Type.tests.utils import FileUpload from Products.ERP5Type.tests.utils import FileUpload
import os import os
...@@ -88,61 +88,6 @@ class TestCRMSkinsMixin(SlapOSTestCaseMixinWithAbort): ...@@ -88,61 +88,6 @@ class TestCRMSkinsMixin(SlapOSTestCaseMixinWithAbort):
return software_installation return software_installation
class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
def test_SupportRequestModule_getMonitoringUrlList(self):
module = self.portal.support_request_module
# We assume here that several objects created by others tests don't influentiate
# this test.
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
with TemporaryAlarmScript(self.portal, 'Item_getSubscriptionStatus', "'subscribed'"):
instance_tree = self._makeInstanceTree(self.project)
self._makeSoftwareInstance(instance_tree, "https://xxx/")
support_request = module.newContent(portal_type="Support Request")
self.tic()
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
support_request.setAggregateValue(instance_tree)
support_request.validate()
self.assertNotEqual(instance_tree.getSuccessorList(), [])
self.tic()
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
instance = instance_tree.getSuccessorValue()
instance.setConnectionXml("""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="aa">xx</parameter>
<parameter id="bb">yy</parameter>
</instance>
""")
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
instance.setConnectionXml("""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="monitor-setup-url">http</parameter>
<parameter id="bb">yy</parameter>
</instance>
""")
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
self.assertEqual(module.SupportRequestModule_getMonitoringUrlList(), [])
instance.setConnectionXml("""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="monitor-setup-url">http://monitor.url/#/ABC</parameter>
<parameter id="bb">yy</parameter>
</instance>
""")
monitor_url_temp_document_list = module.SupportRequestModule_getMonitoringUrlList()
self.assertEqual(len(monitor_url_temp_document_list), 1)
self.assertEqual(monitor_url_temp_document_list[0].title,
instance_tree.getTitle())
self.assertEqual(monitor_url_temp_document_list[0].monitor_url,
"http://monitor.url/#/ABC")
support_request.invalidate()
self.tic()
self.assertNotEqual(instance_tree.getSuccessorList(), [])
class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin): class TestSlapOSisSupportRequestCreationClosed(TestCRMSkinsMixin):
def afterSetUp(self): def afterSetUp(self):
......
...@@ -6,4 +6,3 @@ Regularisation Request | create_new_file ...@@ -6,4 +6,3 @@ Regularisation Request | create_new_file
Regularisation Request | document_list Regularisation Request | document_list
Regularisation Request | new_event Regularisation Request | new_event
Regularisation Request | view Regularisation Request | view
Support Request Module | support_request_monitor_link
\ No newline at end of file
...@@ -113,7 +113,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template): ...@@ -113,7 +113,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency', 'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency',
'slapos_cloud/ComputerNetwork_getRelatedSoftwareReleaseList', 'slapos_cloud/ComputerNetwork_getRelatedSoftwareReleaseList',
'slapos_crm_monitoring/SupportRequest_afterNewEvent', 'slapos_crm_monitoring/SupportRequest_afterNewEvent',
'slapos_crm_monitoring/SupportRequest_getMonitorUrl',
'slapos_crm/RegularisationRequest_afterClone', 'slapos_crm/RegularisationRequest_afterClone',
'slapos_crm/RegularisationRequest_getResourceItemList', 'slapos_crm/RegularisationRequest_getResourceItemList',
'slapos_crm/RegularisationRequest_init', 'slapos_crm/RegularisationRequest_init',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment