Commit 4164fc66 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

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

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