Commit 1e4bd485 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Major fixes and speed up for status gadget

Update the API to remove the additional get to get monitoring status information, this may cause a major improvement in speed, as the most of the queries to master are removed.
parent a9cc0a0e
......@@ -223,7 +223,8 @@
new_marker_list[index].openPopup();
return computer.render({value: {
jio_key : gadget.options.marker_list ? gadget.options.marker_list[index].jio_key : "",
doc: gadget.options.marker_list ? gadget.options.marker_list[index].doc : ""
doc: gadget.options.marker_list ? gadget.options.marker_list[index].doc : "",
result: gadget.options.marker_list ? gadget.options.marker_list[index].doc.result : ""
}
});
});
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.17374.26177.2048</string> </value>
<value> <string>974.51816.55280.41267</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1513795256.89</float>
<float>1554319312.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29154.30429.60091</string> </value>
<value> <string>974.29228.49487.5973</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1554310335.73</float>
<float>1554308925.29</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.50679.18778.20650</string> </value>
<value> <string>972.38762.9625.45482</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1554258070.92</float>
<float>1545932477.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.50466.65103.30515</string> </value>
<value> <string>974.50467.55565.53623</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1554257716.79</float>
<float>1554251651.88</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -149,8 +149,9 @@
},
"my_monitoring_status": {
"description": "",
"title": "Map",
"default": {jio_key: gadget.state.jio_key},
"title": "Monitoring",
"default": {jio_key: gadget.state.jio_key,
result: gadget.state.doc.news},
"css_class": "",
"required": 1,
"editable": 0,
......@@ -162,11 +163,12 @@
},
"my_organisation_map": {
"description": "",
"title": "Monitoring Status",
"title": "Map",
"default": [
{"jio_key": gadget.state.jio_key,
"doc": {"title": gadget.state.doc.title,
"reference": gadget.state.doc.reference,
"result": gadget.state.doc.news,
"latitude": gadget.state.doc.default_geographical_location_latitude,
"longitude": gadget.state.doc.default_geographical_location_longitude}
}
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29134.59085.11229</string> </value>
<value> <string>974.51812.23976.40123</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1554310309.89</float>
<float>1554319566.54</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -20,14 +20,13 @@
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].value.hasOwnProperty("Project_getNewsDict"))) {
value = result.data.rows[i].id;
news = result.data.rows[i].Project_getNewsDict;
news = result.data.rows[i].value.Project_getNewsDict;
result.data.rows[i].value.Project_getNewsDict = {
field_gadget_param : {
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value,
result: news},
"default": {jio_key: value, result: news},
key: "status",
url: "gadget_slapos_project_status.html",
title: "Status",
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.38850.13428.56541</string> </value>
<value> <string>974.29228.49487.5973</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1552958933.45</float>
<float>1554315644.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -36,7 +36,7 @@
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value, result: value},
"default": {jio_key: value_jio_key, result: value},
key: "status",
url: "gadget_slapos_computer_status.html",
title: "Status",
......@@ -137,7 +137,8 @@
"my_monitoring_status": {
"description": "",
"title": "Monitoring Status",
"default": {jio_key: gadget.state.jio_key},
"default": {jio_key: gadget.state.jio_key,
result: gadget.state.doc.news},
"css_class": "",
"required": 1,
"editable": 0,
......@@ -178,7 +179,10 @@
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_reference"], ["my_description"], ['my_monitoring_status']]
[["my_title"], ["my_reference"], ["my_description"]]
], [
"right",
[['my_monitoring_status']]
], [
"bottom",
[["listbox"]]
......
......@@ -227,7 +227,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -241,7 +241,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29152.50153.14045</string> </value>
<value> <string>974.51731.9751.49032</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -259,7 +259,7 @@
</tuple>
<state>
<tuple>
<float>1554310275.02</float>
<float>1554315625.43</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29121.45777.11366</string> </value>
<value> <string>974.50694.51828.32204</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1554257753.72</float>
<float>1554254296.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,16 +16,17 @@
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, value, len = result.data.total_rows;
var i, value, value_jio_key, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = {
if (1 || (result.data.rows[i].value.hasOwnProperty("Organisation_getNewsDict"))) {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Organisation_getNewsDict;
result.data.rows[i].value.Organisation_getNewsDict = {
field_gadget_param : {
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value},
"default": {jio_key: value_jio_key, result: value},
key: "status",
url: "gadget_slapos_site_status.html",
title: "Status",
......@@ -75,7 +76,7 @@
['title', 'Title'],
['reference', 'Reference'],
['default_address_region_title', 'Region'],
['monitoring_status', 'Status']
['Organisation_getNewsDict', 'Status']
];
destination_list = "%22NULL%22%2C";
for (i in result[1].assignment_destination_list) {
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.34170.7223.58060</string> </value>
<value> <string>974.29228.49487.5973</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1552959192.5</float>
<float>1554317319.46</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -12,6 +12,7 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
......
......@@ -259,7 +259,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.29726.26723.5427</string> </value>
<value> <string>967.29586.55987.8055</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1522752587.64</float>
<float>1529596709.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -12,6 +12,7 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")
......@@ -93,7 +94,7 @@
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: "Destroy Hosting Subscription: " + options.doc.title,
page_title: "Stop Hosting Subscription: " + options.doc.title,
selection_url: url_list[0],
submit_action: true
});
......
......@@ -259,7 +259,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -273,7 +273,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.29726.36584.7355</string> </value>
<value> <string>968.24287.54461.29371</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1522752577.81</float>
<float>1529594068.95</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -34,16 +34,17 @@
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, value, date, len = result.data.total_rows;
var i, value, value_jio_key, date, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (1 || (result.data.rows[i].hasOwnProperty("id"))) {
value = result.data.rows[i].id;
result.data.rows[i].value.monitoring_status = {
value_jio_key = result.data.rows[i].id;
value = result.data.rows[i].value.Organisation_getNewsDict;
result.data.rows[i].value.Organisation_getNewsDict = {
field_gadget_param : {
css_class: "",
description: "The Status",
hidden: 0,
"default": {jio_key: value},
"default": {jio_key: value_jio_key, result: value},
key: "status",
url: "gadget_slapos_site_status.html",
title: "Status",
......@@ -110,7 +111,7 @@
.push(function (result) {
var i, destination_list, column_list = [
['title', 'Title'],
['monitoring_status', 'Status']
['Organisation_getNewsDict', 'Status']
];
gadget.me_dict = result[1];
destination_list = "%22NULL%22%2C";
......@@ -250,6 +251,7 @@
query: "portal_type:Organisation AND role_title:Host AND relative_url:(" + destination_list + ")",
select_list: ['title',
'reference',
'Organisation_getNewsDict',
'default_geographical_location_longitude',
'default_geographical_location_latitude']
});
......@@ -261,6 +263,7 @@
"jio_key": result.data.rows[idx].id,
"doc": {"title": result.data.rows[idx].value.title,
"reference": result.data.rows[idx].value.reference,
"result": result.data.rows[idx].value.Organisation_getNewsDict,
"latitude": result.data.rows[idx].value.default_geographical_location_latitude,
"longitude": result.data.rows[idx].value.default_geographical_location_longitude}
});
......
......@@ -227,7 +227,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -241,7 +241,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.29127.37243.30225</string> </value>
<value> <string>974.51826.62399.12902</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -259,7 +259,7 @@
</tuple>
<state>
<tuple>
<float>1552958273.58</float>
<float>1554320110.18</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -258,7 +258,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -272,7 +272,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.32024.53732.34406</string> </value>
<value> <string>970.21496.17710.36488</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>1554257675.61</float>
<float>1554255222.31</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.32024.53732.34406</string> </value>
<value> <string>974.50748.25599.3686</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1554257864.46</float>
<float>1554255778.44</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.50044.7881.17544</string> </value>
<value> <string>974.50363.35694.46455</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1554213380.38</float>
<float>1554236784.11</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -68,8 +68,8 @@
var previous_status = "START",
status = 'ui-btn-no-data',
i;
for (i in options.computer_news) {
status = checkComputerStatus(options.computer_news[i]);
for (i in options.news.computer) {
status = checkComputerStatus(options.news.computer[i]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -92,9 +92,9 @@
var computer_reference,
status = 'ui-btn-no-data',
previous_status = "START";
for (computer_reference in options.computer_partition_news) {
for (computer_reference in options.news.partition) {
status = checkComputerPartitionStatus(
options.computer_partition_news[computer_reference]);
options.news.partition[computer_reference]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -117,36 +117,31 @@
return status;
}
function getStatus(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
function getStatus(gadget, result) {
var status_class = 'ui-btn-no-data',
status_title = 'Computer',
right_title = 'Partitions',
right_class = 'ui-btn-no-data',
status_style = '',
right_style = '';
right_class = 'ui-btn-no-data';
status_class = checkNetworkStatus(result);
right_class = checkNetworkPartitionStatus(result);
if (status_class === 'ui-btn-no-data') {
status_style = "color: transparent !important;";
}
gadget.element.innerHTML = inline_status_template({
status_class: status_class,
status_title: status_title,
status_style: status_style,
right_class: right_class,
right_title: right_title,
right_style: right_style
right_title: right_title
});
return gadget;
}
function getStatusLoop(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
return getStatus(gadget, result);
});
}
......@@ -165,20 +160,19 @@
.declareMethod("getContent", function () {
return {};
})
.declareJob("getStatus", function () {
.declareJob("getStatus", function (result) {
var gadget = this;
return getStatus(gadget);
return getStatus(gadget, {news: result});
})
.onLoop(function () {
var gadget = this;
return getStatus(gadget);
return getStatusLoop(gadget);
}, 300000)
.declareMethod("render", function (options) {
var gadget = this;
gadget.options = options;
gadget.flag = options.value.jio_key;
return gadget.getStatus();
return gadget.getStatus(options.value.result);
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.33063.24201.50227</string> </value>
<value> <string>974.51836.28846.24849</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1530119497.39</float>
<float>1554320626.62</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -68,8 +68,8 @@
var previous_status = "START",
status = 'ui-btn-no-data',
i;
for (i in options.computer_news) {
status = checkComputerStatus(options.computer_news[i]);
for (i in options.news.computer) {
status = checkComputerStatus(options.news.computer[i]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -92,9 +92,9 @@
var computer_reference,
status = 'ui-btn-no-data',
previous_status = "START";
for (computer_reference in options.computer_partition_news) {
for (computer_reference in options.news.partition) {
status = checkComputerPartitionStatus(
options.computer_partition_news[computer_reference]);
options.news.partition[computer_reference]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -118,12 +118,7 @@
}
function getStatus(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
function getStatus(gadget, result) {
var monitor_url,
status_class = 'ui-btn-no-data',
status_title = 'Computer',
......@@ -135,9 +130,6 @@
status_class = checkProjectStatus(result);
right_class = checkProjectPartitionStatus(result);
if (status_class === 'ui-btn-no-data') {
status_style = "color: transparent !important;";
}
monitor_url = gadget.props.hateoas_url + gadget.options.value.jio_key + '/Base_redirectToMonitor';
gadget.element.innerHTML = inline_status_template({
monitor_url: monitor_url,
......@@ -150,7 +142,15 @@
});
return gadget;
}
);
function getStatusLoop(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
return getStatus(gadget, result);
});
}
gadget_klass
......@@ -168,19 +168,19 @@
.declareMethod("getContent", function () {
return {};
})
.declareJob("getStatus", function () {
.declareJob("getStatus", function (result) {
var gadget = this;
return getStatus(gadget);
return getStatus(gadget, {news: result});
})
.onLoop(function () {
var gadget = this;
return getStatus(gadget);
return getStatusLoop(gadget);
}, 300000)
.declareMethod("render", function (options) {
var gadget = this;
gadget.options = options;
gadget.flag = options.value.jio_key;
return gadget.getStatus();
return gadget.getStatus(options.value.result);
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -257,7 +257,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.33071.21265.51541</string> </value>
<value> <string>974.51745.60684.16657</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -275,7 +275,7 @@
</tuple>
<state>
<tuple>
<float>1530119961.69</float>
<float>1554315362.25</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -68,8 +68,8 @@
var previous_status = "START",
status = 'ui-btn-no-data',
i;
for (i in options.computer_news) {
status = checkComputerStatus(options.computer_news[i]);
for (i in options.news.computer) {
status = checkComputerStatus(options.news.computer[i]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -92,9 +92,9 @@
var computer_reference,
status = 'ui-btn-no-data',
previous_status = "START";
for (computer_reference in options.computer_partition_news) {
for (computer_reference in options.news.partition) {
status = checkComputerPartitionStatus(
options.computer_partition_news[computer_reference]);
options.news.partition[computer_reference]);
if (previous_status === "START") {
previous_status = status;
}
......@@ -117,29 +117,18 @@
return status;
}
function getStatus(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
function getStatus(gadget, result) {
var monitor_url,
status_class = 'ui-btn-no-data',
status_title = 'Computer',
right_title = 'Partitions',
right_class = 'ui-btn-no-data',
status_style = "color: transparent !important;",
right_style = 'color: transparent !important;';
status_style = '',
right_style = '';
status_class = checkSiteStatus(result);
right_class = checkSitePartitionStatus(result);
right_style = '';
status_style = '';
if (status_class === 'ui-btn-no-data') {
status_style = "color: transparent !important;";
}
monitor_url = gadget.props.hateoas_url + gadget.options.value.jio_key + '/Base_redirectToMonitor';
gadget.element.innerHTML = inline_status_template({
monitor_url: monitor_url,
......@@ -152,7 +141,15 @@
});
return gadget;
}
);
function getStatusLoop(gadget) {
return new RSVP.Queue()
.push(function () {
return gadget.jio_get(gadget.options.value.jio_key);
})
.push(function (result) {
return getStatus(gadget, result);
});
}
gadget_klass
......@@ -170,20 +167,19 @@
.declareMethod("getContent", function () {
return {};
})
.declareJob("getStatus", function () {
.declareJob("getStatus", function (result) {
var gadget = this;
return getStatus(gadget);
return getStatus(gadget, {news: result});
})
.onLoop(function () {
var gadget = this;
return getStatus(gadget);
return getStatusLoop(gadget);
}, 300000)
.declareMethod("render", function (options) {
var gadget = this;
gadget.options = options;
gadget.flag = options.value.jio_key;
return gadget.getStatus();
return gadget.getStatus(options.value.result);
});
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -254,7 +254,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>superrafael</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -268,7 +268,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>966.58781.43824.3635</string> </value>
<value> <string>969.37904.40841.53947</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -286,7 +286,7 @@
</tuple>
<state>
<tuple>
<float>1530119121.08</float>
<float>1554317692.05</float>
<string>UTC</string>
</tuple>
</state>
......
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