Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amer
erp5
Commits
306e95c0
Commit
306e95c0
authored
Jun 01, 2018
by
Alain Takoudjou
Committed by
Alain Takoudjou
Oct 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_monitoring] load monitoring parameter from json serialized connection parameter
parent
bc7c68c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
28 deletions
+56
-28
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_erp5_page_ojsm_import_export_js.js
...web_page_module/gadget_erp5_page_ojsm_import_export_js.js
+51
-23
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_erp5_page_ojsm_import_export_js.xml
...eb_page_module/gadget_erp5_page_ojsm_import_export_js.xml
+2
-2
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_appcache.xml
...m/web_page_module/gadget_officejs_monitoring_appcache.xml
+3
-3
No files found.
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_erp5_page_ojsm_import_export_js.js
View file @
306e95c0
...
...
@@ -260,41 +260,69 @@
});
}
function
getParameterDictFromUrl
(
uri_param
)
{
if
(
uri_param
.
has
(
'
url
'
)
&&
uri_param
.
has
(
'
password
'
)
&&
uri_param
.
has
(
'
username
'
)
&&
uri_param
.
get
(
'
url
'
).
startsWith
(
'
http
'
))
{
return
{
opml_url
:
uri_param
.
get
(
'
url
'
),
username
:
uri_param
.
get
(
'
username
'
),
password
:
uri_param
.
get
(
'
password
'
)
};
}
}
function
getParameterFromconnectionDict
(
connection_dict
)
{
if
(
connection_dict
[
"
monitor-url
"
]
&&
connection_dict
[
"
monitor-url
"
].
startsWith
(
'
http
'
)
&&
connection_dict
[
"
monitor-user
"
]
&&
connection_dict
[
"
monitor-password
"
])
{
return
{
opml_url
:
connection_dict
[
"
monitor-url
"
],
username
:
connection_dict
[
"
monitor-user
"
],
password
:
connection_dict
[
"
monitor-password
"
]
};
}
}
function
readMonitoringParameter
(
parmeter_xml
)
{
var
parser
=
new
DOMParser
(),
xmlDoc
=
parser
.
parseFromString
(
parmeter_xml
,
"
text/xml
"
),
parameter
,
uri_param
,
json_parameter
,
parameter_dict
,
monitor_dict
=
{};
json_parameter
=
xmlDoc
.
getElementById
(
"
_
"
);
if
(
json_parameter
!==
undefined
&&
json_parameter
!==
null
)
{
parameter_dict
=
JSON
.
parse
(
json_parameter
.
textContent
);
if
(
parameter_dict
.
hasOwnProperty
(
"
monitor-setup-url
"
))
{
return
getParameterDictFromUrl
(
new
URLSearchParams
(
parameter_dict
[
"
monitor-setup-url
"
])
);
}
return
getParameterFromconnectionDict
(
parameter_dict
);
}
parameter
=
xmlDoc
.
getElementById
(
"
monitor-setup-url
"
);
if
(
parameter
!==
undefined
&&
parameter
!==
null
)
{
// monitor-setup-url exists
uri_param
=
new
URLSearchParams
(
parameter
.
textContent
);
if
(
uri_param
.
has
(
'
url
'
)
&&
uri_param
.
has
(
'
password
'
)
&&
uri_param
.
has
(
'
username
'
)
&&
uri_param
.
get
(
'
url
'
).
startsWith
(
'
http
'
))
{
return
{
opml_url
:
uri_param
.
get
(
'
url
'
),
username
:
uri_param
.
get
(
'
username
'
),
password
:
uri_param
.
get
(
'
password
'
)
};
return
getParameterDictFromUrl
(
uri_param
);
}
parameter
=
xmlDoc
.
getElementById
(
"
monitor-url
"
);
if
(
parameter
!==
undefined
&&
parameter
!==
null
)
{
monitor_dict
.
url
=
parameter
.
textContent
.
trim
();
parameter
=
xmlDoc
.
getElementById
(
"
monitor-user
"
);
if
(
parameter
===
undefined
&&
parameter
!==
null
)
{
return
;
}
}
else
{
parameter
=
xmlDoc
.
getElementById
(
"
monitor-url
"
);
if
(
parameter
!==
undefined
&&
parameter
!==
null
)
{
monitor_dict
.
url
=
parameter
.
textContent
.
trim
();
parameter
=
xmlDoc
.
getElementById
(
"
monitor-user
"
);
if
(
parameter
===
undefined
&&
parameter
!==
null
)
{
return
;
}
monitor_dict
.
username
=
parameter
.
textContent
.
trim
();
parameter
=
xmlDoc
.
getElementById
(
"
monitor-password
"
);
if
(
parameter
===
undefined
&&
parameter
!==
null
)
{
return
;
}
monitor_dict
.
password
=
parameter
.
textContent
.
trim
();
return
monitor_dict
;
monitor_dict
.
username
=
parameter
.
textContent
.
trim
();
parameter
=
xmlDoc
.
getElementById
(
"
monitor-password
"
);
if
(
parameter
===
undefined
&&
parameter
!==
null
)
{
return
;
}
monitor_dict
.
password
=
parameter
.
textContent
.
trim
();
return
monitor_dict
;
}
}
...
...
@@ -629,4 +657,4 @@
}
});
});
}(
window
,
rJS
,
RSVP
,
jsen
,
Handlebars
,
atob
,
btoa
,
DOMParser
,
URLSearchParams
));
}(
window
,
rJS
,
RSVP
,
jsen
,
Handlebars
,
atob
,
btoa
,
DOMParser
,
URLSearchParams
));
\ No newline at end of file
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_erp5_page_ojsm_import_export_js.xml
View file @
306e95c0
...
...
@@ -250,7 +250,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
5.42470.47064.30003
</string>
</value>
<value>
<string>
96
7.60726.55816.57890
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -268,7 +268,7 @@
</tuple>
<state>
<tuple>
<float>
15
19233144.55
</float>
<float>
15
27847350.32
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_monitoring/PathTemplateItem/web_page_module/gadget_officejs_monitoring_appcache.xml
View file @
306e95c0
...
...
@@ -108,7 +108,7 @@
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
CACHE MANIFEST\n
# generated on Fri, 2
1 Fev 2018 10:37:42
+0000\n
# generated on Fri, 2
0 May 2018 17:47:45
+0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
...
...
@@ -387,7 +387,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
5.42293.15886.4599
4
</string>
</value>
<value>
<string>
96
6.64659.26947.4500
4
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -405,7 +405,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
15
19222522.75
</float>
<float>
15
27847381.11
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment