From cec12a0b8c2d15fd22f7d2c7bf3f9cb104e788d2 Mon Sep 17 00:00:00 2001 From: Alain Takoudjou <talino@tiolive.com> Date: Tue, 5 Aug 2014 13:29:18 +0200 Subject: [PATCH] Computer_viewCurrentUsage also show software installation status --- .../Computer_viewCurrentUsage.xml | 1 + .../Computer_viewCurrentUsage/listbox.xml | 4 + .../listbox_installation_status.xml | 307 ++++++++++++++++++ ...ease_getCurrentInstallationStateAsHtml.xml | 106 ++++++ master/bt5/slapos_cloud/bt/revision | 2 +- 5 files changed, 419 insertions(+), 1 deletion(-) create mode 100644 master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox_installation_status.xml create mode 100644 master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage.xml index eecccec5b..f12e1c0a3 100644 --- a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage.xml +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage.xml @@ -99,6 +99,7 @@ <string>my_busy_computer_partition_list_status</string> <string>my_busy_computer_partition_list_owner_title</string> <string>my_busy_computer_partition_list_instance_title</string> + <string>listbox_installation_status</string> </list> </value> </item> diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox.xml index 8db1b8b0c..f7c0c8a55 100644 --- a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox.xml +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox.xml @@ -118,6 +118,10 @@ <string>usage</string> <string>Usage</string> </tuple> + <tuple> + <string>installation_status</string> + <string>Status</string> + </tuple> </list> </value> </item> diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox_installation_status.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox_installation_status.xml new file mode 100644 index 000000000..3c8427a39 --- /dev/null +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_viewCurrentUsage/listbox_installation_status.xml @@ -0,0 +1,307 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>listbox_installation_status</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> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Monitoring</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </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.SoftwareRelease_getCurrentInstallationStateAsHtml(context.REQUEST.get(\'here\').getUid())</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml new file mode 100644 index 000000000..451935fb1 --- /dev/null +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_getCurrentInstallationStateAsHtml.xml @@ -0,0 +1,106 @@ +<?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> diff --git a/master/bt5/slapos_cloud/bt/revision b/master/bt5/slapos_cloud/bt/revision index 194ba8cc7..9d239ff80 100644 --- a/master/bt5/slapos_cloud/bt/revision +++ b/master/bt5/slapos_cloud/bt/revision @@ -1 +1 @@ -320 \ No newline at end of file +321 \ No newline at end of file -- 2.30.9