Commit 5f7e151b authored by Lu Xu's avatar Lu Xu 👀

slapos_jio: display software logo on services list & view page

parent fe196dc4
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_viewDummyAsHateoas</string> </value> <value> <string>string:${object_url}/HostingSubscriptionModule_viewServicesListAsHateoas</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -166,10 +166,24 @@ ...@@ -166,10 +166,24 @@
"Connection Parameters", "Connection Parameters",
"Associated Tickets", "Associated Tickets",
"Instances", "Instances",
"Hosting Subscription:" "Hosting Subscription:",
"Software Logo"
]; ];
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getSetting("hateoas_url");
})
.push(function (hateoas_url) {
return gadget.jio_getAttachment(gadget.state.jio_key,
hateoas_url + gadget.state.jio_key +
'/HostingSubscription_getDefaultImageAbsoluteUrl',
{});
})
.push(function (blob) {
return jIO.util.readBlobAsText(blob);
})
.push(function (result) {
gadget.state.doc.list_image = result.srcElement.result;
return RSVP.all([ return RSVP.all([
gadget.getDeclaredGadget('form_view'), gadget.getDeclaredGadget('form_view'),
gadget.getTranslationList(translation_list) gadget.getTranslationList(translation_list)
...@@ -444,6 +458,18 @@ ...@@ -444,6 +458,18 @@
"sort": [["title", "ascending"]], "sort": [["title", "ascending"]],
"title": result[1][28], "title": result[1][28],
"type": "ListBox" "type": "ListBox"
},
"my_list_image": {
"css_class": "",
"default": gadget.state.doc.list_image +
"?quality=75.0&amp;display=thumbnail&amp;format=png",
"description": "",
"editable": 1,
"hidden": 0,
"key": "list_image",
"required": 0,
"title": result[1][30],
"type": "ImageField"
} }
}}, }},
"_links": { "_links": {
...@@ -462,7 +488,7 @@ ...@@ -462,7 +488,7 @@
[["my_slap_state_title"], ['my_monitoring_status'], ['my_monitor_scope'], ['my_upgrade_scope'], ['my_source_project'], ['my_source']] [["my_slap_state_title"], ['my_monitoring_status'], ['my_monitor_scope'], ['my_upgrade_scope'], ['my_source_project'], ['my_source']]
], ["center", ], ["center",
[["my_source_reference"], ["my_url_string"]] [["my_source_reference"], ["my_url_string"], ["my_list_image"]]
], [ ], [
"bottom", "bottom",
[["ticket_listbox"], ["connection_listbox"], ["my_text_content"], ["listbox"]] [["ticket_listbox"], ["connection_listbox"], ["my_text_content"], ["listbox"]]
...@@ -510,4 +536,4 @@ ...@@ -510,4 +536,4 @@
return gadget.updateHeader(header_dict); return gadget.updateHeader(header_dict);
}); });
}); });
}(window, rJS, RSVP, btoa)); }(window, rJS, RSVP, btoa));
\ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>986.45437.22132.61764</string> </value> <value> <string>992.9555.45845.62054</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1602259937.61</float> <float>1621433830.07</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
data-i18n=Services data-i18n=Services
data-i18n=Subscription data-i18n=Subscription
data-i18n=Subscriptions data-i18n=Subscriptions
data-i18n=Software Logo
--> -->
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
......
...@@ -12,12 +12,11 @@ ...@@ -12,12 +12,11 @@
.declareAcquiredMethod("setSetting", "setSetting") .declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("getTranslationList", "getTranslationList") .declareAcquiredMethod("getTranslationList", "getTranslationList")
.allowPublicAcquisition("jio_allDocs", function (param_list) { .allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this; var gadget = this;
param_list[0].select_list = ["uid", "title", "short_title",
"root_slave"];
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
var i, value, news, len = result.data.total_rows; var i, value, news, len = result.data.total_rows;
...@@ -28,19 +27,13 @@ ...@@ -28,19 +27,13 @@
result.data.rows[i].value.HostingSubscription_getNewsDict = { result.data.rows[i].value.HostingSubscription_getNewsDict = {
field_gadget_param : { field_gadget_param : {
css_class: "", css_class: "",
description: gadget.description_translation,
hidden: 0, hidden: 0,
"default": {jio_key: value, result: news}, default: {jio_key: value, result: news},
key: "status", key: "status",
url: "gadget_slapos_hosting_subscription_status.html", url: "gadget_slapos_hosting_subscription_status.html",
title: gadget.title_translation,
type: "GadgetField" type: "GadgetField"
} }
}; };
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
} }
} }
return result; return result;
...@@ -59,65 +52,32 @@ ...@@ -59,65 +52,32 @@
}) })
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this, var gadget = this,
lines_limit, services_translation;
services_translation,
translation_list = [
"Title",
"Short Title",
"Status",
"Services",
"The Status"
];
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.jio_getAttachment('hosting_subscription_module', 'view');
})
.push(function (result) {
gadget.hosting_subscription_module_view = result;
return RSVP.all([ return RSVP.all([
gadget.getDeclaredGadget('form_list'), gadget.getDeclaredGadget('form_list'),
gadget.getSetting("listbox_lines_limit", 20), gadget.getSetting("listbox_lines_limit", 20),
gadget.getTranslationList(translation_list) gadget.getTranslationList(["Services"])
]); ]);
}) })
.push(function (result) { .push(function (result) {
gadget.title_translation = result[2][2]; gadget.title_translation = result[2][2];
gadget.description_translation = result[2][4]; gadget.description_translation = result[2][4];
var column_list = [ var form_list = result[0];
['title', result[2][0]], services_translation = result[2][0];
['short_title', result[2][1]],
['HostingSubscription_getNewsDict', result[2][2]]
],
form_list = result[0];
lines_limit = result[1];
services_translation = result[2][3];
return form_list.render({ return form_list.render({
erp5_document: { /**
"_embedded": {"_view": { * XXX should update every page on Panel
"listbox": { * Directly use a new created ERP5 form to display the list
"column_list": column_list, * instead of using hard-corded JS
"show_anchor": 0, **/
"default_params": {}, erp5_document: gadget.hosting_subscription_module_view,
"editable": 0,
"editable_column_list": [],
"key": "slap_service_listbox",
"lines": lines_limit,
"list_method": "portal_catalog",
// XXX TODO Filter by default_strict_allocation_scope_uid="!=%s" % context.getPortalObject().portal_categories.allocation_scope.close.forever.getUid(),
"query": "urn:jio:allDocs?query=portal_type%3A%22" +
"Hosting Subscription" + "%22%20AND%20validation_state%3Avalidated",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["title", "ascending"]],
"title": services_translation,
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: { form_definition: {
group_list: [[ group_list: [[
"bottom", "bottom",
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_doSelect</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_list_image</string>
</list>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscriptionModule_viewServicesListAsHateoas</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>HostingSubscriptionModule_viewServicesList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Services List</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></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>
<string>all_columns</string>
<string>columns</string>
<string>default_params</string>
<string>selection_name</string>
<string>sort</string>
<string>style_columns</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox</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>all_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value> <string></string> </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>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>all_columns</string> </key>
<value>
<list>
<tuple>
<string>creation_date</string>
<string>Creation Date</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>Modification Date</string>
</tuple>
<tuple>
<string>url_string</string>
<string>Software Release</string>
</tuple>
<tuple>
<string>list_image</string>
<string>Software Logo</string>
</tuple>
<tuple>
<string>reference</string>
<string>Reference</string>
</tuple>
<tuple>
<string>translated_validation_state_title</string>
<string>Validation State</string>
</tuple>
<tuple>
<string>translated_slap_state_title</string>
<string>Slap State</string>
</tuple>
<tuple>
<string>destination_section_title</string>
<string>Destination Section</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>short_title</string>
<string>Short Title</string>
</tuple>
<tuple>
<string>HostingSubscription_getNewsDict</string>
<string>Status</string>
</tuple>
<tuple>
<string>list_image</string>
<string>Software Logo</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
<list>
<tuple>
<string>validation_state</string>
<string>validated</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_mode_listbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value>
<list>
<tuple>
<string>Hosting Subscription</string>
<string>Hosting Subscription</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string>hosting_subscription_module_hateoas_selection</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>ascending</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>short_title</string>
<string>Short Title</string>
</tuple>
<tuple>
<string>HostingSubscription_getNewsDict</string>
<string>Status</string>
</tuple>
</list>
</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>Services</string> </value>
</item>
</dictionary>
</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>
<string>default</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_list_image</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>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_listbox_thumbnail</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewDMSFieldLibrary</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>Software Logo</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.HostingSubscription_getDefaultImageAbsoluteUrl()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
<string>my_upgrade_scope</string> <string>my_upgrade_scope</string>
<string>my_source_project_title</string> <string>my_source_project_title</string>
<string>my_source_title</string> <string>my_source_title</string>
<string>my_list_image</string>
</list> </list>
</value> </value>
</item> </item>
......
<?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>default</string>
<string>editable</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_list_image</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>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </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>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_thumbnail</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewDMSFieldLibrary</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>Software Logo</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: here.HostingSubscription_getDefaultImageAbsoluteUrl()</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