Commit 30679038 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Alain Takoudjou

[erp5_web_monitoring] set correct portal_type for software instance objects

Monitor Jio storage has been updated to fix monitoring global Json files and set correct portal_type to it. The fix allow to keep backward compatibility with old/non updated monitoring backend instance.
parent 073444ac
......@@ -27,7 +27,7 @@
};
}
return gadget.jio_allDocs({
query: '(portal_type:"opml-outline") OR (portal_type:"global")',
query: '(portal_type:"opml-outline") OR (portal_type:"Software Instance")',
select_list: [
"parent_url",
"status",
......@@ -52,7 +52,7 @@
}
}
for (i = 0; i < result.data.total_rows; i += 1) {
if (result.data.rows[i].value.portal_type === 'global') {
if (result.data.rows[i].value.portal_type === 'Software Instance') {
if (instance_dict.hasOwnProperty(result.data.rows[i].value.parent_id)) {
instance_dict[result.data.rows[i].value.parent_id].date =
result.data.rows[i].value.date;
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27984.14453.52343</string> </value>
<value> <string>963.38008.45596.26931</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1510766156.1</float>
<float>1511187554.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -224,11 +224,12 @@
var column_list = [
['title', 'Instance Title'],
['date', 'Status Date'],
['aggregate_reference', 'Computer'],
['status', 'Status']
],
j,
key_list = [],
instance_query = '(portal_type:"global")';
instance_query = '(portal_type:"Software Instance")';
if (gadget.state.ouline_list.length === 0) {
return;
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27984.14453.52343</string> </value>
<value> <string>963.33706.12675.27699</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1510586789.54</float>
<float>1510929502.78</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,7 +243,7 @@
if (status) {
return gadget.redirect({
"command": "display",
"options": {"page": "settings_configurator"}
"options": {"page": "ojsm_synchronize"}
});
}
});
......@@ -599,7 +599,7 @@
if (!has_failed) {
return gadget.redirect({
"command": "display",
"options": {"page": "settings_configurator"}
"options": {"page": "ojsm_synchronize"}
});
}
});
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27920.40078.20411</string> </value>
<value> <string>963.27984.14453.52343</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1510582176.99</float>
<float>1510833881.21</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,10 +5,7 @@
rJS(window)
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
......@@ -95,7 +92,8 @@
.push(function (form_list) {
var column_list = [
['title', 'Instance Title'],
['hosting-title', 'Hosting Subscription'],
['specialise_title', 'Hosting Subscription'],
['aggregate_reference', 'Computer'],
['date', 'Status Date'],
['status', 'Status']
];
......@@ -112,7 +110,7 @@
"lines": lines_limit,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22" +
"global" + "%22",
"Software Instance" + "%22",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27984.14453.52343</string> </value>
<value> <string>963.32354.21099.3054</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1510766173.29</float>
<float>1510928975.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -9,7 +9,6 @@
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.29546.42896.22118</string> </value>
<value> <string>963.29555.15349.17885</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1510680193.17</float>
<float>1510848320.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -115,7 +115,7 @@
"_embedded",
"reference"
],
query: '(portal_type:"global") AND (parent_id:"' +
query: '(portal_type:"Software Instance") AND (parent_id:"' +
options.doc.parent_id + '")'
});
})
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.29333.34848.27204</string> </value>
<value> <string>963.33711.61316.13482</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1510666984.34</float>
<float>1510929659.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -15,7 +15,7 @@
<a href="{{url}}" target="{{target}}">{{title}}</a>
</script>
<script src="gadget_officejs_jio_global_view.js"></script>
<script src="gadget_officejs_jio_software_instance_view.js"></script>
</head>
<body>
......
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_jio_global_view.html</string> </value>
<value> <string>gadget_officejs_jio_software_instance_view.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -93,7 +93,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_jio_global_view_html</string> </value>
<value> <string>gadget_officejs_jio_software_instance_view_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.47216.7271.9574</string> </value>
<value> <string>963.33703.32471.53657</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1507901938.7</float>
<float>1510929101.2</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, Handlebars */
/*global window, rJS, RSVP, Handlebars, atob */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Handlebars) {
(function (window, rJS, RSVP, Handlebars, atob) {
"use strict";
var gadget_klass = rJS(window),
......@@ -30,7 +30,6 @@
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("redirect", "redirect")
......@@ -39,11 +38,7 @@
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
hosting_subscription,
software_instance,
opml_outline,
opml_doc;
var gadget = this;
return new RSVP.Queue()
.push(function () {
......@@ -92,8 +87,8 @@
// fix URLs
private_url = gadget.state.instance._links
.private_url.href.replace("jio_private", "private");
public_url = gadget.state.instance._links.
public_url.href.replace("jio_public", "public");
public_url = gadget.state.instance._links
.public_url.href.replace("jio_public", "public");
pass_url = "https://" + atob(gadget.state.opml.basic_login) +
"@" + private_url.split("//")[1];
......@@ -214,8 +209,14 @@
gadget.state.instance.data.state
)
.push(undefined, function (error) {
console.log(error);
return gadget.notifySubmitted({
message: "Warning: Failed to download monitoring state history file!\n " +
error.message || "",
status: "error"
})
.push(function () {
return {};
});
})
.push(function (element_dict) {
var promise_data = [
......@@ -354,7 +355,7 @@
"your_error_count": {
"description": "",
"title": "Promises Error",
"default": "" + gadget.state.error,
"default": String(gadget.state.error),
"css_class": "",
"required": 0,
"editable": 0,
......@@ -365,7 +366,7 @@
"your_success_count": {
"description": "",
"title": "Promises OK",
"default": "" + gadget.state.success,
"default": String(gadget.state.success),
"css_class": "",
"required": 0,
"editable": 0,
......@@ -500,16 +501,24 @@
}
},
form_definition: {
group_list: [[
group_list: [
[
"left",
[["your_title"], ["your_status"], ["your_status_date"], ["your_report_date"],
["your_error_count"], ["your_success_count"], ["your_public_url"], ["your_private_url"]]
[
["your_title"], ["your_status"], ["your_status_date"],
["your_report_date"], ["your_error_count"],
["your_success_count"], ["your_public_url"],
["your_private_url"]
]
],
[
"right",
[["your_hosting_title"], ["your_instance_title"], ["your_computer_reference"], ["your_computer_partition"],
["your_partition_ipv4"], ["your_partition_ipv6"], ["your_software_release_url"],
["your_rss_url"]]
[
["your_hosting_title"], ["your_instance_title"],
["your_computer_reference"], ["your_computer_partition"],
["your_partition_ipv4"], ["your_partition_ipv6"],
["your_software_release_url"], ["your_rss_url"]
]
],
[
"center",
......@@ -518,7 +527,8 @@
[
"bottom",
[["your_instance_promise_list"]]
]]
]
]
}
});
})
......@@ -549,4 +559,4 @@
});
});
});
}(window, rJS, RSVP, Handlebars));
}(window, rJS, RSVP, Handlebars, atob));
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_jio_global_view.js</string> </value>
<value> <string>gadget_officejs_jio_software_instance_view.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -93,7 +93,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_jio_global_view_js</string> </value>
<value> <string>gadget_officejs_jio_software_instance_view_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.48890.59022.44748</string> </value>
<value> <string>963.33702.55453.15257</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1508949714.27</float>
<float>1510929159.97</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -207,7 +207,7 @@ gadget_erp5_page_settings_configurator.html\n
gadget_erp5_page_ojsm_processes_view.html\n
gadget_erp5_page_ojsm_hosting_subscription_view.html\n
gadget_officejs_monitoring_sync.html\n
gadget_officejs_jio_global_view.html\n
gadget_officejs_jio_software_instance_view.html\n
gadget_erp5_page_ojsm_software_instance_list.html\n
gadget_officejs_monitoring_router.html\n
gadget_officejs_jio_promise_view.html\n
......@@ -232,12 +232,11 @@ gadget_erp5_page_settings_configurator.js\n
gadget_erp5_page_ojsm_processes_view.js\n
gadget_officejs_monitoring_custom.css\n
gadget_erp5_page_ojsm_hosting_subscription_view.js\n
gadget_global.js\n
gadget_erp5_global.js\n
gadget_officejs_monitoring_sync.js\n
gadget_erp5_page_ojsm_software_instance_list.js\n
gadget_officejs_monitoring_panel.js\n
gadget_officejs_jio_global_view.js\n
gadget_officejs_jio_software_instance_view.js\n
gadget_erp5_page_ojsm_import_export.js\n
gadget_erp5_page_ojsm_resources_view.js\n
gadget_officejs_jio_promise_view.js\n
......@@ -384,7 +383,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.30985.26464.16281</string> </value>
<value> <string>963.33744.19919.32631</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -402,7 +401,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1510766013.21</float>
<float>1510932931.68</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -363,3 +363,11 @@ margin-top: 5px;
background-color: #af441a;
opacity: 0.5;
}
.search-result {
font-size: 130%;
color: #517286;
padding: 20px 10px;
margin: 30px 25px 10px 0;
border-top: 1px solid #dedede;
}
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.57554.52005.49783</string> </value>
<value> <string>963.27666.8050.30907</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1508428094.57</float>
<float>1510935596.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -295,10 +295,10 @@
})
.push(function (data) {
var options = {
page: "ojsm_status_list"
page: "ojsm_dispatch"
};
if (data.search) {
options.extended_search = data.search;
options.query = data.search;
}
// Remove focus from the search field
document.activeElement.blur();
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27666.8050.30907</string> </value>
<value> <string>963.33473.65379.28757</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1510668451.66</float>
<float>1510915343.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.29129.42634.5819</string> </value>
<value> <string>963.29142.15969.45158</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1510655414.57</float>
<float>1510669949.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -243,6 +243,32 @@
});
}
function fixGlobalInstanceDocument(instance) {
// Fix some property as backed is old, to keep backward compatibility
// XXX - this method should be removed when all backend will be upgraded
if (instance._embedded !== undefined) {
if (instance._embedded.instance !== undefined) {
// set aggregate_reference to the computer reference and make it
// searchable
instance.aggregate_reference = instance._embedded.instance.computer;
}
if (instance._embedded.hasOwnProperty('promises')) {
// remove useless information from the document
delete instance._embedded.promises;
}
}
if (instance.hasOwnProperty('hosting-title')) {
// hosting-title should be specialise_title
instance.specialise_title = instance['hosting-title'];
delete instance['hosting-title'];
}
// set portal_type is not defined
if (!instance.hasOwnProperty('portal_type')) {
instance.portal_type = "Software Instance";
}
return instance;
}
function updateSubStorageStatus(context, signature_dict, next_status) {
var key,
update_status_queue = new RSVP.Queue();
......@@ -488,13 +514,19 @@
extra_dict,
item_signature_dict = {};
function applyItemToTree(item, item_result, portal_type, extra_dict) {
function applyItemToTree(item, item_result, extra_dict) {
var id_hash,
element = item.doc,
signature,
item_id = item.guid || item.id,
status = (element.status || element.category);
if (element.type === 'global' &&
element.aggregate_reference === undefined) {
// XXX - document need to be updated to keep compatibility
element = fixGlobalInstanceDocument(element);
}
id_hash = generateHash(item_result.parent_id +
item_result.url + item_id);
......@@ -520,7 +552,8 @@
}
Object.assign(element, {
parent_id: item_result.parent_id,
portal_type: portal_type || element.type || item_result.type,
portal_type: element.portal_type || element.type ||
item_result.type,
status: status,
reference: id_hash,
active: true
......@@ -543,18 +576,12 @@
channel: result_list[i].result.data.rows[0].doc.description,
channel_item: result_list[i].result.data.rows[0].doc.title
};
applyItemToTree(
result_list[i].result.data.rows[0],
result_list[i],
"rss"
);
start = 1;
}
for (j = start; j < result_list[i].result.data.total_rows; j += 1) {
applyItemToTree(
result_list[i].result.data.rows[j],
result_list[i],
undefined,
extra_dict
);
}
......
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.39289.49107.2628</string> </value>
<value> <string>963.31914.46636.11724</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1503487925.99</float>
<float>1510928894.69</float>
<string>UTC</string>
</tuple>
</state>
......
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/gadget_officejs_jio_global_view_html
web_page_module/gadget_officejs_jio_global_view_js
web_page_module/gadget_officejs_jio_software_instance_view_html
web_page_module/gadget_officejs_jio_software_instance_view_js
web_page_module/gadget_officejs_jio_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_jio_promise_view_html
......
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/gadget_officejs_jio_global_view_html
web_page_module/gadget_officejs_jio_global_view_js
web_page_module/gadget_officejs_jio_software_instance_view_html
web_page_module/gadget_officejs_jio_software_instance_view_js
web_page_module/gadget_officejs_jio_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_jio_promise_view_html
......
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/gadget_officejs_jio_global_view_html
web_page_module/gadget_officejs_jio_global_view_js
web_page_module/gadget_officejs_jio_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_jio_promise_view_html
web_page_module/gadget_officejs_jio_promise_view_js
web_page_module/gadget_officejs_jio_software_instance_view_html
web_page_module/gadget_officejs_jio_software_instance_view_js
web_page_module/gadget_officejs_monitoring_*
web_page_module/jsen_json_validator_js
web_page_module/monitoring_jio_storage_js
......
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