Commit 0835e6d7 authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Alain Takoudjou

[erp5_web_monitoring] when needed import opml configuration before run dispatch

parent 726595d1
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
.declareAcquiredMethod("jio_allDocs", "jio_allDocs") .declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting") .declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// declared methods // declared methods
...@@ -118,29 +119,50 @@ ...@@ -118,29 +119,50 @@
} else { } else {
portal_type = pt_result[1]; portal_type = pt_result[1];
} }
} else {
portal_type = "promise";
} }
return gadget.changeState({ return gadget.getUrlFor({command: 'display', options: {page: 'ojsm_status_list'}})
original_query: original_query, .push(function (back_url) {
query: options.query, return gadget.updateHeader({
page_title: page_title, page_title: page_title,
portal_type: portal_type back_url: back_url
}); });
})
.push(function () {
return gadget.changeState({
original_query: original_query,
query: options.query,
portal_type: portal_type || "promise",
import_opml: portal_type === undefined ? false : options.import_opml || true
});
});
}) })
.onStateChange(function () { .onStateChange(function () {
var gadget = this; var gadget = this;
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return gadget.getUrlFor({command: 'display', options: {page: 'ojsm_status_list'}}); if (gadget.state.import_opml) {
}) return gadget.getSetting('latest_import_date')
.push(function (back_url) { .push(function (import_date) {
return gadget.updateHeader({ // If import was never done, or was done more than 2 weeks ago
page_title: gadget.state.page_title, // 1209600000 = 1000*60*60*24*14
back_url: back_url var current_date = new Date().getTime();
}); if (import_date === undefined ||
(import_date + 1209600000) < current_date) {
return gadget.setSetting('sync_redirect_options', {
query: gadget.state.original_query,
page: 'ojsm_dispatch'
})
.push(function () {
return gadget.redirect({command: 'change', options: {
page: "ojsm_erp5_configurator",
type: "erp5"
}});
});
}
});
}
}) })
.push(function () { .push(function () {
return gadget.getDeclaredGadget('erp5_searchfield'); return gadget.getDeclaredGadget('erp5_searchfield');
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.33811.1739.59187</string> </value> <value> <string>963.38063.22401.1996</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>1510935658.24</float> <float>1511190866.88</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
Your ERP5 Connection parameters Your ERP5 Connection parameters
</h3> </h3>
</section> </section>
<p>You have to be logged in this ERP5 prior to synchronising</p> <p>You have to be logged in this ERP5 prior to import OPML</p>
</article> </article>
<br> <br>
<form class="save_form ui-body-c" novalidate> <form class="save_form ui-body-c" novalidate>
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.54628.50882.58453</string> </value> <value> <string>963.27666.8050.30907</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>1508258766.54</float> <float>1511257051.71</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -590,10 +590,13 @@ ...@@ -590,10 +590,13 @@
status: "error" status: "error"
}); });
} }
return gadget.notifySubmitted({ return RSVP.all([
message: "Configuration Saved!", gadget.setSetting("latest_import_date", new Date().getTime()),
status: "success" gadget.notifySubmitted({
}); message: "Configuration Saved!",
status: "success"
})
]);
}) })
.push(function () { .push(function () {
if (!has_failed) { if (!has_failed) {
......
...@@ -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.27984.14453.52343</string> </value> <value> <string>963.37770.32649.6058</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>1510833881.21</float> <float>1511174176.26</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
"lines": lines_limit, "lines": lines_limit,
"list_method": "portal_catalog", "list_method": "portal_catalog",
"query": "urn:jio:allDocs?query=portal_type%3A%22" + "query": "urn:jio:allDocs?query=portal_type%3A%22" +
"Software Instance" + "%22", "Software%20Instance" + "%22",
"portal_type": [], "portal_type": [],
"search_column_list": column_list, "search_column_list": column_list,
"sort_column_list": column_list, "sort_column_list": column_list,
......
...@@ -242,7 +242,7 @@ ...@@ -242,7 +242,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.32354.21099.3054</string> </value> <value> <string>963.33701.38666.63044</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>1510928975.35</float> <float>1511187464.03</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("render", function () { .declareMethod("render", function () {
var gadget = this; var gadget = this;
...@@ -23,10 +25,20 @@ ...@@ -23,10 +25,20 @@
}); });
}) })
.push(function () { .push(function () {
return gadget.redirect({ var redirect_options = {"page": "ojsm_status_list"};
command: "change", return gadget.getSetting('sync_redirect_options')
options: {page: "ojsm_status_list"} .push(function (redirect_dict) {
}); if (redirect_options) {
redirect_options = redirect_dict;
return gadget.setSetting("sync_redirect_options", undefined);
}
})
.push(function () {
return gadget.redirect({
"command": "display",
"options": redirect_options
});
});
}); });
}); });
}(window, rJS)); }(window, rJS));
...@@ -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.29336.22296.43468</string> </value> <value> <string>963.37808.2626.47837</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>1510668189.54</float> <float>1511175451.34</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