Commit cec12a0b authored by Alain Takoudjou's avatar Alain Takoudjou

Computer_viewCurrentUsage also show software installation status

parent 5bc8a596
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
<string>my_busy_computer_partition_list_status</string> <string>my_busy_computer_partition_list_status</string>
<string>my_busy_computer_partition_list_owner_title</string> <string>my_busy_computer_partition_list_owner_title</string>
<string>my_busy_computer_partition_list_instance_title</string> <string>my_busy_computer_partition_list_instance_title</string>
<string>listbox_installation_status</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -118,6 +118,10 @@ ...@@ -118,6 +118,10 @@
<string>usage</string> <string>usage</string>
<string>Usage</string> <string>Usage</string>
</tuple> </tuple>
<tuple>
<string>installation_status</string>
<string>Status</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<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>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
portal = context.getPortalObject()\n
import json\n
\n
memcached_dict = context.getPortalObject().portal_memcached.getMemcachedDict(\n
key_prefix=\'slap_tool\',\n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
\n
error_style = \'background-color: red; display: block; height: 2em; width: 2em; float: left; margin: 5px;\'\n
access_style = \'background-color: green; display: block; height: 2em; width: 2em; float: left; margin: 5px;\'\n
\n
software_installation = portal.portal_catalog.getResultValue(\n
portal_type=\'Software Installation\',\n
validation_state=\'validated\',\n
url_string=context.getUrlString(),\n
default_aggregate_uid=computer_uid\n
)\n
if not software_installation or software_installation.getSlapState() == "destroy_requested":\n
return \'<span" style="%s" title="Information not available"></a>\' % error_style\n
\n
try:\n
d = memcached_dict[software_installation.getReference()]\n
except KeyError:\n
return "<a href=\'%s\' style=\'%s\'></a>" % (software_installation.getRelativeUrl(),\n
error_style)\n
else:\n
d = json.loads(d)\n
result = d[\'text\']\n
date = DateTime(d[\'created_at\'])\n
limit_date = DateTime() - 0.084\n
if result.startswith(\'#error \') or (date - limit_date) < 0:\n
access_style = error_style\n
\n
return "<a href=\'%s\' style=\'%s\' title=\'%s at %s\'></a>" % (\n
software_installation.getRelativeUrl(),\n
access_style, result, d[\'created_at\'])\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>computer_uid</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareRelease_getCurrentInstallationStateAsHtml</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
320 321
\ No newline at end of file \ No newline at end of file
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