Commit 38e56924 authored by Alain Takoudjou's avatar Alain Takoudjou

[erp5_web_monitoring] replace jquery notify plugin with erp5_notify gadget

parent 2932fbc3
......@@ -148,11 +148,14 @@
}
if (msg_list.length > 0) {
return RSVP.all([
gadget.notifySubmitted('Error while ' + msg_list.join('; '))
gadget.notifySubmitted({
message: 'Error while ' + msg_list.join('; '),
status: 'error'
})
]);
}
return RSVP.all([
gadget.notifySubmitted('Parameters Updated')
gadget.notifySubmitted({message: 'Parameters Updated', status: 'success'})
]);
});
})
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.1690.33865.32955</string> </value>
<value> <string>963.20929.61143.52155</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1509095405.67</float>
<float>1510216762.18</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -548,7 +548,8 @@
.push(function (select_limit) {
return getInstanceOPMLListFromMaster(gadget, select_limit);
})
.push(undefined, function () {
.push(undefined, function (error) {
console.log(error);
gadget.state.message
.innerHTML = notify_msg_template({
status: 'error',
......@@ -587,10 +588,16 @@
has_failed = true;
})
.push(function () {
if (!has_failed) {
return gadget.notifySubmitted("Failed to import Configurations");
if (has_failed) {
return gadget.notifySubmitted({
message: "Failed to import Configurations",
status: "error"
});
} else {
return gadget.notifySubmitted("Configuration Saved!");
return gadget.notifySubmitted({
message: "Configuration Saved!",
status: "success"
});
}
})
.push(function () {
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.17936.4203.52804</string> </value>
<value> <string>963.21850.42337.9796</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1509983206.06</float>
<float>1510219191.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -85,9 +85,9 @@
return opml_global.saveOPML(doc, true);
})
.push(function (status) {
var msg = 'Document Updated';
var msg = {message: 'OPML document added', status: 'success'};
if (!status) {
msg = 'Document update failed';
msg = {message: 'Failed to add OPML document', status: "error"};
}
return RSVP.all([
gadget.notifySubmitted(msg),
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.1933.16122.39953</string> </value>
<value> <string>963.21318.32760.12475</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1509023050.17</float>
<float>1510217057.28</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -21,7 +21,7 @@
return gadget.jio_remove(options.jio_key);
})
.push(function () {
return gadget.notifySubmitted("Document Deleted");
return gadget.notifySubmitted({message: "Document Deleted", status: "success"});
})
.push(function () {
return gadget.redirect({command: 'change', options: {
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.642.61316.20292</string> </value>
<value> <string>963.20929.61143.52155</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1508945461.31</float>
<float>1510231849.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -8,7 +8,6 @@
<link href="gadget_officejs_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="notify.min.js"></script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
......
......@@ -243,7 +243,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.46066.30387.47069</string> </value>
<value> <string>963.22427.36654.49664</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>1507902085.76</float>
<float>1510327379.3</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, URI, location, $,
loopEventListener, btoa */
/*global window, rJS, RSVP, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, $, RSVP) {
(function (window, rJS, RSVP, Handlebars) {
"use strict";
var gadget_klass = rJS(window),
......@@ -71,16 +70,13 @@
.get(gadget.property_dict.monitor_process_state);
})
.push(undefined, function (error) {
console.error(error);
$.notify(
"Error: Failed to download data files!",
{
position: "top right",
autoHideDelay: 7000,
className: "error"
}
);
return undefined;
return gadget.notifySubmitted({
message: "Error: Failed to download data files!",
status: "error"
})
.push(function () {
return undefined;
});
})
.push(function (average_result) {
if (average_result !== undefined) {
......@@ -93,6 +89,7 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.allowPublicAcquisition("jio_allDocs", function (param_list) {
var gadget = this,
......@@ -225,8 +222,7 @@
return gadget.property_dict.jio_gadget
.get(gadget.property_dict.monitor_process_state)
.push(undefined, function (error) {
console.error(error);
.push(undefined, function () {
return undefined;
})
.push(function (average_result) {
......@@ -238,4 +234,4 @@
});
}, 65000);
}(window, rJS, $, RSVP));
\ No newline at end of file
}(window, rJS, RSVP, Handlebars));
\ No newline at end of file
......@@ -239,7 +239,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.16563.15280.46899</string> </value>
<value> <string>963.22187.48632.58282</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>1510052139.85</float>
<float>1510239168.21</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -8,7 +8,6 @@
<link href="gadget_officejs_monitoring_custom.css" rel="stylesheet" type="text/css"/>
<script src="notify.min.js"></script>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<!--<script src="handlebars.js"></script>-->
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.36002.50044.8055</string> </value>
<value> <string>963.22427.36654.49664</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1507902037.02</float>
<float>1510327355.11</float>
<string>UTC</string>
</tuple>
</state>
......
/*global window, rJS, RSVP, Handlebars, $, console */
/*global window, rJS, RSVP, console */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS, RSVP, $, console) {
(function (window, rJS, RSVP, console) {
"use strict";
var gadget_klass = rJS(window);
......@@ -9,20 +9,15 @@
function loadGraphData(gadget, key) {
var resource_key = gadget.property_dict.ressource_dict[key];
return gadget.property_dict.jio_gadget.get(resource_key)
.push(undefined, function (error) {
console.log(error);
$.notify(
"Error: Failed to download resource file '" + resource_key +
"' from URL: " + gadget.state.opml_outline.url,
{
position: "top right",
autoHideDelay: 7000,
className: "error"
}
);
return {
data: []
};
.push(undefined, function () {
return gadget.notifySubmitted({
message: "Error: Failed to download resource file '" + resource_key +
"' from URL: " + gadget.state.opml_outline.url,
status: "error"
})
.push(function () {
return {data: []};
});
})
.push(function (jio_element) {
gadget.property_dict.date_window = getDateWindow(gadget.property_dict.mem_data.data);
......@@ -98,7 +93,7 @@
}
}
return {
value:{
value: {
data: data_list,
layout: {
axis_dict : axis_dict,
......@@ -117,13 +112,13 @@
max_date = data[data.length - 1].split(',')[0];
begin_date = new Date(max_date);
end_date = new Date(max_date);
begin_date.setHours(begin_date.getHours() -2);
begin_date.setHours(begin_date.getHours() - 2);
date_window = [Date.parse(begin_date), Date.parse(end_date)];
}
return date_window;
}
function updateGraph (gadget) {
function updateGraph(gadget) {
return new RSVP.Queue()
.push(function () {
var key,
......@@ -178,7 +173,7 @@
data_list[0].value_dict["1"].push(line_list[2]);
}
return gadget.property_dict.graph_mem_used.render({
value:{
value: {
data: data_list,
layout: {
axis_dict : axis_dict,
......@@ -246,7 +241,7 @@
}
}
return gadget.property_dict.graph_cpu.render({
value:{
value: {
data: data_list,
layout: {
axis_dict : axis_dict,
......@@ -345,6 +340,7 @@
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod('jio_get', 'jio_get')
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("notifySubmitted", 'notifySubmitted')
.onLoop(function () {
return updateGraph(this);
......@@ -443,4 +439,4 @@
});
});
}(window, rJS, RSVP, $, console));
\ No newline at end of file
}(window, rJS, RSVP, console));
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.64762.24229.58760</string> </value>
<value> <string>963.22199.29933.17390</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1508860480.94</float>
<float>1510239154.52</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -107,7 +107,7 @@
})
.push(function () {
return RSVP.all([
gadget.notifySubmitted('All OPML removed')
gadget.notifySubmitted({message: 'All OPML removed', status: 'success'})
]);
})
.push(function () {
......@@ -115,8 +115,7 @@
return gadget.redirect({"command": "reload"});
});
}
event.returnValue = true;
})
}, false, false)
.onEvent('submit', function () {
var gadget = this,
doc;
......@@ -146,7 +145,7 @@
})
.push(function () {
return RSVP.all([
gadget.notifySubmitted('Parameters Updated')
gadget.notifySubmitted({message: 'Parameters Updated', status: 'success'})
]);
});
})
......
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.17877.3072.30788</string> </value>
<value> <string>963.21245.1149.59784</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1509981253.88</float>
<float>1510216637.34</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -83,9 +83,9 @@
doc.title === "" || doc.title === undefined || doc.verify_password === 1);
})
.push(function (status) {
var msg = 'Document Updated';
var msg = {message: 'Document Updated', status: 'success'};
if (!status) {
msg = 'Document update failed';
msg = {message: 'Document update failed', status: "error"};
}
return RSVP.all([
gadget.notifySubmitted(msg),
......@@ -117,7 +117,7 @@
"opml_title": doc.title || "",
"opml_key": options.jio_key,
"password": doc.password
});
});
})
.push(function () {
return RSVP.all([
......
......@@ -250,7 +250,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.1932.7812.44987</string> </value>
<value> <string>963.21293.17700.853</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>1509022866.95</float>
<float>1510185606.72</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -137,11 +137,9 @@ monitoring_jio_http_storage.js\n
monitoring_jio_parser_storage.js\n
monitoring_jio_storage.js\n
monitoring_jio_web_storage.js\n
jquery.js\n
jsen.min.js\n
renderjs.js\n
rsvp.js\n
notify.min.js\n
\n
# shared\n
gadget_erp5_notification.html\n
......@@ -197,6 +195,8 @@ gadget_erp5_field_integer.html\n
gadget_erp5_field_integer.js\n
gadget_erp5_jio.html\n
gadget_erp5_jio.js\n
gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n
\n
# monitoring\n
gadget_officejs_monitoring.appcache\n
......@@ -383,7 +383,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.17891.16389.10547</string> </value>
<value> <string>963.22437.57747.1757</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -401,7 +401,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1509980460.49</float>
<float>1510327329.0</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -8,8 +8,6 @@
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="jquery.js" type="text/javascript"></script>
<script src="notify.min.js"></script>
<script src="gadget_officejs_monitoring_sync.js"></script>
......
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.48761.27674.29661</string> </value>
<value> <string>963.20929.61143.52155</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -264,7 +264,7 @@
</tuple>
<state>
<tuple>
<float>1507900413.18</float>
<float>1510233336.64</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -14,6 +14,8 @@
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("jio_repair", "jio_repair")
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareMethod("registerSync", function (options) {
var gadget = this;
......@@ -74,15 +76,6 @@
return syncAllStorage();
}
gadget.props.offline = true;
return $.notify(
"Sync aborted, no internet access...",
{
position: "bottom right",
autoHide: true,
className: "error",
autoHideDelay: 10000
}
);
});
}
return syncAllStorage();
......@@ -98,15 +91,13 @@
return gadget.setSetting('sync_start_time', new Date().getTime());
})
.push(function () {
$(".notifyjs-wrapper").remove();
return $.notify(
"Synchronizing Data...",
{
position: "bottom right",
autoHide: false,
className: "info"
}
);
return gadget.notifySubmitting();
})
.push(function () {
return gadget.notifySubmitted({
message: "Synchronizing Data...",
status: "success"
});
})
.push(function () {
// call repair on storage
......@@ -119,36 +110,33 @@
})
.push(function () {
last_sync_time = new Date().getTime();
return gadget.setSetting('latest_sync_time', last_sync_time);
return RSVP.all([
gadget.setSetting('latest_sync_time', last_sync_time),
gadget.notifySubmitting()
]);
})
.push(function () {
var time = 3000,
classname = "info",
classname = "success",
message = "Synchronisation finished.",
//log_message = '',
log_title = "OK: " + message;
if (has_error) {
classname = "warning";
classname = "error";
time = 5000;
//log_message = getErrorLog(gadget.props.error_list);
log_title = "Synchronisation finished with error(s).";
message = log_title + "\nYou can retry with manual sync.";
}
$(".notifyjs-wrapper").remove();
return RSVP.all([$.notify(
message,
{
position: "bottom right",
autoHide: true,
className: classname,
autoHideDelay: time
}
)]);
return gadget.notifySubmitted({
message: message,
status: classname
});
})
.push(function () {
gadget.props.started = false;
return $.notify(
/*return $.notify(
"Last Sync: " + formatDate(new Date(last_sync_time)),
{
position: "bottom right",
......@@ -156,7 +144,7 @@
className: "success",
autoHideDelay: 30000
}
);
);*/
});
}
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>962.53134.26022.64665</string> </value>
<value> <string>963.21916.52285.31846</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1508860939.04</float>
<float>1510233154.98</float>
<string>UTC</string>
</tuple>
</state>
......
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/ojsm_gadget_erp5_statusfield_*
web_page_module/Notify_min_js
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/gadget_officejs_jio_global_view_html
web_page_module/gadget_officejs_jio_global_view_js
web_page_module/gadget_officejs_jio_opml_view_html
......@@ -15,6 +13,6 @@ web_page_module/monitoring_jio_http_storage_js
web_page_module/monitoring_jio_parser_storage_js
web_page_module/monitoring_jio_storage_js
web_page_module/monitoring_jio_web_storage_js
web_page_module/rjs_jquery_js
web_page_module/ojsm_gadget_erp5_statusfield_*
web_site_module/officejs_monitoring
web_site_module/officejs_monitoring/**
\ No newline at end of file
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/ojsm_gadget_erp5_statusfield_*
web_page_module/Notify_min_js
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
web_page_module/gadget_officejs_jio_global_view_html
web_page_module/gadget_officejs_jio_global_view_js
web_page_module/gadget_officejs_jio_opml_view_html
......@@ -15,6 +13,6 @@ web_page_module/monitoring_jio_http_storage_js
web_page_module/monitoring_jio_parser_storage_js
web_page_module/monitoring_jio_storage_js
web_page_module/monitoring_jio_web_storage_js
web_page_module/rjs_jquery_js
web_page_module/ojsm_gadget_erp5_statusfield_*
web_site_module/officejs_monitoring
web_site_module/officejs_monitoring/**
\ No newline at end of file
web_page_module/Notify_min_js
web_page_module/gadget_erp5_field_status_*
web_page_module/gadget_erp5_page_ojsm_*
web_page_module/gadget_erp5_page_settings_configurator_*
......@@ -15,6 +14,5 @@ web_page_module/monitoring_jio_parser_storage_js
web_page_module/monitoring_jio_storage_js
web_page_module/monitoring_jio_web_storage_js
web_page_module/ojsm_gadget_erp5_statusfield_*
web_page_module/rjs_jquery_js
web_site_module/officejs_monitoring
web_site_module/officejs_monitoring/**
\ No newline at end of file
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