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
c931d317
Commit
c931d317
authored
8 years ago
by
右书僮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复资产组更新中 用户己选择的资产项不全问题
parent
c5666f13
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
asset_modal_list.html
apps/assets/templates/assets/asset_modal_list.html
+5
-5
views.py
apps/assets/views.py
+13
-3
No files found.
apps/assets/templates/assets/asset_modal_list.html
View file @
c931d317
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% for asset in asset
_modal_list
%}
{% for asset in asset
s
%}
{% if asset.id in all_assets %}
{% if asset.id in all_assets %}
<tr
name=
"oAssets"
class=
"odd selected text-center"
>
<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>
...
@@ -26,10 +26,10 @@
...
@@ -26,10 +26,10 @@
<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
class=
"text-center"
>
{{ asset.id }}
</td>
<td>
{{ asset.hostname }}
</td>
<td
class=
"text-center"
>
{{ asset.hostname }}
</td>
<td>
{{ asset.ip }}
</td>
<td
class=
"text-center"
>
{{ asset.ip }}
</td>
<td>
{{ asset.env }}-{{ asset.type }}
</td>
<td
class=
"text-center"
>
{{ asset.env }}-{{ asset.type }}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
...
This diff is collapsed.
Click to expand it.
apps/assets/views.py
View file @
c931d317
...
@@ -195,6 +195,7 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
...
@@ -195,6 +195,7 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
tag_id
=
self
.
request
.
GET
.
get
(
'tag_id'
)
tag_id
=
self
.
request
.
GET
.
get
(
'tag_id'
)
plain_id_lists
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
plain_id_lists
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
self
.
s
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
self
.
s
=
self
.
request
.
GET
.
get
(
'plain_id_lists'
)
assets
=
Asset
.
objects
.
all
()
if
","
in
str
(
self
.
s
):
if
","
in
str
(
self
.
s
):
self
.
plain_id_lists
=
[
int
(
x
)
for
x
in
self
.
s
.
split
(
','
)]
self
.
plain_id_lists
=
[
int
(
x
)
for
x
in
self
.
s
.
split
(
','
)]
else
:
else
:
...
@@ -206,19 +207,28 @@ class AssetModalListView(AdminUserRequiredMixin, ListView):
...
@@ -206,19 +207,28 @@ 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
,
'assets'
:
assets
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
if
group_id
:
if
group_id
:
group
=
AssetGroup
.
objects
.
get
(
id
=
group_id
)
group
=
AssetGroup
.
objects
.
get
(
id
=
group_id
)
print
group
context
=
{
context
=
{
'all_assets'
:
[
x
.
id
for
x
in
group
.
assets
.
all
()]
'all_assets'
:
[
x
.
id
for
x
in
group
.
assets
.
all
()],
'assets'
:
assets
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
if
tag_id
:
if
tag_id
:
tag
=
Tag
.
objects
.
get
(
id
=
tag_id
)
tag
=
Tag
.
objects
.
get
(
id
=
tag_id
)
context
=
{
context
=
{
'all_assets'
:
[
x
.
id
for
x
in
tag
.
asset_set
.
all
()]
'all_assets'
:
[
x
.
id
for
x
in
tag
.
asset_set
.
all
()],
'assets'
:
assets
}
kwargs
.
update
(
context
)
else
:
context
=
{
'assets'
:
assets
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
(
AssetModalListView
,
self
)
.
get_context_data
(
**
kwargs
)
return
super
(
AssetModalListView
,
self
)
.
get_context_data
(
**
kwargs
)
...
...
This diff is collapsed.
Click to expand it.
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