Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
19
Merge Requests
19
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
5bd4fe83
Commit
5bd4fe83
authored
May 20, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_monitoring: allow to sync data in local indexdb, add offline mode support
parent
a6119296
Changes
44
Show whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1396 additions
and
210 deletions
+1396
-210
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_appcache.xml
...mplateItem/web_page_module/gadget_monitoring_appcache.xml
+5
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_document_edit_js.html
...m/web_page_module/gadget_monitoring_document_edit_js.html
+1
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_document_edit_js.xml
...em/web_page_module/gadget_monitoring_document_edit_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_html.html
...teItem/web_page_module/gadget_monitoring_header_html.html
+1
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_html.xml
...ateItem/web_page_module/gadget_monitoring_header_html.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_js.js
...mplateItem/web_page_module/gadget_monitoring_header_js.js
+11
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_js.xml
...plateItem/web_page_module/gadget_monitoring_header_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_html.html
..._page_module/gadget_monitoring_hosting_overview_html.html
+1
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_html.xml
...b_page_module/gadget_monitoring_hosting_overview_html.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_js.html
...eb_page_module/gadget_monitoring_hosting_overview_js.html
+16
-13
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_js.xml
...web_page_module/gadget_monitoring_hosting_overview_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_html.html
...web_page_module/gadget_monitoring_import_export_html.html
+4
-4
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_html.xml
.../web_page_module/gadget_monitoring_import_export_html.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_js.html
...m/web_page_module/gadget_monitoring_import_export_js.html
+60
-13
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_js.xml
...em/web_page_module/gadget_monitoring_import_export_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_jio_js.js
...hTemplateItem/web_page_module/gadget_monitoring_jio_js.js
+189
-108
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_jio_js.xml
...TemplateItem/web_page_module/gadget_monitoring_jio_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.html
...em/web_page_module/gadget_monitoring_login_widget_js.html
+22
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.xml
...tem/web_page_module/gadget_monitoring_login_widget_js.xml
+3
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_html.xml
...plateItem/web_page_module/gadget_monitoring_main_html.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_js.html
...mplateItem/web_page_module/gadget_monitoring_main_js.html
+7
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_js.xml
...emplateItem/web_page_module/gadget_monitoring_main_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_overview_js.html
...teItem/web_page_module/gadget_monitoring_overview_js.html
+1
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_overview_js.xml
...ateItem/web_page_module/gadget_monitoring_overview_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_process_view_js.html
...em/web_page_module/gadget_monitoring_process_view_js.html
+1
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_process_view_js.xml
...tem/web_page_module/gadget_monitoring_process_view_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_promise_interface_js.js
...web_page_module/gadget_monitoring_promise_interface_js.js
+8
-7
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_promise_interface_js.xml
...eb_page_module/gadget_monitoring_promise_interface_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_resource_view_js.html
...m/web_page_module/gadget_monitoring_resource_view_js.html
+1
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_resource_view_js.xml
...em/web_page_module/gadget_monitoring_resource_view_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
..._module/gadget_monitoring_settings_configurator_html.html
+19
-1
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.xml
...e_module/gadget_monitoring_settings_configurator_html.xml
+3
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
...lateItem/web_page_module/gadget_monitoring_static_js.html
+87
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.xml
...plateItem/web_page_module/gadget_monitoring_static_js.xml
+3
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_status_list_js.html
...tem/web_page_module/gadget_monitoring_status_list_js.html
+7
-4
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_status_list_js.xml
...Item/web_page_module/gadget_monitoring_status_list_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_html.html
...lateItem/web_page_module/gadget_monitoring_sync_html.html
+22
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_html.xml
...plateItem/web_page_module/gadget_monitoring_sync_html.xml
+336
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.html
...mplateItem/web_page_module/gadget_monitoring_sync_js.html
+203
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.xml
...emplateItem/web_page_module/gadget_monitoring_sync_js.xml
+332
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_listbox_js.js
...em/web_page_module/gadget_monitoring_widget_listbox_js.js
+9
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_listbox_js.xml
...m/web_page_module/gadget_monitoring_widget_listbox_js.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_overview_js.js
...m/web_page_module/gadget_monitoring_widget_overview_js.js
+10
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_overview_js.xml
.../web_page_module/gadget_monitoring_widget_overview_js.xml
+2
-2
No files found.
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_appcache.xml
View file @
5bd4fe83
...
...
@@ -107,7 +107,7 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
CACHE MANIFEST\n
# generated on Fri,
11
Mai 2016 15:47:33 +0000\n
# generated on Fri,
20
Mai 2016 15:47:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
...
...
@@ -158,6 +158,7 @@ gadget_monitoring_router.html\n
gadget_monitoring_settings_configurator.html\n
gadget_monitoring_status_grid.html\n
gadget_monitoring_status_list.html\n
gadget_monitoring_sync.html\n
gadget_monitoring_widget_listbox.html\n
gadget_monitoring_widget_listview.html\n
gadget_monitoring_widget_overview.html\n
...
...
@@ -181,6 +182,7 @@ gadget_monitoring_router.js\n
gadget_monitoring_static.js\n
gadget_monitoring_status_grid.js\n
gadget_monitoring_status_list.js\n
gadget_monitoring_sync.js\n
gadget_monitoring_tooltipster.min.js\n
gadget_monitoring_widget_listbox.js\n
gadget_monitoring_widget_listview.js\n
...
...
@@ -327,7 +329,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
6586.44195.10240
</string>
</value>
<value>
<string>
951.
21023.1861.15223
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -345,7 +347,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
146
2958448.28
</float>
<float>
146
3759960.49
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_document_edit_js.html
View file @
5bd4fe83
...
...
@@ -64,7 +64,7 @@
basic_login:
cred
.
hash
}
}
});
}
,
false
);
return
gadget
.
props
.
jio_gadget
.
put
(
gadget
.
props
.
options
.
key
,
jio_document
);
})
.
push
(
function
(
result
)
{
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_document_edit_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.49438.50290.39714
</string>
</value>
<value>
<string>
9
50.63263.62080.55091
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
58061223.97
</float>
<float>
14
63069373.0
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_html.html
View file @
5bd4fe83
...
...
@@ -31,6 +31,7 @@
<!--div data-role="header" data-theme="a" class="ui-header ui-bar-a" data-position="fixed" data-tap-toggle="false"-->
<div
data-role=
"header"
data-position=
"fixed"
data-theme=
"a"
class=
"ui-header ui-bar-a"
data-tap-toggle=
"false"
>
<div
data-gadget-url=
"gadget_monitoring_sync.html"
data-gadget-scope=
"sync_gadget"
data-gadget-sandbox=
"public"
></div>
<div
class=
"ui-controlgroup ui-controlgroup-horizontal ui-btn-left"
>
<div
class=
"ui-controlgroup-controls"
>
</div>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_html.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.63263.62080.55091
</string>
</value>
<value>
<string>
95
1.17777.16093.25088
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
2896137.92
</float>
<float>
146
3744803.95
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_js.js
View file @
5bd4fe83
...
...
@@ -44,6 +44,13 @@
};
})
.
ready
(
function
(
g
)
{
return
g
.
getDeclaredGadget
(
"
sync_gadget
"
)
.
push
(
function
(
sync_gadget
)
{
g
.
props
.
sync_gadget
=
sync_gadget
;
});
})
// Assign the element to a variable
.
ready
(
function
(
g
)
{
return
g
.
getElement
()
...
...
@@ -266,6 +273,10 @@
gadget
.
props
.
title_element
.
innerHTML
=
my_translated_html_list
[
0
];
gadget
.
props
.
left_link
.
innerHTML
=
my_translated_html_list
[
1
];
gadget
.
props
.
right_link
.
innerHTML
=
my_translated_html_list
[
2
];
})
.
push
(
function
()
{
// set auto sync timer
return
gadget
.
props
.
sync_gadget
.
startSync
();
});
})
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_header_js.xml
View file @
5bd4fe83
...
...
@@ -235,7 +235,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
6822.36434.34560
</string>
</value>
<value>
<string>
951.
20773.60158.51182
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -253,7 +253,7 @@
</tuple>
<state>
<tuple>
<float>
146
2954238.66
</float>
<float>
146
3745210.1
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_html.html
View file @
5bd4fe83
...
...
@@ -118,6 +118,7 @@
<
/table
>
{{
/
if
}}
{{
/each}
}
<
div
class
=
"
alert alert-info ui-content-hidden
"
>
Your
Changes
can
take
a
few
minutes
to
appear
in
this
screen
!<
/div
>
{{
else
}}
<
h2
>
No
parameters
.
<
/h2
>
{{
/
if
}}
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_html.xml
View file @
5bd4fe83
...
...
@@ -243,7 +243,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
7634.20557.47701
</string>
</value>
<value>
<string>
951.
10932.20107.12578
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>
146
2956704.34
</float>
<float>
146
3154501.48
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_js.html
View file @
5bd4fe83
...
...
@@ -115,9 +115,8 @@
opml_tmp_key_list =
[];
for
(
key
in
url_description_dict
)
{
opml_tmp_key_list
.
push
(
key
);
promise_list
.
push
(
gadget
.
props
.
jio_gadget
.
getMonitorUrlListFromOpml
(
url_description_dict
[
key
].
href
));
promise_list
.
push
(
gadget
.
props
.
jio_gadget
.
getMonitorUrlList
(
undefined
,
url_description_dict
[
key
].
title
));
}
return
RSVP
.
all
(
promise_list
);
})
...
...
@@ -291,7 +290,9 @@
}
gadget.props.document_list[index].parameters =
data;
updateParameterBox
(
data
,
gadget
.
props
.
document_list
[
index
].
title
);
return
RSVP
.
push
(
update_promise
);
$(
gadget
.
props
.
element
.
querySelector
('.
alert-info
'))
.
removeClass
('
ui-content-hidden
');
return
RSVP
.
all
(
update_promise
);
});
});
}
...
...
@@ -308,7 +309,7 @@
);
}
function
get
Secure
Document
(
url
,
auth_login
)
{
function
get
Monitor
Document
(
url
,
auth_login
)
{
var
jio_options =
{
type:
"
query
",
sub_storage:
{
...
...
@@ -321,7 +322,9 @@
},
document_id =
'monitor.global'
;
if
(
auth_login
)
{
jio_options.sub_storage.sub_storage.basic_login =
auth_login;
}
gadget
.
props
.
jio_gadget
.
createJio
(
jio_options
);
return
gadget
.
props
.
jio_gadget
.
get
(
document_id
);
}
...
...
@@ -377,7 +380,7 @@
$(".ui-block-b .signal").removeClass("ui-content-hidden");
return $(element.querySelector('td:first-child > a')).addClass('selected');
})
.push(function () {
/*
.push(function () {
var i,
cred_promise_list = [];
for (i = 0; i
<
gadget
.
props
.
hosting_list
[
index
].
instance_list
.
length
;
i
+=
1
)
{
...
...
@@ -388,14 +391,14 @@
));
}
return
RSVP
.
all
(
cred_promise_list
);
})
.
push
(
function
(
cred_list
)
{
})
*
/
.
push
(
function
()
{
var
i
,
promise_list =
[];
for
(i =
0;
i
<
gadget
.
props
.
hosting_list
[
index
].
instance_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
get
Secure
Document
(
gadget
.
props
.
hosting_list
[
index
].
instance_list
[
i
].
url
,
cred_list
[
i
].
hash
promise_list
.
push
(
get
Monitor
Document
(
gadget
.
props
.
hosting_list
[
index
].
instance_list
[
i
].
url
//
cred_list
[
i
].
hash
));
}
return
RSVP
.
all
(
promise_list
);
...
...
@@ -430,7 +433,7 @@
}
}
if
(
gadget
.
props
.
opml_dict
[
gadget
.
props
.
opml_key_list
[
index
]]
!==
undefined
)
{
status_url =
"#page=status_list&
opml_url="
+
gadget
.
props
.
opml_dict
[
gadget
.
props
.
opml_key_list
[
index
]].
href
;
status_url =
"#page=status_list&
search="
+
gadget
.
props
.
opml_dict
[
gadget
.
props
.
opml_key_list
[
index
]].
title
;
}
parameter_content =
parameters_widget_template({parameter_list:
parameter_list
});
instance_content =
instance_widget_template({
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_hosting_overview_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
7620.46241.55705
</string>
</value>
<value>
<string>
951.
17698.39476.46574
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
2957229.65
</float>
<float>
146
3560631.34
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_html.html
View file @
5bd4fe83
...
...
@@ -15,6 +15,7 @@
<body>
<div
data-gadget-url=
"gadget_monitoring_jio.html"
data-gadget-scope=
"jio_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_monitoring_login_widget.html"
data-gadget-scope=
"login_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_monitoring_sync.html"
data-gadget-scope=
"sync_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-role=
"tabs"
class=
"config-tabs"
>
<div
data-role=
"navbar"
>
...
...
@@ -50,13 +51,12 @@
<textarea
name=
"settings-data-input"
class=
"text-data"
></textarea>
</div>
</div>
<div
class=
"ui-text-right padding-5"
>
<span
class=
"ui-text-error"
></span>
</div>
<div
class=
"alert alert-error ui-content-hidden"
></div>
<div
class=
"select-storage ui-controlgroup ui-controlgroup-horizontal"
>
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-b"
>
<div
class=
"ui-block-b padding-lr-10"
>
<button
data-i18n=
"Continue"
class=
"ui-btn-btn-right btn-continue ui-content-hidden"
>
Continue
</button>
</div>
<div
class=
"ui-block-c"
>
<button
data-i18n=
"Reload Settings"
class=
"ui-btn-btn-right btn-save"
>
Import Settings
</button>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_html.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.11579.61166.10564
</string>
</value>
<value>
<string>
95
1.20886.9345.28125
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
59353714.18
</float>
<float>
14
63752338.87
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_js.html
View file @
5bd4fe83
...
...
@@ -117,6 +117,12 @@
g.props.login_gadget = login_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("sync_gadget")
.push(function (sync_gadget) {
gadget.props.sync_gadget = sync_gadget;
});
})
.ready(function (g) {
return g.getDeclaredGadget("jio_gadget")
.push(function (jio_gadget) {
...
...
@@ -124,7 +130,7 @@
return jio_gadget.createJio({
type: "indexeddb",
database: "setting"
});
}
, false
);
});
})
.declareAcquiredMethod("getSetting", "getSetting")
...
...
@@ -170,6 +176,18 @@
}
));
promise_list.push(loopEventListener(
gadget.props.element.querySelector('.btn-continue'),
'click',
true,
function () {
return gadget.redirect({
page: 'settings_configurator',
tab: 'manage'
});
}
));
promise_list.push(loopEventListener(
gadget.props.element.querySelector('.btn-save'),
'click',
...
...
@@ -179,16 +197,15 @@
configuration_dict,
monitor_url_dict = {},
monitor_opml_url_dict = {},
error_msg = '',
i;
gadget.props.element.querySelector('.ui-text-error')
.innerHTML = "";
try {
configuration_dict = JSON.parse(json_string);
} catch (e) {
gadget.props.element.querySelector('.ui-text-error'
)
.innerHTML = 'Error: Invalid json content!';
return
;
return $(gadget.props.element.querySelector('.alert-error')
)
.removeClass('ui-content-hidden')
.html('Error: Invalid json content!')
;
}
return validateJsonConfiguration(configuration_dict)
...
...
@@ -204,19 +221,49 @@
hashCode
(
configuration_dict
.
monitor_url
[
i
].
url
)
] =
configuration_dict.monitor_url[i];
}
$(
gadget
.
props
.
element
.
querySelector
('.
btn-continue
'))
.
addClass
('
ui-content-hidden
');
gadget
.
props
.
element
.
querySelector
('.
btn-save
')
.innerHTML =
"Please wait..."
;
return
gadget
.
props
.
login_gadget
.
setUrlDict
(
monitor_url_dict
)
.
push
(
function
()
{
return
gadget
.
setSetting
('
monitor_url_description
',
monitor_opml_url_dict
);
})
.
push
(
function
()
{
return
gadget
.
props
.
jio_gadget
.
syncMonitoringOpmlData
();
})
.
push
(
function
(
result_list
)
{
var
i
;
for
(i =
0;
i
<
result_list
.
length
;
i
+=
1
)
{
if
(
result_list
[
i
].
error
)
{
error_msg
+=
'
Failed
to
sync
data
at
"'
+
result_list
[
i
].
url
+
'"
<
br
/>
';
}
}
gadget.props.element.querySelector('.btn-save')
.innerHTML = "Sync Data...";
return gadget.props.sync_gadget.startSync({now: true});
})
.push(function (){
if (error_msg) {
$(gadget.props.element.querySelector('.alert-error'))
.removeClass('ui-content-hidden')
.html(error_msg);
$(gadget.props.element.querySelector('.btn-continue'))
.removeClass('ui-content-hidden');
gadget.props.element.querySelector('.btn-save')
.innerHTML = "Retry Import";
} else {
return gadget.redirect({
page: 'settings_configurator',
tab: 'manage'
});
}
});
} else {
gadget
.
props
.
element
.
querySelector
('.
ui-text-error
')
.innerHTML =
'Error: Content is not a valid Monitoring Json configuration!'
;
$(gadget.props.element.querySelector('.alert-error'))
.removeClass('ui-content-hidden')
.html('Error: Content is not a valid Monitoring Json configuration!');
}
});
}
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_import_export_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
6586.6078.25975
</string>
</value>
<value>
<string>
951.
20891.29228.48298
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
2894491.67
</float>
<float>
146
3752927.42
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_jio_js.js
View file @
5bd4fe83
...
...
@@ -3,57 +3,164 @@
(
function
(
window
,
rJS
,
jIO
)
{
"
use strict
"
;
function
getOPMLUrlList
(
url
,
query
)
{
function
createReplicatedJio
(
gadget
,
storage_dict
,
query
)
{
var
storage_url
,
the_storage
,
configuration
,
hashCode
=
function
(
s
)
{
return
s
.
split
(
""
).
reduce
(
function
(
a
,
b
){
a
=
((
a
<<
5
)
-
a
)
+
b
.
charCodeAt
(
0
);
return
a
&
a
},
0
);
};
the_storage
=
JSON
.
parse
(
JSON
.
stringify
(
storage_dict
));
while
(
the_storage
.
hasOwnProperty
(
'
sub_storage
'
))
{
the_storage
=
the_storage
.
sub_storage
;
}
/*if (! the_storage.hawOwnProperty('url')) {
throw new Error('Jio configuration must contain url!');
} else {
storage_url = the_storage.url;
}*/
storage_url
=
the_storage
.
url
;
configuration
=
{
type
:
"
replicate
"
,
query
:
query
,
use_remote_post
:
false
,
conflict_handling
:
2
,
check_local_modification
:
false
,
check_local_creation
:
false
,
check_local_deletion
:
false
,
check_remote_modification
:
true
,
check_remote_creation
:
true
,
check_remote_deletion
:
true
,
local_sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
monitoringdb_
"
+
hashCode
(
storage_url
)
}
}
},
remote_sub_storage
:
storage_dict
};
return
jIO
.
createJIO
(
configuration
);
}
function
createOPMLReplicatedJio
(
url
)
{
var
jio_options
=
{
type
:
"
replicate
"
,
query
:
{},
use_remote_post
:
false
,
conflict_handling
:
2
,
check_local_modification
:
false
,
check_local_creation
:
false
,
check_local_deletion
:
false
,
check_remote_modification
:
true
,
check_remote_creation
:
true
,
check_remote_deletion
:
true
,
local_sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
monitoringdb
"
}
}
},
remote_sub_storage
:
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
feed
"
,
feed_type
:
'
opml
'
,
url
:
url
}
}
},
jio_storage
=
jIO
.
createJIO
(
jio_options
);
return
jio_storage
;
}
function
syncMonitoringOpmlData
(
url
)
{
var
jio_storage
=
createOPMLReplicatedJio
(
url
);
console
.
log
(
"
Sync of
"
+
url
);
return
jio_storage
.
repair
()
.
push
(
function
()
{
return
{
error
:
false
,
url
:
url
};
},
function
(
error
)
{
console
.
log
(
error
);
return
{
error
:
true
,
url
:
url
};
});
}
function
getFeedUrlList
(
query
)
{
var
jio_options
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
monitoringdb
"
}
}
},
jio_storage
=
jIO
.
createJIO
(
jio_options
);
if
(
query
===
undefined
)
{
query
=
{};
query
=
{
include_docs
:
true
};
}
return
jio_storage
.
allDocs
(
query
)
.
push
(
function
(
url_list
)
{
var
i
,
feed_url
=
[];
feed_url
_list
=
[];
for
(
i
=
0
;
i
<
url_list
.
data
.
total_rows
;
i
+=
1
)
{
if
(
url_list
.
data
.
rows
[
i
].
value
.
htmlurl
)
{
// || url_list.data.rows[i].value.xmlUrl
feed_url
.
push
(
url_list
.
data
.
rows
[
i
].
value
.
htmlurl
);
// || url_list.data.rows[i].value.xmlUrl
if
(
url_list
.
data
.
rows
[
i
].
doc
.
htmlurl
)
{
// || url_list.data.rows[i].doc.xmlUrl
feed_url_list
.
push
(
url_list
.
data
.
rows
[
i
].
doc
.
htmlurl
);
// || url_list.data.rows[i].doc.xmlUrl
}
}
return
feed_url
;
return
feed_url
_list
;
},
function
(
error
)
{
console
.
log
(
error
);
});
}
function
getMonitorUrlList
(
url
,
query
)
{
function
getMonitorUrlList
(
query
,
opml_title
)
{
var
jio_options
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
feed
"
,
feed_type
:
'
opml
'
,
url
:
url
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
monitoringdb
"
}
}
},
jio_storage
=
jIO
.
createJIO
(
jio_options
);
if
(
query
===
undefined
)
{
query
=
{};
query
=
{
include_docs
:
true
};
}
return
jio_storage
.
allDocs
(
query
)
.
push
(
function
(
url_list
)
{
var
i
,
monitor_url
=
[];
monitor_url
_list
=
[];
for
(
i
=
0
;
i
<
url_list
.
data
.
total_rows
;
i
+=
1
)
{
if
(
url_list
.
data
.
rows
[
i
].
value
.
url
)
{
monitor_url
.
push
(
url_list
.
data
.
rows
[
i
].
value
.
url
);
if
(
url_list
.
data
.
rows
[
i
].
doc
.
url
)
{
if
((
opml_title
&&
url_list
.
data
.
rows
[
i
].
doc
.
opml_title
===
opml_title
)
||
(
opml_title
===
undefined
))
{
monitor_url_list
.
push
(
url_list
.
data
.
rows
[
i
].
doc
.
url
);
}
}
return
monitor_url
;
}
return
monitor_url_list
;
},
function
(
error
)
{
console
.
log
(
error
);
});
...
...
@@ -79,8 +186,16 @@
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
setSetting
"
,
"
setSetting
"
)
.
declareMethod
(
'
createJio
'
,
function
(
jio_options
)
{
var
gadget
=
this
;
.
declareMethod
(
'
createJio
'
,
function
(
jio_options
,
replicated
,
query
)
{
var
gadget
=
this
,
storage
;
if
((
replicated
===
undefined
||
replicated
===
true
)
&&
jio_options
)
{
if
(
query
===
undefined
)
{
query
=
{};
}
this
.
state_parameter_dict
.
jio_storage
=
createReplicatedJio
(
gadget
,
jio_options
,
query
);
}
else
{
if
(
jio_options
===
undefined
)
{
jio_options
=
{
type
:
"
query
"
,
...
...
@@ -94,95 +209,70 @@
};
}
this
.
state_parameter_dict
.
jio_storage
=
jIO
.
createJIO
(
jio_options
);
return
this
.
getSetting
(
"
jio_storage_name
"
)
.
push
(
function
(
jio_storage_name
)
{
gadget
.
state_parameter_dict
.
jio_storage_name
=
jio_storage_name
;
});
}
return
this
.
state_parameter_dict
.
jio_storage
;
})
.
declareMethod
(
'
createJioFromRssFeed
'
,
function
(
feed_url
,
basic_login
)
{
var
gadget
=
this
,
jio_options
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
feed
"
,
feed_type
:
'
rss
'
,
url
:
opml_url
.
declareMethod
(
'
syncMonitoringOpmlData
'
,
function
(
url
)
{
if
(
url
!==
undefined
)
{
return
syncMonitoringOpmlData
(
url
);
}
};
if
(
basic_login
!==
undefined
)
{
jio_options
.
sub_storage
.
basic_login
=
basic_login
;
return
this
.
getSetting
(
'
monitor_url_description
'
)
.
push
(
function
(
url_description_dict
)
{
var
promise_list
=
[],
key
;
for
(
key
in
url_description_dict
)
{
promise_list
.
push
(
syncMonitoringOpmlData
(
url_description_dict
[
key
].
href
));
}
this
.
state_parameter_dict
.
jio_storage
=
jIO
.
createJIO
(
jio_options
);
return
jio_options
;
return
RSVP
.
all
(
promise_list
);
})
;
})
.
declareMethod
(
'
get
UrlListFromOPML
'
,
function
(
opml_url
,
query
)
{
return
get
OPMLUrlList
(
opml_url
,
query
);
.
declareMethod
(
'
get
FeedUrlList
'
,
function
(
query
)
{
return
get
FeedUrlList
(
query
);
})
.
declareMethod
(
'
getUrl
DescriptionFromOPML
'
,
function
(
opml_url
,
query
)
{
.
declareMethod
(
'
getUrl
FeedDescription
'
,
function
(
query
)
{
var
jio_options
=
{
type
:
"
query
"
,
sub_storage
:
{
type
:
"
feed
"
,
feed_type
:
'
opml
'
,
url
:
opml_url
type
:
"
uuid
"
,
sub_storage
:
{
type
:
"
indexeddb
"
,
database
:
"
monitoringdb
"
}
}
},
jio_storage
=
jIO
.
createJIO
(
jio_options
);
if
(
query
===
undefined
)
{
query
=
{};
query
=
{
include_docs
:
true
};
}
return
jio_storage
.
allDocs
(
query
)
.
push
(
function
(
url_list
)
{
var
i
,
feed_url
;
feed_url
_list
=
[]
;
for
(
i
=
0
;
i
<
url_list
.
data
.
total_rows
;
i
+=
1
)
{
if
(
url_list
.
data
.
rows
[
i
].
value
.
htmlurl
||
url_list
.
data
.
rows
[
i
].
value
.
xmlUrl
)
{
feed_url
.
push
({
htmlurl
:
url_list
.
data
.
rows
[
i
].
value
.
htmlurl
,
xmlUrl
:
url_list
.
data
.
rows
[
i
].
value
.
xmlUrl
,
title
:
url_list
.
data
.
rows
[
i
].
value
.
title
,
opml_title
:
url_list
.
data
.
rows
[
i
].
value
.
opml_title
,
type
:
url_list
.
data
.
rows
[
i
].
value
.
type
,
create_date
:
url_list
.
data
.
rows
[
i
].
value
.
create_date
,
modified_date
:
url_list
.
data
.
rows
[
i
].
value
.
modified_date
,
version
:
url_list
.
data
.
rows
[
i
].
value
.
version
,
text
:
url_list
.
data
.
rows
[
i
].
value
.
text
,
});
}
}
return
feed_url
;
if
(
url_list
.
data
.
rows
[
i
].
doc
.
htmlurl
||
url_list
.
data
.
rows
[
i
].
doc
.
xmlurl
)
{
feed_url_list
.
push
({
htmlurl
:
url_list
.
data
.
rows
[
i
].
doc
.
htmlurl
,
xmlUrl
:
url_list
.
data
.
rows
[
i
].
doc
.
xmlurl
,
url
:
url_list
.
data
.
rows
[
i
].
doc
.
url
,
title
:
url_list
.
data
.
rows
[
i
].
doc
.
title
,
opml_title
:
url_list
.
data
.
rows
[
i
].
doc
.
opml_title
,
type
:
url_list
.
data
.
rows
[
i
].
doc
.
type
,
create_date
:
url_list
.
data
.
rows
[
i
].
doc
.
create_date
,
modified_date
:
url_list
.
data
.
rows
[
i
].
doc
.
modified_date
,
version
:
url_list
.
data
.
rows
[
i
].
doc
.
version
,
text
:
url_list
.
data
.
rows
[
i
].
doc
.
text
,
});
})
.
declareMethod
(
'
getUrlListFromFullOPML
'
,
function
(
query
)
{
return
this
.
getSetting
(
'
monitor_url_description
'
)
.
push
(
function
(
url_description_dict
)
{
var
promise_list
=
[],
key
;
for
(
key
in
url_description_dict
)
{
promise_list
.
push
(
getOPMLUrlList
(
url_description_dict
[
key
].
href
,
query
));
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
url_list
)
{
return
concatArrayOfArray
(
url_list
);
});
})
.
declareMethod
(
'
getMonitorUrlList
'
,
function
(
query
)
{
return
this
.
getSetting
(
'
monitor_url_description
'
)
.
push
(
function
(
url_description_dict
)
{
var
promise_list
=
[],
key
;
for
(
key
in
url_description_dict
)
{
promise_list
.
push
(
getMonitorUrlList
(
url_description_dict
[
key
].
href
,
query
));
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
url_list
)
{
return
concatArrayOfArray
(
url_list
);
return
feed_url_list
;
});
})
.
declareMethod
(
'
getMonitorUrlList
FromOpml
'
,
function
(
url
,
query
)
{
return
getMonitorUrlList
(
url
,
query
);
.
declareMethod
(
'
getMonitorUrlList
'
,
function
(
query
,
opml_title
)
{
return
getMonitorUrlList
(
query
,
opml_title
);
})
.
declareMethod
(
'
allDocs
'
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
...
...
@@ -232,15 +322,6 @@
storage
=
gadget
.
state_parameter_dict
.
jio_storage
;
return
storage
.
repair
.
apply
(
storage
,
arguments
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
XMLHttpRequestProgressEvent
&&
error
.
currentTarget
.
status
===
401
&&
gadget
.
state_parameter_dict
.
jio_storage_name
===
"
ERP5
"
)
{
return
{
redirect
:
{
page
:
"
login
"
}
};
}
throw
error
;
});
});
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_jio_js.xml
View file @
5bd4fe83
...
...
@@ -235,7 +235,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.59884.43592.12680
</string>
</value>
<value>
<string>
9
51.20849.6596.3413
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -253,7 +253,7 @@
</tuple>
<state>
<tuple>
<float>
14
58313807.96
</float>
<float>
14
63759566.63
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.html
View file @
5bd4fe83
...
...
@@ -94,6 +94,24 @@
});
}
function getUrlDict(gadget) {
var jio_gadget;
return gadget.getDeclaredGadget("jio_gadget")
.push(function (result) {
jio_gadget = result;
return jio_gadget.get("urls");
})
.push(undefined, function (error) {
if (error.status_code === 404) {
return {};
}
throw error;
})
.push(function (doc) {
return doc;
});
}
function clearSettingFromParentUrl (gadget, parent_url) {
var jio_gadget;
return gadget.getDeclaredGadget("jio_gadget")
...
...
@@ -206,6 +224,10 @@
var gadget = this;
return setUrlDict(gadget, url_dict);
})
.declareMethod('getUrlDict', function () {
var gadget = this;
return getUrlDict(gadget);
})
.declareMethod('clearSettingFromParentUrl', function (parent_url) {
var gadget = this;
return clearSettingFromParentUrl(gadget, parent_url);
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.xml
View file @
5bd4fe83
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
superalain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.
54785.50611.22596
</string>
</value>
<value>
<string>
950.
63263.62080.55091
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
1942642.99
</float>
<float>
146
2973707.48
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_html.xml
View file @
5bd4fe83
...
...
@@ -243,7 +243,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
48.31845.65187.32494
</string>
</value>
<value>
<string>
9
51.17777.16093.25088
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -261,7 +261,7 @@
</tuple>
<state>
<tuple>
<float>
14
52874621.91
</float>
<float>
14
63744746.17
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_js.html
View file @
5bd4fe83
...
...
@@ -7,7 +7,7 @@
gadget_klass
.ready(function (g) {
return false
;
g.props = {}
;
})
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getSetting", "getSetting")
...
...
@@ -38,6 +38,12 @@
page: 'status_' + current_display
});
});
})
.declareService(function () {
var gadget = this;
});
}(window, rJS));
\ No newline at end of file
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_main_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.56645.25063.6451
</string>
</value>
<value>
<string>
9
51.20773.46331.52377
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
58320618.57
</float>
<float>
14
63745785.66
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_overview_js.html
View file @
5bd4fe83
...
...
@@ -41,7 +41,7 @@
],
query: {
select_list: ['title', 'status', 'date', '_links', 'state', 'hosting-title'],
query: '_id:"monitor.global"',
//
query: '_id:"monitor.global"',
sort_on: [["status", "ascending"]]
}
};
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_overview_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.28768.11607.28996
</string>
</value>
<value>
<string>
95
1.9443.43477.54732
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
0450670.49
</float>
<float>
146
3065265.96
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_process_view_js.html
View file @
5bd4fe83
...
...
@@ -53,7 +53,7 @@
return gadget.property_dict.login_gadget.loginRedirect(options.jio_for, options, options.title, options.root)
.push(function (cred) {
jio_options.sub_storage.sub_storage.basic_login = cred.hash;
gadget.property_dict.jio_gadget.createJio(jio_options);
gadget.property_dict.jio_gadget.createJio(jio_options
, false
);
return gadget.updateHeader({
title: options.title + ' [' + options.root + '] Processes status'
});
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_process_view_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.59799.36045.13670
</string>
</value>
<value>
<string>
9
50.63263.62080.55091
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
58308638.96
</float>
<float>
14
63148214.4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_promise_interface_js.js
View file @
5bd4fe83
...
...
@@ -109,15 +109,15 @@
promise_list
=
[];
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
/*
.push(function () {
return gadget.property_dict.login_gadget.loginRedirect(
element._links.monitor.href,
options,
element.instance,
element.hosting_subscription
);
})
.
push
(
function
(
cred
)
{
})
*/
.
push
(
function
()
{
status
=
(
element
.
status
.
toLowerCase
()
===
'
error
'
)
?
'
red
'
:
(
element
.
status
.
toLowerCase
()
===
'
warning
'
)
?
'
warning
'
:
'
ok
'
;
element
.
state
=
status
;
...
...
@@ -139,7 +139,7 @@
sub_storage
:
{
type
:
"
dav
"
,
url
:
element
.
_links
.
monitor
.
href
,
basic_login
:
cred
.
hash
//
basic_login: cred.hash
}
}
};
...
...
@@ -200,7 +200,7 @@
var
title
=
options
.
jio_key
.
slice
(
0
,
-
7
),
jio_options
,
history_content
,
jio_url
=
options
.
jio_for
+
'
/.jio_documents/history/
'
+
title
;
// XXX hardcoded URL
jio_url
=
options
.
jio_for
;
jio_options
=
{
type
:
"
query
"
,
...
...
@@ -212,9 +212,10 @@
}
}
};
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
);
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
,
false
);
return
gadget
.
property_dict
.
jio_gadget
.
allDocs
({
select_list
:
[
'
title
'
,
'
message
'
,
'
start-date
'
,
'
status
'
],
query
:
'
_id: "%.history.status"
'
,
limit
:
[
0
,
30
],
sort_on
:
[[
"
start-date
"
,
"
descending
"
]]
})
...
...
@@ -254,7 +255,7 @@
}
}
};
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
);
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
,
false
);
return
gadget
.
property_dict
.
jio_gadget
.
get
(
jio_key
);
})
.
push
(
function
(
monitor_state
)
{
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_promise_interface_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.56728.21843.28501
</string>
</value>
<value>
<string>
9
51.10830.35453.12458
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
58901454.8
3
</float>
<float>
14
63152445.6
3
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_resource_view_js.html
View file @
5bd4fe83
...
...
@@ -93,7 +93,7 @@
}
}
};
gadget.property_dict.jio_gadget.createJio(jio_options);
gadget.property_dict.jio_gadget.createJio(jio_options
, false
);
return gadget.property_dict.jio_gadget.get(gadget.property_dict.ressource_dict[key])
.push(function (jio_element) {
if (!jio_element.hasOwnProperty('data')) {
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_resource_view_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
49.64188.296.22835
</string>
</value>
<value>
<string>
9
50.63263.62080.55091
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
58571980.17
</float>
<float>
14
63147612.98
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
View file @
5bd4fe83
...
...
@@ -31,6 +31,7 @@
<body>
<div
data-gadget-url=
"gadget_monitoring_jio.html"
data-gadget-scope=
"jio_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_monitoring_login_widget.html"
data-gadget-scope=
"login_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_monitoring_sync.html"
data-gadget-scope=
"sync_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-role=
"tabs"
class=
"config-tabs"
>
<div
data-role=
"navbar"
>
<ul>
...
...
@@ -129,7 +130,7 @@
<div
class=
"overview-header"
>
<div
class=
'content-title ui-instance-title'
>
<div
class=
"overview-title"
>
<i
class=
"fa fa-link"
></i><span>
Monitoring
OPML URL
</span>
<i
class=
"fa fa-link"
></i><span>
Monitoring
Instances list
</span>
</div>
<div
class=
"commands"
>
</div>
...
...
@@ -161,6 +162,23 @@
</span>
</div>
<div
class=
"padding-5"
>
<fieldset
class=
"sync-interval-controlgroup"
data-role=
"controlgroup"
data-type=
"horizontal"
>
<legend><strong>
Auto Sync Interval:
</strong></legend>
<input
type=
"radio"
name=
"sync-data-timer"
id=
"sync-data-5m"
value=
"300000"
checked=
"checked"
>
<label
for=
"sync-data-5m"
>
5 min
</label>
<input
type=
"radio"
name=
"sync-data-timer"
id=
"sync-data-10m"
value=
"600000"
>
<label
for=
"sync-data-10m"
>
10 min
</label>
<input
type=
"radio"
name=
"sync-data-timer"
id=
"sync-data-20m"
value=
"1200000"
>
<label
for=
"sync-data-20m"
>
20 min
</label>
<input
type=
"radio"
name=
"sync-data-timer"
id=
"sync-data-30m"
value=
"1800000"
>
<label
for=
"sync-data-30m"
>
30 min
</label>
<input
type=
"radio"
name=
"sync-data-timer"
id=
"sync-data-1h"
value=
"3600000"
>
<label
for=
"sync-data-1h"
>
1 h
</label>
</fieldset>
<button
class=
"ui-btn ui-corner-all ui-btn-inline sync-all"
><i
class=
"fa fa-download"
></i>
Sync Data Now
</button>
</div>
<div
class=
"padding-5"
>
<h2><strong>
Access links:
</strong></h2>
<a
href=
"#page=hosting_overview"
>
Access Applications
</a>
<a
href=
"#page=import_export"
>
Export Settings
</a>
</div>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.xml
View file @
5bd4fe83
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
superalain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.54736.61765.9915
</string>
</value>
<value>
<string>
95
1.21014.7809.37444
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
1937944.7
</float>
<float>
146
3759407.22
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
View file @
5bd4fe83
...
...
@@ -113,7 +113,8 @@
query: {
select_list: ['title', 'opml_title', 'htmlurl', 'type', 'url'],
sort_on: [["opml_title", "ascending"]]
}
},
replicate: false
},
jio_options = {
type: "query",
...
...
@@ -269,7 +270,7 @@
url:
url
}
};
gadget
.
props
.
jio_gadget
.
createJio
(
jio_options
);
gadget
.
props
.
jio_gadget
.
createJio
(
jio_options
,
false
);
return
gadget
.
props
.
jio_gadget
.
allDocs
({})
.
push
(
function
(
doc
)
{
if
(!
doc
)
{
...
...
@@ -313,6 +314,12 @@
gadget.props.jio_gadget = jio_gadget;
});
})
.ready(function (gadget) {
return gadget.getDeclaredGadget("sync_gadget")
.push(function (sync_gadget) {
gadget.props.sync_gadget = sync_gadget;
});
})
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("reload", "reload")
...
...
@@ -365,7 +372,41 @@
// Form submit
/////////////////////////////////////////
.declareService(function () {
var gadget = this;
var gadget = this,
sync_checkbox_list,
i;
function setSyncTimerInterval(element) {
var timer;
if ($(element).prop('checked')) {
timer = parseInt($(element).val(), 10);
console.log(timer);
if (timer
&&
!isNaN(timer)) {
return new RSVP.Queue()
.push(function () {
return gadget.setSetting('sync_data_interval', timer);
});
}
}
}
function setSelectSyncTime(time_interval) {
var element_id = "#sync-data-";
if (time_interval === 300000) {
element_id += "5m";
} else if (time_interval === 600000) {
element_id += "10m";
} else if (time_interval === 1200000) {
element_id += "20m";
} else if (time_interval === 1800000) {
element_id += "30m";
} else if (time_interval === 3600000) {
element_id += "1h";
}
$(element_id).prop('checked', true);
return $(gadget.props.element.querySelector(".sync-interval-controlgroup"))
.controlgroup().controlgroup("refresh");
}
return new RSVP.Queue()
.push(function () {
...
...
@@ -374,6 +415,12 @@
.push(function () {
return $(gadget.props.element.querySelector("a[href='#config-" + gadget.props.selected + "']")).trigger('click');
})
.push(function () {
return gadget.getSetting('sync_data_interval');
})
.push(function (time_interval) {
return setSelectSyncTime(time_interval);
})
.push(function () {
var text = "Give username and password that you have.
<br/>
For each Monitor, " +
"credentials will be saved only if Login/password are valid.
<br/>
<br>
" +
...
...
@@ -412,6 +459,29 @@
}
));
promise_list.push(loopEventListener(
gadget.props.element.querySelector('.sync-all'),
'click',
true,
function () {
var title = gadget.props.element.querySelector('.sync-all').innerHTML;
return new RSVP.Queue()
.push(function () {
gadget.props.element.querySelector('.sync-all')
.innerHTML = '
<i
class=
"fa fa-download"
></i>
Please wait...';
gadget.props.element.querySelector('.sync-all')
.disabled = true;
return gadget.props.sync_gadget.startSync({now: true});
})
.push(function () {
gadget.props.element.querySelector('.sync-all')
.innerHTML = title;
gadget.props.element.querySelector('.sync-all')
.disabled = false;
});
}
));
promise_list.push(loopEventListener(
gadget.props.element.querySelector("table th input[name='opml-all']"),
'change',
...
...
@@ -439,6 +509,7 @@
}
}
));*/
promise_list.push(
$(gadget.props.element.querySelector("input[name='configure-auth']")).bind( "change", function(event, ui) {
var input_login = gadget.props.element.querySelector(".configure input[name='username']"),
...
...
@@ -679,6 +750,10 @@
config_promise_list
.
push
(
setUrlConfiguration
(
gadget
,
gadget
.
props
.
opml_url
,
root_name
)
);
//
sync
this
opml
feed
config_promise_list
.
push
(
gadget
.
props
.
jio_gadget
.
syncMonitoringOpmlData
(
gadget
.
props
.
opml_url
)
);
return
RSVP
.
all
(
config_promise_list
);
})
.
push
(
function
(
result
)
{
...
...
@@ -744,6 +819,15 @@
}
));
sync_checkbox_list = gadget.props.element.querySelectorAll("input[name='sync-data-timer']");
for (i = 0; i
<
sync
_checkbox_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
$(
sync_checkbox_list
[
i
])
.
bind
("
change
",
setSyncTimerInterval
.
bind
(
gadget
,
sync_checkbox_list
[
i
]))
);
}
return
RSVP
.
all
(
promise_list
);
});
});
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.xml
View file @
5bd4fe83
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
superalain
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.54797.54715.48554
</string>
</value>
<value>
<string>
95
1.21015.25528.41881
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
1942058.71
</float>
<float>
146
3759548.44
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_status_list_js.html
View file @
5bd4fe83
...
...
@@ -66,18 +66,21 @@
query: {
select_list: ['title', 'siteTitle', 'reference', 'category',
'date', 'message', 'link', 'source'],
//query: '_id:(NOT "monitor.hal") AND _id:(NOT "monitor.global
")',
query: '_id: (NOT "_replicate_%
")',
sort_on: [["category", "ascending"]]
}
};
return gadget.updateHeader(header)
.push(function () {
if (options.opml_url) {
return gadget.property_dict.jio_gadget.getUrlListFromOPML(options.opml_url);
if (options.root_title) {
return gadget.property_dict.jio_gadget.getFeedUrlList({
query: 'opml_title: "' + options.root_title + '"',
include_docs: true
});
}
else {
return gadget.property_dict.jio_gadget.get
UrlListFromFullOPML
();
return gadget.property_dict.jio_gadget.get
FeedUrlList
();
}
})
.push(function (url_list) {
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_status_list_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.28768.11607.28996
</string>
</value>
<value>
<string>
95
1.16713.3981.39628
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
0450783.19
</float>
<float>
146
3501364.68
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_html.html
0 → 100644
View file @
5bd4fe83
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Monitoring Sync Data
</title>
<link
href=
"gadget_monitoring_custom.css"
rel=
"stylesheet"
type=
"text/css"
/>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_monitoring_sync.js"
></script>
</head>
<body>
<div
data-gadget-url=
"gadget_monitoring_jio.html"
data-gadget-scope=
"jio_gadget"
data-gadget-sandbox=
"public"
></div>
<div
data-gadget-url=
"gadget_monitoring_login_widget.html"
data-gadget-scope=
"login_gadget"
data-gadget-sandbox=
"public"
></div>
</body>
</html>
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_html.xml
0 → 100644
View file @
5bd4fe83
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Page"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
classification/collaborative/public
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_monitoring_sync.html
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_monitoring_sync_html
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Page
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Monitoring Sync Data
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
document_publication_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
edit_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
processing_status_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAU=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
publish_alive
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463424662.99
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
published_alive
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
edit
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.15435.34499.18483
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463424729.85
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record
id=
"5"
aka=
"AAAAAAAAAAU="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
detect_converted_file
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_processing_state
</string>
</key>
<value>
<string>
converted
</string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
0.0.0.0
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463424597.78
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.html
0 → 100644
View file @
5bd4fe83
/*global window, rJS */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(function (window, rJS) {
"use strict";
var gadget_klass = rJS(window),
rusha = new Rusha();
gadget_klass
.ready(function (g) {
g.props = {};
return g.getDeclaredGadget('jio_gadget')
.push(function (jio_gadget) {
g.props.jio_gadget = jio_gadget;
});
})
.ready(function (g) {
return g.getDeclaredGadget('login_gadget')
.push(function (login_gadget) {
g.props.login_gadget = login_gadget;
});
})
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod("startSync", function (options) {
var gadget = this,
monitor_cred_dict = {},
sync_lock = false;
function syncStorage(gadget, storage_dict, query) {
gadget.props.jio_gadget.createJio(storage_dict, true, query);
return gadget.props.jio_gadget.repair()
.push(undefined, function (error) {
console.log(error);
});
}
function getMonitoringStorageList (feed_url_list) {
var base_url,
base_url_hash,
key,
i,
j,
feed_config,
dav_config,
monitor_storage_list = [],
storage_type_list = [],
dav_storage = {
type: "query",
sub_storage: {
type: "drivetojiomapping",
sub_storage: {
type: "dav"
}
}
},
feed_storage = {
type: "query",
sub_storage: {
type: "feed",
feed_type: 'rss'
}
};
storage_type_list = [
{path: 'jio_public/', query: {}},
{path: 'jio_private/', query: {}, private_access: true},
/*{path: 'jio_private/data/', query: {
//query: '_id: "%.data" AND _id: "%.status"' // Skip history
}},
/*{path: 'jio_private/report/', query: {
query: '_id:"%.report"' // Skip history
}}*/
];
for (i = 0; i
<
feed
_url_list
.
length
;
i
+=
1
)
{
feed_config =
JSON.parse(JSON.stringify(feed_storage));
feed_config.sub_storage.url =
feed_url_list[i].htmlurl;
monitor_storage_list
.
push
({
storage:
feed_config
,
query:
{}
});
base_url =
feed_url_list[i].url.replace('jio_public/',
'');
//
Hard
coded
!!
base_url_hash =
rusha.digestFromString(base_url
+
'
jio_private
/');
//
hard
coded
!!
for
(j =
0;
j
<
storage_type_list
.
length
;
j
+=
1
)
{
dav_config =
JSON.parse(JSON.stringify(dav_storage));
dav_config.sub_storage.sub_storage.url =
base_url
+
storage_type_list
[
j
].
path
;
if
(
storage_type_list
[
j
].
private_access
)
{
if
(
monitor_cred_dict
.
hasOwnProperty
(
base_url_hash
))
{
dav_config.sub_storage.sub_storage.basic_login =
monitor_cred_dict[base_url_hash].hash;
}
else
{
continue
;
}
}
monitor_storage_list
.
push
({
storage:
dav_config
,
query:
storage_type_list
[
j
].
query
});
}
}
return
monitor_storage_list
;
}
function
syncAllStorage
()
{
var
monitor_storage_list =
[];
if
(sync_lock =
==
true
)
{
return
[];
}
if
(
options
.
now
)
{
sync_lock =
true;
}
return
gadget
.
props
.
login_gadget
.
getUrlDict
()
.
push
(
function
(
url_dict
)
{
monitor_cred_dict =
url_dict;
return
gadget
.
props
.
jio_gadget
.
getUrlFeedDescription
(
options
.
query
);
})
.
push
(
function
(
url_list
)
{
var
i
,
promise_list =
[];
monitor_storage_list =
getMonitoringStorageList(url_list);
for
(i =
0;
i
<
monitor_storage_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
syncStorage
(
gadget
,
monitor_storage_list
[
i
].
storage
,
monitor_storage_list
[
i
].
query
));
}
console
.
log
("
Sync
monitoring
data
...");
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
()
{
var
sync_time =
new
Date
().
getTime
();
sync_lock =
false;
return
gadget
.
setSetting
('
latest_sync_time
',
sync_time
);
});
}
function
syncDataTimer
()
{
if
(
gadget
.
props
.
timer
)
{
clearInterval
(
gadget
.
props
.
timer
);
}
gadget.props.timer =
setTimeout(function(){
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
syncAllStorage
();
})
.
push
(
function
()
{
return
gadget
.
getSetting
('
sync_data_interval
');
})
.
push
(
function
(
timer_interval
)
{
if
(timer_interval =
==
undefined
)
{
timer_interval =
300000;
}
gadget.props.timer_interval =
timer_interval;
return
syncDataTimer
();
});
},
gadget
.
props
.
timer_interval
);
}
if
(options =
==
undefined
)
{
options =
{};
}
if
(options.query =
==
undefined
)
{
options.query =
{
include_docs:
true
};
}
if
(
options
.
now
)
{
return
syncAllStorage
();
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getSetting
('
sync_data_interval
');
})
.
push
(
function
(
timer_interval
)
{
if
(timer_interval =
==
undefined
)
{
timer_interval =
300000;
}
gadget.props.timer_interval =
timer_interval;
return
gadget
.
getSetting
('
latest_sync_time
');
})
.
push
(
function
(
latest_sync_time
)
{
var
current_time =
new
Date
().
getTime
(),
time_diff
;
if
(
latest_sync_time
!==
undefined
)
{
time_diff =
current_time
-
latest_sync_time
;
if
((
time_diff
-
10000
)
>
= gadget.props.timer_interval) {
// sync in after 5 second
gadget.props.timer_interval = 5000;
} else {
gadget.props.timer_interval = gadget.props.timer_interval - time_diff;
}
}
return syncDataTimer();
});
});
}(window, rJS));
\ No newline at end of file
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_sync_js.xml
0 → 100644
View file @
5bd4fe83
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
classification/collaborative/public
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_monitoring_sync.js
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_monitoring_sync_js
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<string>
en
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Script
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Monitoring Sync Data Gadget JS
</string>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
001
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
document_publication_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
edit_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
processing_status_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAU=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
publish_alive
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463424020.0
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
published_alive
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
edit
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.20979.34222.27938
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
<value>
<string>
current
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463759827.91
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record
id=
"5"
aka=
"AAAAAAAAAAU="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
detect_converted_file
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
error_message
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_processing_state
</string>
</key>
<value>
<string>
converted
</string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
0.0.0.0
</string>
</value>
</item>
<item>
<key>
<string>
time
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1463423808.77
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_listbox_js.js
View file @
5bd4fe83
...
...
@@ -95,7 +95,7 @@
search_list
=
[],
translated_column_list
=
[],
all_docs_result_list
=
[],
all_docs
=
function
(
query
,
storage_list
)
{
all_docs
=
function
(
query
,
storage_list
,
replicate
)
{
var
promise_list
=
[],
i
;
if
(
storage_list
===
undefined
)
{
...
...
@@ -103,8 +103,11 @@
}
else
if
(
storage_list
===
[])
{
return
[];
}
if
(
replicate
===
undefined
)
{
replicate
=
true
;
}
for
(
i
=
0
;
i
<
storage_list
.
length
;
i
+=
1
)
{
gadget
.
property_dict
.
jio_gadget
.
createJio
(
storage_list
[
i
]);
gadget
.
property_dict
.
jio_gadget
.
createJio
(
storage_list
[
i
]
,
replicate
);
/*promise_list.push(
getJioAllDocument(gadget, 'jio_gadget' + i, storage_list[i], query)
);*/
...
...
@@ -149,7 +152,7 @@
}
}
//return gadget.jio_allDocs(option_dict.query)
return
all_docs
(
option_dict
.
query
,
option_dict
.
storage_list
)
return
all_docs
(
option_dict
.
query
,
option_dict
.
storage_list
,
option_dict
.
replicate
)
.
push
(
function
(
result_list
)
{
var
promise_list
=
[],
promise_url_list
=
[],
...
...
@@ -202,6 +205,9 @@
// build handlebars object
for
(
k
=
0
;
k
<
all_docs_result_list
.
length
;
k
+=
1
)
{
for
(
j
=
0
,
j_len
=
all_docs_result_list
[
k
].
data
.
total_rows
;
j
<
j_len
;
j
+=
1
)
{
if
(
Object
.
keys
(
all_docs_result_list
[
k
].
data
.
rows
[
j
].
value
).
length
===
0
)
{
continue
;
// Skip empty value
}
gadget
.
property_dict
.
data_result
.
push
(
all_docs_result_list
[
k
].
data
.
rows
[
j
].
value
);
cell_list
=
[];
for
(
i
=
0
,
i_len
=
option_dict
.
column_list
.
length
;
i
<
i_len
;
i
+=
1
)
{
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_listbox_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
0.12978.57403.22323
</string>
</value>
<value>
<string>
95
1.9258.8411.9847
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
59432097.87
</float>
<float>
14
63055528.9
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_overview_js.js
View file @
5bd4fe83
...
...
@@ -111,7 +111,11 @@
search_string
+=
'
OR (
'
+
option_dict
.
search_column_list
[
k
].
select
+
'
:"%
'
+
option_dict
.
search
+
'
%"
'
+
'
)
'
;
}
if
(
option_dict
.
query
.
query
)
{
option_dict
.
query
.
query
=
'
(
'
+
search_string
+
'
) AND
'
+
option_dict
.
query
.
query
;
}
else
{
option_dict
.
query
.
query
=
search_string
;
}
}
getPartialData
=
function
(
dav_url
,
key
)
{
...
...
@@ -131,6 +135,9 @@
var
i
;
if
(
monitor_dict
&&
monitor_dict
.
data
.
total_rows
>
0
)
{
for
(
i
=
0
;
i
<
monitor_dict
.
data
.
total_rows
;
i
+=
1
)
{
if
(
monitor_dict
.
data
.
rows
[
i
].
id
!==
option_dict
.
data_id
)
{
continue
;
}
all_document_list
.
push
(
monitor_dict
.
data
.
rows
[
i
].
value
);
}
}
else
{
...
...
@@ -274,7 +281,7 @@
);
})
.
push
(
function
(
cred
)
{
jio_options
.
sub_storage
.
sub_storage
.
url
=
cred
.
url
;
jio_options
.
sub_storage
.
sub_storage
.
url
=
private_link
;
jio_options
.
sub_storage
.
sub_storage
.
basic_login
=
cred
.
hash
;
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
);
return
gadget
.
property_dict
.
jio_gadget
.
get
(
...
...
@@ -295,7 +302,7 @@
promise_list_template
=
Handlebars
.
compile
(
templater
.
getElementById
(
"
promiselist-widget-template
"
).
innerHTML
);
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
);
gadget
.
property_dict
.
jio_gadget
.
createJio
(
jio_options
,
false
);
return
gadget
.
property_dict
.
jio_gadget
.
get
(
current_document
.
data
.
state
)
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_widget_overview_js.xml
View file @
5bd4fe83
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
951.
7653.61879.51080
</string>
</value>
<value>
<string>
951.
10827.14939.1501
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
146
2958298.9
</float>
<float>
146
3501917.46
</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