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
c5666f13
Commit
c5666f13
authored
Mar 24, 2017
by
右书僮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some files
parent
3f72ce4b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
38 deletions
+30
-38
asset_group_create.html
apps/assets/templates/assets/asset_group_create.html
+0
-1
asset_modal_list.html
apps/assets/templates/assets/asset_modal_list.html
+13
-19
asset_modal_update.html
apps/assets/templates/assets/asset_modal_update.html
+14
-16
views.py
apps/assets/views.py
+3
-2
No files found.
apps/assets/templates/assets/asset_group_create.html
View file @
c5666f13
...
@@ -99,7 +99,6 @@
...
@@ -99,7 +99,6 @@
keyboard
:
'false'
,
keyboard
:
'false'
,
remote
:
"{% url 'assets:asset-modal-list' %}?group_id={{ group_id }}"
remote
:
"{% url 'assets:asset-modal-list' %}?group_id={{ group_id }}"
});
});
$
(
'#modal'
).
on
(
'show.bs.modal'
,
function
(){
$
(
'#modal'
).
on
(
'show.bs.modal'
,
function
(){
//alert('当调用show方法时,立即触发;')
//alert('当调用show方法时,立即触发;')
});
});
...
...
apps/assets/templates/assets/asset_modal_list.html
View file @
c5666f13
...
@@ -14,26 +14,22 @@
...
@@ -14,26 +14,22 @@
<th
id=
"th_no"
>
id
</th>
<th
id=
"th_no"
>
id
</th>
<th>
资产名称
</th>
<th>
资产名称
</th>
<th>
IP
</th>
<th>
IP
</th>
<th>
硬件类型
</th>
<th>
类型
</th>
<th>
资产组
</th>
<th>
部门
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% for asset in asset_modal_list %}
{% for asset in asset_modal_list %}
{% if asset.id in all_assets %}
{% if asset.id in all_assets %}
<tr
name=
"oAssets"
class=
"odd selected"
>
<tr
name=
"oAssets"
class=
"odd selected
text-center
"
>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
checked=
"checked"
></td>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
checked=
"checked"
></td>
{% else %}
{% else %}
<tr
name=
"oAssets"
>
<tr
name=
"oAssets"
>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
></td>
<td
class=
"text-center"
><input
type=
"checkbox"
name=
"checked"
value=
"{{ asset.id }}"
></td>
{% endif %}
{% endif %}
<td>
{{ asset.id }}
</td>
<td>
{{ asset.id }}
</td>
<td>
{{ asset.hostname }}
</td>
<td>
{{ asset.hostname }}
</td>
<td>
{{ asset.ip }}
</td>
<td>
{{ asset.ip }}
</td>
<td>
虚拟机
</td>
<td>
{{ asset.env }}-{{ asset.type }}
</td>
<td>
网络设备
</td>
<td>
微信事业部
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
@@ -61,9 +57,7 @@ $(document).ready(function(){
...
@@ -61,9 +57,7 @@ $(document).ready(function(){
{
data
:
"id"
},
{
data
:
"id"
},
{
data
:
"hostname"
},
{
data
:
"hostname"
},
{
data
:
"ip"
},
{
data
:
"ip"
},
{
data
:
"type"
},
{
data
:
"type"
}
{
data
:
"group"
},
{
data
:
"dp"
}
]
]
});
});
//将ID列隐藏
//将ID列隐藏
...
@@ -77,18 +71,18 @@ $(document).ready(function(){
...
@@ -77,18 +71,18 @@ $(document).ready(function(){
}
else
{
}
else
{
$
(
this
).
addClass
(
'selected'
);
$
(
this
).
addClass
(
'selected'
);
this
.
children
[
0
].
children
[
0
].
checked
=
1
;
this
.
children
[
0
].
children
[
0
].
checked
=
1
;
}
;
}
});
});
$
(
'#close-btn'
).
on
(
'click'
,
function
(){
$
(
'#close-btn'
).
on
(
'click'
,
function
(){
$
(
'#modal'
).
modal
(
'hide'
);
$
(
'#modal'
).
modal
(
'hide'
);
});
});
var
size_name
=
document
.
getElementById
(
'asset_on_count'
).
innerText
var
size_name
=
document
.
getElementById
(
'asset_on_count'
).
innerText
;
$
(
'#save-btn'
).
on
(
'click'
,
function
(){
$
(
'#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
d
=
table
.
rows
(
'.selected'
).
data
();
var
size
=
d
.
length
;
var
size
=
d
.
length
;
var
re
=
/
\d
+/
var
re
=
/
\d
+/
;
document
.
getElementById
(
'add_asset'
).
value
=
size
;
document
.
getElementById
(
'add_asset'
).
value
=
size
;
var
str
=
size_name
;
var
str
=
size_name
;
var
re
=
/
\d
+/g
;
var
re
=
/
\d
+/g
;
...
@@ -109,8 +103,8 @@ $(document).ready(function(){
...
@@ -109,8 +103,8 @@ $(document).ready(function(){
});
//$(document).ready
});
//$(document).ready
var
bCheck
=
1
;
var
bCheck
=
1
;
function
checkAll
(){
function
checkAll
(){
if
(
bCheck
){
if
(
bCheck
){
$
(
"tr[name='oAssets']"
).
each
(
function
(){
$
(
"tr[name='oAssets']"
).
each
(
function
(){
oCheckbox
=
this
.
children
[
0
].
children
[
0
];
oCheckbox
=
this
.
children
[
0
].
children
[
0
];
...
@@ -127,7 +121,7 @@ $(document).ready(function(){
...
@@ -127,7 +121,7 @@ $(document).ready(function(){
});
});
document
.
getElementById
(
'check_all'
).
checked
=
0
;
document
.
getElementById
(
'check_all'
).
checked
=
0
;
bCheck
=
1
;
bCheck
=
1
;
};
}
};
}
</script>
</script>
apps/assets/templates/assets/asset_modal_update.html
View file @
c5666f13
...
@@ -43,7 +43,6 @@
...
@@ -43,7 +43,6 @@
</div>
</div>
</form>
</form>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"ydxbd"
id=
"formlists"
style=
"display: block;"
>
<div
class=
"ydxbd"
id=
"formlists"
style=
"display: block;"
>
<p
id=
"tags_p"
class=
"mgl-5 c02"
>
选择需要修改属性
</p>
<p
id=
"tags_p"
class=
"mgl-5 c02"
>
选择需要修改属性
</p>
<div
class=
"tagBtnList"
>
<div
class=
"tagBtnList"
>
...
@@ -67,7 +66,6 @@
...
@@ -67,7 +66,6 @@
<a
onclick=
"AddForm(this,'id_comment')"
class=
"tagBtn2 label label-default"
name=
"changebtn"
>
备注
</a>
<a
onclick=
"AddForm(this,'id_comment')"
class=
"tagBtn2 label label-default"
name=
"changebtn"
>
备注
</a>
</div>
</div>
</div>
</div>
<input
name=
"assets_ids"
type=
"hidden"
value=
"111"
>
<input
name=
"assets_ids"
type=
"hidden"
value=
"111"
>
<input
name=
"assets_ids"
type=
"hidden"
value=
"112"
>
<input
name=
"assets_ids"
type=
"hidden"
value=
"112"
>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
...
@@ -130,15 +128,15 @@
...
@@ -130,15 +128,15 @@
$
(
'.select2'
).
select2
();
$
(
'.select2'
).
select2
();
$
(
"#id_tags"
).
select2
({
$
(
"#id_tags"
).
select2
({
tags
:
true
,
tags
:
true
,
maximumSelectionLength
:
8
,
//最多能够选择的个数
maximumSelectionLength
:
8
//最多能够选择的个数
//closeOnSelect: false
//closeOnSelect: false
});
});
}
;
}
function
AddForm
(
obj
,
id_form
)
{
function
AddForm
(
obj
,
id_form
)
{
var
oHiddenForms
=
document
.
getElementById
(
"ridd"
);
var
oHiddenForms
=
document
.
getElementById
(
"ridd"
);
var
parentElem
=
document
.
getElementById
(
"add_form"
);
var
parentElem
=
document
.
getElementById
(
"add_form"
);
var
oH
=
document
.
getElementById
(
id_form
);
var
oH
=
document
.
getElementById
(
id_form
);
var
oNew
=
oH
.
parentNode
.
parentNode
var
oNew
=
oH
.
parentNode
.
parentNode
;
var
aDiv
=
parentElem
.
getElementsByClassName
(
'form-group'
);
var
aDiv
=
parentElem
.
getElementsByClassName
(
'form-group'
);
if
(
oNew
.
parentNode
.
id
==
'ridd'
)
{
if
(
oNew
.
parentNode
.
id
==
'ridd'
)
{
obj
.
className
=
"tagBtn2 label label-warning"
;
obj
.
className
=
"tagBtn2 label label-warning"
;
...
@@ -148,15 +146,15 @@
...
@@ -148,15 +146,15 @@
oHiddenForms
.
appendChild
(
oNew
);
oHiddenForms
.
appendChild
(
oNew
);
obj
.
className
=
"tagBtn2 label label-default"
;
obj
.
className
=
"tagBtn2 label label-default"
;
SetSelect2
();
SetSelect2
();
}
;
}
}
;
}
function
ChangeBtnCss
(
class_var
){
function
ChangeBtnCss
(
class_var
){
var
changebtns
=
$
(
"#formlists"
).
find
(
"a[name='changebtn']"
)
var
changebtns
=
$
(
"#formlists"
).
find
(
"a[name='changebtn']"
)
;
for
(
var
i
=
0
;
i
<
changebtns
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
changebtns
.
length
;
i
++
){
changebtns
[
i
].
className
=
class_var
;
changebtns
[
i
].
className
=
class_var
;
}
;
}
}
;
}
function
AddAllForm
(
obj
)
{
function
AddAllForm
(
obj
)
{
var
oHiddenForms
=
document
.
getElementById
(
"ridd"
);
var
oHiddenForms
=
document
.
getElementById
(
"ridd"
);
var
parentElem
=
document
.
getElementById
(
"add_form"
);
var
parentElem
=
document
.
getElementById
(
"add_form"
);
...
@@ -167,18 +165,18 @@
...
@@ -167,18 +165,18 @@
if
(
oHidden_len
==
0
||
obj
.
innerText
==
"取消全选"
){
if
(
oHidden_len
==
0
||
obj
.
innerText
==
"取消全选"
){
for
(
var
i
=
0
;
i
<
aDiv_len
-
1
;
i
++
){
for
(
var
i
=
0
;
i
<
aDiv_len
-
1
;
i
++
){
oHiddenForms
.
appendChild
(
aDiv
[
0
]);
oHiddenForms
.
appendChild
(
aDiv
[
0
]);
}
;
}
ChangeBtnCss
(
"tagBtn2 label label-default"
);
ChangeBtnCss
(
"tagBtn2 label label-default"
);
$
(
'#changeall'
).
text
(
"全选"
);
$
(
'#changeall'
).
text
(
"全选"
);
}
else
{
}
else
{
for
(
var
i
=
0
;
i
<
oHidden_len
;
i
++
){
for
(
var
i
=
0
;
i
<
oHidden_len
;
i
++
){
parentElem
.
insertBefore
(
oHiddenForms
.
children
[
0
],
bFormBtn
);
parentElem
.
insertBefore
(
oHiddenForms
.
children
[
0
],
bFormBtn
);
}
;
}
ChangeBtnCss
(
"tagBtn2 label label-warning"
);
ChangeBtnCss
(
"tagBtn2 label label-warning"
);
$
(
'#changeall'
).
text
(
"取消全选"
);
$
(
'#changeall'
).
text
(
"取消全选"
);
SetSelect2
();
SetSelect2
();
}
;
}
}
;
}
function
fsubmit
(){
function
fsubmit
(){
...
@@ -202,11 +200,11 @@
...
@@ -202,11 +200,11 @@
for
(
var
i
=
0
;
i
<
m
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
m
.
length
;
i
++
){
alert
(
m
[
0
].
value
);
alert
(
m
[
0
].
value
);
oForm
.
appendChild
(
m
[
0
]);
oForm
.
appendChild
(
m
[
0
]);
}
;
}
action
=
"/assets/asset/"
+
assets_id
[
0
].
value
+
"/update"
;
action
=
"/assets/asset/"
+
assets_id
[
0
].
value
+
"/update"
;
oForm
.
action
=
action
;
oForm
.
action
=
action
;
oForm
.
submit
();
oForm
.
submit
();
}
;
}
}
}
</script>
</script>
{% endblock %}
{% endblock %}
apps/assets/views.py
View file @
c5666f13
...
@@ -206,7 +206,7 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
...
@@ -206,7 +206,7 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
else
:
else
:
plain_id_lists
=
[
int
(
self
.
s
)]
plain_id_lists
=
[
int
(
self
.
s
)]
context
=
{
context
=
{
'all_assets'
:
plain_id_lists
'all_assets'
:
plain_id_lists
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
if
group_id
:
if
group_id
:
...
@@ -304,7 +304,8 @@ class AssetGroupUpdateView(AdminUserRequiredMixin, UpdateView):
...
@@ -304,7 +304,8 @@ class AssetGroupUpdateView(AdminUserRequiredMixin, UpdateView):
'action'
:
_
(
'Create asset group'
),
'action'
:
_
(
'Create asset group'
),
'assets_on_list'
:
assets_all
,
'assets_on_list'
:
assets_all
,
'assets_count'
:
len
(
assets_all
),
'assets_count'
:
len
(
assets_all
),
'group_id'
:
self
.
object
.
id
,
'group_id'
:
self
.
object
.
id
,
'tags'
:
Tag
.
objects
.
all
()
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
(
AssetGroupUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
return
super
(
AssetGroupUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
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