Commit b8dc37b5 authored by Alain Takoudjou's avatar Alain Takoudjou

[erp5_web_monitoring] option to add OPML, immediately synchronize then go to status list

When adding opml from SlapOS interface, sync then show promise status.
parent 91122e12
......@@ -13,6 +13,7 @@
</head>
<body>
<div data-gadget-url="gadget_officejs_monitoring_sync.html" data-gadget-scope="sync_gadget" data-gadget-sandbox="public"></div>
<form class="save_form ui-body-c" novalidate>
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"></button>
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.27666.8050.30907</string> </value>
<value> <string>963.29479.31715.56712</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1510675648.98</float>
<float>1542210800.49</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -5,6 +5,7 @@
rJS(window)
.setState({auto_sync: false})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
......@@ -56,6 +57,19 @@
})
.push(function (result_list) {
if (result_list[1]) {
if (gadget.state.auto_sync) {
return gadget.getDeclaredGadget('sync_gadget')
.push(function (sync_gadget) {
// start synchronization now
return sync_gadget.register({now: true});
})
.push(function () {
return gadget.redirect({
"command": "display",
"options": {"page": "ojsm_status_list"}
});
});
}
return gadget.redirect({
"command": "display",
"options": {"page": "settings_configurator"}
......@@ -178,6 +192,9 @@
}
});
})
.push(function () {
return gadget.changeState({auto_sync: options.sync === "yes"});
})
.push(function () {
var new_options;
......@@ -194,6 +211,14 @@
save_action: true,
change_password: chg_pwd_url
});
})
.push(function () {
return gadget.checkSynchronize();
});
})
.declareJob("checkSynchronize", function () {
if (this.state.auto_sync) {
return this.element.querySelector('button[type="submit"]').click();
}
});
}(window, rJS, RSVP));
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.29486.6222.37785</string> </value>
<value> <string>963.29492.59843.64085</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1510676454.74</float>
<float>1542210884.62</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -225,9 +225,7 @@
.push(function (status_history) {
var i,
len,
start,
//lines,
message;
start;
if (status_history && status_history.hasOwnProperty('data')) {
// the status history list is reversed ([old, ...., newest])
......@@ -241,10 +239,6 @@
// lines = len - start;
//}
for (i = start; i >= 0; i -= 1) {
message = status_history.data[i].message.slice(0, 80);
if (message.length >= 80) {
message += "...";
}
result.data.total_rows += 1;
result.data.rows.push({
value: {
......@@ -302,7 +296,7 @@
type: "DateTimeField"
}
},
message: message,
message: status_history.data[i].message,
"listbox_uid:list": {
key: "listbox_uid:list",
value: 2713
......@@ -524,7 +518,7 @@
"sort": [],
"hide_sort": true,
"command": "reload",
"title": "Promise Status History",
"title": "Promise Status list (On live)",
"type": "ListBox"
}
}},
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>971.37851.10663.58692</string> </value>
<value> <string>971.40824.2567.53640</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1542030756.81</float>
<float>1542294280.54</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -177,10 +177,12 @@
})
.push(undefined, function (error) {
var message_text,
code;
code = 0;
if (error instanceof jIO.util.jIOError) {
message_text = error.message;
code = error.status_code;
} else if (error instanceof TypeError || error.message) {
message_text = error.message;
} else {
code = error.target.status;
message_text = error.target.responseType === "text" ?
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>965.42333.60944.62105</string> </value>
<value> <string>971.37897.12342.12851</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1542033191.29</float>
<float>1542281232.26</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