mirror of https://github.com/jumpserver/jumpserver
Merge branch 'dev' of git.coding.net:jumpserver/jumpserver into dev
commit
3176608eaa
|
@ -285,9 +285,13 @@ def asset_list(request):
|
||||||
if user_perm != 0:
|
if user_perm != 0:
|
||||||
asset_find = Asset.objects.all()
|
asset_find = Asset.objects.all()
|
||||||
else:
|
else:
|
||||||
|
asset_id_all = []
|
||||||
user = get_object(User, username=username)
|
user = get_object(User, username=username)
|
||||||
asset_perm = get_group_user_perm(user) if user else {'asset': ''}
|
asset_perm = get_group_user_perm(user) if user else {'asset': ''}
|
||||||
asset_find = asset_perm['asset'].keys()
|
user_asset_perm = asset_perm['asset'].keys()
|
||||||
|
for asset in user_asset_perm:
|
||||||
|
asset_id_all.append(asset.id)
|
||||||
|
asset_find = Asset.objects.filter(pk__in=asset_id_all)
|
||||||
asset_group_all = list(asset_perm['asset_group'])
|
asset_group_all = list(asset_perm['asset_group'])
|
||||||
|
|
||||||
if idc_name:
|
if idc_name:
|
||||||
|
@ -309,10 +313,16 @@ def asset_list(request):
|
||||||
Q(ip__contains=keyword) |
|
Q(ip__contains=keyword) |
|
||||||
Q(remote_ip__contains=keyword) |
|
Q(remote_ip__contains=keyword) |
|
||||||
Q(comment__contains=keyword) |
|
Q(comment__contains=keyword) |
|
||||||
|
Q(username__contains=keyword) |
|
||||||
Q(group__name__contains=keyword) |
|
Q(group__name__contains=keyword) |
|
||||||
Q(cpu__contains=keyword) |
|
Q(cpu__contains=keyword) |
|
||||||
Q(memory__contains=keyword) |
|
Q(memory__contains=keyword) |
|
||||||
Q(disk__contains=keyword))
|
Q(disk__contains=keyword) |
|
||||||
|
Q(brand__contains=keyword) |
|
||||||
|
Q(cabinet__contains=keyword) |
|
||||||
|
Q(sn__contains=keyword) |
|
||||||
|
Q(system_type__contains=keyword) |
|
||||||
|
Q(system_version__contains=keyword))
|
||||||
|
|
||||||
if export:
|
if export:
|
||||||
if asset_id_all:
|
if asset_id_all:
|
||||||
|
|
|
@ -24,7 +24,61 @@
|
||||||
|
|
||||||
<div class="ibox-content">
|
<div class="ibox-content">
|
||||||
<form id="asset_form">
|
<form id="asset_form">
|
||||||
<div class="col-sm-4 col-sm-offset-8" style="padding-right: 0">
|
<div class="col-sm-7" style="padding-left: 0px">
|
||||||
|
{# <label>#}
|
||||||
|
{# <select name="idc" class="form-control m-b input-sm" onchange="change_info()">#}
|
||||||
|
{# <option value="">机房</option>#}
|
||||||
|
{# {% for idc in idc_all %}#}
|
||||||
|
{# {% ifequal idc.name idc_name %}#}
|
||||||
|
{# <option value="{{idc.name}}" selected> {{ idc.name|slice:":20" }}</option>#}
|
||||||
|
{# {% else %}#}
|
||||||
|
{# <option value="{{idc.name}}"> {{ idc.name|slice:":20" }}</option>#}
|
||||||
|
{# {% endifequal %}#}
|
||||||
|
{# {% endfor %}#}
|
||||||
|
{# </select>#}
|
||||||
|
{# </label>#}
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<select name="group" class="form-control m-b input-sm" onchange="change_info()">
|
||||||
|
<option value="">主机组</option>
|
||||||
|
{% for asset_group in asset_group_all %}
|
||||||
|
{% ifequal asset_group.name group_name %}
|
||||||
|
<option value="{{ asset_group.name }}" selected> {{ asset_group.name|slice:":20" }} </option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ asset_group.name }}"> {{ asset_group.name|slice:":20" }} </option>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<select name="asset_type" class="form-control m-b input-sm" onchange="change_info()">
|
||||||
|
<option value="">资产类型</option>
|
||||||
|
{% for type in asset_types %}
|
||||||
|
{% ifequal type.0|int2str asset_type %}
|
||||||
|
<option value="{{ type.0 }}" selected> {{ type.1 }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ type.0 }}"> {{ type.1 }}</option>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
<select name="status" class="form-control m-b input-sm" onchange="change_info()">
|
||||||
|
<option value="">资产状态</option>
|
||||||
|
{% for s in asset_status %}
|
||||||
|
{% ifequal s.0|int2str status %}
|
||||||
|
<option value="{{ s.0 }}" selected> {{ s.1 }}</option>
|
||||||
|
{% else %}
|
||||||
|
<option value="{{ s.0 }}"> {{ s.1 }}</option>
|
||||||
|
{% endifequal %}
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-4" style="padding-right: 0">
|
||||||
<div class="input-group inline-group">
|
<div class="input-group inline-group">
|
||||||
<input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search">
|
<input type="text" class="form-control m-b input-sm" id="search_input" name="keyword" value="{{ keyword }}" placeholder="Search">
|
||||||
<input type="text" style="display: none">
|
<input type="text" style="display: none">
|
||||||
|
@ -70,7 +124,7 @@
|
||||||
{# <td class="text-center">{{ asset.cpu }}|{{ asset.memory }}|{{ asset.disk }}</td>#}
|
{# <td class="text-center">{{ asset.cpu }}|{{ asset.memory }}|{{ asset.disk }}</td>#}
|
||||||
<td class="text-center">{{ asset.system_type|default_if_none:"" }}{{ asset.system_version|default_if_none:"" }}</td>
|
<td class="text-center">{{ asset.system_type|default_if_none:"" }}{{ asset.system_version|default_if_none:"" }}</td>
|
||||||
<td class="text-center"> {{ asset.cpu|get_cpu_core|default_if_none:"" }} </td>
|
<td class="text-center"> {{ asset.cpu|get_cpu_core|default_if_none:"" }} </td>
|
||||||
<td class="text-center"> {{ asset.memory }}{% if asset.memory %}G{% endif %}</td>
|
<td class="text-center"> {{ asset.memory|default_if_none:"" }}{% if asset.memory %}G{% endif %} </td>
|
||||||
<td class="text-center"> {{ asset.disk|get_disk_info }}{% if asset.memory %}G{% endif %}</td>
|
<td class="text-center"> {{ asset.disk|get_disk_info }}{% if asset.memory %}G{% endif %}</td>
|
||||||
<td class="text-center" data-editable='false'>
|
<td class="text-center" data-editable='false'>
|
||||||
<a value="{{ asset.id }}" class="conn btn btn-xs btn-warning">连接</a>
|
<a value="{{ asset.id }}" class="conn btn btn-xs btn-warning">连接</a>
|
||||||
|
@ -285,19 +339,10 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function change_info(){
|
||||||
|
var args = $("#asset_form").serialize();
|
||||||
{# $('#asset_update_all').click(function () {#}
|
window.location = "{% url 'asset_list' %}?" + args
|
||||||
{# layer.msg('玩命更新中...', {time: 200000});#}
|
}
|
||||||
{# $.ajax({#}
|
|
||||||
{# type: "post",#}
|
|
||||||
{# url: "/jasset/asset_update_batch/?arg=all",#}
|
|
||||||
{# success: function () {#}
|
|
||||||
{# parent.location.reload();#}
|
|
||||||
{# }#}
|
|
||||||
{# });#}
|
|
||||||
{# });#}
|
|
||||||
|
|
||||||
|
|
||||||
$("#search_input").keydown(function(e){
|
$("#search_input").keydown(function(e){
|
||||||
if(e.keyCode==13){
|
if(e.keyCode==13){
|
||||||
|
|
Loading…
Reference in New Issue