Commit 061eb0ec authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

[erp5_web_monitoring] minor fixes, sort status on hosting subscription is not working well yet

parent 8b9df2aa
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
// optimized way to fetch hosting subscription list // optimized way to fetch hosting subscription list
var hosting_dict = {}, var hosting_dict = {},
instance_dict = {}, instance_dict = {},
sort_status_dict = {},
compare_function, compare_function,
total_rows = 0; total_rows = 0;
return gadget.jio_allDocs(filter) return gadget.jio_allDocs(filter)
...@@ -81,16 +80,21 @@ ...@@ -81,16 +80,21 @@
} }
} }
if (status_sort !== undefined) { if (status_sort !== undefined) {
if (status_sort === "ascending") {
compare_function = function (first, second) {
return first > second;
};
} else {
compare_function = function (first, second) { compare_function = function (first, second) {
return first <= second; first = first.toUpperCase();
}; second = second.toUpperCase();
if (first > second) {
return 1;
} }
if (first < second) {
return -1;
}
return 0;
};
row_list.sort(function (a, b) { row_list.sort(function (a, b) {
if (status_sort === "ascending") {
return compare_function(b.value.status, a.value.status);
}
return compare_function(a.value.status, b.value.status); return compare_function(a.value.status, b.value.status);
}); });
} }
...@@ -119,10 +123,10 @@ ...@@ -119,10 +123,10 @@
.allowPublicAcquisition("jio_allDocs", function (param_list) { .allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this, var gadget = this,
status_sort, status_sort,
i; j;
for (i = 0; i < param_list[0].sort_on.length; i += 1) { for (j = 0; j < param_list[0].sort_on.length; j += 1) {
if (param_list[0].sort_on[i][0] === 'status') { if (param_list[0].sort_on[j][0] === 'status') {
status_sort = param_list[0].sort_on[i][1]; status_sort = param_list[0].sort_on[j][1];
} }
} }
return getHostingData(gadget, param_list[0], status_sort) return getHostingData(gadget, param_list[0], status_sort)
...@@ -223,11 +227,12 @@ ...@@ -223,11 +227,12 @@
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=%28portal_type%3A%22" + "query": "urn:jio:allDocs?query=%28portal_type%3A%22" +
"opml" + "%22%29AND%28active%3A%22" + "opml" + "%22%29AND%28active%3A%22" +
"true" + "%22%29", "true" + "%22%29AND%28url%3A%22" +
"https://%25%22%29",
"portal_type": [], "portal_type": [],
"search_column_list": [['status', 'Status'], ['title', 'Hosting Subscription']], "search_column_list": [['status', 'Status'], ['title', 'Hosting Subscription']],
"sort_column_list": [['status', 'Status'], ['title', 'Hosting Subscription']], "sort_column_list": [['title', 'Hosting Subscription']],
"sort": [['status', 'ascending']], "sort": [['title', 'ascending']],
"title": "Hosting Subscriptions", "title": "Hosting Subscriptions",
"command": "index", "command": "index",
"type": "ListBox" "type": "ListBox"
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.27055.25870.4130</string> </value> <value> <string>965.42290.3299.27938</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1514376211.14</float> <float>1519222382.45</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
.title, .title,
relative_url: hosting_subscription_list[uid_dict[tmp_uid]] relative_url: hosting_subscription_list[uid_dict[tmp_uid]]
.relative_url, .relative_url,
url: tmp_parameter.opml_url || String(tmp_uid), url: tmp_parameter.opml_url || String(tmp_uid) + " NO MONITOR",
has_monitor: tmp_parameter.opml_url !== undefined, has_monitor: tmp_parameter.opml_url !== undefined,
username: tmp_parameter.username, username: tmp_parameter.username,
password: tmp_parameter.password, password: tmp_parameter.password,
...@@ -550,7 +550,7 @@ ...@@ -550,7 +550,7 @@
return gadget.state.erp5_gadget.createJio(); return gadget.state.erp5_gadget.createJio();
}) })
.push(function () { .push(function () {
return gadget.getSetting('opml_import_limit', 100); return gadget.getSetting('opml_import_limit', 300);
}) })
.push(function (select_limit) { .push(function (select_limit) {
return getInstanceOPMLListFromMaster(gadget, select_limit); return getInstanceOPMLListFromMaster(gadget, select_limit);
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.40786.41275.23108</string> </value> <value> <string>965.42096.47763.27016</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>1519166104.03</float> <float>1519210888.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -45,11 +45,13 @@ ...@@ -45,11 +45,13 @@
if (state) { if (state) {
return gadget.notifySubmitting() return gadget.notifySubmitting()
.push(function () { .push(function () {
var verify_opml = doc.title === "" || doc.title === undefined ||
doc.verify_password === 1;
if (gadget.state.active === false && doc.active === 1) {
verify_opml = true;
}
doc.title = gadget.state.opml_title; doc.title = gadget.state.opml_title;
return opml_gadget.saveOPML( return opml_gadget.saveOPML(doc, verify_opml);
doc,
doc.title === "" || doc.title === undefined || doc.verify_password === 1
);
}) })
.push(function (status) { .push(function (status) {
var msg = {message: 'Document Updated', status: 'success'}; var msg = {message: 'Document Updated', status: 'success'};
...@@ -84,7 +86,8 @@ ...@@ -84,7 +86,8 @@
return gadget.changeState({ return gadget.changeState({
"opml_title": doc.title || "", "opml_title": doc.title || "",
"opml_key": options.jio_key, "opml_key": options.jio_key,
"password": doc.password "password": doc.password,
"active": doc.active
}); });
}) })
.push(function () { .push(function () {
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.41380.57960.56268</string> </value> <value> <string>965.42338.34743.44339</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>1519168458.29</float> <float>1519225208.75</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n <value> <string>CACHE MANIFEST\n
# generated on Fri, 09 Jan 2018 10:26:43 +0000\n # generated on Fri, 21 Fev 2018 10:37:42 +0000\n
# XXX + fonts\n # XXX + fonts\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
...@@ -387,7 +387,7 @@ NETWORK:\n ...@@ -387,7 +387,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.41395.56200.9676</string> </value> <value> <string>965.42293.15886.45994</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -405,7 +405,7 @@ NETWORK:\n ...@@ -405,7 +405,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519208317.97</float> <float>1519222522.75</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -147,7 +147,8 @@ ...@@ -147,7 +147,8 @@
username: doc.username, username: doc.username,
password: doc.password, password: doc.password,
active: (doc.active === 1) ? true : false, active: (doc.active === 1) ? true : false,
has_monitor: true has_monitor: true,
state: doc.state || (doc.active ? "Started" : "Stopped")
}, },
update_password_list = []; update_password_list = [];
gadget.state.message.textContent = ""; gadget.state.message.textContent = "";
...@@ -299,7 +300,6 @@ ...@@ -299,7 +300,6 @@
opml_dict.basic_login = opml_dict.basic_login =
btoa(doc.username + ':' + doc.new_password); btoa(doc.username + ':' + doc.new_password);
opml_dict.password = doc.new_password; opml_dict.password = doc.new_password;
opml_dict.state = "Started";
return true; return true;
}); });
}); });
...@@ -308,6 +308,8 @@ ...@@ -308,6 +308,8 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
if (verify_password) { if (verify_password) {
// if verification pass -> instance is started
opml_dict.state = "Started";
return validateOPML(); return validateOPML();
} }
return true; return true;
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.41362.25057.37034</string> </value> <value> <string>965.42325.2049.64307</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1519166629.53</float> <float>1519224835.75</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