Commit cb2c5e0c authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Fixup and speed up Software Release list on Compute Network

   Display only the Software Releases and if they can allocate or not, since display individual computers are not exactly good.
   Filter compute nodes by allocation scope (not closed forever)
parent ae6ae56e
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/ComputerNetwork_viewSofwareRelease</string> </value> <value> <string>string:${object_url}/ComputerNetwork_viewSoftwareReleaseList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
portal = context.getPortalObject()
url_string_list = []
for software_installation in portal.portal_catalog(
portal_type='Software Installation',
validation_state='validated',
default_aggregate_uid=[
x.uid for x in context.portal_catalog(
default_subordination_uid=context.getUid(),
portal_type="Compute Node")]
):
if software_installation.getSlapState() == 'start_requested':
url_string = software_installation.getUrlString()
if url_string:
url_string_list.append(url_string)
if url_string_list:
return context.portal_catalog(
portal_type="Software Release",
url_string=url_string_list)
else:
return []
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerNetwork_getReleatedSoftwareRelease</string> </value> <value> <string>ComputerNetwork_getRelatedSoftwareReleaseList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
portal = context.getPortalObject()
network = context
computter_list_uid = [x.getUid() for x in network.getSubordinationRelatedValueList()]
kw['portal_type']='Software Installation'
kw['validation_state']='validated'
kw['default_aggregate_uid']=computter_list_uid
return portal.portal_catalog(**kw)
software_installation = context
portal = context.getPortalObject()
url_string = ""
software_release = portal.portal_catalog.getResultValue(
portal_type='Software Release',
url_string=software_installation.getUrlString()
)
if software_release:
url_string = "%s?editable_mode:int=1" % software_release.getAbsoluteUrl()
return url_string
<?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>ComputerNetwork_getSoftwareReleaseUrl</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -71,21 +71,24 @@ ...@@ -71,21 +71,24 @@
<string>listbox_image</string> <string>listbox_image</string>
<string>listbox_status</string> <string>listbox_status</string>
<string>listbox_title</string> <string>listbox_title</string>
<string>listbox_version</string>
<string>listbox_compute_node_reference</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list/> <list>
<string>my_title</string>
<string>my_reference</string>
</list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list/> <list>
<string>my_translated_validation_state_title</string>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -93,7 +96,7 @@ ...@@ -93,7 +96,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerNetwork_viewSofwareRelease</string> </value> <value> <string>ComputerNetwork_viewSoftwareReleaseList</string> </value>
</item> </item>
<item> <item>
<key> <string>method</string> </key> <key> <string>method</string> </key>
......
...@@ -411,10 +411,6 @@ ...@@ -411,10 +411,6 @@
<string>image</string> <string>image</string>
<string>Image</string> <string>Image</string>
</tuple> </tuple>
<tuple>
<string>compute_node_reference</string>
<string>Compute Node</string>
</tuple>
<tuple> <tuple>
<string>url_string</string> <string>url_string</string>
<string>URL</string> <string>URL</string>
...@@ -432,9 +428,7 @@ ...@@ -432,9 +428,7 @@
</item> </item>
<item> <item>
<key> <string>count_method</string> </key> <key> <string>count_method</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
...@@ -539,7 +533,7 @@ ...@@ -539,7 +533,7 @@
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -559,12 +553,7 @@ ...@@ -559,12 +553,7 @@
<item> <item>
<key> <string>portal_types</string> </key> <key> <string>portal_types</string> </key>
<value> <value>
<list> <list/>
<tuple>
<string>Software Installation</string>
<string>Software Installation</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -646,18 +635,10 @@ ...@@ -646,18 +635,10 @@
<key> <string>url_columns</string> </key> <key> <string>url_columns</string> </key>
<value> <value>
<list> <list>
<tuple>
<string>title</string>
<string>ComputerNetwork_getSoftwareReleaseUrl</string>
</tuple>
<tuple> <tuple>
<string>url_string</string> <string>url_string</string>
<string>getUrlString</string> <string>getUrlString</string>
</tuple> </tuple>
<tuple>
<string>version</string>
<string>ComputerNetwork_getSoftwareReleaseUrl</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
...@@ -718,20 +699,7 @@ string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getI ...@@ -718,20 +699,7 @@ string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getI
<dictionary> <dictionary>
<item> <item>
<key> <string>method_name</string> </key> <key> <string>method_name</string> </key>
<value> <string>countResults</string> </value> <value> <string>ComputerNetwork_getRelatedSoftwareReleaseList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>ComputerNetwork_getReleatedSoftwareRelease</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -186,6 +186,10 @@ ...@@ -186,6 +186,10 @@
<key> <string>image_quality</string> </key> <key> <string>image_quality</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>max_length</string> </key> <key> <string>max_length</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -315,7 +319,7 @@ ...@@ -315,7 +319,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: cell.portal_catalog.getResultValue(portal_type=\'Software Release\', url_string=cell.getUrlString()).getAggregateValue().getDefaultImageAbsoluteUrl()</string> </value> <value> <string>python: cell.getAggregateValue().getDefaultImageAbsoluteUrl()</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: cell.getAggregateValue().getSubordinationValue().ComputerNetwork_getSoftwareReleaseAllocableState(cell.getUrlString())</string> </value> <value> <string>python: context.ComputerNetwork_getSoftwareReleaseAllocableState(cell.getUrlString())</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -10,16 +10,13 @@ ...@@ -10,16 +10,13 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>default</string>
<string>display_width</string>
<string>editable</string> <string>editable</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_compute_node_reference</string> </value> <value> <string>my_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -55,12 +52,6 @@ ...@@ -55,12 +52,6 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -80,21 +71,13 @@ ...@@ -80,21 +71,13 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value> <value> <string>my_view_mode_read_only_reference</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
...@@ -104,27 +87,10 @@ ...@@ -104,27 +87,10 @@
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Compute Node Reference</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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>python: cell.getAggregateValue().getTitle()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -10,16 +10,13 @@ ...@@ -10,16 +10,13 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>default</string>
<string>display_width</string>
<string>editable</string> <string>editable</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>listbox_version</string> </value> <value> <string>my_title</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -55,12 +52,6 @@ ...@@ -55,12 +52,6 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -80,21 +71,13 @@ ...@@ -80,21 +71,13 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item> <item>
<key> <string>editable</string> </key> <key> <string>editable</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value> <value> <string>my_view_mode_title</string> </value>
</item> </item>
<item> <item>
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
...@@ -104,27 +87,10 @@ ...@@ -104,27 +87,10 @@
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value> <value> <string>Click to edit the target</string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Version</string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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>python: cell.portal_catalog.getResultValue(portal_type=\'Software Release\', url_string=cell.getUrlString()).getVersion()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?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/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_translated_validation_state_title</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>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>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_translated_workflow_state_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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