Commit 03ee21ca authored by Rafael Monnerat's avatar Rafael Monnerat

Instance tree fast input

See merge request !504
parents 47ff8c75 ad8d64de
......@@ -490,6 +490,18 @@
});
})
.push(function () {
var fast_input_dict = {
command: "display",
options: {
page: "slap_intent",
intent: "request",
shared: 1,
sofware_type: gadget.state.doc.source_reference,
software_release: gadget.state.doc.url_string,
sla_xml: gadget.state.doc.fast_input_dict.sla_xml,
strict: "True"
}
};
return RSVP.all([
gadget.getUrlFor({command: "change", options: {editable: true}}),
gadget.getUrlFor({command: "change", options: {"page": "slap_add_related_ticket"}}),
......@@ -498,7 +510,8 @@
gadget.getUrlFor({command: "change", options: {"page": "slap_destroy_instance_tree"}}),
gadget.getUrlFor({command: "change", options: {page: "slap_rss_ticket"}}),
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: "change", options: {page: "slap_transfer_instance_tree"}})
gadget.getUrlFor({command: "change", options: {page: "slap_transfer_instance_tree"}}),
gadget.getUrlFor(fast_input_dict)
]);
})
.push(function (url_list) {
......@@ -517,6 +530,9 @@
if (gadget.state.doc.slap_state === "stop_requested") {
header_dict.start_url = url_list[2];
}
if (gadget.state.doc.fast_input_dict.enabled !== undefined) {
header_dict.fast_input_url = url_list[8];
}
if (!gadget.state.editable) {
header_dict.edit_content = url_list[0];
}
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1004.26872.6486.682</string> </value>
<value> <string>1007.21760.63093.46916</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -258,7 +258,7 @@
</tuple>
<state>
<tuple>
<float>1669310224.29</float>
<float>1679945002.44</float>
<string>UTC</string>
</tuple>
</state>
......
# Recommendation, keep as simple as possible.
# Use string in url because there are multiple products for ORS,
# and it would be a costly query and require Manager Proxy role.
if context.getRootSlave():
return {}
for sr_string in ['software/re6stnet/', 'software/caddy-frontend/']:
if context.getSuccessorReference() is not None and sr_string in context.getUrlString(''):
return {
'enabled': True,
'sla_xml': '<parameter id="instance_guid">%s</parameter>' % context.getSuccessorReference()
}
return {}
<?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>InstanceTree_getFastInputDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -114,6 +114,7 @@
<string>my_source_project_title</string>
<string>my_source_title</string>
<string>my_list_image</string>
<string>my_fast_input_dict</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_fast_input_dict</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Fast Input Dict</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>here/InstanceTree_getFastInputDict</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1659,3 +1659,84 @@ class TestBase_getAttentionPointList(TestSlapOSHalJsonStyleMixin):
attention_point_list = json.loads(
support_request_module.Base_getAttentionPointList())
self.assertEqual(attention_point_list, [])
class TestInstanceTree_getFastInputDict(TestSlapOSHalJsonStyleMixin):
def afterSetUp(self):
self.instance_tree = self.portal.instance_tree_module.newContent(
portal_type="Instance Tree"
)
self.software_instance = self.portal.software_instance_module.newContent(
portal_type="Software Instance"
)
TestSlapOSHalJsonStyleMixin.afterSetUp(self)
def testInstanceTree_getFastInputDict_noUrlString(self):
self.assertEqual({},
self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_re6st_no_instance(self):
self.instance_tree.setUrlString(
self.portal.software_release_module.re6st.getUrlString())
self.assertEqual({},
self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_frontend_no_instance(self):
self.instance_tree.setUrlString(
self.portal.software_release_module.frontend.getUrlString())
self.assertEqual({},
self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_slave_re6st(self):
self.instance_tree.setRootSlave(True)
self.instance_tree.setUrlString(
self.portal.software_release_module.re6st.getUrlString())
slave_instance = self.portal.software_instance_module.newContent(
portal_type="Slave Instance",
specialise_value=self.instance_tree
)
self.instance_tree.setSuccessorValue(slave_instance)
self.assertEqual({},
self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_slave_frontend(self):
self.instance_tree.setRootSlave(True)
slave_instance = self.portal.software_instance_module.newContent(
portal_type="Slave Instance",
specialise_value=self.instance_tree
)
self.instance_tree.setSuccessorValue(slave_instance)
self.instance_tree.setUrlString(
self.portal.software_release_module.frontend.getUrlString())
self.assertEqual({},
self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_re6st(self):
self.instance_tree.setUrlString(
self.portal.software_release_module.re6st.getUrlString())
software_instance = self.portal.software_instance_module.newContent(
portal_type="Software Instance",
specialise_value=self.instance_tree,
reference="TESTSOFTINST-%s" % self.generateNewId()
)
self.instance_tree.setSuccessorValue(software_instance)
self.instance_tree.setUrlString(
self.portal.software_release_module.re6st.getUrlString())
self.assertEqual({
'enabled': True,
'sla_xml': '<parameter id="instance_guid">%s</parameter>' % software_instance.getReference()
}, self.instance_tree.InstanceTree_getFastInputDict())
def testInstanceTree_getFastInputDict_frontend(self):
software_instance = self.portal.software_instance_module.newContent(
portal_type="Software Instance",
specialise_value=self.instance_tree,
reference="TESTSOFTINST-%s" % self.generateNewId()
)
self.instance_tree.setSuccessorValue(software_instance)
self.instance_tree.setUrlString(
self.portal.software_release_module.frontend.getUrlString())
self.assertEqual({
'enabled': True,
'sla_xml': '<parameter id="instance_guid">%s</parameter>' % software_instance.getReference()
}, self.instance_tree.InstanceTree_getFastInputDict())
\ No newline at end of file
......@@ -15,6 +15,9 @@ if software_product_reference is None:
if not software_release:
return []
if strict:
return [software_release]
software_product_reference = software_release.getAggregateReference()
if not software_product_reference:
return []
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_product_reference=None, software_release_url=None</string> </value>
<value> <string>software_product_reference=None, software_release_url=None, strict=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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