Commit 04040ae4 authored by Alain Takoudjou's avatar Alain Takoudjou

[erp5_web_monitoring] update promise view for changes in new backend instances

parent 4ab3d134
...@@ -113,7 +113,12 @@ ...@@ -113,7 +113,12 @@
"portal_type", "portal_type",
"_links", "_links",
"_embedded", "_embedded",
"reference" "reference",
"aggregate_reference",
"ipv6",
"ipv4",
"partition_id",
"software_release"
], ],
query: '(portal_type:"Software Instance") AND (parent_id:"' + query: '(portal_type:"Software Instance") AND (parent_id:"' +
options.doc.parent_id + '")' options.doc.parent_id + '")'
...@@ -148,6 +153,13 @@ ...@@ -148,6 +153,13 @@
public_url: {href: ""}}, public_url: {href: ""}},
_embedded: {instance: {}}}; _embedded: {instance: {}}};
} }
if (software_instance._embedded !== undefined &&
software_instance._embedded.hasOwnProperty('instance')) {
software_instance.ipv6 = software_instance._embedded.instance.ipv6;
software_instance.ipv4 = software_instance._embedded.instance.ipv4;
software_instance.partition_id = software_instance._embedded.instance.partition;
software_instance.software_release = software_instance._embedded.instance['software-release'];
}
// fix URLs // fix URLs
software_instance._links.private_url.href = software_instance software_instance._links.private_url.href = software_instance
._links.private_url.href.replace("jio_private", "private"); ._links.private_url.href.replace("jio_private", "private");
...@@ -171,10 +183,11 @@ ...@@ -171,10 +183,11 @@
instance_title: software_instance.title, instance_title: software_instance.title,
hosting_title: opml_doc.title, hosting_title: opml_doc.title,
hosting_url: hosting_url, hosting_url: hosting_url,
partition_ipv6: software_instance._embedded.instance.ipv6, partition_ipv6: software_instance.ipv6,
computer_partition: software_instance._embedded.instance.partition, partition_ipv4: software_instance.ipv4,
computer_reference: software_instance._embedded.instance.computer, computer_partition: software_instance.partition_id,
software_release: software_instance._embedded.instance['software-release'] computer_reference: software_instance.aggregate_reference,
software_release: software_instance.software_release
}); });
}); });
}) })
...@@ -252,7 +265,10 @@ ...@@ -252,7 +265,10 @@
editable: 0, editable: 0,
hidden: 0, hidden: 0,
hidden_day_is_last_day: 0, hidden_day_is_last_day: 0,
"default": new Date(status_history.data[i]['start-date']).toUTCString(), "default": new Date(
status_history.data[i].date ||
status_history.data[i]['start-date']
).toUTCString(),
key: "start_date", key: "start_date",
required: 0, required: 0,
timezone_style: 0, timezone_style: 0,
...@@ -268,8 +284,10 @@ ...@@ -268,8 +284,10 @@
editable: 0, editable: 0,
hidden: 0, hidden: 0,
hidden_day_is_last_day: 0, hidden_day_is_last_day: 0,
"default": new Date(status_history.data[i]['change-time'] * 1000) "default": new Date(
.toUTCString(), status_history.data[i]['change-date'] ||
status_history.data[i]['change-time'] * 1000
).toUTCString(),
key: "change_date", key: "change_date",
required: 0, required: 0,
timezone_style: 0, timezone_style: 0,
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.33711.61316.13482</string> </value> <value> <string>966.22632.27070.1706</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1510929659.2</float> <float>1523626142.93</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -66,6 +66,13 @@ ...@@ -66,6 +66,13 @@
private_url, private_url,
current_document = gadget.state.instance; current_document = gadget.state.instance;
if (current_document._embedded !== undefined &&
current_document._embedded.hasOwnProperty('instance')) {
current_document.ipv6 = current_document._embedded.instance.ipv6;
current_document.ipv4 = current_document._embedded.instance.ipv4;
current_document.partition_id = current_document._embedded.instance.partition;
current_document.software_release = current_document._embedded.instance['software-release'];
}
// fix URLs // fix URLs
private_url = gadget.state.instance._links private_url = gadget.state.instance._links
.private_url.href.replace("jio_private", "private"); .private_url.href.replace("jio_private", "private");
...@@ -88,11 +95,11 @@ ...@@ -88,11 +95,11 @@
//process_url: tmp_process_url, //process_url: tmp_process_url,
hosting_title: gadget.state.opml.title, hosting_title: gadget.state.opml.title,
hosting_url: hosting_url, hosting_url: hosting_url,
partition_ipv6: current_document._embedded.instance.ipv6, partition_ipv6: current_document.ipv6,
partition_ipv4: current_document._embedded.instance.ipv4, partition_ipv4: current_document.ipv4,
computer_partition: current_document._embedded.instance.partition, computer_partition: current_document.partition_id,
computer_reference: current_document._embedded.instance.computer, computer_reference: current_document.aggregate_reference,
software_release: current_document._embedded.instance['software-release'] software_release: current_document.software_release
}); });
}); });
}) })
...@@ -110,7 +117,7 @@ ...@@ -110,7 +117,7 @@
var gadget = this; var gadget = this;
return gadget.jio_allDocs(param_list[0]) return gadget.jio_allDocs(param_list[0])
.push(function (result) { .push(function (result) {
var i, value, len = result.data.total_rows; var i, j, tmp, value, len = result.data.total_rows;
for (i = 0; i < len; i += 1) { for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("lastBuildDate")) { if (result.data.rows[i].value.hasOwnProperty("lastBuildDate")) {
value = new Date(result.data.rows[i].value.lastBuildDate); value = new Date(result.data.rows[i].value.lastBuildDate);
...@@ -135,26 +142,20 @@ ...@@ -135,26 +142,20 @@
value: 2713 value: 2713
}; };
} }
if (result.data.rows[i].value.hasOwnProperty("comments")) { if (result.data.rows[i].value.hasOwnProperty("description")) {
value = result.data.rows[i].value.comments.slice(0, 30); tmp = result.data.rows[i].value.description.split('\n');
if (result.data.rows[i].value.comments.length >= 30) { value = "";
for (j = 1; j < tmp.length; j += 1) {
// first line of text is the date and status
if (!value && tmp[j].trim() !== "") {
value += tmp[j].slice(0, 50);
if (tmp[j].length >= 50 || j + 1 < tmp.length) {
// a part of text is not shown
value += "..."; value += "...";
} }
result.data.rows[i].value.comments = { }
css_class: "string_field", }
description: "The Message", result.data.rows[i].value.description = value;
editable: 0,
hidden: 0,
"default": value,
key: "comments",
required: 0,
title: "Message",
type: "StringField"
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
} }
if (result.data.rows[i].value.hasOwnProperty("category")) { if (result.data.rows[i].value.hasOwnProperty("category")) {
value = result.data.rows[i].value.category; value = result.data.rows[i].value.category;
...@@ -256,10 +257,10 @@ ...@@ -256,10 +257,10 @@
}) })
.push(function (form_gadget) { .push(function (form_gadget) {
var column_list = [ var column_list = [
['category', 'Status'],
['source', 'Promise'], ['source', 'Promise'],
['lastBuildDate', 'Promise Date'], ['lastBuildDate', 'Promise Date'],
['comments', 'Message'], ['description', 'Message']
['category', 'Status']
]; ];
return form_gadget.render({ return form_gadget.render({
erp5_document: { erp5_document: {
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.26968.43905.35072</string> </value> <value> <string>966.64656.29215.3054</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1514370868.02</float> <float>1524237317.01</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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