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
534321d1
Commit
534321d1
authored
Oct 28, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge with master
parents
3c00c578
45dcb261
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
17 deletions
+63
-17
asset_create.html
apps/assets/templates/assets/asset_create.html
+2
-1
asset_group_create.html
apps/assets/templates/assets/asset_group_create.html
+10
-3
asset_list.html
apps/assets/templates/assets/asset_list.html
+0
-0
asset_modal_list.html
apps/assets/templates/assets/asset_modal_list.html
+13
-3
asset_tag_create.html
apps/assets/templates/assets/asset_tag_create.html
+9
-3
views.py
apps/assets/views.py
+6
-3
jumpserver.css
apps/static/css/jumpserver.css
+20
-2
_base_list.html
apps/templates/_base_list.html
+2
-1
_nav.html
apps/templates/_nav.html
+1
-1
No files found.
apps/assets/templates/assets/asset_create.html
View file @
534321d1
...
...
@@ -44,7 +44,8 @@
$
(
'.select2'
).
select2
();
$
(
"#tags"
).
select2
({
tags
:
true
,
maximumSelectionLength
:
8
//最多能够选择的个数
maximumSelectionLength
:
8
,
//最多能够选择的个数
closeOnSelect
:
false
});
})
...
...
apps/assets/templates/assets/asset_group_create.html
View file @
534321d1
...
...
@@ -10,6 +10,7 @@ div.dataTables_wrapper div.dataTables_filter,
.dataTables_length
{
float
:
left
;
}
</style>
{% endblock %}
{% block content %}
...
...
@@ -45,10 +46,16 @@ div.dataTables_wrapper div.dataTables_filter,
<div
class=
"hr-line-dashed"
></div>
<h3
class=
"widget-head-color-box"
>
用户选择的资产
</h3>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
已选
</label>
<div
class=
"col-sm-9"
id=
"asset_sed"
>
<input
type=
"text"
class=
" form-control"
id=
"add_asset"
value=
"{{ assets_count }}"
>
<label
class=
"col-sm-2 control-label"
id=
"asset_on_count"
>
已选({{ assets_count }})
</label>
<div
class=
"col-sm-9"
id=
"asset_sed"
>
<div
class=
"form-asset-on"
id=
"add_asset"
>
<p
id=
"asset_on_p"
>
{% for asset in assets_on_list %}
<button
name=
'asset_hostname'
title=
'{{ asset.ip }}'
type=
'button'
class=
'btn btn-default btn-xs'
>
{{ asset.hostname }}
</button>
{% endfor %}
</p>
</div>
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<h3
class=
"widget-head-color-box"
>
资产用户
</h3>
...
...
apps/assets/templates/assets/asset_list.html
View file @
534321d1
This diff is collapsed.
Click to expand it.
apps/assets/templates/assets/asset_modal_list.html
View file @
534321d1
...
...
@@ -50,7 +50,8 @@
$
(
document
).
ready
(
function
(){
var
table
=
$
(
'#editable'
).
DataTable
({
aLengthMenu
:
[[
2
,
25
,
50
,
-
1
],
[
"2"
,
"25"
,
"50"
,
"all"
]],
"aLengthMenu"
:
[[
10
,
25
,
50
,
-
1
],
[
"10"
,
"25"
,
"50"
,
"all"
]],
"iDisplayLength"
:
25
,
"aaSorting"
:
[[
2
,
"asc"
]],
"aoColumnDefs"
:
[
{
"bSortable"
:
false
,
"aTargets"
:
[
0
]
}],
"bAutoWidth"
:
false
,
...
...
@@ -60,7 +61,7 @@ $(document).ready(function(){
columns
:
[
{
data
:
"checkbox"
},
{
data
:
"id"
},
{
data
:
"name"
},
{
data
:
"
host
name"
},
{
data
:
"ip"
},
{
data
:
"type"
},
{
data
:
"group"
},
...
...
@@ -84,17 +85,26 @@ $(document).ready(function(){
$
(
'#close-btn'
).
on
(
'click'
,
function
(){
$
(
'#modal'
).
modal
(
'hide'
);
});
var
size_name
=
document
.
getElementById
(
'asset_on_count'
).
innerText
$
(
'#save-btn'
).
on
(
'click'
,
function
(){
//
alert( table.rows('.selected').data().length +' row(s) selected' );
//
alert( table.rows('.selected').data().length +' row(s) selected' );
var
d
=
table
.
rows
(
'.selected'
).
data
();
var
size
=
d
.
length
;
var
re
=
/
\d
+/
document
.
getElementById
(
'add_asset'
).
value
=
size
;
var
str
=
size_name
;
var
re
=
/
\d
+/g
;
document
.
getElementById
(
'asset_on_count'
).
innerText
=
str
.
replace
(
re
,
size
);
var
column2
=
table
.
rows
(
'.selected'
).
data
();
$
(
"#asset_sed"
).
find
(
"input[name='assets']"
).
remove
();
$
(
"#asset_sed"
).
find
(
"button[name='asset_hostname']"
).
remove
();
for
(
var
i
=
0
;
i
<
column2
.
length
;
i
++
){
column2
[
i
].
checkbox
=
'<input name="checked" value="1" checked="" type="checkbox">'
;
var
value
=
column2
[
i
].
id
;
var
ip
=
column2
[
i
].
ip
;
var
hostname
=
column2
[
i
].
hostname
;
$
(
"#asset_sed"
).
append
(
"<input type='hidden' name='assets' value='"
+
value
+
"'>"
);
$
(
"#asset_on_p"
).
append
(
"<button name='asset_hostname' title='"
+
ip
+
"' type='button' class='btn btn-default btn-xs ss'>"
+
hostname
+
"</button> "
);
}
$
(
'#modal'
).
modal
(
'hide'
);
});
...
...
apps/assets/templates/assets/asset_tag_create.html
View file @
534321d1
...
...
@@ -42,10 +42,16 @@ div.dataTables_wrapper div.dataTables_filter,
<h3
class=
"widget-head-color-box"
>
基本信息
</h3>
{{ form.name|bootstrap_horizontal }}
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
关联的资产
</label>
<div
class=
"col-sm-9"
id=
"asset_sed"
>
<input
type=
"text"
class=
" form-control"
id=
"add_asset"
value=
"{{ assets_count }}"
>
<label
class=
"col-sm-2 control-label"
id=
"asset_on_count"
>
关联的资产({{ assets_count }})
</label>
<div
class=
"col-sm-9"
id=
"asset_sed"
>
<div
class=
"form-asset-on"
id=
"add_asset"
>
<p
id=
"asset_on_p"
>
{% for asset in assets_on_list %}
<button
name=
'asset_hostname'
title=
'{{ asset.ip}}'
type=
'button'
class=
'btn btn-default btn-xs'
>
{{ asset.hostname }}
</button>
{% endfor %}
</p>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-5"
>
...
...
apps/assets/views.py
View file @
534321d1
...
...
@@ -228,11 +228,12 @@ class AssetGroupUpdateView(AdminUserRequiredMixin, UpdateView):
return
super
(
AssetGroupUpdateView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
assets_all
=
self
.
object
.
assets
.
all
()
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Create asset group'
),
# 'assets': Asset.objects.all()
,
'assets_count'
:
self
.
object
.
assets
.
all
()
.
count
(
),
'assets_on_list'
:
assets_all
,
'assets_count'
:
len
(
assets_all
),
'group_id'
:
self
.
object
.
id
,
}
kwargs
.
update
(
context
)
...
...
@@ -662,10 +663,12 @@ class AssetTagUpdateView(AdminUserRequiredMixin, UpdateView):
return
super
(
AssetTagUpdateView
,
self
)
.
get
(
request
,
*
args
,
**
kwargs
)
def
get_context_data
(
self
,
**
kwargs
):
assets_all
=
self
.
object
.
asset_set
.
all
()
context
=
{
'app'
:
_
(
'Tag'
),
'action'
:
_
(
'Asset Tags detail'
),
'assets_count'
:
self
.
object
.
asset_set
.
all
()
.
count
(),
'assets_count'
:
len
(
assets_all
),
'assets_on_list'
:
assets_all
,
'tag_id'
:
self
.
object
.
id
,
}
kwargs
.
update
(
context
)
...
...
apps/static/css/jumpserver.css
View file @
534321d1
...
...
@@ -204,14 +204,31 @@ table.dataTable tbody td.selected td i.text-navy
padding-top
:
15px
;
margin-bottom
:
15px
;
display
:
block
;
background
:
#f4f4f4
;
/*background: #ccc;*/
padding-left
:
10px
;
}
.mar
{
margin-left
:
2px
;
line-height
:
15
px
;
line-height
:
0
px
;
}
.mar-j
{
margin-left
:
3px
;
margin-right
:
3px
;
}
.form-asset-on
button
{
background
:
#f1f1f1
;
margin-right
:
2px
;
}
.form-asset-on
{
border
:
1px
solid
#e5e6e7
;
padding-top
:
5px
;
padding-bottom
:
0px
;
padding-left
:
5px
;
padding-right
:
5px
;
min-height
:
34px
;
height
:
100%
;
}
.form-asset-on
p
{
margin-bottom
:
0px
;
}
\ No newline at end of file
apps/templates/_base_list.html
View file @
534321d1
...
...
@@ -30,7 +30,7 @@
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<div
class=
""
id=
"content_start"
>
{% block content_left_head %} {% endblock %}
{% block table_search %}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
...
...
@@ -44,6 +44,7 @@
</div>
</form>
{% endblock %}
{% block tags_list %}{% endblock %}
</div>
{% block table_container %}
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
...
...
apps/templates/_nav.html
View file @
534321d1
...
...
@@ -34,7 +34,7 @@
</li>
</ul>
</li>
<li
id=
""
>
<li
id=
"
terminal
"
>
<a
href=
"{% url 'terminal:terminal-list' %}"
>
<i
class=
"fa fa-desktop"
></i><span
class=
"nav-label"
>
{% trans 'Terminal' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
...
...
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