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
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
Titouan Soulard
slapos.core
Commits
b992c34e
Commit
b992c34e
authored
Apr 29, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_monitoring: fix monitor instance registration
parent
8d66b2e4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
189 additions
and
91 deletions
+189
-91
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_appcache.xml
...mplateItem/web_page_module/gadget_monitoring_appcache.xml
+4
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_custom_css.css
...lateItem/web_page_module/gadget_monitoring_custom_css.css
+53
-0
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_custom_css.xml
...lateItem/web_page_module/gadget_monitoring_custom_css.xml
+3
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.html
...em/web_page_module/gadget_monitoring_login_widget_js.html
+2
-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
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
..._module/gadget_monitoring_settings_configurator_html.html
+2
-3
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.xml
...e_module/gadget_monitoring_settings_configurator_html.xml
+2
-2
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
...lateItem/web_page_module/gadget_monitoring_static_js.html
+119
-76
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.xml
...plateItem/web_page_module/gadget_monitoring_static_js.xml
+2
-2
No files found.
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_appcache.xml
View file @
b992c34e
...
...
@@ -107,7 +107,7 @@
<value>
<string
encoding=
"cdata"
>
<![CDATA[
CACHE MANIFEST\n
# generated on Fri, 2
8 April 2016 11
:47:33 +0000\n
# generated on Fri, 2
9 April 2016 15
:47:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
...
...
@@ -126,6 +126,7 @@ gadget_jio.html\n
gadget_jio.js\n
gadget_translate.html\n
gadget_translate.js\n
gadget_translation.html\n
handlebars.js\n
i18next.js\n
jiodev.js\n
...
...
@@ -326,7 +327,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.5
3381.7699.19968
</string>
</value>
<value>
<string>
950.5
4525.37134.26453
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -344,7 +345,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
1461
861221.53
</float>
<float>
1461
945469.4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_custom_css.css
View file @
b992c34e
...
...
@@ -691,6 +691,59 @@ html table.instance-overview td:first-child > a, html table.instance-overview td
margin
:
20px
auto
;
}
/* Alert box custom */
.alert
{
padding
:
8px
35px
8px
14px
;
margin-bottom
:
8px
;
margin-top
:
8px
;
color
:
#c09853
;
text-shadow
:
0
1px
0
rgba
(
255
,
255
,
255
,
0.5
);
background-color
:
#fcf8e3
;
border
:
1px
solid
#fbeed5
;
-webkit-border-radius
:
4px
;
-moz-border-radius
:
4px
;
border-radius
:
4px
;
}
.alert-heading
{
color
:
inherit
;
}
.alert
.close
{
position
:
relative
;
top
:
-2px
;
right
:
-21px
;
line-height
:
18px
;
}
.alert-success
{
color
:
#468847
;
background-color
:
#dff0d8
;
border-color
:
#d6e9c6
;
}
.alert-danger
,
.alert-error
{
color
:
#b94a48
;
background-color
:
#f2dede
;
border-color
:
#eed3d7
;
}
.alert-info
{
color
:
#3a87ad
;
background-color
:
#d9edf7
;
border-color
:
#bce8f1
;
}
.alert-block
>
p
,
.alert-block
>
ul
{
margin-bottom
:
0
;
}
.alert-block
p
+
p
{
margin-top
:
5px
;
}
/************** Media @ **********************/
@media
all
and
(
max-width
:
62em
)
{
form
.search
.ui-block-a
{
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_custom_css.xml
View file @
b992c34e
...
...
@@ -225,7 +225,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
zope
</string>
</value>
<value>
<string>
superalain
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.
11464.24567.15445
</string>
</value>
<value>
<string>
950.
54665.64561.63931
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
14
59341758.63
</float>
<float>
14
61939565.36
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.html
View file @
b992c34e
...
...
@@ -60,9 +60,11 @@
if (doc.hasOwnProperty(key)) {
doc[key].hash = btoa(login + ':' + password);
doc[key].url = url;
doc[key].login = login;
} else {
doc[key] = {
hash: btoa(login + ':' + password),
login: login,
url: url,
parent_url: ''};
}
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_login_widget_js.xml
View file @
b992c34e
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.5
1968.20423.17902
</string>
</value>
<value>
<string>
950.5
4785.50611.22596
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
1461
832953.11
</float>
<float>
1461
942642.99
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
View file @
b992c34e
...
...
@@ -107,9 +107,7 @@
</div>
</div>
</div>
<div
class=
"padding-5"
>
<span
class=
"ui-text-error"
></span>
</div>
<div
class=
"alert alert-error ui-content-hidden"
></div>
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-b"
>
...
...
@@ -164,6 +162,7 @@
</div>
<div
class=
"padding-5"
>
<a
href=
"#page=hosting_overview"
>
Access Applications
</a>
<a
href=
"#page=import_export"
>
Export Settings
</a>
</div>
</div>
</div>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.xml
View file @
b992c34e
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.5
3466.15484.25019
</string>
</value>
<value>
<string>
950.5
4736.61765.9915
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
1461
860815.1
7
</float>
<float>
1461
937944.
7
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
View file @
b992c34e
...
...
@@ -83,10 +83,16 @@
}
function loadUrlFromOPML(gadget, url) {
var text_content = gadget.props.element.querySelector('form.opml button.show')
.textContent;
return new RSVP.Queue()
.push(function () {
return $("article.configure-b").addClass("ui-content-hidden");
})
.push(function () {
gadget.props.element.querySelector('form.opml button.show')
.textContent = "Loading...";
})
.push(function () {
var listbox_configuration = {
enable_search: false,
...
...
@@ -121,6 +127,8 @@
return gadget.props.listbox.render(listbox_configuration);
})
.push(function () {
gadget.props.element.querySelector('form.opml button.show')
.textContent = text_content;
if (gadget.props.listbox.property_dict.data_result.length > 0) {
return $("article.configure-b").removeClass("ui-content-hidden");
} else {
...
...
@@ -130,6 +138,8 @@
}
//return $(gadget.props.element.querySelector(".configure-b")).show();
}, function(error) {
gadget.props.element.querySelector('form.opml button.show')
.textContent = text_content;
$(gadget.props.element.querySelector('.opml .ui-text-error')).fadeIn(400);
gadget.props.element.querySelector('.opml .ui-text-error')
.innerHTML = "ERROR " + (error.target.status || '') + "Failed to load URL!";
...
...
@@ -151,7 +161,7 @@
return gadget.props.login_gadget.login(credential.url, credential.hash)
.then(function(result) {
if (result.status === 'OK') {
return credential
.hash
;
return credential;
} else {
return undefined;
}
...
...
@@ -174,7 +184,11 @@
return loginFromLocalCredential(gadget, url)
.push(function (result) {
if (result) {
return {status: 'OK', hash: result, url: url};
return {
status: 'OK',
hash: result.hash,
login: result.login,
url: url};
}
return {status: 'KO', msg: error.msg + ' (' + url + ')'};
});
...
...
@@ -183,7 +197,11 @@
return loginFromLocalCredential(gadget, url)
.push(function (result) {
if (result) {
return {status: 'OK', hash: result, url: url};
return {
status: 'OK',
hash: result.hash,
login: result.login,
url: url};
}
return {status: 'KO', msg: error.msg + ' (' + url + ')'};
});
...
...
@@ -191,7 +209,7 @@
}
function changeMonitorPassword(gadget, credential_dict,
login
, password) {
function changeMonitorPassword(gadget, credential_dict,
url_key
, password) {
var url,
jio_gadget,
jio_options;
...
...
@@ -234,13 +252,10 @@
return
new
Error
("
Cannot
get
document
at
:
"
%
url
);
})
.
push
(
function
(
result
)
{
return
gadget
.
props
.
login_gadget
.
updateUrlValue
(
credential_dict
.
url
,
login
,
password
)
.
push
(
function
()
{
return
{
status:
'
OK
'};
});
return
{
status:
'
OK
',
key:
url_key
};
},
function
(
error
)
{
console
.
log
(
error
);
return
{
status:
'
ERROR
',
code:
error
.
target
.
status
};
return
{
status:
'
ERROR
',
code:
error
.
target
.
status
,
key:
url_key
};
});
}
...
...
@@ -360,14 +375,16 @@
return $(gadget.props.element.querySelector("a[href='#config-" + gadget.props.selected + "']")).trigger('click');
})
.push(function () {
var text = "Give user name and password that you have.
<br/>
If required " +
"credentials will be updated from what you provided.";
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>
" +
"For simple use,
<strong>
configure instances with the " +
"same password
</strong>
.";
return $('.tooltip').tooltipster({
animation: 'fade',
delay: 200,
theme: 'tooltipster-shadow',
touchDevices: true,
content: $("
<h2><strong>
Configure
Private Access
</strong></h2><p>
" + text + "
</p>
"),
content: $("
<h2><strong>
Monitors
Private Access
</strong></h2><p>
" + text + "
</p>
"),
interactive: true,
trigger: 'hover'
});
...
...
@@ -566,25 +583,28 @@
credential_dict =
{},
username =
''
,
password =
''
,
old_password
,
new_password =
''
,
cnew_password =
''
,
reload =
true,
rows_list =
gadget.props.listbox.property_dict.data_result,
instance_name_dict =
{},
not_changed_dict =
{},
config_promise_list =
[];
if
(
rows_list
.
length
>
0) {
root_name = rows_list[0].opml_title;
}
gadget.props.element.querySelector('.configure .ui-text-error')
.innerHTML = '';
$(gadget.props.element.querySelector('.configure .alert-error'))
.addClass('ui-content-hidden').html('');
if ($(gadget.props.element.querySelector("input[name='configure-newpwd']")).prop('checked')) {
new_password = gadget.props.element.querySelector("input[name='new_password']").value;
cnew_password = gadget.props.element.querySelector("input[name='new_password_confirm']").value;
if (new_password !== cnew_password) {
gadget.props.element.querySelector('.configure .ui-text-error')
.innerHTML = 'The new password and it confirmation are differents!';
$(gadget.props.element.querySelector('.configure .alert-error'))
.removeClass('ui-content-hidden')
.html('The new password and it confirmation are differents!');
return false;
}
}
...
...
@@ -592,6 +612,7 @@
.push(function () {
var promise_list = [],
i;
$(gadget.props.element.querySelector('.spinner')).removeClass('ui-content-hidden');
if ($(gadget.props.element.querySelector("input[name='configure-auth']")).prop('checked')) {
username = gadget.props.element.querySelector("input[name='username']").value;
password = gadget.props.element.querySelector("input[name='password']").value;
...
...
@@ -614,7 +635,10 @@
if
(
status_list
[
i
].
status
!==
'
OK
')
{
error_msg
+=
'
Login
/
password
invalid
for:
'
+
rows_list
[
i
].
title
+
'.
'
+
status_list
[
i
].
msg
+
'<
br
/>
';
} else if (status_list[i].hasOwnProperty('url')) {
not_changed_dict[ hashCode( status_list[i].url ) ] = status_list[i].hash;
not_changed_dict[ hashCode( status_list[i].url ) ] = {
hash: status_list[i].hash,
login: (status_list[i].login || username)
};
}
}
return error_msg;
...
...
@@ -624,8 +648,9 @@
tmp_hash,
i;
if (error_msg !== '') {
gadget.props.element.querySelector('.configure .ui-text-error')
.innerHTML = error_msg;
$(gadget.props.element.querySelector('.configure .alert-error'))
.removeClass('ui-content-hidden')
.html(error_msg);
new_password = '';
reload = false;
return error_msg;
...
...
@@ -636,15 +661,18 @@
if
(
validateHttpUrl
(
rows_list
[
i
].
url
))
{
tmp =
{
hash:
btoa
(
username
+
'
:
'
+
password
),
login:
username
,
url:
rows_list
[
i
].
url
.
replace
('
public
',
'
private
'),
//
XXX
-
Need
to
fix
this
(
replace
())
parent_url:
gadget
.
props
.
opml_url
//
parent_title:
root_name
};
tmp_hash =
hashCode(
tmp
.
url
);
if
(
not_changed_dict
.
hasOwnProperty
(
tmp_hash
))
{
tmp.hash =
not_changed_dict[tmp_hash];
tmp.hash =
not_changed_dict[tmp_hash].hash;
tmp.login =
not_changed_dict[tmp_hash].login;
}
credential_dict
[
tmp_hash
] =
tmp;
instance_name_dict
[
tmp_hash
] =
{title:
rows_list
[
i
].
title
};
}
}
}
...
...
@@ -664,29 +692,42 @@
changeMonitorPassword
(
gadget
,
credential_dict
[
key
],
username
,
key
,
new_password
)
);
}
return
RSVP
.
all
(
promise_list
);
}
else
{
//
Only
save
provided
credentials
return
gadget
.
props
.
login_gadget
.
setUrlDict
(
credential_dict
)
.
push
(
function
()
{
return
[];
});
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
result_list
)
{
var
i
,
has_error =
false;
for
(i =
0;
i
<
result_list
.
length
;
i
+=
1
)
{
if
(result_list[i].status =
==
'
ERROR
')
{
gadget
.
props
.
element
.
querySelector
('.
configure
.
ui-text-error
')
.
innerHTML
+=
'
ERROR
'
+
result_list
[
i
].
code
+
'
:
Failed
to
save
password
!
Please
try
again
.
<
br
/>
';
$(
gadget
.
props
.
element
.
querySelector
('.
configure
.
alert-error
'))
.
removeClass
('
ui-content-hidden
')
.
append
('
ERROR
'
+
result_list
[
i
].
code
+
'.
['
+
instance_name_dict
[
result_list
[
i
].
key
].
title
+
']
Failed
to
save
password
,
please
try
again
<
br
/>
');
has_error = true;
} else if (result_list[i].status === 'OK') {
// Update if we could change password
credential_dict[result_list[i].key].hash = btoa(
credential_dict[result_list[i].key].login + ':' +
new_password
);
}
}
if (credential_dict){
// Only save provided credentials
return gadget.props.login_gadget.setUrlDict(credential_dict)
.push(function () {
has_error;
});
}
return has_error;
})
.push(function (has_error) {
if (! has_error
&&
reload) {
if (gadget.props.selected !== "manage") {
return gadget.redirect({
...
...
@@ -696,6 +737,8 @@
} else {
return gadget.reload();
}
} else {
$(gadget.props.element.querySelector('.spinner')).addClass('ui-content-hidden');
}
});
}
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.xml
View file @
b992c34e
...
...
@@ -239,7 +239,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
950.5
3470.24267.49032
</string>
</value>
<value>
<string>
950.5
4797.54715.48554
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -257,7 +257,7 @@
</tuple>
<state>
<tuple>
<float>
1461
861122.87
</float>
<float>
1461
942058.71
</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