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
Jérome Perrin
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
Hide 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 @@
...
@@ -62,7 +62,7 @@
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-grid-b ui-responsive"
>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-a"
></div>
<div
class=
"ui-block-b"
>
<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>
<div
class=
"ui-block-c"
>
<div
class=
"ui-block-c"
>
</div>
</div>
...
@@ -73,25 +73,25 @@
...
@@ -73,25 +73,25 @@
</article>
</article>
<article
class=
"ui-content ui-body-c configure-b ui-content-hidden"
>
<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>
<div
data-gadget-url=
"gadget_monitoring_widget_listbox.html"
data-gadget-scope=
"listbox"
></div>
<form
class=
"configure"
>
<form
class=
"configure
padding-tb-10
"
>
<label
class=
"configure-auth"
>
<
!--<
label class="configure-auth">
<input type="checkbox" name="configure-auth">Set or update credentials
<input type="checkbox" name="configure-auth">Set or update credentials
</label>
</label>
-->
<div
class=
"auth-block padding-lr-20 border-gray"
style=
"display: none"
>
<div
class=
"auth-block padding-lr-20 border-gray"
>
<div
class=
"ui-form"
>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Username:"
>
Username:
</label>
<label
data-i18n=
"Username:"
>
Username:
</label>
<input
type=
"text"
name=
"username"
required
value=
"
-
"
/>
<input
type=
"text"
name=
"username"
required
value=
""
/>
</div>
</div>
</div>
</div>
<div
class=
"ui-form"
>
<div
class=
"ui-form"
>
<div
class=
"ui-field-contain"
>
<div
class=
"ui-field-contain"
>
<label
data-i18n=
"Password:"
>
Password
<span
class=
'tooltip'
>
(?)
</span>
:
</label>
<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>
</div>
</div>
<label
class=
"configure-auth"
>
<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>
</label>
<div
class=
"new-password"
style=
"display: none"
>
<div
class=
"new-password"
style=
"display: none"
>
<div
class=
"ui-form"
>
<div
class=
"ui-form"
>
...
...
master/bt5/slapos_monitoring/PathTemplateItem/web_page_module/gadget_monitoring_static_js.html
View file @
22beacb2
...
@@ -28,53 +28,6 @@
...
@@ -28,53 +28,6 @@
+
"
:
"
+
addZero
(
d
.
getMinutes
())
+
"
:
"
+
addZero
(
d
.
getMinutes
());
+
"
:
"
+
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
)
{
function
setUrlConfiguration
(
gadget
,
url
,
title
)
{
return
gadget
.
getSetting
('
monitor_url_description
')
return
gadget
.
getSetting
('
monitor_url_description
')
.
push
(
function
(
url_description_dict
)
{
.
push
(
function
(
url_description_dict
)
{
...
@@ -108,7 +61,7 @@
...
@@ -108,7 +61,7 @@
enable_search:
false
,
enable_search:
false
,
disable_href:
true
,
disable_href:
true
,
column_list:
[{
column_list:
[{
title:
'
Instance
',
title:
'
Software
Instance
',
select:
'
title
'
select:
'
title
'
},
{
},
{
title:
'
Hosting
Subscription
',
title:
'
Hosting
Subscription
',
...
@@ -118,7 +71,7 @@
...
@@ -118,7 +71,7 @@
title:
'
URL
'
title:
'
URL
'
},
{
},
{
select:
'
type
',
select:
'
type
',
title:
'
Type
'
title:
'
URL
Type
'
}],
}],
query:
{
query:
{
select_list:
['
title
',
'
opml_title
',
'
htmlurl
',
'
type
',
'
url
'],
select_list:
['
title
',
'
opml_title
',
'
htmlurl
',
'
type
',
'
url
'],
...
@@ -303,7 +256,6 @@
...
@@ -303,7 +256,6 @@
g.props.deferred = RSVP.defer();
g.props.deferred = RSVP.defer();
g.props.urls = [];
g.props.urls = [];
g.props.gindex = 0;
g.props.gindex = 0;
return g.getSetting('jio_storage_name');
});
});
})
})
.ready(function (gadget) {
.ready(function (gadget) {
...
@@ -346,9 +298,13 @@
...
@@ -346,9 +298,13 @@
if (options.url !== undefined
&&
options.url !== '') {
if (options.url !== undefined
&&
options.url !== '') {
gadget.props.element.querySelector("input[name='url']").value = options.url;
gadget.props.element.querySelector("input[name='url']").value = options.url;
}
}
return;
if (options.username !== undefined
&&
options.username !== ''
&&
})
options.password !== undefined
&&
options.password !== '') {
.push(function () {
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');
return gadget.getSetting('monitor_url_description');
})
})
.push(function (url_description_dict) {
.push(function (url_description_dict) {
...
@@ -428,10 +384,30 @@
...
@@ -428,10 +384,30 @@
.controlgroup().controlgroup("refresh");
.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()
return new RSVP.Queue()
.push(function () {
.push(function () {
return gadget.props.deferred.promise;
return gadget.props.deferred.promise;
})
})
.push(function () {
if (gadget.props.username
&&
gadget.props.password) {
return loadOPMLContent();
}
})
.push(function () {
.push(function () {
return $(gadget.props.element.querySelector("a[href='#config-" + gadget.props.selected + "']")).trigger('click');
return $(gadget.props.element.querySelector("a[href='#config-" + gadget.props.selected + "']")).trigger('click');
})
})
...
@@ -463,19 +439,7 @@
...
@@ -463,19 +439,7 @@
'click',
'click',
true,
true,
function () {
function () {
var url = gadget.props.element.querySelector("input[name='url']").value;
return loadOPMLContent();
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;
}
}
));
));
...
@@ -540,7 +504,7 @@
...
@@ -540,7 +504,7 @@
}
}
));*/
));*/
promise_list.push(
/*
promise_list.push(
$(gadget.props.element.querySelector("input[name='configure-auth']")).bind( "change", function(event, ui) {
$(gadget.props.element.querySelector("input[name='configure-auth']")).bind( "change", function(event, ui) {
var input_login = gadget.props.element.querySelector(".configure input[name='username']"),
var input_login = gadget.props.element.querySelector(".configure input[name='username']"),
input_pwd = gadget.props.element.querySelector(".configure input[name='password']");
input_pwd = gadget.props.element.querySelector(".configure input[name='password']");
...
@@ -554,7 +518,7 @@
...
@@ -554,7 +518,7 @@
return $(gadget.props.element.querySelector(".configure .auth-block")).slideUp();
return $(gadget.props.element.querySelector(".configure .auth-block")).slideUp();
}
}
})
})
);
);
*/
promise_list.push(
promise_list.push(
$(gadget.props.element.querySelector("input[name='configure-newpwd']")).bind( "change", function(event, ui) {
$(gadget.props.element.querySelector("input[name='configure-newpwd']")).bind( "change", function(event, ui) {
...
@@ -690,7 +654,8 @@
...
@@ -690,7 +654,8 @@
rows_list =
gadget.props.listbox.property_dict.data_result,
rows_list =
gadget.props.listbox.property_dict.data_result,
instance_name_dict =
{},
instance_name_dict =
{},
not_changed_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) {
if
(
rows_list
.
length
>
0) {
root_name = rows_list[0].opml_title;
root_name = rows_list[0].opml_title;
...
@@ -709,22 +674,23 @@
...
@@ -709,22 +674,23 @@
return false;
return false;
}
}
}
}
return new RSVP.Queue()
return new RSVP.Queue()
.push(function () {
.push(function () {
var promise_list = [],
var promise_list = [],
i;
i;
$(gadget.props.element.querySelector('.spinner'))
.removeClass('ui-content-hidden');
$(gadget.props.element.querySelector('.spinner'))
if ($(gadget.props.element.querySelector("input[name='configure-auth']")).prop('checked')) {
.removeClass('ui-content-hidden');
username = gadget.props.element.querySelector("input[name='username']").val
ue;
button_submit.disabled = tr
ue;
password = gadget.props.element.querySelector("input[name='password
']").value;
username = gadget.props.element.querySelector("input[name='username
']").value;
for (i = 0; i
<
rows
_list
.
length
;
i
+=
1
)
{
password = gadget.props.element.querySelector("input[name='password']").value;
if
(
rows_list
[
i
].
htmlurl
)
{
for (i = 0; i
<
rows
_list
.
length
;
i
+=
1
)
{
promise_list
.
push
(
checkCredential
(
if
(
rows_list
[
i
].
htmlurl
)
{
gadget
,
promise_list
.
push
(
checkCredential
(
rows_list
[
i
].
url
.
replace
('
public
',
'
private
')
,
gadget
,
btoa
(
username
+
'
:
'
+
password
)
rows_list
[
i
].
url
.
replace
('
public
',
'
private
'),
));
btoa
(
username
+
'
:
'
+
password
)
}
));
}
}
}
}
return
RSVP
.
all
(
promise_list
);
return
RSVP
.
all
(
promise_list
);
...
@@ -833,6 +799,7 @@
...
@@ -833,6 +799,7 @@
return has_error;
return has_error;
})
})
.push(function (has_error) {
.push(function (has_error) {
button_submit.disabled = false;
if (! has_error
&&
reload) {
if (! has_error
&&
reload) {
if (gadget.props.selected !== "manage") {
if (gadget.props.selected !== "manage") {
return gadget.redirect({
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