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
dbc2779b
Unverified
Commit
dbc2779b
authored
Dec 12, 2018
by
老广
Committed by
GitHub
Dec 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2151 from jumpserver/dev
Dev
parents
f00a6503
33b1de0d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
30 deletions
+68
-30
asset_detail.html
apps/assets/templates/assets/asset_detail.html
+4
-0
command_execution_create.html
apps/ops/templates/ops/command_execution_create.html
+21
-2
command_execution_list.html
apps/ops/templates/ops/command_execution_list.html
+41
-27
api.py
apps/perms/api.py
+2
-1
No files found.
apps/assets/templates/assets/asset_detail.html
View file @
dbc2779b
...
@@ -77,6 +77,10 @@
...
@@ -77,6 +77,10 @@
<td>
{% trans 'Admin user' %}:
</td>
<td>
{% trans 'Admin user' %}:
</td>
<td><b>
{{ asset.admin_user }}
</b></td>
<td><b>
{{ asset.admin_user }}
</b></td>
</tr>
</tr>
<tr>
<td>
{% trans 'Domain' %}:
</td>
<td><b>
{{ asset.domain|default:"" }}
</b></td>
</tr>
<tr>
<tr>
<td>
{% trans 'Vendor' %}:
</td>
<td>
{% trans 'Vendor' %}:
</td>
<td><b>
{{ asset.vendor|default:"" }}
</b></td>
<td><b>
{{ asset.vendor|default:"" }}
</b></td>
...
...
apps/ops/templates/ops/command_execution_create.html
View file @
dbc2779b
...
@@ -171,7 +171,7 @@ function initResultTerminal() {
...
@@ -171,7 +171,7 @@ function initResultTerminal() {
cursorBlink
:
false
,
cursorBlink
:
false
,
screenKeys
:
false
,
screenKeys
:
false
,
fontFamily
:
'"Monaco", "Consolas", "monospace"'
,
fontFamily
:
'"Monaco", "Consolas", "monospace"'
,
fontSize
:
1
2
,
fontSize
:
1
3
,
rightClickSelectsWord
:
true
,
rightClickSelectsWord
:
true
,
disableStdin
:
true
,
disableStdin
:
true
,
theme
:
{
theme
:
{
...
@@ -182,6 +182,10 @@ function initResultTerminal() {
...
@@ -182,6 +182,10 @@ function initResultTerminal() {
term
.
write
(
"选择左侧资产, 选择运行的系统用户,批量执行命令
\
r
\n
"
)
term
.
write
(
"选择左侧资产, 选择运行的系统用户,批量执行命令
\
r
\n
"
)
}
}
function
wrapperError
(
msg
)
{
return
'
\
033[31m'
+
msg
+
'
\
033[0m'
+
'
\
r
\
n'
;
}
function
execute
()
{
function
execute
()
{
if
(
!
term
)
{
if
(
!
term
)
{
initResultTerminal
()
initResultTerminal
()
...
@@ -192,6 +196,18 @@ function execute() {
...
@@ -192,6 +196,18 @@ function execute() {
var
hosts
=
getSelectedAssetsNode
().
map
(
function
(
node
)
{
var
hosts
=
getSelectedAssetsNode
().
map
(
function
(
node
)
{
return
node
.
id
;
return
node
.
id
;
});
});
if
(
hosts
.
length
===
0
)
{
term
.
write
(
wrapperError
(
'没有选中资产'
));
return
}
if
(
!
command
)
{
term
.
write
(
wrapperError
(
'没有输入命令'
));
return
}
if
(
!
run_as
)
{
term
.
write
(
wrapperError
(
'没有选择运行用户'
));
return
}
var
data
=
{
var
data
=
{
hosts
:
hosts
,
hosts
:
hosts
,
run_as
:
run_as
,
run_as
:
run_as
,
...
@@ -247,7 +263,10 @@ function execute() {
...
@@ -247,7 +263,10 @@ function execute() {
var
editor
;
var
editor
;
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
systemUserId
=
$
(
'#system-users-select'
).
val
();
systemUserId
=
$
(
'#system-users-select'
).
val
();
$
(
".select2"
).
select2
().
on
(
'select2:select'
,
function
(
evt
)
{
$
(
".select2"
).
select2
({
dropdownAutoWidth
:
true
,
width
:
'auto'
}).
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
var
data
=
evt
.
params
.
data
;
systemUserId
=
data
.
id
;
systemUserId
=
data
.
id
;
initTree
();
initTree
();
...
...
apps/ops/templates/ops/command_execution_list.html
View file @
dbc2779b
...
@@ -3,6 +3,18 @@
...
@@ -3,6 +3,18 @@
{% load static %}
{% load static %}
{% load common_tags %}
{% load common_tags %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
footable
/
footable
.
core
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static 'css/plugins/datepicker/datepicker3.css' %}"
rel=
"stylesheet"
>
<link
href=
"{% static 'css/plugins/select2/select2.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
<style>
#search_btn
{
margin-bottom
:
0
;
}
</style>
{% endblock %}
{% block content_left_head %}
{% block content_left_head %}
{% endblock %}
{% endblock %}
...
@@ -39,46 +51,49 @@
...
@@ -39,46 +51,49 @@
</form>
</form>
{% endblock %}
{% endblock %}
{% block table_
head
%}
{% block table_
container
%}
<t
h
class=
"text-center"
></th
>
<t
able
class=
"footable table table-stripped table-bordered toggle-arrow-tiny"
data-page=
"false"
>
<th
class=
"text-center"
>
{% trans 'Hosts' %}
</th
>
<th
ead
>
<th
class=
"text-center"
>
{% trans 'User' %}
</th>
<th
class=
"text-center"
>
</th>
<th
class=
"text-center"
>
{% trans 'Command
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Hosts
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Run as
' %}
</th>
<th
class=
"text-center"
>
{% trans 'User
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Output
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Command
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Finished
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Run as
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Success
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Output
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Date start
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Finished
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Date finished
' %}
</th>
<th
class=
"text-center"
>
{% trans 'Success
' %}
</th>
{% endblock %}
<th
class=
"text-center"
>
{% trans 'Date start' %}
</th>
</thead>
{% block table_body %}
<tbody>
{% for object in object_list %}
{% for object in object_list %}
<tr
class=
"gradeX"
>
<tr
class=
"gradeX"
>
<td
class=
"text-center"
><input
type=
"checkbox"
class=
"cbx-term"
>
</td>
<td
>
{{ forloop.counter }}
</td>
<td
class=
"text-center hosts"
>
{{ object.get_hosts_names }}
</td>
<td
class=
"text-center hosts"
value=
"{{ object.get_hosts_names }}"
>
</td>
<td
class=
"text-center"
>
{{ object.user }}
</td>
<td
class=
"text-center"
>
{{ object.user
.name
}}
</td>
<td
class=
"text-center"
>
{{ object.command| truncatechars:16 }}
</td>
<td
class=
"text-center"
>
{{ object.command| truncatechars:16 }}
</td>
<td
class=
"text-center"
>
{{ object.run_as }}
</td>
<td
class=
"text-center"
>
{{ object.run_as
.username
}}
</td>
<td
class=
"text-center"
><a
href=
"{% url "
ops:celery-task-log
"
pk=
object.id
%}"
target=
"_blank"
>
查看
</a></td>
<td
class=
"text-center"
><a
href=
"{% url "
ops:celery-task-log
"
pk=
object.id
%}"
target=
"_blank"
>
查看
</a></td>
<td
class=
"text-center"
>
{{ object.is_finished | state_show | safe }}
</td>
<td
class=
"text-center"
>
{{ object.is_finished | state_show | safe }}
</td>
<td
class=
"text-center"
>
{{ object.is_success | state_show | safe }}
</td>
<td
class=
"text-center"
>
{{ object.is_success | state_show | safe }}
</td>
<td
class=
"text-center"
>
{{ object.date_start }}
</td>
<td
class=
"text-center"
>
{{ object.date_start }}
</td>
<td
class=
"text-center"
>
{{ object.date_finished }}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endblock %}
{% endblock %}
{% block custom_foot_js %}
{% block custom_foot_js %}
<script
src=
"{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"
></script>
<script
src=
"{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"
></script>
<script
src=
"{% static "
js
/
plugins
/
footable
/
footable
.
all
.
min
.
js
"
%}"
></script>
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
$
(
'table'
).
DataTable
({
{
#
$
(
'table'
).
DataTable
({
#
}
"searching"
:
false
,
{
#
"searching"
:
false
,
#
}
"paging"
:
false
,
{
#
"paging"
:
false
,
#
}
"bInfo"
:
false
,
{
#
"bInfo"
:
false
,
#
}
"order"
:
[]
{
#
"order"
:
[]
#
}
});
{
#
});
#
}
{
#
$
(
'.footable'
).
footable
();
#
}
$
(
'.select2'
).
select2
({
$
(
'.select2'
).
select2
({
dropdownAutoWidth
:
true
,
dropdownAutoWidth
:
true
,
width
:
'auto'
width
:
'auto'
...
@@ -92,7 +107,7 @@ $(document).ready(function() {
...
@@ -92,7 +107,7 @@ $(document).ready(function() {
autoclose
:
true
autoclose
:
true
});
});
$
(
".hosts"
).
each
(
function
(
i
)
{
$
(
".hosts"
).
each
(
function
(
i
)
{
var
data
=
$
(
this
).
text
(
);
var
data
=
$
(
this
).
attr
(
'value'
);
var
data_list
=
data
.
split
(
","
);
var
data_list
=
data
.
split
(
","
);
if
(
data_list
.
length
===
1
&&
data_list
[
0
]
===
""
)
{
if
(
data_list
.
length
===
1
&&
data_list
[
0
]
===
""
)
{
data_list
.
pop
();
data_list
.
pop
();
...
@@ -101,7 +116,6 @@ $(document).ready(function() {
...
@@ -101,7 +116,6 @@ $(document).ready(function() {
$
(
this
).
html
(
html
);
$
(
this
).
html
(
html
);
});
});
$
(
'[data-toggle="popover"]'
).
popover
();
$
(
'[data-toggle="popover"]'
).
popover
();
})
})
</script>
</script>
{% endblock %}
{% endblock %}
...
...
apps/perms/api.py
View file @
dbc2779b
...
@@ -227,8 +227,9 @@ class UserGrantedNodesWithAssetsAsTreeApi(ListAPIView):
...
@@ -227,8 +227,9 @@ class UserGrantedNodesWithAssetsAsTreeApi(ListAPIView):
@staticmethod
@staticmethod
def
parse_asset_to_tree_node
(
node
,
asset
,
system_users
):
def
parse_asset_to_tree_node
(
node
,
asset
,
system_users
):
system_users_protocol_matched
=
[
s
for
s
in
system_users
if
s
.
protocol
==
asset
.
protocol
]
system_user_serializer
=
serializers
.
GrantedSystemUserSerializer
(
system_user_serializer
=
serializers
.
GrantedSystemUserSerializer
(
system_users
,
many
=
True
system_users
_protocol_matched
,
many
=
True
)
)
asset_serializer
=
serializers
.
GrantedAssetSerializer
(
asset
)
asset_serializer
=
serializers
.
GrantedAssetSerializer
(
asset
)
icon_skin
=
'file'
icon_skin
=
'file'
...
...
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