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
f9b1d305
Commit
f9b1d305
authored
Nov 19, 2015
by
halcyon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs
parent
d42197db
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
25 additions
and
20 deletions
+25
-20
asset_api.py
jasset/asset_api.py
+5
-1
views.py
jasset/views.py
+9
-6
cmdb_excel_2015_11_18_21_40.xlsx
static/files/excels/cmdb_excel_2015_11_18_21_40.xlsx
+0
-0
cmdb_excel_2015_11_18_21_52.xlsx
static/files/excels/cmdb_excel_2015_11_18_21_52.xlsx
+0
-0
cmdb_excel_2015_11_18_21_53.xlsx
static/files/excels/cmdb_excel_2015_11_18_21_53.xlsx
+0
-0
cmdb_excel_2015_11_18_21_54.xlsx
static/files/excels/cmdb_excel_2015_11_18_21_54.xlsx
+0
-0
cmdb_excel_2015_11_18_22_17.xlsx
static/files/excels/cmdb_excel_2015_11_18_22_17.xlsx
+0
-0
asset_detail.html
templates/jasset/asset_detail.html
+1
-1
asset_excel_download.html
templates/jasset/asset_excel_download.html
+2
-2
asset_list.html
templates/jasset/asset_list.html
+3
-3
group_list.html
templates/jasset/group_list.html
+5
-7
No files found.
jasset/asset_api.py
View file @
f9b1d305
...
@@ -311,8 +311,12 @@ def write_excel(asset_all):
...
@@ -311,8 +311,12 @@ def write_excel(asset_all):
group_all
=
'/'
.
join
(
group_list
)
group_all
=
'/'
.
join
(
group_list
)
status
=
asset
.
get_status_display
()
status
=
asset
.
get_status_display
()
idc_name
=
asset
.
idc
.
name
if
asset
.
idc
else
u''
idc_name
=
asset
.
idc
.
name
if
asset
.
idc
else
u''
system_type
=
asset
.
system_type
if
asset
.
idc
else
u''
system_version
=
asset
.
system_version
if
asset
.
idc
else
u''
system_os
=
unicode
(
system_type
)
+
unicode
(
system_version
)
alter_dic
=
[
asset
.
hostname
,
asset
.
ip
,
idc_name
,
asset
.
mac
,
asset
.
remote_ip
,
asset
.
cpu
,
asset
.
memory
,
alter_dic
=
[
asset
.
hostname
,
asset
.
ip
,
idc_name
,
asset
.
mac
,
asset
.
remote_ip
,
asset
.
cpu
,
asset
.
memory
,
asset
.
disk
,
(
asset
.
system_type
+
asset
.
system_version
)
,
asset
.
cabinet
,
group_all
,
status
,
asset
.
disk
,
system_os
,
asset
.
cabinet
,
group_all
,
status
,
asset
.
comment
]
asset
.
comment
]
data
.
append
(
alter_dic
)
data
.
append
(
alter_dic
)
format
=
workbook
.
add_format
()
format
=
workbook
.
add_format
()
...
...
jasset/views.py
View file @
f9b1d305
...
@@ -13,7 +13,7 @@ from ansible_api import Tasks
...
@@ -13,7 +13,7 @@ from ansible_api import Tasks
@require_role
(
'admin'
)
@require_role
(
'admin'
)
def
group_add
(
request
):
def
group_add
(
request
):
"""
"""
Add asset group
Group add view
添加资产组
添加资产组
"""
"""
header_title
,
path1
,
path2
=
u'添加资产组'
,
u'资产管理'
,
u'添加资产组'
header_title
,
path1
,
path2
=
u'添加资产组'
,
u'资产管理'
,
u'添加资产组'
...
@@ -47,7 +47,7 @@ def group_add(request):
...
@@ -47,7 +47,7 @@ def group_add(request):
@require_role
(
'admin'
)
@require_role
(
'admin'
)
def
group_edit
(
request
):
def
group_edit
(
request
):
"""
"""
Edit asset group
Group edit view
编辑资产组
编辑资产组
"""
"""
header_title
,
path1
,
path2
=
u'编辑主机组'
,
u'资产管理'
,
u'编辑主机组'
header_title
,
path1
,
path2
=
u'编辑主机组'
,
u'资产管理'
,
u'编辑主机组'
...
@@ -89,7 +89,10 @@ def group_edit(request):
...
@@ -89,7 +89,10 @@ def group_edit(request):
@require_role
(
'admin'
)
@require_role
(
'admin'
)
def
group_detail
(
request
):
def
group_detail
(
request
):
""" 主机组详情 """
"""
Group detail view
主机组详情
"""
header_title
,
path1
,
path2
=
u'主机组详情'
,
u'资产管理'
,
u'主机组详情'
header_title
,
path1
,
path2
=
u'主机组详情'
,
u'资产管理'
,
u'主机组详情'
group_id
=
request
.
GET
.
get
(
'id'
,
''
)
group_id
=
request
.
GET
.
get
(
'id'
,
''
)
group
=
get_object
(
AssetGroup
,
id
=
group_id
)
group
=
get_object
(
AssetGroup
,
id
=
group_id
)
...
@@ -121,7 +124,7 @@ def group_list(request):
...
@@ -121,7 +124,7 @@ def group_list(request):
@require_role
(
'admin'
)
@require_role
(
'admin'
)
def
group_del
(
request
):
def
group_del
(
request
):
"""
"""
del asset group
Group delete view
删除主机组
删除主机组
"""
"""
group_ids
=
request
.
GET
.
get
(
'id'
,
''
)
group_ids
=
request
.
GET
.
get
(
'id'
,
''
)
...
@@ -293,7 +296,7 @@ def asset_list(request):
...
@@ -293,7 +296,7 @@ def asset_list(request):
s
=
write_excel
(
asset_find
)
s
=
write_excel
(
asset_find
)
if
s
[
0
]:
if
s
[
0
]:
file_name
=
s
[
1
]
file_name
=
s
[
1
]
smg
=
'excel文件已生成,请点击下载!'
smg
=
u
'excel文件已生成,请点击下载!'
return
my_render
(
'jasset/asset_excel_download.html'
,
locals
(),
request
)
return
my_render
(
'jasset/asset_excel_download.html'
,
locals
(),
request
)
assets_list
,
p
,
assets
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
asset_find
,
request
)
assets_list
,
p
,
assets
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
asset_find
,
request
)
return
my_render
(
'jasset/asset_list.html'
,
locals
(),
request
)
return
my_render
(
'jasset/asset_list.html'
,
locals
(),
request
)
...
@@ -463,7 +466,7 @@ def idc_del(request):
...
@@ -463,7 +466,7 @@ def idc_del(request):
@require_role
(
'admin'
)
@require_role
(
'admin'
)
def
asset_upload
(
request
):
def
asset_upload
(
request
):
"""
"""
Upload file view
Upload
asset excel
file view
"""
"""
if
request
.
method
==
'POST'
:
if
request
.
method
==
'POST'
:
excel_file
=
request
.
FILES
.
get
(
'file_name'
,
''
)
excel_file
=
request
.
FILES
.
get
(
'file_name'
,
''
)
...
...
static/files/excels/cmdb_excel_2015_11_18_21_40.xlsx
0 → 100644
View file @
f9b1d305
File added
static/files/excels/cmdb_excel_2015_11_18_21_52.xlsx
0 → 100644
View file @
f9b1d305
File added
static/files/excels/cmdb_excel_2015_11_18_21_53.xlsx
0 → 100644
View file @
f9b1d305
File added
static/files/excels/cmdb_excel_2015_11_18_21_54.xlsx
0 → 100644
View file @
f9b1d305
File added
static/files/excels/cmdb_excel_2015_11_18_22_17.xlsx
0 → 100644
View file @
f9b1d305
File added
templates/jasset/asset_detail.html
View file @
f9b1d305
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
</tr>
</tr>
<tr>
<tr>
<td
class=
"text-navy"
>
内存
</td>
<td
class=
"text-navy"
>
内存
</td>
<td>
{{ asset.memory|default_if_none:"" }}
</td>
<td>
{{ asset.memory|default_if_none:"" }}
{% if asset.memory %}M{% endif %}
</td>
</tr>
</tr>
<tr>
<tr>
<td
class=
"text-navy"
>
硬盘
</td>
<td
class=
"text-navy"
>
硬盘
</td>
...
...
templates/jasset/asset_excel_download.html
View file @
f9b1d305
<div
class=
"col-md-12 column"
>
<div
class=
"col-md-12 column"
>
<div
class=
"alert alert-success alert-dismissable"
>
<div
class=
"alert alert-success alert-dismissable"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-hidden=
"true"
>
×
</button>
<button
type=
"button"
class=
"close"
data-dismiss=
"alert"
aria-hidden=
"true"
>
×
</button>
<h4>
<strong>
Nice!
</strong>
excel文件已生成请点击
<a
href=
"/static/files/excels/{{ file_name }}"
target=
"_blank"
class=
"alert-link"
>
下载
</a>
</h4>
<strong>
Nice!
</strong>
excel文件已生成请点击
<a
href=
"/static/files/excels/{{ file_name }}"
target=
"_blank"
class=
"alert-link"
>
下载
</a>
</div>
</div>
</div>
</div>
\ No newline at end of file
templates/jasset/asset_list.html
View file @
f9b1d305
...
@@ -169,17 +169,17 @@
...
@@ -169,17 +169,17 @@
});
});
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
'#editable'
).
editableTableWidget
({
editor
:
$
(
'<textarea>'
)});
$
(
'.asset_del'
).
click
(
function
(){
$
(
'.asset_del'
).
click
(
function
(){
var
row
=
$
(
this
).
closest
(
'tr'
);
var
row
=
$
(
this
).
closest
(
'tr'
);
if
(
confirm
(
"确定删除"
))
{
$
.
get
(
$
.
get
(
$
(
this
).
attr
(
'value'
),
$
(
this
).
attr
(
'value'
),
{},
{},
function
(
data
){
function
(
data
)
{
alert
(
data
);
row
.
remove
()
row
.
remove
()
}
}
)
)
}
})
})
});
});
...
...
templates/jasset/group_list.html
View file @
f9b1d305
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
<td
class=
"text-center"
>
<td
class=
"text-center"
>
<a
href=
"/jasset/group_detail/?id={{ asset_group.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
<a
href=
"/jasset/group_detail/?id={{ asset_group.id }}"
class=
"btn btn-xs btn-info"
>
详情
</a>
<a
href=
"/jasset/group_edit/?id={{ asset_group.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"/jasset/group_edit/?id={{ asset_group.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
value=
"/jasset/group_del/?id={{ asset_group.id }}"
id=
"del"
class=
"btn btn-xs btn-danger
"
>
删除
</a>
<a
value=
"/jasset/group_del/?id={{ asset_group.id }}"
class=
"btn btn-xs btn-danger group_del
"
>
删除
</a>
</td>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
...
@@ -88,16 +88,17 @@
...
@@ -88,16 +88,17 @@
{% block self_footer_js %}
{% block self_footer_js %}
<script>
<script>
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
'
#
del'
).
click
(
function
(){
$
(
'
.group_
del'
).
click
(
function
(){
var
row
=
$
(
this
).
closest
(
'tr'
);
var
row
=
$
(
this
).
closest
(
'tr'
);
if
(
confirm
(
'确定删除'
))
{
$
.
get
(
$
.
get
(
$
(
this
).
attr
(
'value'
),
$
(
this
).
attr
(
'value'
),
{},
{},
function
(
data
)
{
function
(
data
)
{
row
.
remove
();
row
.
remove
();
alert
(
data
)
}
}
)
)
}
});
});
$
(
'#del_check'
).
click
(
function
(){
$
(
'#del_check'
).
click
(
function
(){
...
@@ -111,15 +112,12 @@
...
@@ -111,15 +112,12 @@
{
id
:
check_array
.
join
(
','
)},
{
id
:
check_array
.
join
(
','
)},
function
(
data
){
function
(
data
){
$
(
'tr.gradeX input:checked'
).
closest
(
'tr'
).
remove
();
$
(
'tr.gradeX input:checked'
).
closest
(
'tr'
).
remove
();
alert
(
data
);
}
}
)
)
}
}
})
})
});
});
</script>
</script>
{% endblock %}
{% endblock %}
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