Commit 68ba9666 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Use callable (script) as listbox columns

It is not ideal, but it works quite fine (since 994d836996f8e762924b2898ef3a6385ad7d5759). Callable scripts should be used to avoid extra queries or calculations.
parent 4a927725
......@@ -27,33 +27,25 @@
.push(function (result) {
var i, value, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
if (1 || (result.data.rows[i].value.monitoring_status)) {
value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = {
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value},
key: "status",
url: "gadget_slapos_installation_status.html",
title: "Status",
type: "GadgetField"
};
result.data.rows[i].value.software_release = {
css_class: "",
description: "Software Release Info",
hidden: 0,
"default": {jio_key: value},
key: "software_release",
url: "gadget_slapos_software_release_info.html",
title: "Software Release Info",
type: "GadgetField"
field_gadget_param : {
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value},
key: "status",
url: "gadget_slapos_installation_status.html",
title: "Status",
type: "GadgetField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
}
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
......@@ -114,7 +106,7 @@
form_gadget = results[0],
computer_network_list = [["", ""]],
column_list = [
['software_release', 'Software Release'],
['SoftwareInstallation_getSoftwareReleaseInformation', 'Software Release'],
['url_string', 'Url'],
['monitoring_status', 'Status']
],
......
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.32024.53732.34406</string> </value>
<value> <string>972.38674.1768.18517</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1545663993.02</float>
<float>1545925663.89</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -411,8 +411,6 @@ gadget_slapos_project_status.html\n
gadget_slapos_project_status.js\n
gadget_slapos_site_status.html\n
gadget_slapos_site_status.js\n
gadget_slapos_software_release_info.html\n
gadget_slapos_software_release_info.js\n
gadget_trial_panel.html\n
gadget_trial_panel.js\n
leaflet.css\n
......@@ -557,7 +555,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.7563.45762.64836</string> </value>
<value> <string>972.32024.53732.34406</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -575,7 +573,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1542984329.71</float>
<float>1545925980.32</float>
<string>UTC</string>
</tuple>
</state>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Background</title>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="handlebars.js"></script>
<script src="gadget_slapos_software_release_info.js"></script>
</head>
<body>
<button data-i18n="loading" type="submit" class="responsive ui-btn ui-icon-spinner ui-icon-spin ui-btn-icon-center ui-disabled" style="border:none;">loading</button>
</body>
</html>
\ No newline at end of file
/*globals console, window, rJS, RSVP, loopEventListener, i18n, Handlebars $*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(function (window, rJS, RSVP, Handlebars) {
"use strict";
var gadget_klass = rJS(window);
gadget_klass
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareMethod("getContent", function () {
return {};
})
.declareMethod("render", function (options) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.getElement(),
gadget.getSetting("hateoas_url")
]);
})
.push(function (result) {
var hateoas_url = result[1],
element = result[0];
return gadget.jio_getAttachment(options.value.jio_key,
hateoas_url + options.value.jio_key +
"/SoftwareInstallation_getSoftwareReleaseInformation")
.push(function (info) {
console.log(info);
element.innerHTML = info;
return info;
});
});
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
import json
software_release = context.portal_catalog.getResultValue(
url_string={'query': context.getUrlString(), 'key': 'ExactMatch'},
portal_type='Software Release')
if software_release is None:
return json.dumps("")
return ""
return json.dumps("%s (%s)" % (software_release.getTitle(), software_release.getVersion()))
return "%s (%s)" % (software_release.getTitle(), software_release.getVersion())
......@@ -166,8 +166,6 @@ web_page_module/rjs_gadget_slapos_project_status_html
web_page_module/rjs_gadget_slapos_project_status_js
web_page_module/rjs_gadget_slapos_site_status_html
web_page_module/rjs_gadget_slapos_site_status_js
web_page_module/rjs_gadget_slapos_software_release_info_html
web_page_module/rjs_gadget_slapos_software_release_info_js
web_page_module/rjs_gadget_trial_panel_html
web_page_module/rjs_gadget_trial_panel_js
web_page_module/rjs_leaflet_css
......
......@@ -166,8 +166,6 @@ web_page_module/rjs_gadget_slapos_project_status_html
web_page_module/rjs_gadget_slapos_project_status_js
web_page_module/rjs_gadget_slapos_site_status_html
web_page_module/rjs_gadget_slapos_site_status_js
web_page_module/rjs_gadget_slapos_software_release_info_html
web_page_module/rjs_gadget_slapos_software_release_info_js
web_page_module/rjs_gadget_trial_panel_html
web_page_module/rjs_gadget_trial_panel_js
web_page_module/rjs_leaflet_css
......
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