Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
8cdc4674
Commit
8cdc4674
authored
Sep 18, 2016
by
xiaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update toastr js and close #8
parent
7fd224e6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
115 deletions
+137
-115
toastr.min.css
apps/static/css/plugins/toastr/toastr.min.css
+0
-0
toastr.js.map
apps/static/js/plugins/toastr/toastr.js.map
+0
-0
toastr.min.js
apps/static/js/plugins/toastr/toastr.min.js
+2
-3
user_detail.html
apps/users/templates/users/user_detail.html
+135
-112
No files found.
apps/static/css/plugins/toastr/toastr.min.css
View file @
8cdc4674
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/toastr/toastr.js.map
0 → 100644
View file @
8cdc4674
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/toastr/toastr.min.js
View file @
8cdc4674
!
function
(
e
){
e
([
"jquery"
],
function
(
e
){
return
function
(){
function
t
(
e
,
t
,
n
){
return
f
({
type
:
O
.
error
,
iconClass
:
g
().
iconClasses
.
error
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
n
(
t
,
n
){
return
t
||
(
t
=
g
()),
v
=
e
(
"#"
+
t
.
containerId
),
v
.
length
?
v
:(
n
&&
(
v
=
c
(
t
)),
v
)}
function
i
(
e
,
t
,
n
){
return
f
({
type
:
O
.
info
,
iconClass
:
g
().
iconClasses
.
info
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
o
(
e
){
w
=
e
}
function
s
(
e
,
t
,
n
){
return
f
({
type
:
O
.
success
,
iconClass
:
g
().
iconClasses
.
success
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
a
(
e
,
t
,
n
){
return
f
({
type
:
O
.
warning
,
iconClass
:
g
().
iconClasses
.
warning
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
r
(
e
){
var
t
=
g
();
v
||
n
(
t
),
l
(
e
,
t
)
||
u
(
t
)}
function
d
(
t
){
var
i
=
g
();
return
v
||
n
(
i
),
t
&&
0
===
e
(
":focus"
,
t
).
length
?
void
h
(
t
):
void
(
v
.
children
().
length
&&
v
.
remove
())}
function
u
(
t
){
for
(
var
n
=
v
.
children
(),
i
=
n
.
length
-
1
;
i
>=
0
;
i
--
)
l
(
e
(
n
[
i
]),
t
)}
function
l
(
t
,
n
){
return
t
&&
0
===
e
(
":focus"
,
t
).
length
?(
t
[
n
.
hideMethod
]({
duration
:
n
.
hideDuration
,
easing
:
n
.
hideEasing
,
complete
:
function
(){
h
(
t
)}}),
!
0
):
!
1
}
function
c
(
t
){
return
v
=
e
(
"<div/>"
).
attr
(
"id"
,
t
.
containerId
).
addClass
(
t
.
positionClass
).
attr
(
"aria-live"
,
"polite"
).
attr
(
"role"
,
"alert"
),
v
.
appendTo
(
e
(
t
.
target
)),
v
}
function
p
(){
return
{
tapToDismiss
:
!
0
,
toastClass
:
"toast"
,
containerId
:
"toast-container"
,
debug
:
!
1
,
showMethod
:
"fadeIn"
,
showDuration
:
300
,
showEasing
:
"swing"
,
onShown
:
void
0
,
hideMethod
:
"fadeOut"
,
hideDuration
:
1
e3
,
hideEasing
:
"swing"
,
onHidden
:
void
0
,
extendedTimeOut
:
1
e3
,
iconClasses
:{
error
:
"toast-error"
,
info
:
"toast-info"
,
success
:
"toast-success"
,
warning
:
"toast-warning"
},
iconClass
:
"toast-info"
,
positionClass
:
"toast-top-right"
,
timeOut
:
5
e3
,
titleClass
:
"toast-title"
,
messageClass
:
"toast-message"
,
target
:
"body"
,
closeHtml
:
'<button type="button">×</button>'
,
newestOnTop
:
!
0
,
preventDuplicates
:
!
1
,
progressBar
:
!
1
}}
function
m
(
e
){
w
&&
w
(
e
)}
function
f
(
t
){
function
i
(
t
){
return
!
e
(
":focus"
,
l
).
length
||
t
?(
clearTimeout
(
O
.
intervalId
),
l
[
r
.
hideMethod
]({
duration
:
r
.
hideDuration
,
easing
:
r
.
hideEasing
,
complete
:
function
(){
h
(
l
),
r
.
onHidden
&&
"hidden"
!==
b
.
state
&&
r
.
onHidden
(),
b
.
state
=
"hidden"
,
b
.
endTime
=
new
Date
,
m
(
b
)}})):
void
0
}
function
o
(){(
r
.
timeOut
>
0
||
r
.
extendedTimeOut
>
0
)
&&
(
u
=
setTimeout
(
i
,
r
.
extendedTimeOut
),
O
.
maxHideTime
=
parseFloat
(
r
.
extendedTimeOut
),
O
.
hideEta
=
(
new
Date
).
getTime
()
+
O
.
maxHideTime
)}
function
s
(){
clearTimeout
(
u
),
O
.
hideEta
=
0
,
l
.
stop
(
!
0
,
!
0
)[
r
.
showMethod
]({
duration
:
r
.
showDuration
,
easing
:
r
.
showEasing
})}
function
a
(){
var
e
=
(
O
.
hideEta
-
(
new
Date
).
getTime
())
/
O
.
maxHideTime
*
100
;
f
.
width
(
e
+
"%"
)}
var
r
=
g
(),
d
=
t
.
iconClass
||
r
.
iconClass
;
if
(
"undefined"
!=
typeof
t
.
optionsOverride
&&
(
r
=
e
.
extend
(
r
,
t
.
optionsOverride
),
d
=
t
.
optionsOverride
.
iconClass
||
d
),
r
.
preventDuplicates
){
if
(
t
.
message
===
C
)
return
;
C
=
t
.
message
}
T
++
,
v
=
n
(
r
,
!
0
);
var
u
=
null
,
l
=
e
(
"<div/>"
),
c
=
e
(
"<div/>"
),
p
=
e
(
"<div/>"
),
f
=
e
(
"<div/>"
),
w
=
e
(
r
.
closeHtml
),
O
=
{
intervalId
:
null
,
hideEta
:
null
,
maxHideTime
:
null
},
b
=
{
toastId
:
T
,
state
:
"visible"
,
startTime
:
new
Date
,
options
:
r
,
map
:
t
};
return
t
.
iconClass
&&
l
.
addClass
(
r
.
toastClass
).
addClass
(
d
),
t
.
title
&&
(
c
.
append
(
t
.
title
).
addClass
(
r
.
titleClass
),
l
.
append
(
c
)),
t
.
message
&&
(
p
.
append
(
t
.
message
).
addClass
(
r
.
messageClass
),
l
.
append
(
p
)),
r
.
closeButton
&&
(
w
.
addClass
(
"toast-close-button"
).
attr
(
"role"
,
"button"
),
l
.
prepend
(
w
)),
r
.
progressBar
&&
(
f
.
addClass
(
"toast-progress"
),
l
.
prepend
(
f
)),
l
.
hide
(),
r
.
newestOnTop
?
v
.
prepend
(
l
):
v
.
append
(
l
),
l
[
r
.
showMethod
]({
duration
:
r
.
showDuration
,
easing
:
r
.
showEasing
,
complete
:
r
.
onShown
}),
r
.
timeOut
>
0
&&
(
u
=
setTimeout
(
i
,
r
.
timeOut
),
O
.
maxHideTime
=
parseFloat
(
r
.
timeOut
),
O
.
hideEta
=
(
new
Date
).
getTime
()
+
O
.
maxHideTime
,
r
.
progressBar
&&
(
O
.
intervalId
=
setInterval
(
a
,
10
))),
l
.
hover
(
s
,
o
),
!
r
.
onclick
&&
r
.
tapToDismiss
&&
l
.
click
(
i
),
r
.
closeButton
&&
w
&&
w
.
click
(
function
(
e
){
e
.
stopPropagation
?
e
.
stopPropagation
():
void
0
!==
e
.
cancelBubble
&&
e
.
cancelBubble
!==!
0
&&
(
e
.
cancelBubble
=!
0
),
i
(
!
0
)}),
r
.
onclick
&&
l
.
click
(
function
(){
r
.
onclick
(),
i
()}),
m
(
b
),
r
.
debug
&&
console
&&
console
.
log
(
b
),
l
}
function
g
(){
return
e
.
extend
({},
p
(),
b
.
options
)}
function
h
(
e
){
v
||
(
v
=
n
()),
e
.
is
(
":visible"
)
||
(
e
.
remove
(),
e
=
null
,
0
===
v
.
children
().
length
&&
(
v
.
remove
(),
C
=
void
0
))}
var
v
,
w
,
C
,
T
=
0
,
O
=
{
error
:
"error"
,
info
:
"info"
,
success
:
"success"
,
warning
:
"warning"
},
b
=
{
clear
:
r
,
remove
:
d
,
error
:
t
,
getContainer
:
n
,
info
:
i
,
options
:{},
subscribe
:
o
,
success
:
s
,
version
:
"2.1.0"
,
warning
:
a
};
return
b
}()})}(
"function"
==
typeof
define
&&
define
.
amd
?
define
:
function
(
e
,
t
){
"undefined"
!=
typeof
module
&&
module
.
exports
?
module
.
exports
=
t
(
require
(
"jquery"
)):
window
.
toastr
=
t
(
window
.
jQuery
)});
!
function
(
e
){
e
([
"jquery"
],
function
(
e
){
return
function
(){
function
t
(
e
,
t
,
n
){
return
g
({
type
:
O
.
error
,
iconClass
:
m
().
iconClasses
.
error
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
n
(
t
,
n
){
return
t
||
(
t
=
m
()),
v
=
e
(
"#"
+
t
.
containerId
),
v
.
length
?
v
:(
n
&&
(
v
=
d
(
t
)),
v
)}
function
o
(
e
,
t
,
n
){
return
g
({
type
:
O
.
info
,
iconClass
:
m
().
iconClasses
.
info
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
s
(
e
){
C
=
e
}
function
i
(
e
,
t
,
n
){
return
g
({
type
:
O
.
success
,
iconClass
:
m
().
iconClasses
.
success
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
a
(
e
,
t
,
n
){
return
g
({
type
:
O
.
warning
,
iconClass
:
m
().
iconClasses
.
warning
,
message
:
e
,
optionsOverride
:
n
,
title
:
t
})}
function
r
(
e
,
t
){
var
o
=
m
();
v
||
n
(
o
),
u
(
e
,
o
,
t
)
||
l
(
o
)}
function
c
(
t
){
var
o
=
m
();
return
v
||
n
(
o
),
t
&&
0
===
e
(
":focus"
,
t
).
length
?
void
h
(
t
):
void
(
v
.
children
().
length
&&
v
.
remove
())}
function
l
(
t
){
for
(
var
n
=
v
.
children
(),
o
=
n
.
length
-
1
;
o
>=
0
;
o
--
)
u
(
e
(
n
[
o
]),
t
)}
function
u
(
t
,
n
,
o
){
var
s
=!
(
!
o
||!
o
.
force
)
&&
o
.
force
;
return
!
(
!
t
||!
s
&&
0
!==
e
(
":focus"
,
t
).
length
)
&&
(
t
[
n
.
hideMethod
]({
duration
:
n
.
hideDuration
,
easing
:
n
.
hideEasing
,
complete
:
function
(){
h
(
t
)}}),
!
0
)}
function
d
(
t
){
return
v
=
e
(
"<div/>"
).
attr
(
"id"
,
t
.
containerId
).
addClass
(
t
.
positionClass
),
v
.
appendTo
(
e
(
t
.
target
)),
v
}
function
p
(){
return
{
tapToDismiss
:
!
0
,
toastClass
:
"toast"
,
containerId
:
"toast-container"
,
debug
:
!
1
,
showMethod
:
"fadeIn"
,
showDuration
:
300
,
showEasing
:
"swing"
,
onShown
:
void
0
,
hideMethod
:
"fadeOut"
,
hideDuration
:
1
e3
,
hideEasing
:
"swing"
,
onHidden
:
void
0
,
closeMethod
:
!
1
,
closeDuration
:
!
1
,
closeEasing
:
!
1
,
closeOnHover
:
!
0
,
extendedTimeOut
:
1
e3
,
iconClasses
:{
error
:
"toast-error"
,
info
:
"toast-info"
,
success
:
"toast-success"
,
warning
:
"toast-warning"
},
iconClass
:
"toast-info"
,
positionClass
:
"toast-top-right"
,
timeOut
:
5
e3
,
titleClass
:
"toast-title"
,
messageClass
:
"toast-message"
,
escapeHtml
:
!
1
,
target
:
"body"
,
closeHtml
:
'<button type="button">×</button>'
,
closeClass
:
"toast-close-button"
,
newestOnTop
:
!
0
,
preventDuplicates
:
!
1
,
progressBar
:
!
1
,
progressClass
:
"toast-progress"
,
rtl
:
!
1
}}
function
f
(
e
){
C
&&
C
(
e
)}
function
g
(
t
){
function
o
(
e
){
return
null
==
e
&&
(
e
=
""
),
e
.
replace
(
/&/g
,
"&"
).
replace
(
/"/g
,
"""
).
replace
(
/'/g
,
"'"
).
replace
(
/</g
,
"<"
).
replace
(
/>/g
,
">"
)}
function
s
(){
c
(),
u
(),
d
(),
p
(),
g
(),
C
(),
l
(),
i
()}
function
i
(){
var
e
=
""
;
switch
(
t
.
iconClass
){
case
"toast-success"
:
case
"toast-info"
:
e
=
"polite"
;
break
;
default
:
e
=
"assertive"
}
I
.
attr
(
"aria-live"
,
e
)}
function
a
(){
E
.
closeOnHover
&&
I
.
hover
(
H
,
D
),
!
E
.
onclick
&&
E
.
tapToDismiss
&&
I
.
click
(
b
),
E
.
closeButton
&&
j
&&
j
.
click
(
function
(
e
){
e
.
stopPropagation
?
e
.
stopPropagation
():
void
0
!==
e
.
cancelBubble
&&
e
.
cancelBubble
!==!
0
&&
(
e
.
cancelBubble
=!
0
),
E
.
onCloseClick
&&
E
.
onCloseClick
(
e
),
b
(
!
0
)}),
E
.
onclick
&&
I
.
click
(
function
(
e
){
E
.
onclick
(
e
),
b
()})}
function
r
(){
I
.
hide
(),
I
[
E
.
showMethod
]({
duration
:
E
.
showDuration
,
easing
:
E
.
showEasing
,
complete
:
E
.
onShown
}),
E
.
timeOut
>
0
&&
(
k
=
setTimeout
(
b
,
E
.
timeOut
),
F
.
maxHideTime
=
parseFloat
(
E
.
timeOut
),
F
.
hideEta
=
(
new
Date
).
getTime
()
+
F
.
maxHideTime
,
E
.
progressBar
&&
(
F
.
intervalId
=
setInterval
(
x
,
10
)))}
function
c
(){
t
.
iconClass
&&
I
.
addClass
(
E
.
toastClass
).
addClass
(
y
)}
function
l
(){
E
.
newestOnTop
?
v
.
prepend
(
I
):
v
.
append
(
I
)}
function
u
(){
if
(
t
.
title
){
var
e
=
t
.
title
;
E
.
escapeHtml
&&
(
e
=
o
(
t
.
title
)),
M
.
append
(
e
).
addClass
(
E
.
titleClass
),
I
.
append
(
M
)}}
function
d
(){
if
(
t
.
message
){
var
e
=
t
.
message
;
E
.
escapeHtml
&&
(
e
=
o
(
t
.
message
)),
B
.
append
(
e
).
addClass
(
E
.
messageClass
),
I
.
append
(
B
)}}
function
p
(){
E
.
closeButton
&&
(
j
.
addClass
(
E
.
closeClass
).
attr
(
"role"
,
"button"
),
I
.
prepend
(
j
))}
function
g
(){
E
.
progressBar
&&
(
q
.
addClass
(
E
.
progressClass
),
I
.
prepend
(
q
))}
function
C
(){
E
.
rtl
&&
I
.
addClass
(
"rtl"
)}
function
O
(
e
,
t
){
if
(
e
.
preventDuplicates
){
if
(
t
.
message
===
w
)
return
!
0
;
w
=
t
.
message
}
return
!
1
}
function
b
(
t
){
var
n
=
t
&&
E
.
closeMethod
!==!
1
?
E
.
closeMethod
:
E
.
hideMethod
,
o
=
t
&&
E
.
closeDuration
!==!
1
?
E
.
closeDuration
:
E
.
hideDuration
,
s
=
t
&&
E
.
closeEasing
!==!
1
?
E
.
closeEasing
:
E
.
hideEasing
;
if
(
!
e
(
":focus"
,
I
).
length
||
t
)
return
clearTimeout
(
F
.
intervalId
),
I
[
n
]({
duration
:
o
,
easing
:
s
,
complete
:
function
(){
h
(
I
),
clearTimeout
(
k
),
E
.
onHidden
&&
"hidden"
!==
P
.
state
&&
E
.
onHidden
(),
P
.
state
=
"hidden"
,
P
.
endTime
=
new
Date
,
f
(
P
)}})}
function
D
(){(
E
.
timeOut
>
0
||
E
.
extendedTimeOut
>
0
)
&&
(
k
=
setTimeout
(
b
,
E
.
extendedTimeOut
),
F
.
maxHideTime
=
parseFloat
(
E
.
extendedTimeOut
),
F
.
hideEta
=
(
new
Date
).
getTime
()
+
F
.
maxHideTime
)}
function
H
(){
clearTimeout
(
k
),
F
.
hideEta
=
0
,
I
.
stop
(
!
0
,
!
0
)[
E
.
showMethod
]({
duration
:
E
.
showDuration
,
easing
:
E
.
showEasing
})}
function
x
(){
var
e
=
(
F
.
hideEta
-
(
new
Date
).
getTime
())
/
F
.
maxHideTime
*
100
;
q
.
width
(
e
+
"%"
)}
var
E
=
m
(),
y
=
t
.
iconClass
||
E
.
iconClass
;
if
(
"undefined"
!=
typeof
t
.
optionsOverride
&&
(
E
=
e
.
extend
(
E
,
t
.
optionsOverride
),
y
=
t
.
optionsOverride
.
iconClass
||
y
),
!
O
(
E
,
t
)){
T
++
,
v
=
n
(
E
,
!
0
);
var
k
=
null
,
I
=
e
(
"<div/>"
),
M
=
e
(
"<div/>"
),
B
=
e
(
"<div/>"
),
q
=
e
(
"<div/>"
),
j
=
e
(
E
.
closeHtml
),
F
=
{
intervalId
:
null
,
hideEta
:
null
,
maxHideTime
:
null
},
P
=
{
toastId
:
T
,
state
:
"visible"
,
startTime
:
new
Date
,
options
:
E
,
map
:
t
};
return
s
(),
r
(),
a
(),
f
(
P
),
E
.
debug
&&
console
&&
console
.
log
(
P
),
I
}}
function
m
(){
return
e
.
extend
({},
p
(),
b
.
options
)}
function
h
(
e
){
v
||
(
v
=
n
()),
e
.
is
(
":visible"
)
||
(
e
.
remove
(),
e
=
null
,
0
===
v
.
children
().
length
&&
(
v
.
remove
(),
w
=
void
0
))}
var
v
,
C
,
w
,
T
=
0
,
O
=
{
error
:
"error"
,
info
:
"info"
,
success
:
"success"
,
warning
:
"warning"
},
b
=
{
clear
:
r
,
remove
:
c
,
error
:
t
,
getContainer
:
n
,
info
:
o
,
options
:{},
subscribe
:
s
,
success
:
i
,
version
:
"2.1.3"
,
warning
:
a
};
return
b
}()})}(
"function"
==
typeof
define
&&
define
.
amd
?
define
:
function
(
e
,
t
){
"undefined"
!=
typeof
module
&&
module
.
exports
?
module
.
exports
=
t
(
require
(
"jquery"
)):
window
.
toastr
=
t
(
window
.
jQuery
)});
//# sourceMappingURL=/toastr.js.map
//# sourceMappingURL=toastr.js.map
\ No newline at end of file
apps/users/templates/users/user_detail.html
View file @
8cdc4674
...
@@ -211,124 +211,147 @@
...
@@ -211,124 +211,147 @@
{% block custom_foot_js %}
{% block custom_foot_js %}
<script>
<script>
jumpserver
.
selected_groups
=
{};
jumpserver
.
selected_groups
=
{};
function
updateUserGroups
(
user_groups
)
{
function
updateUserGroups
(
user_groups
)
{
var
the_url
=
"{% url 'users:user-group-edit-api' pk=user_object.id%}"
;
var
the_url
=
"{% url 'users:user-group-edit-api' pk=user_object.id %}"
;
var
body
=
{
var
body
=
{
id
:
{{
user_object
.
id
}},
id
:
{{
user_object
.
id
}},
groups
:
Object
.
assign
([],
user_groups
)
groups
:
Object
.
assign
([],
user_groups
)
};
};
var
success
=
function
(
data
)
{
var
success
=
function
(
data
)
{
// remove all the selected groups from select > option and rendered ul element;
// remove all the selected groups from select > option and rendered ul element;
$
(
'.select2-selection__rendered'
).
empty
();
$
(
'.select2-selection__rendered'
).
empty
();
$
(
'#slct_groups'
).
val
(
''
);
$
(
'#slct_groups'
).
val
(
''
);
$
.
map
(
jumpserver
.
selected_groups
,
function
(
group_name
,
index
){
$
.
map
(
jumpserver
.
selected_groups
,
function
(
group_name
,
index
)
{
$
(
'#opt_'
+
index
).
remove
();
$
(
'#opt_'
+
index
).
remove
();
// change tr html of user groups.
// change tr html of user groups.
$
(
'.group_edit tbody'
).
append
(
$
(
'.group_edit tbody'
).
append
(
'<tr>'
+
'<tr>'
+
'<td><b class="bdg_user_group" data-gid="'
+
index
+
'">'
+
group_name
+
'</b></td>'
+
'<td><b class="bdg_user_group" data-gid="'
+
index
+
'">'
+
group_name
+
'</b></td>'
+
'<td><button class="btn btn-danger btn-sm pull-right btn_delete_user_group" type="button"><i class="fa fa-minus"></i></button></td>'
+
'<td><button class="btn btn-danger btn-sm pull-right btn_delete_user_group" type="button"><i class="fa fa-minus"></i></button></td>'
+
'</tr>'
'</tr>'
)
)
});
// clear jumpserver.selected_groups
jumpserver
.
selected_groups
=
{};
toastr
.
success
(
'{% trans "UserGroup Update Success!" %}'
)
};
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
,
method
:
'PUT'
});
});
// clear jumpserver.selected_groups
jumpserver
.
selected_groups
=
{};
toastr
.
success
(
'{% trans "UserGroup Update Success!" %}'
)
};
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
,
method
:
'PUT'
});
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'.select2'
).
select2
()
$
(
'.select2'
).
select2
()
.
on
(
'select2:select'
,
function
(
evt
)
{
.
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
jumpserver
.
selected_groups
[
data
.
id
]
=
data
.
text
;
jumpserver
.
selected_groups
[
data
.
id
]
=
data
.
text
;
}).
on
(
'select2:unselect'
,
function
(
evt
)
{
}).
on
(
'select2:unselect'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
delete
jumpserver
.
selected_groups
[
data
.
id
]
delete
jumpserver
.
selected_groups
[
data
.
id
]
})
})
}).
on
(
'click'
,
'#is_active'
,
function
(){
}).
on
(
'click'
,
'#is_active'
,
function
()
{
var
the_url
=
"{% url 'users:user-patch-api' pk=user_object.id %}"
;
var
the_url
=
"{% url 'users:user-patch-api' pk=user_object.id %}"
;
var
checked
=
!
$
(
this
).
prop
(
'checked'
);
var
checked
=
!
$
(
this
).
prop
(
'checked'
);
var
body
=
{
'is_active'
:
checked
};
var
body
=
{
var
success
=
'{% trans "Update Successfully!" %}'
;
'is_active'
:
checked
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success_message
:
success
});
};
}).
on
(
'click'
,
'#enable_otp'
,
function
(){
var
success
=
'{% trans "Update Successfully!" %}'
;
var
the_url
=
"{% url 'users:user-patch-api' pk=user_object.id %}"
;
APIUpdateAttr
({
var
checked
=
!
$
(
this
).
prop
(
'checked'
);
url
:
the_url
,
var
body
=
{
'enable_otp'
:
checked
};
body
:
JSON
.
stringify
(
body
),
var
success
=
'{% trans "Update Successfully!" %}'
;
success_message
:
success
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success_message
:
success
});
});
}).
on
(
'click'
,
'#btn_add_user_group'
,
function
(){
}).
on
(
'click'
,
'#enable_otp'
,
function
()
{
if
(
Object
.
keys
(
jumpserver
.
selected_groups
).
length
===
0
)
{
var
the_url
=
"{% url 'users:user-patch-api' pk=user_object.id %}"
;
return
false
;
var
checked
=
!
$
(
this
).
prop
(
'checked'
);
}
var
body
=
{
var
user_groups
=
$
(
'.bdg_user_group'
).
map
(
function
(){
'enable_otp'
:
checked
return
$
(
this
).
data
(
'gid'
);
};
}).
get
();
var
success
=
'{% trans "Update Successfully!" %}'
;
$
.
map
(
jumpserver
.
selected_groups
,
function
(
value
,
index
){
APIUpdateAttr
({
user_groups
.
push
(
parseInt
(
index
));
url
:
the_url
,
$
(
'#opt_'
+
index
).
remove
();
body
:
JSON
.
stringify
(
body
),
});
success_message
:
success
updateUserGroups
(
user_groups
)
});
}).
on
(
'click'
,
'.btn_delete_user_group'
,
function
(){
}).
on
(
'click'
,
'#btn_add_user_group'
,
function
()
{
var
$this
=
$
(
this
);
if
(
Object
.
keys
(
jumpserver
.
selected_groups
).
length
===
0
)
{
var
$tr
=
$this
.
closest
(
'tr'
);
return
false
;
var
$badge
=
$tr
.
find
(
'.bdg_user_group'
);
var
gid
=
$badge
.
data
(
'gid'
);
var
group_name
=
$badge
.
html
()
||
$badge
.
text
();
$
(
'#slct_groups'
).
append
(
'<option value="'
+
gid
+
'" id="opt_'
+
gid
+
'">'
+
group_name
+
'</option>'
);
$tr
.
remove
();
var
user_groups
=
$
(
'.bdg_user_group'
).
map
(
function
(){
return
$
(
this
).
data
(
'gid'
);
}).
get
();
updateUserGroups
(
user_groups
)
}).
on
(
'click'
,
'#btn_reset_password'
,
function
(){
function
doReset
()
{
var
the_url
=
'{% url "users:user-reset-password-api" pk=user_object.id %}'
;
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'E-mail sent successfully. An e-mail has been sent to the user
\
's mailbox.' %}"
;
swal
(
"{% trans 'Password-Reset' %}"
,
msg
,
"success"
);
}
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
});
}
swal
({
title
:
"{% trans 'Are you sure?' %}"
,
text
:
"{% trans 'This will reset the user
\
's password.' %}"
,
type
:
"warning"
,
showCancelButton
:
true
,
confirmButtonColor
:
"#DD6B55"
,
confirmButtonText
:
"{% trans 'Confirm' %}"
,
closeOnConfirm
:
false
},
function
()
{
doReset
();
}
}
);
var
user_groups
=
$
(
'.bdg_user_group'
).
map
(
function
()
{
}).
on
(
'click'
,
'#btn_reset_pk'
,
function
(){
return
$
(
this
).
data
(
'gid'
);
function
doReset
()
{
}).
get
();
var
the_url
=
'{% url "users:user-reset-pk-api" pk=user_object.id %}'
;
$
.
map
(
jumpserver
.
selected_groups
,
function
(
value
,
index
)
{
var
body
=
{};
user_groups
.
push
(
parseInt
(
index
));
var
success
=
function
()
{
$
(
'#opt_'
+
index
).
remove
();
var
msg
=
"{% trans 'The reset-ssh-public-key E-mail has been sent successfully. Please inform the user to update his new ssh public key.' %}"
;
});
swal
(
"{% trans 'SSH-Public-Key Reset' %}"
,
msg
,
"success"
);
updateUserGroups
(
user_groups
)
}).
on
(
'click'
,
'.btn_delete_user_group'
,
function
()
{
var
$this
=
$
(
this
);
var
$tr
=
$this
.
closest
(
'tr'
);
var
$badge
=
$tr
.
find
(
'.bdg_user_group'
);
var
gid
=
$badge
.
data
(
'gid'
);
var
group_name
=
$badge
.
html
()
||
$badge
.
text
();
$
(
'#slct_groups'
).
append
(
'<option value="'
+
gid
+
'" id="opt_'
+
gid
+
'">'
+
group_name
+
'</option>'
);
$tr
.
remove
();
var
user_groups
=
$
(
'.bdg_user_group'
).
map
(
function
()
{
return
$
(
this
).
data
(
'gid'
);
}).
get
();
updateUserGroups
(
user_groups
)
}).
on
(
'click'
,
'#btn_reset_password'
,
function
()
{
function
doReset
()
{
var
the_url
=
'{% url "users:user-reset-password-api" pk=user_object.id %}'
;
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'E-mail sent successfully. An e-mail has been sent to the user
\
's mailbox.' %}"
;
swal
(
"{% trans 'Password-Reset' %}"
,
msg
,
"success"
);
};
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
});
}
}
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
});
swal
({
}
title
:
"{% trans 'Are you sure?' %}"
,
swal
({
text
:
"{% trans 'This will reset the user
\
's password.' %}"
,
title
:
"{% trans 'Are you sure?' %}"
,
type
:
"warning"
,
text
:
"{% trans 'This will reset the user
\
's public key.' %}"
,
showCancelButton
:
true
,
type
:
"warning"
,
confirmButtonColor
:
"#DD6B55"
,
showCancelButton
:
true
,
confirmButtonText
:
"{% trans 'Confirm' %}"
,
confirmButtonColor
:
"#DD6B55"
,
closeOnConfirm
:
false
confirmButtonText
:
"{% trans 'Confirm' %}"
,
},
function
()
{
closeOnConfirm
:
false
doReset
();
},
function
()
{
});
doReset
();
}).
on
(
'click'
,
'#btn_reset_pk'
,
function
()
{
function
doReset
()
{
var
the_url
=
'{% url "users:user-reset-pk-api" pk=user_object.id %}'
;
var
body
=
{};
var
success
=
function
()
{
var
msg
=
"{% trans 'The reset-ssh-public-key E-mail has been sent successfully. Please inform the user to update his new ssh public key.' %}"
;
swal
(
"{% trans 'SSH-Public-Key Reset' %}"
,
msg
,
"success"
);
};
APIUpdateAttr
({
url
:
the_url
,
body
:
JSON
.
stringify
(
body
),
success
:
success
});
}
}
);
swal
({
title
:
"{% trans 'Are you sure?' %}"
,
text
:
"{% trans 'This will reset the user
\
's public key.' %}"
,
type
:
"warning"
,
showCancelButton
:
true
,
confirmButtonColor
:
"#DD6B55"
,
confirmButtonText
:
"{% trans 'Confirm' %}"
,
closeOnConfirm
:
false
},
function
()
{
doReset
();
});
});
});
</script>
</script>
{% endblock %}
{% endblock %}
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