Commit fa0c0c85 authored by Alain Takoudjou's avatar Alain Takoudjou

[erp5_web_monitoring] do not sync opml from stopped hosting subscription

parent ee6bc18d
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
} }
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")',
select_list: ['title', 'default_predecessor_uid', 'uid'], select_list: ['title', 'default_predecessor_uid', 'uid', 'slap_state'],
limit: [0, limit], limit: [0, limit],
sort_on: [ sort_on: [
["creation_date", "descending"] ["creation_date", "descending"]
...@@ -307,15 +307,19 @@ ...@@ -307,15 +307,19 @@
var i, var i,
uid_search_list = []; uid_search_list = [];
for (i = 0; i < result.data.total_rows; i += 1) { for (i = 0; i < result.data.total_rows; i += 1) {
if (result.data.rows[i].value.slap_state !== "destroy_requested") {
hosting_subscription_list.push({ hosting_subscription_list.push({
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 ===
"start_requested") ? true : false
}); });
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) {
uid_dict[result.data.rows[i].value.default_predecessor_uid] = i; uid_dict[result.data.rows[i].value.default_predecessor_uid] = i;
} }
} }
}
return gadget.state.erp5_gadget.allDocs({ return gadget.state.erp5_gadget.allDocs({
query: '(portal_type:"Software Instance") AND ' + query: '(portal_type:"Software Instance") AND ' +
'(predecessor_related_uid:("' + uid_search_list.join('","') + '"))', '(predecessor_related_uid:("' + uid_search_list.join('","') + '"))',
...@@ -344,7 +348,7 @@ ...@@ -344,7 +348,7 @@
password: tmp_parameter.password, password: tmp_parameter.password,
basic_login: btoa(tmp_parameter.username + ':' + basic_login: btoa(tmp_parameter.username + ':' +
tmp_parameter.password), tmp_parameter.password),
active: true active: hosting_subscription_list[uid_dict[tmp_uid]].active
}); });
} }
} }
......
...@@ -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.37770.32649.6058</string> </value> <value> <string>964.27271.46031.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>1511174176.26</float> <float>1514389684.37</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