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
e83ecb12
Commit
e83ecb12
authored
Sep 28, 2016
by
江世峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
assets_group_forbug
parent
49f00760
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
59 deletions
+53
-59
models.py
apps/assets/models.py
+1
-1
asset_group_create.html
apps/assets/templates/assets/asset_group_create.html
+11
-0
asset_modal_list.html
apps/assets/templates/assets/asset_modal_list.html
+40
-58
user_list.html
apps/users/templates/users/user_list.html
+1
-0
No files found.
apps/assets/models.py
View file @
e83ecb12
...
...
@@ -312,7 +312,7 @@ class Asset(models.Model):
status
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
blank
=
True
,
related_name
=
"status_asset"
,
verbose_name
=
_
(
'Asset status'
),)
# default=functools.partial(get_default_extend, 'status', 'In use'))
type
=
models
.
ForeignKey
(
AssetExtend
,
null
=
True
,
limit_choices_to
=
{
'key'
:
'type'
},
type
=
models
.
ForeignKey
(
AssetExtend
,
blank
=
True
,
null
=
True
,
limit_choices_to
=
{
'key'
:
'type'
},
related_name
=
"type_asset"
,
verbose_name
=
_
(
'Asset type'
),)
# default=functools.partial(get_default_extend, 'type','Server'))
env
=
models
.
ForeignKey
(
AssetExtend
,
blank
=
True
,
null
=
True
,
limit_choices_to
=
{
'key'
:
'env'
},
...
...
apps/assets/templates/assets/asset_group_create.html
View file @
e83ecb12
...
...
@@ -7,6 +7,17 @@
<script
src=
"{% static 'js/plugins/select2/select2.full.min.js' %}"
></script>
<link
href=
"{% static 'css/plugins/dataTables/datatables.min.css' %}"
rel=
"stylesheet"
>
<script
src=
"{% static 'js/plugins/dataTables/datatables.min.js' %}"
></script>
<style>
<!
--table
.dataTable
tbody
tr
.selected
{
-->
<!
--background-color
:
white
;
-->
<!
--color
:
#676a6c
;
-->
<!--//
background-color
:
transparent
;
-->
<!--
}
--
>
<!
--table
.dataTable
tbody
tr
.selected
td
.text-center
{
-->
<!
--background-color
:
#B0BED9
;
-->
<!--
}
--
>
</style>
{% endblock %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
...
...
apps/assets/templates/assets/asset_modal_list.html
View file @
e83ecb12
...
...
@@ -11,6 +11,7 @@
<th
class=
"text-center"
style=
"background-color:white"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
id=
"th_no"
>
id
</th>
<th>
资产名称
</th>
<th>
IP
</th>
<th>
硬件类型
</th>
...
...
@@ -26,6 +27,7 @@
{% else %}
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
></td>
{% endif %}
<td>
{{ asset.id }}
</td>
<td>
{{ asset.hostname }}
</td>
<td>
{{ asset.ip }}
</td>
<td>
虚拟机
</td>
...
...
@@ -44,74 +46,54 @@
<script
type=
"text/javascript"
>
$
(
'#close-btn'
).
on
(
'click'
,
function
(){
//alert('点击关闭按钮时触发;')
$
(
'#modal'
).
modal
(
'hide'
);
//$(window).load(function (){
$
(
document
).
ready
(
function
(){
var
table
=
$
(
'#editable'
).
DataTable
({
aLengthMenu
:
[[
2
,
25
,
50
,
-
1
],
[
"2"
,
"25"
,
"50"
,
"all"
]],
"aaSorting"
:
[[
2
,
"asc"
]],
"aoColumnDefs"
:
[
{
"bSortable"
:
false
,
"aTargets"
:
[
0
]
}],
"bAutoWidth"
:
false
,
columns
:
[
{
data
:
"checkbox"
},
{
data
:
"id"
},
{
data
:
"name"
},
{
data
:
"ip"
},
{
data
:
"type"
},
{
data
:
"group"
},
{
data
:
"dp"
}
]
});
table
.
column
(
'1'
).
visible
(
false
);
$
(
'#editable tbody'
).
on
(
'click'
,
'tr'
,
function
()
{
$
(
this
).
toggleClass
(
'selected'
);
});
$
(
'#save-btn'
).
on
(
'click'
,
function
(){
// alert('点击保存按钮时触发2;')
var
box
=
$
(
"input[name='checked']:checked"
);
var
size
=
box
.
length
;
//alert( table.rows('.selected').data().length +' row(s) selected' );
var
d
=
table
.
rows
(
'.selected'
).
data
(
);
var
size
=
d
.
length
;
document
.
getElementById
(
'add_asset'
).
value
=
size
;
var
ids
=
[]
;
var
column2
=
table
.
rows
(
'.selected'
).
data
()
;
$
(
"#asset_sed"
).
find
(
"input[name='assets']"
).
remove
();
for
(
var
i
=
0
;
i
<
box
.
length
;
i
++
){
var
value
=
$
(
box
[
i
]).
val
()
;
for
(
var
i
=
0
;
i
<
column2
.
length
;
i
++
){
var
value
=
column2
[
i
].
id
;
$
(
"#asset_sed"
).
append
(
"<input type='hidden' name='assets' value='"
+
value
+
"'>"
);
}
$
(
'#modal'
).
modal
(
'hide'
);
});
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
DataTable
({
"aaSorting"
:
[[
1
,
"asc"
]],
//给列表排序 ,第一个参数表示数组 (由0开始)。第二个参数为 desc或是asc
"aoColumnDefs"
:
[
{
"bSortable"
:
false
,
"aTargets"
:
[
0
]
}],
// 0列不参加排序
"aLengthMenu"
:
[[
10
,
25
,
50
,
-
1
],
[
"10"
,
"25"
,
"50"
,
"all"
]],
//设置每页显示记录的下拉菜单
"oLanguage"
:
{
"sLengthMenu"
:
"每页显示 _MENU_ 条记录"
,
"sZeroRecords"
:
"对不起,查询不到任何相关数据"
,
"sInfo"
:
"当前显示 _START_ 到 _END_ 条,共 _TOTAL_ 条记录"
,
"sInfoEmtpy"
:
"找不到相关数据"
,
"sInfoFiltered"
:
"数据表中共为 _MAX_ 条记录)"
,
"sProcessing"
:
"正在加载中..."
,
"sSearch"
:
"搜索"
,
"sUrl"
:
""
,
//多语言配置文件,可将oLanguage的设置放在一个txt文件中,例:Javascript/datatable/dtCH.txt
"oPaginate"
:
{
"sFirst"
:
"第一页"
,
"sPrevious"
:
" 上一页 "
,
"sNext"
:
" 下一页 "
,
"sLast"
:
" 最后一页 "
}
}
//多语言配置
});
/* Init DataTables */
var
oTable
=
$
(
'#editable'
).
DataTable
();
/* Apply the jEditable handlers to the table */
oTable
.
$
(
'td'
).
editable
(
'../example_ajax.php'
,
{
"callback"
:
function
(
sValue
,
y
)
{
var
aPos
=
oTable
.
fnGetPosition
(
this
);
oTable
.
fnUpdate
(
sValue
,
aPos
[
0
],
aPos
[
1
]
);
},
"submitdata"
:
function
(
value
,
settings
)
{
return
{
"row_id"
:
this
.
parentNode
.
getAttribute
(
'id'
),
"column"
:
oTable
.
fnGetPosition
(
this
)[
2
]
};
},
"width"
:
"90%"
,
"height"
:
"100%"
,
});
});
$
(
'#close-btn'
).
on
(
'click'
,
function
(){
//alert('点击关闭按钮时触发;')
$
(
'#modal'
).
modal
(
'hide'
);
});
function
fnClickAddRow
()
{
$
(
'#editable'
).
dataTable
().
fnAddData
(
[
"Custom row"
,
"New row"
,
"New row"
,
"New row"
,
"New row"
]
);
}
</script>
apps/users/templates/users/user_list.html
View file @
e83ecb12
...
...
@@ -51,6 +51,7 @@ $(document).ready(function(){
url
:
"{% static 'js/plugins/dataTables/i18n/language_code.json' %}"
.
replace
(
'language_code'
,
'{{ LANGUAGE_CODE }}'
)
},
order
:
[[
1
,
'asc'
]],
aLengthMenu
:
[[
3
,
10
,
25
,
50
,
-
1
],
[
"3"
,
"10"
,
"25"
,
"50"
,
"all"
]],
buttons
:
[
{
extend
:
'excel'
,
exportOptions
:
{
...
...
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