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
255e3a04
Commit
255e3a04
authored
Dec 03, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支持选中执行
parent
6080a861
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
views.py
jumpserver/views.py
+1
-0
exec_cmd.html
templates/exec_cmd.html
+2
-2
asset_list.html
templates/jasset/asset_list.html
+7
-2
No files found.
jumpserver/views.py
View file @
255e3a04
...
...
@@ -363,5 +363,6 @@ def download(request):
@login_required
(
login_url
=
'/login'
)
def
exec_cmd
(
request
):
role
=
request
.
GET
.
get
(
'role'
)
check_assets
=
request
.
GET
.
get
(
'check_assets'
,
''
)
web_terminal_uri
=
'ws://
%
s/exec?role=
%
s'
%
(
WEB_SOCKET_HOST
,
role
)
return
my_render
(
'exec_cmd.html'
,
locals
(),
request
)
templates/exec_cmd.html
View file @
255e3a04
...
...
@@ -14,7 +14,7 @@
<div
id=
"footer"
>
<div
class=
"content"
>
<input
type=
"text"
id=
"pattern"
placeholder=
"Ansible Pattern"
>
<input
type=
"text"
id=
"pattern"
value=
"{{ check_assets }}"
placeholder=
"Ansible Pattern"
>
<input
type=
"text"
id=
"command"
placeholder=
"Command to execute"
>
<input
type=
"button"
id=
"send_btn"
value=
"Send"
onclick=
"sendMessage()"
>
</div>
...
...
@@ -119,7 +119,7 @@
position
:
relative
;
}
#pattern
{
width
:
2
0
%
;
}
#pattern
{
width
:
2
5
%
;
}
#command
{
width
:
60%
;
}
#send_btn
{
width
:
10%
;
...
...
templates/jasset/asset_list.html
View file @
255e3a04
...
...
@@ -176,6 +176,11 @@
$
(
'#exec_cmd'
).
click
(
function
(){
var
url
=
'/jperm/role/get/'
;
var
new_url
=
'/exec_cmd/?role='
;
var
check_array
=
[];
$
(
".gradeX input:checked"
).
closest
(
'tr'
).
find
(
'.hostname a'
).
each
(
function
()
{
check_array
.
push
(
$
(
this
).
text
())
});
check_assets
=
check_array
.
join
(
':'
);
$
.
ajax
({
type
:
'GET'
,
url
:
url
,
...
...
@@ -190,7 +195,7 @@
maxmin
:
true
,
shade
:
false
,
area
:
[
'800px'
,
'700px'
],
content
:
new_url
+
data
content
:
new_url
+
data
+
'&check_assets='
+
check_assets
});
//window.open(new_url + data, '', 'location=no, resizeable=no, height=410, width=625, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,status=no');
}
else
if
(
dataArray
.
length
==
'1'
&&
data
==
'error'
){
...
...
@@ -198,7 +203,7 @@
}
else
{
aUrl
=
''
;
$
.
each
(
dataArray
,
function
(
index
,
value
){
aUrl
+=
'<a onclick="windowOpenExec(this); return false" class="btn btn-xs btn-primary newa" href='
+
new_url
+
value
+
'>'
+
value
+
'</a> '
aUrl
+=
'<a onclick="windowOpenExec(this); return false" class="btn btn-xs btn-primary newa" href='
+
new_url
+
value
+
'&check_assets='
+
check_assets
+
'>'
+
value
+
'</a> '
});
layer
.
alert
(
aUrl
,
{
skin
:
'layui-layer-molv'
,
...
...
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