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
17
Merge Requests
17
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
22beacb2
Commit
22beacb2
authored
Jun 14, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_monitoring: configurator can get username and password as parameter from monitor setup url
parent
ad754563
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
89 deletions
+56
-89
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
..._module/gadget_monitoring_settings_configurator_html.html
+8
-8
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
...lateItem/web_page_module/gadget_monitoring_static_js.html
+48
-81
No files found.
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_settings_configurator_html.html
View file @
22beacb2
...
...
@@ -62,7 +62,7 @@
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-b"
>
<button
data-i18n=
"Load
URL"
class=
"ui-btn-btn-right show"
>
Load UR
L
</button>
<button
data-i18n=
"Load
OPML"
class=
"ui-btn-btn-right show"
>
Load OPM
L
</button>
</div>
<div
class=
"ui-block-c"
>
</div>
...
...
@@ -73,25 +73,25 @@
</article>
<article
class=
"ui-content ui-body-c configure-b ui-content-hidden"
>
<div
data-gadget-url=
"gadget_monitoring_widget_listbox.html"
data-gadget-scope=
"listbox"
></div>
<form
class=
"configure"
>
<label
class=
"configure-auth"
>
<form
class=
"configure
padding-tb-10
"
>
<
!--<
label class="configure-auth">
<input type="checkbox" name="configure-auth">Set or update credentials
</label>
<div
class=
"auth-block padding-lr-20 border-gray"
style=
"display: none"
>
</label>
-->
<div
class=
"auth-block padding-lr-20 border-gray"
>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Username:"
>
Username:
</label>
<input
type=
"text"
name=
"username"
required
value=
"
-
"
/>
<input
type=
"text"
name=
"username"
required
value=
""
/>
</div>
</div>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Password:"
>
Password
<span
class=
'tooltip'
>
(?)
</span>
:
</label>
<input
type=
"password"
name=
"password"
required
value=
"
-
"
/>
<input
type=
"password"
name=
"password"
required
value=
""
/>
</div>
</div>
<label
class=
"configure-auth"
>
<input
type=
"checkbox"
name=
"configure-newpwd"
>
Change
all
current password(s)
<input
type=
"checkbox"
name=
"configure-newpwd"
>
Change current password(s)
</label>
<div
class=
"new-password"
style=
"display: none"
>
<div
class=
"ui-form"
>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
View file @
22beacb2
...
...
@@ -28,53 +28,6 @@
+
"
:
"
+
addZero
(
d
.
getMinutes
())
+
"
:
"
+
addZero
(
d
.
getMinutes
());
}
function
setjIODAVConfiguration
(
gadget
,
options
)
{
var
url =
""
,
//
login_input =
gadget.props.element.querySelector("input[name='dav_username']").value,
//
password_input =
gadget.props.element.querySelector("input[name='dav_password']").value,
login_input=
''
,
password_input =
''
,
configuration =
{
type:
"
query
",
sub_storage:
{
type:
"
drivetojiomapping
",
sub_storage:
{
type:
"
dav
"
}
}
};
if
(
options
!==
undefined
&&
options
.
url
!==
undefined
&&
options
.
url
!==
'')
{
configuration.sub_storage.sub_storage.url =
options.url;
url =
options.url;
if
(
options
.
login
!==
undefined
&&
options
.
password
!==
undefined
)
{
configuration.sub_storage.sub_storage.basic_login =
btoa(options.login
+
'
:
'
+
options
.
password
);
}
}
else
{
url =
gadget.props.element.querySelector("input[name='url']").value;
configuration.sub_storage.sub_storage.url =
url;
if
(
login_input
!==
''
&&
password_input
!==
'')
{
configuration.sub_storage.sub_storage.basic_login =
btoa(login_input
+
'
:
'
+
password_input
);
}
}
return
gadget
.
getSetting
('
jio_storage_description
')
.
push
(
function
(
jio_storage_description
)
{
return
gadget
.
setSetting
('
jio_storage_description
',
configuration
)
.
push
(
function
()
{
return
gadget
.
setSetting
('
jio_storage_name
',
"
DAV
");
})
.
push
(
function
()
{
if
(
jio_storage_description
&&
url
!==
jio_storage_description
.
sub_storage
.
sub_storage
.
url
)
{
return
gadget
.
reload
();
}
else
{
return
gadget
.
redirect
({
page:
'
main
'
});
}
});
});
}
function
setUrlConfiguration
(
gadget
,
url
,
title
)
{
return
gadget
.
getSetting
('
monitor_url_description
')
.
push
(
function
(
url_description_dict
)
{
...
...
@@ -108,7 +61,7 @@
enable_search:
false
,
disable_href:
true
,
column_list:
[{
title:
'
Instance
',
title:
'
Software
Instance
',
select:
'
title
'
},
{
title:
'
Hosting
Subscription
',
...
...
@@ -118,7 +71,7 @@
title:
'
URL
'
},
{
select:
'
type
',
title:
'
Type
'
title:
'
URL
Type
'
}],
query:
{
select_list:
['
title
',
'
opml_title
',
'
htmlurl
',
'
type
',
'
url
'],
...
...
@@ -303,7 +256,6 @@
g.props.deferred = RSVP.defer();
g.props.urls = [];
g.props.gindex = 0;
return g.getSetting('jio_storage_name');
});
})
.ready(function (gadget) {
...
...
@@ -346,9 +298,13 @@
if (options.url !== undefined
&&
options.url !== '') {
gadget.props.element.querySelector("input[name='url']").value = options.url;
}
return;
})
.push(function () {
if (options.username !== undefined
&&
options.username !== ''
&&
options.password !== undefined
&&
options.password !== '') {
gadget.props.username = options.username;
gadget.props.password = options.password;
gadget.props.element.querySelector("input[name='username']").value = options.username;
gadget.props.element.querySelector("input[name='password']").value = options.password;
}
return gadget.getSetting('monitor_url_description');
})
.push(function (url_description_dict) {
...
...
@@ -428,10 +384,30 @@
.controlgroup().controlgroup("refresh");
}
function loadOPMLContent () {
var url = gadget.props.element.querySelector("input[name='url']").value;
gadget.props.element.querySelector('.opml .ui-text-error')
.innerHTML = "";
$(gadget.props.element.querySelector('.opml .ui-text-error')).fadeOut(400);
if (url
&&
validateHttpUrl(url)) {
gadget.props.opml_url = url;
return loadUrlFromOPML(gadget, url);
} else {
$(gadget.props.element.querySelector('.opml .ui-text-error')).fadeIn(400);
gadget.props.element.querySelector('.opml .ui-text-error')
.innerHTML = "'" + url + "' is not a valid URL";
}
}
return new RSVP.Queue()
.push(function () {
return gadget.props.deferred.promise;
})
.push(function () {
if (gadget.props.username
&&
gadget.props.password) {
return loadOPMLContent();
}
})
.push(function () {
return $(gadget.props.element.querySelector("a[href='#config-" + gadget.props.selected + "']")).trigger('click');
})
...
...
@@ -463,19 +439,7 @@
'click',
true,
function () {
var url = gadget.props.element.querySelector("input[name='url']").value;
gadget.props.element.querySelector('.opml .ui-text-error')
.innerHTML = "";
$(gadget.props.element.querySelector('.opml .ui-text-error')).fadeOut(400);
if (url
&&
validateHttpUrl(url)) {
gadget.props.opml_url = url;
return loadUrlFromOPML(gadget, url);
} else {
$(gadget.props.element.querySelector('.opml .ui-text-error')).fadeIn(400);
gadget.props.element.querySelector('.opml .ui-text-error')
.innerHTML = "'" + url + "' is not a valid URL";
}
return false;
return loadOPMLContent();
}
));
...
...
@@ -540,7 +504,7 @@
}
));*/
promise_list.push(
/*
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']"),
input_pwd = gadget.props.element.querySelector(".configure input[name='password']");
...
...
@@ -554,7 +518,7 @@
return $(gadget.props.element.querySelector(".configure .auth-block")).slideUp();
}
})
);
);
*/
promise_list.push(
$(gadget.props.element.querySelector("input[name='configure-newpwd']")).bind( "change", function(event, ui) {
...
...
@@ -690,7 +654,8 @@
rows_list =
gadget.props.listbox.property_dict.data_result,
instance_name_dict =
{},
not_changed_dict =
{},
config_promise_list =
[];
config_promise_list =
[],
button_submit =
gadget.props.element.querySelector('.configure
button[type=
"submit"
]');
if
(
rows_list
.
length
>
0) {
root_name = rows_list[0].opml_title;
...
...
@@ -709,12 +674,14 @@
return false;
}
}
return new RSVP.Queue()
.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')) {
$(gadget.props.element.querySelector('.spinner'))
.removeClass('ui-content-hidden');
button_submit.disabled = true;
username = gadget.props.element.querySelector("input[name='username']").value;
password = gadget.props.element.querySelector("input[name='password']").value;
for (i = 0; i
<
rows
_list
.
length
;
i
+=
1
)
{
...
...
@@ -726,7 +693,6 @@
));
}
}
}
return
RSVP
.
all
(
promise_list
);
})
.
push
(
function
(
status_list
)
{
...
...
@@ -833,6 +799,7 @@
return has_error;
})
.push(function (has_error) {
button_submit.disabled = false;
if (! has_error
&&
reload) {
if (gadget.props.selected !== "manage") {
return gadget.redirect({
...
...
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