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 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/ComputerNetwork_viewSofwareRelease</string> </value>
<value> <string>string:${object_url}/ComputerNetwork_viewSoftwareReleaseList</string> </value>
</item>
</dictionary>
</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 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerNetwork_getReleatedSoftwareRelease</string> </value>
<value> <string>ComputerNetwork_getRelatedSoftwareReleaseList</string> </value>
</item>
</dictionary>
</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 @@
<string>listbox_image</string>
<string>listbox_status</string>
<string>listbox_title</string>
<string>listbox_version</string>
<string>listbox_compute_node_reference</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
<list>
<string>my_title</string>
<string>my_reference</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
<list>
<string>my_translated_validation_state_title</string>
</list>
</value>
</item>
</dictionary>
......@@ -93,7 +96,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerNetwork_viewSofwareRelease</string> </value>
<value> <string>ComputerNetwork_viewSoftwareReleaseList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......
......@@ -411,10 +411,6 @@
<string>image</string>
<string>Image</string>
</tuple>
<tuple>
<string>compute_node_reference</string>
<string>Compute Node</string>
</tuple>
<tuple>
<string>url_string</string>
<string>URL</string>
......@@ -432,9 +428,7 @@
</item>
<item>
<key> <string>count_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
......@@ -539,7 +533,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
......@@ -559,12 +553,7 @@
<item>
<key> <string>portal_types</string> </key>
<value>
<list>
<tuple>
<string>Software Installation</string>
<string>Software Installation</string>
</tuple>
</list>
<list/>
</value>
</item>
<item>
......@@ -646,18 +635,10 @@
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>ComputerNetwork_getSoftwareReleaseUrl</string>
</tuple>
<tuple>
<string>url_string</string>
<string>getUrlString</string>
</tuple>
<tuple>
<string>version</string>
<string>ComputerNetwork_getSoftwareReleaseUrl</string>
</tuple>
</list>
</value>
</item>
......@@ -718,20 +699,7 @@ string:Base_viewListMode?proxy_form_id=${form/getId}&proxy_field_id=${field/getI
<dictionary>
<item>
<key> <string>method_name</string> </key>
<value> <string>countResults</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>
<value> <string>ComputerNetwork_getRelatedSoftwareReleaseList</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -186,6 +186,10 @@
<key> <string>image_quality</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
......@@ -315,7 +319,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -125,7 +125,7 @@
<dictionary>
<item>
<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>
</dictionary>
</pickle>
......
......@@ -10,16 +10,13 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>display_width</string>
<string>editable</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_compute_node_reference</string> </value>
<value> <string>my_reference</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -55,12 +52,6 @@
<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>
......@@ -80,21 +71,13 @@
<key> <string>values</string> </key>
<value>
<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>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<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>
<key> <string>form_id</string> </key>
......@@ -104,27 +87,10 @@
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Compute Node Reference</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>python: cell.getAggregateValue().getTitle()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,16 +10,13 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>display_width</string>
<string>editable</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_version</string> </value>
<value> <string>my_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......@@ -55,12 +52,6 @@
<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>
......@@ -80,21 +71,13 @@
<key> <string>values</string> </key>
<value>
<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>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
<value> <string>my_view_mode_title</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
......@@ -104,27 +87,10 @@
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Version</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>python: cell.portal_catalog.getResultValue(portal_type=\'Software Release\', url_string=cell.getUrlString()).getVersion()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</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