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
227cc4e9
Commit
227cc4e9
authored
Jul 31, 2018
by
BaiJiangJie
Committed by
老广
Jul 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 更新org下普通用户的资产详情 (#1619)
* [Update] 更新org下普通用户查看资产详情,只显示数据 * [Update] 优化org下普通用户查看资产详情前端代码
parent
01bef95e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
_user_asset_detail_modal.html
apps/assets/templates/assets/_user_asset_detail_modal.html
+21
-0
user_asset_list.html
apps/assets/templates/assets/user_asset_list.html
+42
-4
No files found.
apps/assets/templates/assets/_user_asset_detail_modal.html
0 → 100644
View file @
227cc4e9
{% extends '_modal.html' %}
{% load i18n %}
{% load static %}
{% block modal_id %}user_asset_detail_modal{% endblock %}
{% block modal_title %}{% trans "Asset detail" %}{% endblock %}
{% block modal_body %}
<div
class=
"ibox-content"
>
<table
class=
"table"
>
<tbody
id=
"asset_detail_tbody"
>
</tbody>
</table>
</div>
{% endblock %}
{% block modal_button %}
<button
data-dismiss=
"modal"
class=
"btn btn-white"
type=
"button"
>
{% trans "Close" %}
</button>
{% endblock %}
apps/assets/templates/assets/user_asset_list.html
View file @
227cc4e9
...
...
@@ -55,8 +55,11 @@
</div>
</div>
</div>
{% include 'assets/_user_asset_detail_modal.html' %}
{% endblock %}
{% block custom_foot_js %}
<script>
var
zTree
,
rMenu
,
asset_table
;
...
...
@@ -71,11 +74,15 @@ function initTable() {
var
options
=
{
ele
:
$
(
'#user_assets_table'
),
columnDefs
:
[
{
#
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
#
}
{
#
{
%
url
'assets:asset-detail'
pk
=
DEFAULT_PK
as
the_url
%
}
#
}
{
#
var
detail_btn
=
'<a href="{{ the_url }}">'
+
cellData
+
'</a>'
;
#
}
{
#
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
#
}
{
#
}},
#
}
{
targets
:
1
,
createdCell
:
function
(
td
,
cellData
,
rowData
)
{
{
%
url
'assets:asset-detail'
pk
=
DEFAULT_PK
as
the_url
%
}
var
detail_btn
=
'<a href="{{ the_url }}">'
+
cellData
+
'</a>'
;
$
(
td
).
html
(
detail_btn
.
replace
(
'{{ DEFAULT_PK }}'
,
rowData
.
id
));
}},
var
detail_btn
=
'<a class="asset_detail" asset-id="rowData_id" data-toggle="modal" data-target="#user_asset_detail_modal" tabindex="0">'
+
cellData
+
'</a>'
$
(
td
).
html
(
detail_btn
.
replace
(
"rowData_id"
,
rowData
.
id
));
}},
{
targets
:
3
,
createdCell
:
function
(
td
,
cellData
)
{
if
(
!
cellData
)
{
$
(
td
).
html
(
'<i class="fa fa-times text-danger"></i>'
)
...
...
@@ -165,7 +172,37 @@ function initTree() {
$
(
document
).
ready
(
function
()
{
initTree
();
})
.
on
(
'click'
,
'.asset_detail'
,
function
()
{
var
data
=
asset_table
.
ajax
.
json
();
var
asset_id
=
this
.
getAttribute
(
"asset-id"
);
var
trs
=
''
;
var
desc
=
{
'hostname'
:
"{% trans 'Hostname' %}"
,
'ip'
:
"{% trans 'IP' %}"
,
'port'
:
"{% trans 'Port' %}"
,
'protocol'
:
"{% trans 'Protocol' %}"
,
'platform'
:
"{% trans 'Platform' %}"
,
'os'
:
"{% trans 'OS' %}"
,
'system_users_join'
:
"{% trans 'System user' %}"
,
'domain'
:
"{% trans 'Domain' %}"
,
'is_active'
:
"{% trans 'Is active' %}"
,
'comment'
:
"{% trans 'Comment' %}"
{
#
'date_joined'
:
"{% trans 'Date joined' %}"
,
#
}
};
$
.
each
(
data
,
function
(
index
,
value
){
if
(
value
.
id
===
asset_id
){
for
(
var
i
in
desc
){
trs
+=
"<tr>
\n
"
+
"<td>"
+
desc
[
i
]
+
":</td>"
+
"<td><b>"
+
(
value
[
i
]
===
null
?
''
:
value
[
i
])
+
"</b></td>
\n
"
+
"</tr>"
;
}
}
});
$
(
'#asset_detail_tbody'
).
html
(
trs
)
});
</script>
{% endblock %}
\ No newline at end of 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