Commit 831cf1a8 authored by Roque's avatar Roque

Monitoring app refactoring and fixes

See merge request !1948
parents b1dcfe05 7b6a679f
......@@ -72,7 +72,6 @@
serie.drawPoints = true;
serie.strokeWidth = 0;
}
console.log("serie", serie);
graph_data_and_parameter.series[trace.title || ''] = serie;
}
for (i = 0; i < data.length; i = i + 1) {
......@@ -195,7 +194,11 @@
graph_data_and_parameter;
container = gadget.element.querySelector(".graph-content");
if (modification_dict.value.new_format) {
graph_data_and_parameter = formatGraphDict(modification_dict.value);
} else {
graph_data_and_parameter = getGraphDataAndParameterFromConfiguration(modification_dict.value);
}
gadget.property_dict.graph = new Dygraph(container,
graph_data_and_parameter.dygraph_data,
graph_data_and_parameter.dygraph_parameter_dict);
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.32471.45294.12919</string> </value>
<value> <string>1016.58116.20617.24900</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1715371703.99</float>
<float>1716991783.66</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/opml_viewForMonitoring</string> </value>
<value> <string>string:${object_url}/Opml_viewForMonitoring</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -10,13 +10,14 @@
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this, portal_type, extended_search, query_parts_list;
var gadget = this, portal_type, extended_search, query_parts_list, query_redirect;
if (options.query && options.url && options.username && options.password) {
return new RSVP.Queue()
.push(function () {
......@@ -25,32 +26,44 @@
});
})
.push(function (result) {
// URL queries from slapos master / panel rapid space:
// 'portal_type: "Instance Tree" AND title:"my-title"
// or
// 'portal_type: "Software Instance" AND title:"my-title"
// AND specialise_title:"my-parent-title"
query_parts_list = options.query.split('AND');
portal_type = query_parts_list[0].replace('portal_type:', '').replaceAll('"', '').trim();
extended_search = options.query.replace(query_parts_list[0] + 'AND ', '').trim();
if (options.slapos_master_url) {
// disambiguate equal instances by slapos master url
// TODO refactor this if slapos_id disambiguation way is choose
if (result !== undefined && result.data.total_rows > 1) {
extended_search += ' AND slapos_master_url:"' + options.slapos_master_url + '"';
}
}
query_redirect = {
"page": "ojs_local_controller",
"portal_type": portal_type + " Module",
"extended_search": extended_search
};
if (result === undefined || result.data.total_rows === 0) {
return gadget.setSetting('sync_redirect_options', query_redirect)
.push(function (result) {
return gadget.redirect(
{"command": "display",
"options": {
"url": options.url,
"username": options.username,
"password": options.password,
"slapos_master_url": options.slapos_master_url || "not-provided",
"page": "ojsm_opml_add"
}
});
});
} else {
// URL queries from slapos master / panel rapid space:
// 'portal_type: "Instance Tree" AND title:"my-title"'
// or
// 'portal_type: "Software Instance" AND title:"my-title"
// AND specialise_title:"my-parent-title"'
query_parts_list = options.query.split('AND');
portal_type = query_parts_list[0].replace('portal_type:', '').replaceAll('"', '').trim();
extended_search = options.query.replace(query_parts_list[0] + 'AND ', '').trim();
return gadget.redirect(
{"command": "display",
"options": {
"page": "ojs_local_controller",
"portal_type": portal_type + " Module",
"extended_search": extended_search
}
return gadget.redirect({
"command": "display",
"options": query_redirect
});
}
});
......@@ -61,6 +74,7 @@
"url": options.url,
"username": options.username,
"password": options.password,
"slapos_master_url": options.slapos_master_url || "not-provided",
"page": "ojsm_opml_add"
}
});
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.49507.50003.17561</string> </value>
<value> <string>1017.31995.2932.55961</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1716393876.23</float>
<float>1719275229.13</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,7 +5,7 @@
rJS(window)
.setState({
erp5_url: "https://panel.rapid.space/hateoas/"
erp5_url_list: "https://panel.rapid.space/hateoas/"
})
/////////////////////////////////////////////////////////////////
// Acquired methods
......@@ -19,21 +19,21 @@
// Form submit
/////////////////////////////////////////
.onEvent('submit', function () {
var gadget = this,
master_url;
var gadget = this, i,
master_url_list;
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (content) {
master_url = content.erp5_url;
return gadget.setSetting("hateoas_url", master_url);
})
.push(function () {
master_url_list = content.erp5_url_list.split(/\r?\n|\r|\n/g);
for (i = 0; i < master_url_list.length; i += 1) {
master_url_list[i] = master_url_list[i].trim();
}
return gadget.redirect({command: "display", options: {
page: "ojsm_import_export",
auto_sync: "erp5",
url: master_url
url_list: master_url_list
}});
});
})
......@@ -47,19 +47,20 @@
return gadget.getDeclaredGadget('form_view')
.push(function (form_gadget) {
//TODO replace textarea by N stringfield inputs
return form_gadget.render({
erp5_document: {
"_embedded": {"_view": {
"my_erp5_url": {
"my_erp5_url_list": {
"description": "",
"title": "Connection Url",
"default": gadget.state.erp5_url,
"title": "Connection Url List",
"default": gadget.state.erp5_url_list,
"css_class": "",
"required": 1,
"editable": 1,
"key": "erp5_url",
"key": "erp5_url_list",
"hidden": 0,
"type": "StringField"
"type": "TextAreaField"
}
}},
"_links": {
......@@ -72,7 +73,7 @@
form_definition: {
group_list: [[
"top",
[["my_erp5_url"]]
[["my_erp5_url_list"]]
]]
}
});
......
......@@ -79,7 +79,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -244,7 +246,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -258,7 +260,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>993.44733.59148.57105</string> </value>
<value> <string>1016.60960.54632.28569</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -278,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>1627310085.03</float>
<float>1718127515.73</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -63,6 +63,5 @@
<br/>
<div class="storage-list">
</div>
<div data-gadget-url="gadget_erp5_jio.html" data-gadget-scope="erp5_gadget" data-gadget-sandbox="public"></div>
</body>
</html>
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.16563.15280.46899</string> </value>
<value> <string>1017.31621.18655.52206</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -270,7 +270,7 @@
</tuple>
<state>
<tuple>
<float>1509979675.96</float>
<float>1719252800.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,6 +5,7 @@
URLSearchParams) {
"use strict";
var OPML_PORTAL_TYPE = "Opml";
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
notify_msg_template = Handlebars.compile(
......@@ -19,8 +20,9 @@
function getMonitorSetting(gadget) {
return gadget.jio_allDocs({
select_list: ["basic_login", "url", "title", "active", "state"],
query: '(portal_type:"opml")'
select_list: ["basic_login", "url", "title", "active", "state",
"slapos_master_url"],
query: '(portal_type:"' + OPML_PORTAL_TYPE + '")'
})
.push(function (opml_result) {
var i,
......@@ -194,7 +196,7 @@
title: configuration_dict.opml_description[i].title,
url: configuration_dict.opml_description[i].href,
active: configuration_dict.opml_description[i].active,
portal_type: "opml",
portal_type: OPML_PORTAL_TYPE,
has_monitor: configuration_dict.opml_description[i]
.href.startsWith("https://"),
state: configuration_dict.opml_description[i].state || "Started"
......@@ -220,7 +222,7 @@
} else {
for (i = 0; i < configuration_dict.opml_description_list.length; i += 1) {
item = configuration_dict.opml_description_list[i];
item.portal_type = "opml";
item.portal_type = OPML_PORTAL_TYPE;
cred_list = atob(item.basic_login).split(':');
item.username = cred_list[0];
item.password = cred_list[1];
......@@ -333,22 +335,26 @@
if (limit === undefined) {
limit = 300;
}
return gadget.state.erp5_gadget.allDocs({
return gadget.state.jio_gadget.allDocs({
query: '(portal_type:"Instance Tree") AND (validation_state:"validated")',
select_list: ['title', 'default_successor_uid', 'uid', 'slap_state'],
select_list: ['title', 'default_successor_uid', 'uid', 'slap_state', 'id'],
limit: [0, limit],
sort_on: [
["creation_date", "descending"]
]
})
.push(function (result) {
var i,
var i, slapos_id,
uid_search_list = [];
for (i = 0; i < result.data.total_rows; i += 1) {
if (result.data.rows[i].value.slap_state !== "destroy_requested") {
//TODO slapos_id could be used to desambiguate identic title
//instances trees between different storages
slapos_id = result.data.rows[i].value.title;
instance_tree_list.push({
title: result.data.rows[i].value.title,
relative_url: result.data.rows[i].id,
slapos_id: slapos_id,
active: (result.data.rows[i].value.slap_state ===
"start_requested") ? true : false,
state: (result.data.rows[i].value.slap_state ===
......@@ -360,7 +366,7 @@
}
}
}
return gadget.state.erp5_gadget.allDocs({
return gadget.state.jio_gadget.allDocs({
query: '(portal_type:"Software Instance") AND ' +
'(successor_related_uid:("' + uid_search_list.join('","') + '"))',
select_list: ['uid', 'successor_related_uid', 'connection_xml'],
......@@ -381,7 +387,7 @@
}
if (instance_tree_list[uid_dict[tmp_uid]]) {
opml_list.push({
portal_type: "opml",
portal_type: OPML_PORTAL_TYPE,
title: instance_tree_list[uid_dict[tmp_uid]]
.title,
relative_url: instance_tree_list[uid_dict[tmp_uid]]
......@@ -394,7 +400,8 @@
tmp_parameter.password),
active: tmp_parameter.opml_url !== undefined &&
instance_tree_list[uid_dict[tmp_uid]].active,
state: instance_tree_list[uid_dict[tmp_uid]].state
state: instance_tree_list[uid_dict[tmp_uid]].state,
slapos_master_url: ""
});
}
}
......@@ -412,12 +419,12 @@
config: "",
is_export: false,
options: "",
erp5_gadget: ""
jio_gadget: ""
})
.ready(function (g) {
return g.getDeclaredGadget('erp5_gadget')
.push(function (erp5_gadget) {
return g.changeState({erp5_gadget: erp5_gadget});
return g.declareGadget('gadget_jio.html')
.push(function (jio_gadget) {
return g.changeState({jio_gadget: jio_gadget});
});
})
/////////////////////////////////////////////////////////////////
......@@ -453,12 +460,17 @@
})
.declareMethod("render", function (options) {
var gadget = this,
var gadget = this, i,
is_exporter = options.exporter === "true",
message_element = gadget.element.querySelector('.ui-message-alert');
message_element.textContent = "";
if (options.url && !options.url.endsWith('/')) {
options.url += '/';
if (options.url_list) {
options.url_list = options.url_list.split(",");
for (i = 0; i < options.url_list.length; i += 1) {
if (!options.url_list[i].endsWith('/')) {
options.url_list[i] += '/';
}
}
}
if (is_exporter) {
return new RSVP.Queue()
......@@ -482,7 +494,7 @@
config: "",
message: message_element,
sync: options.auto_sync,
storage_url: options.url
storage_url_list: options.url_list
});
})
.declareJob('deferChangeState', function deferStateChange(state) {
......@@ -586,15 +598,34 @@
});
})
.push(function () {
var has_failed = false;
if (gadget.state.sync === "erp5" && gadget.state.storage_url) {
var has_failed = false, i;
if (gadget.state.sync === "erp5" && gadget.state.storage_url_list) {
var storage_definition_list = [];
// start import from erp5 now
return gadget.notifySubmitting()
.push(function () {
return gadget.setSetting("hateoas_url", gadget.state.storage_url);
gadget.getSetting('default_view_reference');
})
.push(function () {
return gadget.state.erp5_gadget.createJio();
.push(function (default_view_reference) {
for (i = 0; i < gadget.state.storage_url_list.length; i += 1) {
storage_definition_list.push({
type: "erp5",
url: gadget.state.storage_url_list[i],
default_view_reference: default_view_reference
});
}
//TODO fix. union doesn't bring all elements (limit issue?)
/*return gadget.state.jio_gadget.createJio(
{
"type": "union",
"storage_list": storage_definition_list
}
);*/
return gadget.state.jio_gadget.createJio({
type: "erp5",
url: gadget.state.storage_url_list[0],
default_view_reference: default_view_reference
});
})
.push(function () {
return gadget.getSetting('opml_import_limit', 300);
......@@ -607,14 +638,13 @@
.innerHTML = notify_msg_template({
status: 'error',
message: 'Error: Failed to get Monitor Configuration from URL: ' +
gadget.state.storage_url
gadget.state.storage_url_list[0]
});
has_failed = true;
return [];
})
.push(function (opml_list) {
var i,
push_queue = new RSVP.Queue();
var i, push_queue = new RSVP.Queue();
function pushOPML(opml_dict) {
push_queue
......@@ -636,7 +666,7 @@
.innerHTML = notify_msg_template({
status: 'error',
message: 'An error occurred while saving Configuration from URL: ' +
gadget.state.storage_url
gadget.state.storage_url_list[0]
});
has_failed = true;
})
......
......@@ -260,7 +260,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1014.43844.29599.43673</string> </value>
<value> <string>1017.35724.42699.60194</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -280,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>1708448979.03</float>
<float>1719499012.07</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.618.22640.54749</string> </value>
<value> <string>1016.7866.18952.22323</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1713546953.85</float>
<float>1714398308.5</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.49474.6665.29303</string> </value>
<value> <string>1016.49501.58649.51319</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1716391830.68</float>
<float>1717176193.02</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -11,6 +11,7 @@
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
......@@ -72,6 +73,15 @@
"options": {page: "ojs_local_controller",
portal_type: "Promise Module"}
};
return gadget.getSetting('sync_redirect_options')
.push(function (sync_redirect_options) {
if (sync_redirect_options) {
redirect_options.options = sync_redirect_options;
return gadget.setSetting("sync_redirect_options", undefined);
}
})
.push(function () {
if (gadget.state.auto_sync) {
return gadget.getDeclaredGadget('sync_gadget')
.push(function (sync_gadget) {
......@@ -83,6 +93,7 @@
});
}
return gadget.redirect(redirect_options);
});
}
if (result_list[1].can_force) {
gadget.element.getElementsByClassName("btn-nopasswd")[0]
......@@ -146,6 +157,17 @@
"hidden": 0,
"type": "PasswordField"
},
"my_slapos_master_url": {
"description": "Slapos master URL",
"title": "Slapos master URL",
"default": options.slapos_master_url || "not-provided",
"css_class": "",
"required": 1,
"editable": 1,
"key": "slapos_master_url",
"hidden": 0,
"type": "StringField"
},
"my_portal_type": {
"description": "The name of a document in ERP5",
"title": "Portal Type",
......@@ -202,7 +224,7 @@
group_list: [[
"left",
[["my_url"], ["my_username"], ["my_password"],
["my_portal_type"], ["my_active"],
["my_slapos_master_url"], ["my_portal_type"], ["my_active"],
["my_new_password"], ["my_confirm_new_password"]]
]]
}
......
......@@ -260,7 +260,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.46878.65388.21691</string> </value>
<value> <string>1017.7024.38172.32733</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -280,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>1716236126.38</float>
<float>1717777119.89</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -79,7 +79,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -244,7 +246,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -258,7 +260,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27666.8050.30907</string> </value>
<value> <string>1016.7854.16646.24046</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -278,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>1510581396.39</float>
<float>1713981022.38</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -24,6 +23,7 @@
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
......@@ -42,6 +42,8 @@
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......@@ -56,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -172,11 +173,11 @@
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</string> </value>
<value> <string>publish_alive</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -200,7 +201,7 @@
</tuple>
<state>
<tuple>
<float>1454520181.06</float>
<float>1717179451.17</float>
<string>UTC</string>
</tuple>
</state>
......@@ -209,7 +210,7 @@
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
<value> <string>published_alive</string> </value>
</item>
</dictionary>
</list>
......@@ -249,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.32493.13517.11946</string> </value>
<value> <string>1016.62600.58488.20736</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -269,7 +270,7 @@
</tuple>
<state>
<tuple>
<float>1715373485.61</float>
<float>1717179443.83</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -252,7 +252,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1015.60575.57531.48776</string> </value>
<value> <string>1016.39499.37502.35754</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -272,7 +272,7 @@
</tuple>
<state>
<tuple>
<float>1713212157.56</float>
<float>1717176362.9</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>Monitoring Promises Status</title>
<link href="gadget_officejs_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_erp5_page_ojsm_status_list.js"></script>
</head>
<body>
<div data-gadget-url="gadget_erp5_pt_form_list.html" data-gadget-scope="form_list" data-gadget-sandbox="public"></div>
</body>
</html>
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP) {
"use strict";
rJS(window)
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this;
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
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")) {
result.data.rows[i].value.lastBuildDate = {
field_gadget_param: {
//allow_empty_time: 0,
//ampm_time_style: 0,
css_class: "date_field",
date_only: 0,
description: "The Date",
editable: 0,
hidden: 0,
hidden_day_is_last_day: 0,
"default": result.data.rows[i].value.lastBuildDate,
key: "lastBuildDate",
required: 0,
timezone_style: 1,
title: "Promise Date",
type: "DateTimeField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
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.description = value;
}
if (result.data.rows[i].value.hasOwnProperty("category")) {
value = result.data.rows[i].value.category;
result.data.rows[i].value.category = {
field_gadget_param: {
css_class: "",
description: "The Status",
hidden: 0,
"default": value,
key: "category",
url: "gadget_erp5_field_status.html",
title: "Status",
type: "GadgetField"
}
};
result.data.rows[i].value["listbox_uid:list"] = {
key: "listbox_uid:list",
value: 2713
};
}
}
return result;
});
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("triggerSubmit", function () {
var argument_list = arguments;
return this.getDeclaredGadget('form_list')
.push(function (gadget) {
return gadget.triggerSubmit.apply(gadget, argument_list);
});
})
.declareMethod("render", function (options) {
return this.changeState({
options: options,
latest_reload_time: new Date().getTime()
});
})
.onStateChange(function () {
var gadget = this,
lines_limit;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting("latest_sync_time");
})
.push(function (latest_sync_time) {
if (latest_sync_time === undefined) {
// no sync yet
return gadget.redirect({command: "display", options: {page: "ojsm_import_export"}});
}
})
.push(function () {
return gadget.getSetting("listbox_lines_limit", 20);
})
.push(function (listbox_lines_limit) {
lines_limit = listbox_lines_limit;
return gadget.getDeclaredGadget('form_list');
})
.push(function (form_list) {
var column_list = [
['category', 'Status'],
['source', 'Promise'],
['channel_item', 'Software Instance'],
['channel', 'Instance Tree'],
['lastBuildDate', 'Promise Date'],
['description', 'Message']
];
return form_list.render({
erp5_document: {
"_embedded": {"_view": {
"listbox": {
"column_list": column_list,
"show_anchor": 0,
"default_params": {},
"editable": 0,
"editable_column_list": [],
"key": "field_listbox",
"lines": lines_limit,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22" +
"promise" + "%22",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
"sort": [["category", "ascending"], ["channel", "ascending"]],
"title": "Monitoring Promises",
"type": "ListBox"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"bottom",
[["listbox"]]
]]
}
});
})
.push(function () {
return gadget.updateHeader({
page_title: "Monitoring Promises Status",
filter_action: true
});
});
})
.onLoop(function () {
var gadget = this;
return gadget.getSetting('latest_sync_time')
.push(function (latest_sync_time) {
if (latest_sync_time > gadget.state.latest_reload_time) {
return gadget.changeState({latest_reload_time: new Date().getTime()});
}
});
}, 30000);
}(window, rJS, RSVP));
......@@ -260,7 +260,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1014.27855.54097.10478</string> </value>
<value> <string>1017.6962.52907.14592</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -280,7 +280,7 @@
</tuple>
<state>
<tuple>
<float>1707263598.02</float>
<float>1717773952.0</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,6 +3,7 @@
(function (window, rJS, RSVP, Handlebars) {
"use strict";
var OPML_PORTAL_TYPE = "Opml";
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
......@@ -101,7 +102,7 @@
.push(function () {
element.setAttribute("disabled", "disabled");
return gadget.jio_allDocs({
query: 'portal_type: "opml"',
query: 'portal_type: "' + OPML_PORTAL_TYPE + '"',
select_list: ['title']
})
.push(function (result) {
......@@ -317,7 +318,7 @@
"key": "monitoring_setting_listbox",
"lines": 20,
"list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22opml%22",
"query": "urn:jio:allDocs?query=portal_type%3A%22" + OPML_PORTAL_TYPE + "%22",
"portal_type": [],
"search_column_list": column_list,
"sort_column_list": column_list,
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.27838.64215.37273</string> </value>
<value> <string>1017.1125.9926.47069</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1716236037.63</float>
<float>1717423120.28</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>OfficeJS Jio Web Page View</title>
<link href="gadget_officejs_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="gadget_officejs_jio_opml_view.js"></script>
</head>
<body>
<div class="template-view"></div>
<form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
<div data-gadget-url="gadget_officejs_monitoring_opml_edit.html"
data-gadget-scope="opml_gadget" data-gadget-sandbox="public"></div>
<div data-gadget-url="gadget_erp5_form.html"
data-gadget-scope="form_view"
data-gadget-sandbox="public">
</div>
</form>
</body>
</html>
\ No newline at end of file
/*global window, rJS, RSVP, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS, RSVP, Rusha) {
"use strict";
var rusha = new Rusha();
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.onEvent('submit', function () {
var gadget = this,
doc,
opml_gadget;
return new RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget('opml_gadget');
})
.push(function (g) {
opml_gadget = g;
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (form_doc) {
doc = form_doc;
if (doc.password !== gadget.state.password) {
// password was modified, update on backend
doc.new_password = doc.password;
doc.confirm_new_password = doc.new_password;
doc.password = gadget.state.password;
doc.verify_password = 1;
} else {
doc.verify_password = (doc.verify_password === "on") ? 1 : 0;
}
return opml_gadget.checkOPMLForm(doc);
})
.push(function (state) {
if (state) {
return gadget.notifySubmitting()
.push(function () {
var verify_opml = doc.title === "" || doc.title === undefined ||
doc.verify_password === 1;
if (gadget.state.active === false && doc.active === "on") {
verify_opml = true;
}
doc.title = gadget.state.opml_title;
return opml_gadget.saveOPML(doc, verify_opml);
})
.push(function (state) {
var msg = {message: 'Document Updated', status: 'success'};
if (!state.status) {
msg = {message: 'Document update failed', status: "error"};
}
return RSVP.all([
gadget.notifySubmitted(msg),
state
]);
})
.push(function (result) {
if (result[1].status) {
return gadget.changeState({
"password": doc.password
});
}
});
}
});
})
.declareMethod("triggerSubmit", function () {
return this.element.querySelector('button[type="submit"]').click();
})
.declareMethod("render", function (options) {
var gadget = this,
doc = options.doc;
return RSVP.Queue()
.push(function () {
return gadget.changeState({
"opml_title": doc.title || "",
"opml_key": options.jio_key,
"password": doc.password,
"active": doc.active
});
})
.push(function () {
return RSVP.all([
gadget.getDeclaredGadget('form_view')
]);
})
.push(function (result) {
return result[0].render({
erp5_document: {
"_embedded": {"_view": {
"my_title": {
"description": "The name of OPML",
"title": "Title",
"default": doc.title || "",
"css_class": "",
"required": 0,
"editable": 0,
"key": "title",
"hidden": doc.title === undefined ? 1 : 0,
"type": "StringField"
},
"my_url": {
"description": "",
"title": "OPML URL",
"default": doc.url || options.url || "",
"css_class": "",
"required": 1,
"editable": 1,
"key": "url",
"hidden": 0,
"type": "StringField"
},
"my_username": {
"description": "Username for access private URLs",
"title": "Username",
"default": doc.username || "",
"css_class": "",
"required": 1,
"editable": 0,
"key": "username",
"hidden": 0,
"type": "StringField"
},
"my_password": {
"description": "Password for access private URLs",
"title": "Password",
"default": doc.password || "",
"css_class": "",
"required": 1,
"editable": 1,
"key": "password",
"hidden": 0,
"type": "PasswordField"
},
"my_requested_state": {
"description": "Instance tree state",
"title": "Requested State",
"default": doc.state || (doc.active ? "Started" : "Stopped"),
"css_class": "",
"required": 1,
"editable": 0,
"key": "state",
"hidden": 0,
"type": "StringField"
},
"my_active": {
"description": "Sync this opml or not",
"title": "Active (Enable Sync)",
"default": doc.active || doc.active === undefined ? 1 : 0,
"css_class": "",
"required": 1,
"editable": 1,
"key": "active",
"hidden": 0,
"type": "CheckBoxField"
},
"my_new_password": {
"description": "Change current OPML password",
"title": "New Password",
"default": "",
"css_class": "",
"required": 1,
"editable": 1,
"key": "new_password",
"hidden": 1,
"type": "PasswordField"
},
"my_verify_password": {
"description": "Check if this OPML is valid, and also verify that password match",
"title": "Verify OPML & Password",
"default": 0,
"css_class": "",
"required": 1,
"editable": 1,
"key": "verify_password",
"hidden": 0,
"type": "CheckBoxField"
}
}},
"_links": {
"type": {
// form_list display portal_type in header
name: ""
}
}
},
form_definition: {
group_list: [[
"left",
[["my_title"], ["my_url"], ["my_username"], ["my_password"],
["my_requested_state"], ["my_active"], ["my_verify_password"],
["my_new_password"]]
]]
}
});
})
.push(function () {
return new RSVP.Queue()
.push(function () {
var hosting_key = rusha.digestFromString(gadget.state.opml_key);
return RSVP.all([
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({command: 'push_history', options: {
page: "ojsm_jump",
jio_key: hosting_key,
title: gadget.state.opml_title,
view_title: "Related Instance Tree"
}}),
gadget.getUrlFor({command: 'change', options: {
page: 'ojsm_opml_delete',
jio_key: gadget.state.opml_key,
return_url: 'settings_configurator'
}})
]);
})
.push(function (url_list) {
return gadget.updateHeader({
page_title: options.doc.title || "OPML View",
selection_url: url_list[0],
previous_url: url_list[1],
next_url: url_list[2],
jump_url: url_list[3],
delete_url: url_list[4],
save_action: true
});
});
});
});
}(window, rJS, RSVP, Rusha));
......@@ -87,7 +87,7 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CONFIGURATION MANIFEST\n
# generated on Fri May 24 14:46:38 2024\n
# generated on Mon Jun 3 13:55:24 2024\n
CACHE:\n
\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL1NvZnR3YXJlIEluc3RhbmNl\n
......@@ -97,9 +97,9 @@ hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL1NvZnR3YXJlIEluc3RhbmNlL21vbml
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfd2ViX21vbml0b3JpbmcvU29mdHdhcmVJbnN0YW5jZV92aWV3Rm9yTW9uaXRvcmluZ1Jlc291cmNlcw==\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL1NvZnR3YXJlIEluc3RhbmNlL21vbml0b3JpbmdfcHJvY2Vzc2VzX3ZpZXc=\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfd2ViX21vbml0b3JpbmcvU29mdHdhcmVJbnN0YW5jZV92aWV3Rm9yTW9uaXRvcmluZ1Byb2Nlc3Nlcw==\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL29wbWw=\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL29wbWwvbW9uaXRvcmluZ192aWV3\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfd2ViX21vbml0b3Jpbmcvb3BtbF92aWV3Rm9yTW9uaXRvcmluZw==\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL09wbWw=\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL09wbWwvbW9uaXRvcmluZ192aWV3\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfd2ViX21vbml0b3JpbmcvT3BtbF92aWV3Rm9yTW9uaXRvcmluZw==\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL0luc3RhbmNlIFRyZWU=\n
hateoas_appcache/definition_view/cG9ydGFsX3R5cGVzL0luc3RhbmNlIFRyZWUvbW9uaXRvcmluZ192aWV3\n
hateoas_appcache/definition_view/cG9ydGFsX3NraW5zL2VycDVfd2ViX21vbml0b3JpbmcvSW5zdGFuY2VUcmVlX3ZpZXdGb3JNb25pdG9yaW5n\n
......
......@@ -79,7 +79,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -236,7 +238,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -250,7 +252,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27666.8050.30907</string> </value>
<value> <string>1015.45861.47176.27204</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -270,7 +272,7 @@
</tuple>
<state>
<tuple>
<float>1542277962.83</float>
<float>1712329323.76</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.40875.18813.28279</string> </value>
<value> <string>1016.40876.2382.12151</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -270,7 +270,7 @@
</tuple>
<state>
<tuple>
<float>1715875922.12</float>
<float>1715958907.55</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -249,7 +249,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1015.32779.62576.10939</string> </value>
<value> <string>1016.59484.28533.58572</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -269,7 +269,7 @@
</tuple>
<state>
<tuple>
<float>1711544405.46</float>
<float>1717176711.0</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,6 +3,7 @@
(function (window, rJS, RSVP, btoa, XMLHttpRequest, Handlebars, jIO) {
"use strict";
var OPML_PORTAL_TYPE = "Opml";
var gadget_klass = rJS(window),
templater = gadget_klass.__template_element,
notify_msg_template = Handlebars.compile(
......@@ -139,9 +140,9 @@
function saveOPML(gadget, doc, verify_password) {
var opml_dict = {
type: "opml",
type: OPML_PORTAL_TYPE,
title: doc.title,
portal_type: "opml",
portal_type: OPML_PORTAL_TYPE,
url: doc.url,
basic_login: btoa(doc.username + ':' + doc.password),
username: doc.username,
......@@ -151,7 +152,12 @@
state: doc.state || (doc.active === "on" ? "Started" : "Stopped")
},
update_password_list = [],
allow_force = false;
allow_force = false,
return_dict;
if (doc.slapos_master_url && doc.slapos_master_url !== undefined &&
doc.slapos_master_url !== "") {
opml_dict.slapos_master_url = doc.slapos_master_url;
}
gadget.state.message.textContent = "";
function validateOPML() {
......@@ -328,6 +334,13 @@
});
}
return {status: status, can_force: allow_force};
})
.push(function (dict) {
return_dict = dict;
return gadget.setSetting("latest_import_date", new Date().getTime());
})
.push(function (dict) {
return return_dict;
});
}
......@@ -359,6 +372,7 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_put", "jio_put")
......
......@@ -79,7 +79,9 @@
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
......@@ -236,7 +238,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -250,7 +252,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.63860.22689.21760</string> </value>
<value> <string>1016.62588.18488.24661</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -270,7 +272,7 @@
</tuple>
<state>
<tuple>
<float>1543593317.26</float>
<float>1717178789.09</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1015.63271.15903.46711</string> </value>
<value> <string>1015.63271.39533.51643</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1713373896.11</float>
<float>1714059517.01</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -91,8 +91,7 @@
}}),
gadget.getUrlFor({command: 'change', options: {
page: 'ojsm_opml_delete',
jio_key: page_options.jio_key,
return_url: 'settings_configurator'
jio_key: page_options.jio_key
}})
]);
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.7694.22139.25207</string> </value>
<value> <string>1016.62553.1098.47598</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1713971424.43</float>
<float>1717176544.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -252,7 +252,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1014.13373.21627.45107</string> </value>
<value> <string>1016.46870.32443.18705</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -272,7 +272,7 @@
</tuple>
<state>
<tuple>
<float>1706621148.81</float>
<float>1716235972.95</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,7 +25,7 @@
<!-- new router -->
<script data-renderjs-configuration="portal_skin_folder" type="text/x-renderjs-configuration">erp5_web_monitoring</script>
<script data-renderjs-configuration="app_view_reference" type="text/x-renderjs-configuration">monitoring_view</script>
<script data-renderjs-configuration="app_actions" type="text/x-renderjs-configuration">('Software Instance | monitoring_view', 'Software Instance | monitoring_resources_view', 'Software Instance | monitoring_processes_view', 'Software Instance Module | monitoring_view', 'Instance Tree | monitoring_view', 'Instance Tree Module | monitoring_view', 'Promise Module | monitoring_view', 'Promise | monitoring_view', 'opml | monitoring_view')</script>
<script data-renderjs-configuration="app_actions" type="text/x-renderjs-configuration">('Software Instance | monitoring_view', 'Software Instance | monitoring_resources_view', 'Software Instance | monitoring_processes_view', 'Software Instance Module | monitoring_view', 'Instance Tree | monitoring_view', 'Instance Tree Module | monitoring_view', 'Promise Module | monitoring_view', 'Promise | monitoring_view', 'Opml | monitoring_view')</script>
<script data-renderjs-configuration="app_allowed_sub_types" type="text/x-renderjs-configuration">('Software Instance Module | Software Instance', 'Instance Tree Module | Instance Tree', 'Software Instance | Promise')</script>
<script data-renderjs-configuration="app_configurator" type="text/x-renderjs-configuration">ojsm_import_export</script>
<script data-renderjs-configuration="software_instance_module_dict" type="text/x-renderjs-configuration">{"front_page": 1, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 1, "panel_action": 1, "previous_next_button": 0, "history_previous_link": 0, "title": "Software Instances Status", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0}</script>
......@@ -34,6 +34,6 @@
<script data-renderjs-configuration="instance_tree_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Instance Tree: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "instance_tree", "custom_submit": "gadget_officejs_monitoring_submit.html" }</script>
<script data-renderjs-configuration="promise_module_dict" type="text/x-renderjs-configuration">{"front_page": 1, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 1, "panel_action": 1, "previous_next_button": 0, "history_previous_link": 0, "title": "Monitoring Promises Status", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0}</script>
<script data-renderjs-configuration="promise_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "title": "Promise: ", "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "promise", "custom_submit": "gadget_officejs_monitoring_submit.html" }</script>
<script data-renderjs-configuration="opml_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "opml" }</script>
<script data-renderjs-configuration="opml_dict" type="text/x-renderjs-configuration"> {"front_page": 0, "upload_button": 0, "download_button": 0, "editable": 0, "hide_add_button": 1, "jump_button": 0, "fast_input_button": 0, "export_button": 0, "filter_action": 0, "panel_action": 1, "previous_next_button": 1, "history_previous_link": 1, "hide_listbox_buttons": 1, "blob_type": "", "blob_create_object_url": 0, "custom_header": "gadget_officejs_monitoring_options_header.html", "view": "opml", "custom_submit": "gadget_officejs_monitoring_submit.html" }</script>
</body>
</html>
\ No newline at end of file
......@@ -265,7 +265,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.14833.52348.59392</string> </value>
<value> <string>1016.62603.53500.56064</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -285,7 +285,7 @@
</tuple>
<state>
<tuple>
<float>1714498936.34</float>
<float>1717428289.21</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,8 +16,69 @@
.declareMethod("handle_submit", function (argument_list, options) {
switch (options.options.portal_type) {
case "Instance Tree":
//XXX do the old parameter gadget save here and fix it
//TODO do the old parameter gadget save here and fix it
return this.redirect({command: 'reload'});
case "Opml":
console.log("opml submit argument_list, options:", argument_list, options);
//TODO fix submit
var gadget = this,
doc,
opml_gadget;
return new RSVP.Queue()
.push(function () {
return gadget.getDeclaredGadget('opml_gadget');
})
.push(function (g) {
opml_gadget = g;
return gadget.getDeclaredGadget('form_view');
})
.push(function (form_gadget) {
return form_gadget.getContent();
})
.push(function (form_doc) {
doc = form_doc;
if (doc.password !== gadget.state.password) {
// password was modified, update on backend
doc.new_password = doc.password;
doc.confirm_new_password = doc.new_password;
doc.password = gadget.state.password;
doc.verify_password = 1;
} else {
doc.verify_password = (doc.verify_password === "on") ? 1 : 0;
}
return opml_gadget.checkOPMLForm(doc);
})
.push(function (state) {
if (state) {
return gadget.notifySubmitting()
.push(function () {
var verify_opml = doc.title === "" || doc.title === undefined ||
doc.verify_password === 1;
if (gadget.state.active === false && doc.active === "on") {
verify_opml = true;
}
doc.title = gadget.state.opml_title;
return opml_gadget.saveOPML(doc, verify_opml);
})
.push(function (state) {
var msg = {message: 'Document Updated', status: 'success'};
if (!state.status) {
msg = {message: 'Document update failed', status: "error"};
}
return RSVP.all([
gadget.notifySubmitted(msg),
state
]);
})
.push(function (result) {
if (result[1].status) {
return gadget.changeState({
"password": doc.password
});
}
});
}
});
default:
return this.redirect({command: 'reload'});
}
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.16493.14116.1297</string> </value>
<value> <string>1017.1223.8753.47035</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1714499837.65</float>
<float>1717428914.0</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -21,6 +21,7 @@
}
return gadget.getDeclaredGadget('graph_gadget')
.push(function (graph_gadget) {
data.new_format = true;
return graph_gadget.render({value: data});
});
}
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.32237.19427.7099</string> </value>
<value> <string>1016.58116.62606.9608</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1715358713.84</float>
<float>1716991956.32</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -35,6 +35,7 @@
PROMISE_TYPE = "Promise",
SOFTWARE_INSTANCE_TYPE = "Software Instance",
INSTANCE_TREE_TYPE = "Instance Tree",
OPML_PORTAL_TYPE = "Opml",
ZONE_LIST = [
"-1200",
"-1100",
......@@ -154,7 +155,7 @@
var storage = this._local_sub_storage;
return storage.get(id)
.push(function (doc) {
if (doc.portal_type !== 'opml') {
if (doc.portal_type !== OPML_PORTAL_TYPE) {
return storage.remove(id);
}
function removeOPMLTree(url) {
......@@ -809,7 +810,7 @@
function syncOpmlStorage(context) {
return context._local_sub_storage.allDocs({
query: '(portal_type:"opml") AND (active:true) AND (url:"https://%")',
query: '(portal_type:"' + OPML_PORTAL_TYPE + '") AND (active:true) AND (url:"https://%")',
select_list: ["title", "url", "basic_login"]
})
.push(function (storage_result) {
......
......@@ -249,7 +249,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1015.32774.1126.37956</string> </value>
<value> <string>1017.22812.19597.42137</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -269,7 +269,7 @@
</tuple>
<state>
<tuple>
<float>1712157668.63</float>
<float>1718724260.35</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -244,7 +244,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1016.27131.47749.27904</string> </value>
<value> <string>1016.27890.23432.33160</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1715051292.75</float>
<float>1715096834.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.7950.43708.60125</string> </value>
<value> <string>1015.24522.26496.3908</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1509446414.84</float>
<float>1711049003.02</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -24,7 +24,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>opml</string> </value>
<value> <string>Opml</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
......
......@@ -161,6 +161,10 @@
<string>specialise_title</string>
<string>title</string>
</tuple>
<tuple>
<string>slapos_master_url</string>
<string>slapos_master_url</string>
</tuple>
</list>
</value>
</item>
......
......@@ -105,6 +105,7 @@
<string>my_url</string>
<string>my_username</string>
<string>my_password</string>
<string>my_slapos_master_url</string>
<string>my_active</string>
<string>my_verify</string>
<string>my_translated_state</string>
......@@ -122,7 +123,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>opml_viewForMonitoring</string> </value>
<value> <string>Opml_viewForMonitoring</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......
......@@ -165,6 +165,10 @@
<string>channel_item</string>
<string>title</string>
</tuple>
<tuple>
<string>slapos_master_url</string>
<string>slapos_master_url</string>
</tuple>
</list>
</value>
</item>
......
......@@ -89,7 +89,6 @@ url_list = [
"gadget_officejs_monitoring_sync.html",
"gadget_officejs_monitoring_router.html",
"gadget_erp5_page_ojsm_import_export.html",
"gadget_officejs_jio_opml_view.html",
"gadget_erp5_page_ojsm_opml_add.html",
"gadget_officejs_monitoring_panel.html",
"gadget_erp5_page_ojsm_resources_view.html",
......@@ -114,7 +113,6 @@ url_list = [
"gadget_officejs_monitoring_header.js",
"gadget_erp5_page_ojsm_opml_add.js",
"gadget_erp5_page_ojsm_opml_delete.js",
"gadget_officejs_jio_opml_view.js",
"gadget_erp5_page_ojsm_synchronize.js",
"gadget_erp5_page_ojsm_jump.js",
"gadget_erp5_page_ojsm_erp5_configurator.js",
......
image_module/gadget_officejs_appstore_rapid_spage
portal_types/Instance Tree Module/monitoring_view
portal_types/Instance Tree/monitoring_view
portal_types/Opml/monitoring_view
portal_types/Promise Module/monitoring_view
portal_types/Promise/monitoring_view
portal_types/Software Instance Module/monitoring_view
portal_types/Software Instance/monitoring_processes_view
portal_types/Software Instance/monitoring_resources_view
portal_types/Software Instance/monitoring_view
portal_types/opml/monitoring_view
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_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_monitoring.configuration
web_page_module/gadget_officejs_monitoring_*
web_page_module/gadget_ojsm_*
......
portal_types/Instance Tree Module/monitoring_view
portal_types/Instance Tree/monitoring_view
portal_types/Opml/monitoring_view
portal_types/Promise Module/monitoring_view
portal_types/Promise/monitoring_view
portal_types/Software Instance Module/monitoring_view
portal_types/Software Instance/monitoring_processes_view
portal_types/Software Instance/monitoring_resources_view
portal_types/Software Instance/monitoring_view
\ No newline at end of file
portal_types/opml/monitoring_view
\ No newline at end of file
image_module/gadget_officejs_appstore_rapid_spage
portal_types/Instance Tree Module/monitoring_view
portal_types/Instance Tree/monitoring_view
portal_types/Opml/monitoring_view
portal_types/Promise Module/monitoring_view
portal_types/Promise/monitoring_view
portal_types/Software Instance Module/monitoring_view
portal_types/Software Instance/monitoring_processes_view
portal_types/Software Instance/monitoring_resources_view
portal_types/Software Instance/monitoring_view
portal_types/opml/monitoring_view
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_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_monitoring.configuration
web_page_module/gadget_officejs_monitoring_*
web_page_module/gadget_ojsm_*
......
image_module/gadget_officejs_appstore_rapid_spage
portal_types/Instance Tree Module/monitoring_view
portal_types/Instance Tree/monitoring_view
portal_types/Opml/monitoring_view
portal_types/Promise Module/monitoring_view
portal_types/Promise/monitoring_view
portal_types/Software Instance Module/monitoring_view
portal_types/Software Instance/monitoring_processes_view
portal_types/Software Instance/monitoring_resources_view
portal_types/Software Instance/monitoring_view
portal_types/opml/monitoring_view
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_opml_view_html
web_page_module/gadget_officejs_jio_opml_view_js
web_page_module/gadget_officejs_monitoring.configuration
web_page_module/gadget_officejs_monitoring_*
web_page_module/gadget_ojsm_*
......
Instance Tree
Instance Tree Module
Opml
Promise
Promise Module
Software Instance
Software Instance Module
\ No newline at end of file
opml
\ No newline at end of file
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