Commit f1a5c5e1 authored by Roque's avatar Roque

erp5_web_monitoring: refactoring

- landing page
- dispatch uses opml-sync parameters
- keeps backward compatibility
parent bab42871
...@@ -31,7 +31,15 @@ ...@@ -31,7 +31,15 @@
}) })
.push(function (result) { .push(function (result) {
if (result === undefined || result.data.total_rows === 0) { if (result === undefined || result.data.total_rows === 0) {
// no result from the query if (gadget.state.url && gadget.state.username && gadget.state.password) {
return gadget.redirect({"command": "display",
"options": {"page": "ojsm_opml_add",
"url": gadget.state.url,
"username": gadget.state.username,
"password": gadget.state.password,
"query": gadget.state.original_query}
});
}
return; return;
} }
if (result.data.total_rows === 1) { if (result.data.total_rows === 1) {
...@@ -123,6 +131,9 @@ ...@@ -123,6 +131,9 @@
return gadget.changeState({ return gadget.changeState({
original_query: original_query, original_query: original_query,
query: options.query, query: options.query,
url: options.url,
username: options.username,
password: options.password,
portal_type: portal_type || "promise", portal_type: portal_type || "promise",
import_opml: portal_type === undefined ? false : options.import_opml || true import_opml: portal_type === undefined ? false : options.import_opml || true
}); });
......
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>963.38066.29413.61576</string> </value> <value> <string>1012.62724.50149.41113</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1540892674.51</float> <float>1701717676.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>ERP5 Page Monitoring Landing</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="gadget_erp5_page_ojsm_landing.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("redirect", "redirect")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
redirect_options = {
"page": "ojsm_dispatch",
"url": options.url,
"username": options.username,
"password": options.password,
"query": options.query
};
if (options.query) {
return gadget.redirect({"command": "display",
"options": redirect_options
});
}
if (options.url && options.username && options.password) {
redirect_options.page = "ojsm_opml_add";
return gadget.redirect({"command": "display",
"options": redirect_options
});
}
return gadget.redirect({"command": "display",
"options": {"page": "ojsm_status_list"}
});
});
}(window, rJS));
\ No newline at end of file
...@@ -654,7 +654,7 @@ ...@@ -654,7 +654,7 @@
portal_type: element.portal_type || element.type || portal_type: element.portal_type || element.type ||
item_result.type, item_result.type,
status: status, status: status,
reference: id_hash, reference: element.reference || id_hash,
active: true active: true
}); });
opml_document_list.push({ opml_document_list.push({
......
...@@ -76,7 +76,9 @@ ...@@ -76,7 +76,9 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
...@@ -233,7 +235,7 @@ ...@@ -233,7 +235,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <unicode>zope</unicode> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -247,7 +249,7 @@ ...@@ -247,7 +249,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>972.3978.30023.34679</string> </value> <value> <string>1012.51177.40041.21742</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -267,7 +269,7 @@ ...@@ -267,7 +269,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1543851108.12</float> <float>1701111013.97</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