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