Commit 34b3d5db authored by Roque's avatar Roque

erp5_web_monitoring: cleanup monitoring jio

parent e3243bdf
...@@ -70,11 +70,9 @@ ...@@ -70,11 +70,9 @@
return appcache_storage.repair(current_version); return appcache_storage.repair(current_version);
}) })
.push(function () { .push(function () {
console.log("appcache repaired.");
return jio_storage.repair(); return jio_storage.repair();
}) })
.push(function () { .push(function () {
console.log("jio repaired.");
return gadget.setSetting("migration_version", current_version); return gadget.setSetting("migration_version", current_version);
}); });
}) })
...@@ -83,10 +81,8 @@ ...@@ -83,10 +81,8 @@
var gadget = this; var gadget = this;
if (options !== undefined) { if (options !== undefined) {
gadget.props.jio_storage = jIO.createJIO(options); gadget.props.jio_storage = jIO.createJIO(options);
console.log("jio options created!");
} else { } else {
gadget.props.jio_storage = jIO.createJIO(monitoring_jio); gadget.props.jio_storage = jIO.createJIO(monitoring_jio);
console.log("monitoring_jio created!");
} }
}) })
...@@ -101,11 +97,7 @@ ...@@ -101,11 +97,7 @@
migration_version = result_list[1]; migration_version = result_list[1];
current_version = window.location.href.replace(window.location.hash, ""); current_version = window.location.href.replace(window.location.hash, "");
index = current_version.indexOf(window.location.host) + window.location.host.length; index = current_version.indexOf(window.location.host) + window.location.host.length;
current_version = current_version.substr(index);/* current_version = current_version.substr(index);
return;
})
.push(function () {
*/
manifest = "gadget_officejs_monitoring.configuration"; manifest = "gadget_officejs_monitoring.configuration";
monitoring_jio = { monitoring_jio = {
type: "replicatedopml", type: "replicatedopml",
...@@ -163,18 +155,14 @@ ...@@ -163,18 +155,14 @@
}) })
.push(function () { .push(function () {
if (migration_version !== current_version) { if (migration_version !== current_version) {
console.log("NEW APP VERSION! gadget.props.jio_storage:", gadget.props.jio_storage);
if (gadget.props.jio_storage) { if (gadget.props.jio_storage) {
console.log("call jio_allDocs!");
return gadget.props.jio_storage.allDocs(); return gadget.props.jio_storage.allDocs();
} }
} }
}) })
.push(function (all_docs) { .push(function (all_docs) {
console.log("all_docs:", all_docs);
if (all_docs && all_docs.data.total_rows) { if (all_docs && all_docs.data.total_rows) {
//iterate all docs, jio_remove, and recreate //iterate all docs, jio_remove, and recreate
//for gadget.jio_remove(options.jio_key);
var remove_queue = new RSVP.Queue(), i; var remove_queue = new RSVP.Queue(), i;
function remove_doc(id) { function remove_doc(id) {
remove_queue remove_queue
...@@ -190,16 +178,11 @@ ...@@ -190,16 +178,11 @@
gadget.createStorage(options, monitoring_jio), gadget.createStorage(options, monitoring_jio),
gadget.setSetting("latest_import_date", undefined) gadget.setSetting("latest_import_date", undefined)
]); ]);
} else {
console.log("no new version, no delete");
} }
}) })
.push(function () { .push(function () {
console.log("remove part done");
if (migration_version !== current_version) { if (migration_version !== current_version) {
console.log("new app version! recreate appcache and force repair");
appcache_storage = jIO.createJIO(appcache_jio); appcache_storage = jIO.createJIO(appcache_jio);
console.log("appcache_jio created");
return gadget.updateConfiguration(appcache_storage, migration_version, current_version, gadget.props.jio_storage); return gadget.updateConfiguration(appcache_storage, migration_version, current_version, gadget.props.jio_storage);
} }
}) })
......
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1015.31834.14596.52957</string> </value> <value> <string>1015.32779.62576.10939</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1711494540.44</float> <float>1711544405.46</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