Commit cb1e6dd7 authored by Guillaume Hervier's avatar Guillaume Hervier

slapos_cloud: Computer_viewCurrentUsage: Make column links proper and compatible with RenderJS UI.

parent 2b311891
partition = context
if brain is None:
brain = context
software_instance_list = partition.getAggregateRelatedValueList(portal_type=["Software Instance"])
for si in software_instance_list:
obj = si.getObject()
hosting_url = obj.getSpecialise()
if hosting_url:
return "%s?editable_mode:int=1" % hosting_url
software_instance = brain.getAggregateRelatedValue(portal_type=["Software Instance"])
if software_instance is None:
return None
hosting_subscription = software_instance.getSpecialiseValue()
if url_dict: # If RenderJS UI
jio_key = hosting_subscription.getRelativeUrl()
return {
'command': 'push_history',
'view_kw': {
'view': 'view',
'jio_key': jio_key,
},
'options': {
'jio_key': jio_key
},
}
else:
return hosting_subscription.absolute_url()
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>url_dict=False, brain=None, selection=None, selection_name=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
partition = context
if brain is None:
brain = context
software_instance_list = partition.getAggregateRelatedValueList(portal_type=["Software Instance"])
for si in software_instance_list:
obj = si.getObject()
return "%s?editable_mode:int=1" % obj.getRelativeUrl()
software_instance = brain.getAggregateRelatedValue(portal_type=["Software Instance"])
if software_instance is None:
return None
if url_dict: # If RenderJS UI
jio_key = software_instance.getRelativeUrl()
return {
'command': 'push_history',
'view_kw': {
'view': 'view',
'jio_key': jio_key,
'editable': 'true',
},
'options': {
'jio_key': jio_key
},
}
else:
return software_instance.absolute_url()
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>url_dict=False, brain=None, selection=None, selection_name=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
partition = context
si = partition.getAggregateRelatedValue(portal_type=["Software Instance", "Slave Instance"])
if si:
person = si.getSpecialiseValue().getDestinationSectionValue()
return '<a href="%s?editable_mode:int=1">%s</a>' % (person.getRelativeUrl(), person.getTitle())
instance = context.getAggregateRelatedValue(portal_type=["Software Instance"])
if instance is None:
return None
owner = instance.getSpecialiseValue().getDestinationSectionValue()
return owner.getTitle()
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerPartition_getOwnerAsHtml</string> </value>
<value> <string>ComputerPartition_getOwnerName</string> </value>
</item>
</dictionary>
</pickle>
......
if brain is None:
brain = context
instance = brain.getAggregateRelatedValue(portal_type=["Software Instance"])
if instance is None:
return None
owner = instance.getSpecialiseValue().getDestinationSectionValue()
if url_dict: # If RenderJS UI
jio_key = owner.getRelativeUrl()
return {
'command': 'push_history',
'view_kw': {
'view': 'view',
'jio_key': jio_key,
},
'options': {
'jio_key': jio_key
},
}
else:
return owner.absolute_url()
......@@ -50,11 +50,11 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>url_dict=False, brain=None, selection=None, selection_name=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ComputerPartition_getUsageReportUrl</string> </value>
<value> <string>ComputerPartition_getOwnerUrl</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -95,7 +95,6 @@
<string>listbox_usage</string>
<string>my_busy_computer_partition_list_creation_date</string>
<string>my_busy_computer_partition_list_status</string>
<string>my_busy_computer_partition_list_owner_title</string>
<string>listbox_installation_status</string>
<string>my_busy_computer_partition_list_hosting_subscription_title</string>
<string>my_busy_computer_partition_list_instance_title</string>
......
......@@ -414,7 +414,7 @@
<string>Image</string>
</tuple>
<tuple>
<string>owner_title</string>
<string>ComputerPartition_getOwnerName</string>
<string>Owner</string>
</tuple>
<tuple>
......@@ -641,10 +641,6 @@
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
<string>reference</string>
<string>ComputerPartition_getUsageReportUrl</string>
</tuple>
<tuple>
<string>instance_title</string>
<string>ComputerPartition_getInstanceUrlString</string>
......@@ -661,6 +657,10 @@
<string>image</string>
<string>ComputerPartition_getInstanceUrlString</string>
</tuple>
<tuple>
<string>ComputerPartition_getOwnerName</string>
<string>ComputerPartition_getOwnerUrl</string>
</tuple>
<tuple>
<string>ComputerPartition_getLastestContactedDate</string>
<string>ComputerPartition_getInstanceUrlString</string>
......
<?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>title</string>
<string>default</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_busy_computer_partition_list_owner_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>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>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_editor_field</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>
<item>
<key> <string>title</string> </key>
<value> <string>Instance Owner</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>cell/ComputerPartition_getOwnerAsHtml</string> </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