mirror of https://github.com/jumpserver/jumpserver
fix bugs
parent
d42197db3a
commit
f9b1d3059a
|
@ -311,8 +311,12 @@ def write_excel(asset_all):
|
|||
group_all = '/'.join(group_list)
|
||||
status = asset.get_status_display()
|
||||
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,
|
||||
asset.disk, (asset.system_type + asset.system_version), asset.cabinet, group_all, status,
|
||||
asset.disk, system_os, asset.cabinet, group_all, status,
|
||||
asset.comment]
|
||||
data.append(alter_dic)
|
||||
format = workbook.add_format()
|
||||
|
|
|
@ -13,7 +13,7 @@ from ansible_api import Tasks
|
|||
@require_role('admin')
|
||||
def group_add(request):
|
||||
"""
|
||||
Add asset group
|
||||
Group add view
|
||||
添加资产组
|
||||
"""
|
||||
header_title, path1, path2 = u'添加资产组', u'资产管理', u'添加资产组'
|
||||
|
@ -47,7 +47,7 @@ def group_add(request):
|
|||
@require_role('admin')
|
||||
def group_edit(request):
|
||||
"""
|
||||
Edit asset group
|
||||
Group edit view
|
||||
编辑资产组
|
||||
"""
|
||||
header_title, path1, path2 = u'编辑主机组', u'资产管理', u'编辑主机组'
|
||||
|
@ -89,7 +89,10 @@ def group_edit(request):
|
|||
|
||||
@require_role('admin')
|
||||
def group_detail(request):
|
||||
""" 主机组详情 """
|
||||
"""
|
||||
Group detail view
|
||||
主机组详情
|
||||
"""
|
||||
header_title, path1, path2 = u'主机组详情', u'资产管理', u'主机组详情'
|
||||
group_id = request.GET.get('id', '')
|
||||
group = get_object(AssetGroup, id=group_id)
|
||||
|
@ -121,7 +124,7 @@ def group_list(request):
|
|||
@require_role('admin')
|
||||
def group_del(request):
|
||||
"""
|
||||
del asset group
|
||||
Group delete view
|
||||
删除主机组
|
||||
"""
|
||||
group_ids = request.GET.get('id', '')
|
||||
|
@ -293,7 +296,7 @@ def asset_list(request):
|
|||
s = write_excel(asset_find)
|
||||
if s[0]:
|
||||
file_name = s[1]
|
||||
smg = 'excel文件已生成,请点击下载!'
|
||||
smg = u'excel文件已生成,请点击下载!'
|
||||
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)
|
||||
return my_render('jasset/asset_list.html', locals(), request)
|
||||
|
@ -463,7 +466,7 @@ def idc_del(request):
|
|||
@require_role('admin')
|
||||
def asset_upload(request):
|
||||
"""
|
||||
Upload file view
|
||||
Upload asset excel file view
|
||||
"""
|
||||
if request.method == 'POST':
|
||||
excel_file = request.FILES.get('file_name', '')
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -91,7 +91,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<td class="text-navy">硬盘</td>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<div class="col-md-12 column">
|
||||
<div class="alert alert-success alert-dismissable">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4>
|
||||
</h4> <strong>Nice!</strong> excel文件已生成请点击 <a href="/static/files/excels/{{ file_name }}" target="_blank" class="alert-link">下载</a>
|
||||
<strong>Nice!</strong> excel文件已生成请点击 <a href="/static/files/excels/{{ file_name }}" target="_blank" class="alert-link">下载</a>
|
||||
</div>
|
||||
</div>
|
|
@ -169,17 +169,17 @@
|
|||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#editable').editableTableWidget({editor: $('<textarea>')});
|
||||
$('.asset_del').click(function(){
|
||||
var row = $(this).closest('tr');
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function(data){
|
||||
alert(data);
|
||||
row.remove()
|
||||
}
|
||||
)
|
||||
if (confirm("确定删除")) {
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function (data) {
|
||||
row.remove()
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<td class="text-center">
|
||||
<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 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>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -88,16 +88,17 @@
|
|||
{% block self_footer_js %}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#del').click(function(){
|
||||
$('.group_del').click(function(){
|
||||
var row = $(this).closest('tr');
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function(data){
|
||||
row.remove();
|
||||
alert(data)
|
||||
}
|
||||
)
|
||||
if (confirm('确定删除')) {
|
||||
$.get(
|
||||
$(this).attr('value'),
|
||||
{},
|
||||
function (data) {
|
||||
row.remove();
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
$('#del_check').click(function(){
|
||||
|
@ -111,15 +112,12 @@
|
|||
{id: check_array.join(',')},
|
||||
function(data){
|
||||
$('tr.gradeX input:checked').closest('tr').remove();
|
||||
alert(data);
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue