Commit 8b9df2aa authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

[erp5_web_monitoring] increase opml import limit, show state of imported...

[erp5_web_monitoring] increase opml import limit, show state of imported Instance and if they are monitored or not
parent 111bc4fb
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
opml_list = [], opml_list = [],
uid_dict = {}; uid_dict = {};
if (limit === undefined) { if (limit === undefined) {
limit = 100; limit = 300;
} }
return gadget.state.erp5_gadget.allDocs({ return gadget.state.erp5_gadget.allDocs({
query: '(portal_type:"Hosting Subscription") AND (validation_state:"validated")', query: '(portal_type:"Hosting Subscription") AND (validation_state:"validated")',
...@@ -312,7 +312,9 @@ ...@@ -312,7 +312,9 @@
title: result.data.rows[i].value.title, title: result.data.rows[i].value.title,
relative_url: result.data.rows[i].id, relative_url: result.data.rows[i].id,
active: (result.data.rows[i].value.slap_state === active: (result.data.rows[i].value.slap_state ===
"start_requested") ? true : false "start_requested") ? true : false,
state: (result.data.rows[i].value.slap_state ===
"start_requested") ? "Started" : "Stopped"
}); });
uid_search_list.push(result.data.rows[i].value.uid); uid_search_list.push(result.data.rows[i].value.uid);
if (result.data.rows[i].value.default_predecessor_uid) { if (result.data.rows[i].value.default_predecessor_uid) {
...@@ -336,21 +338,25 @@ ...@@ -336,21 +338,25 @@
tmp_uid = result.data.rows[i].value.uid; tmp_uid = result.data.rows[i].value.uid;
if (uid_dict.hasOwnProperty(tmp_uid)) { if (uid_dict.hasOwnProperty(tmp_uid)) {
tmp_parameter = readMonitoringParameter(result.data.rows[i].value.connection_xml); tmp_parameter = readMonitoringParameter(result.data.rows[i].value.connection_xml);
if (tmp_parameter !== undefined) { if (tmp_parameter === undefined) {
opml_list.push({ tmp_parameter = {username: "", password: "", opml_url: undefined};
portal_type: "opml",
title: hosting_subscription_list[uid_dict[tmp_uid]]
.title,
relative_url: hosting_subscription_list[uid_dict[tmp_uid]]
.relative_url,
url: tmp_parameter.opml_url,
username: tmp_parameter.username,
password: tmp_parameter.password,
basic_login: btoa(tmp_parameter.username + ':' +
tmp_parameter.password),
active: hosting_subscription_list[uid_dict[tmp_uid]].active
});
} }
opml_list.push({
portal_type: "opml",
title: hosting_subscription_list[uid_dict[tmp_uid]]
.title,
relative_url: hosting_subscription_list[uid_dict[tmp_uid]]
.relative_url,
url: tmp_parameter.opml_url || String(tmp_uid),
has_monitor: tmp_parameter.opml_url !== undefined,
username: tmp_parameter.username,
password: tmp_parameter.password,
basic_login: btoa(tmp_parameter.username + ':' +
tmp_parameter.password),
active: tmp_parameter.opml_url !== undefined &&
hosting_subscription_list[uid_dict[tmp_uid]].active,
state: hosting_subscription_list[uid_dict[tmp_uid]].state
});
} }
} }
return opml_list; return opml_list;
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.27271.46031.23108</string> </value> <value> <string>965.40786.41275.23108</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>1514389684.37</float> <float>1519166104.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getSetting('opml_import_limit', 100); return gadget.getSetting('opml_import_limit', 300);
}) })
.push(function (import_limit) { .push(function (import_limit) {
opml_import_limit = import_limit; opml_import_limit = import_limit;
...@@ -237,9 +237,10 @@ ...@@ -237,9 +237,10 @@
}) })
.push(function (result) { .push(function (result) {
var column_list = [ var column_list = [
['title', 'OPML Title'], ['title', 'Title'],
['url', 'Url'], ['url', 'Url'],
['active', 'Enable Sync'] ['state', 'Requested State'],
['active', 'Sync Enabled']
]; ];
return result[0].render({ return result[0].render({
erp5_document: { erp5_document: {
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.38401.39195.47086</string> </value> <value> <string>965.41349.16774.45977</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1515059069.3</float> <float>1519166193.87</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -140,6 +140,17 @@ ...@@ -140,6 +140,17 @@
"hidden": 0, "hidden": 0,
"type": "PasswordField" "type": "PasswordField"
}, },
"my_requested_state": {
"description": "Hosting subscription 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": { "my_active": {
"description": "Sync this opml or not", "description": "Sync this opml or not",
"title": "Active (Enable Sync)", "title": "Active (Enable Sync)",
...@@ -185,7 +196,7 @@ ...@@ -185,7 +196,7 @@
group_list: [[ group_list: [[
"left", "left",
[["my_title"], ["my_url"], ["my_username"], ["my_password"], [["my_title"], ["my_url"], ["my_username"], ["my_password"],
["my_active"], ["my_verify_password"], ["my_requested_state"], ["my_active"], ["my_verify_password"],
["my_new_password"]] ["my_new_password"]]
]] ]]
} }
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.29555.15349.17885</string> </value> <value> <string>965.41380.57960.56268</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>1510848320.68</float> <float>1519168458.29</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, 27 Dec 2017 11:48:33 +0000\n # generated on Fri, 09 Jan 2018 10:26:43 +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>964.26988.39431.42120</string> </value> <value> <string>965.41395.56200.9676</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>1514371963.04</float> <float>1519208317.97</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -146,7 +146,8 @@ ...@@ -146,7 +146,8 @@
basic_login: btoa(doc.username + ':' + doc.password), basic_login: btoa(doc.username + ':' + doc.password),
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
}, },
update_password_list = []; update_password_list = [];
gadget.state.message.textContent = ""; gadget.state.message.textContent = "";
...@@ -298,6 +299,7 @@ ...@@ -298,6 +299,7 @@
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;
}); });
}); });
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>964.28658.19106.46779</string> </value> <value> <string>965.41362.25057.37034</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>1514476756.65</float> <float>1519166629.53</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -695,7 +695,7 @@ ...@@ -695,7 +695,7 @@
function syncOpmlStorage(context) { function syncOpmlStorage(context) {
return context._local_sub_storage.allDocs({ return context._local_sub_storage.allDocs({
query: '(portal_type:"opml") AND (active:true)', query: '(portal_type:"opml") AND (active:true) AND (url:"https://%")',
select_list: ["url", "basic_login"] select_list: ["url", "basic_login"]
}) })
.push(function (storage_result) { .push(function (storage_result) {
......
...@@ -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.7018.29631.50551</string> </value> <value> <string>965.40778.47295.35669</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>1514476144.01</float> <float>1519208313.2</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