mirror of https://github.com/jumpserver/jumpserver
bug
parent
a269c43d1c
commit
75e1ea7f7d
|
@ -8,7 +8,6 @@ from django.shortcuts import render_to_response
|
|||
|
||||
from jasset.models import IDC, Asset, BisGroup, AssetAlias
|
||||
from jperm.models import Perm, SudoPerm
|
||||
from django.shortcuts import redirect
|
||||
from jumpserver.api import *
|
||||
|
||||
cryptor = PyCrypt(KEY)
|
||||
|
@ -18,6 +17,10 @@ class RaiseError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
def my_render(template, data, request):
|
||||
return render_to_response(template, data, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def httperror(request, emg):
|
||||
message = emg
|
||||
return render_to_response('error.html', locals(), context_instance=RequestContext(request))
|
||||
|
@ -156,7 +159,7 @@ def db_host_delete(request, host_id):
|
|||
|
||||
|
||||
def db_idc_delete(request, idc_id):
|
||||
""" IDC删除操作数据库函数 """
|
||||
""" 删除IDC操作 """
|
||||
if idc_id == 1:
|
||||
return httperror(request, '删除失败, 默认IDC不能删除!')
|
||||
|
||||
|
@ -200,7 +203,7 @@ def host_add(request):
|
|||
|
||||
if Asset.objects.filter(ip=str(j_ip)):
|
||||
emg = u'该IP %s 已存在!' % j_ip
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_add.html', locals(), request)
|
||||
if j_type == 'M':
|
||||
j_user = request.POST.get('j_user')
|
||||
j_password = request.POST.get('j_password', '')
|
||||
|
@ -209,7 +212,7 @@ def host_add(request):
|
|||
db_host_insert(host_info)
|
||||
smg = u'主机 %s 添加成功' % j_ip
|
||||
|
||||
return render_to_response('jasset/host_add.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_add.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -263,9 +266,9 @@ def host_add_batch(request):
|
|||
db_host_insert(host_info)
|
||||
|
||||
smg = u'批量添加添加成功'
|
||||
return render_to_response('jasset/host_add_multi.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_add_multi.html', locals(), request)
|
||||
|
||||
return render_to_response('jasset/host_add_multi.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_add_multi.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -297,21 +300,20 @@ def host_edit_batch(request):
|
|||
host_info = [j_id, j_ip, j_idc, j_port, j_type, j_group, j_dept, j_active, j_comment]
|
||||
batch_host_edit(host_info)
|
||||
|
||||
return render_to_response('jasset/host_list.html')
|
||||
return HttpResponseRedirect('/jasset/host_list/')
|
||||
|
||||
|
||||
@require_login
|
||||
def host_edit_common_batch(request):
|
||||
""" 普通用户批量修改主机别名 """
|
||||
user_id = get_session_user_info(request)[0]
|
||||
u = User.objects.get(id=user_id)
|
||||
u = get_session_user_info(request)[2]
|
||||
if request.method == 'POST':
|
||||
len_table = request.POST.get('len_table')
|
||||
for i in range(int(len_table)):
|
||||
j_id = "editable[" + str(i) + "][j_id]"
|
||||
j_alias = "editable[" + str(i) + "][j_alias]"
|
||||
j_id = request.POST.get(j_id).strip()
|
||||
j_alias = request.POST.get(j_alias).strip()
|
||||
j_id = request.POST.get(j_id, '').strip()
|
||||
j_alias = request.POST.get(j_alias, '').strip()
|
||||
a = Asset.objects.get(id=j_id)
|
||||
asset_alias = AssetAlias.objects.filter(user=u, host=a)
|
||||
if asset_alias:
|
||||
|
@ -320,7 +322,7 @@ def host_edit_common_batch(request):
|
|||
asset_alias.save()
|
||||
else:
|
||||
AssetAlias.objects.create(user=u, host=a, alias=j_alias)
|
||||
return render_to_response('jasset/host_list_common.html')
|
||||
return my_render('jasset/host_list_common.html')
|
||||
|
||||
|
||||
@require_login
|
||||
|
@ -342,7 +344,7 @@ def host_list(request):
|
|||
if did:
|
||||
dept = DEPT.objects.get(id=did)
|
||||
posts = dept.asset_set.all()
|
||||
return render_to_response('jasset/host_list_nop.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list_nop.html', locals(), request)
|
||||
|
||||
elif gid:
|
||||
posts = []
|
||||
|
@ -352,7 +354,7 @@ def host_list(request):
|
|||
for post in perm.asset_group.asset_set.all():
|
||||
posts.append(post)
|
||||
posts = list(set(posts))
|
||||
return render_to_response('jasset/host_list_nop.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list_nop.html', locals(), request)
|
||||
|
||||
elif sid:
|
||||
posts = []
|
||||
|
@ -362,7 +364,7 @@ def host_list(request):
|
|||
for post in perm.asset_group.asset_set.all():
|
||||
posts.append(post)
|
||||
posts = list(set(posts))
|
||||
return render_to_response('jasset/host_list_nop.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list_nop.html', locals(), request)
|
||||
|
||||
else:
|
||||
if is_super_user(request):
|
||||
|
@ -371,7 +373,7 @@ def host_list(request):
|
|||
else:
|
||||
posts = post_all
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list.html', locals(), request)
|
||||
|
||||
elif is_group_admin(request):
|
||||
if keyword:
|
||||
|
@ -380,14 +382,13 @@ def host_list(request):
|
|||
posts = post_all.filter(dept=dept)
|
||||
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list.html', locals(), request)
|
||||
|
||||
elif is_common_user(request):
|
||||
user_id, username = get_session_user_info(request)[0:2]
|
||||
posts = user_perm_asset_api(username)
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/host_list_common.html', locals(),
|
||||
context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_list_common.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -435,18 +436,18 @@ def host_edit(request):
|
|||
j_active = request.POST.get('j_active', '')
|
||||
j_comment = request.POST.get('j_comment', '')
|
||||
|
||||
host_info = [j_ip, j_port, j_idc, j_type, j_group, j_dept, j_active, j_comment]
|
||||
host_info = [j_ip, j_port, j_idc, j_type, j_group, j_dept, j_active, j_comment, post]
|
||||
if j_type == 'M':
|
||||
j_user = request.POST.get('j_user')
|
||||
j_password = request.POST.get('j_password')
|
||||
db_host_update(host_info, j_user, j_password, post)
|
||||
db_host_update(host_info, j_user, j_password)
|
||||
else:
|
||||
db_host_update(host_info, post)
|
||||
db_host_update(host_info)
|
||||
|
||||
smg = u'主机 %s 修改成功' % j_ip
|
||||
return HttpResponseRedirect('/jasset/host_detail/?id=%s' % host_id)
|
||||
|
||||
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_edit.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -481,7 +482,7 @@ def host_edit_adm(request):
|
|||
|
||||
if not verify(request, asset_group=j_group, edept=j_dept):
|
||||
emg = u'修改失败,您无权操作!'
|
||||
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_edit.html', locals(), request)
|
||||
|
||||
if j_type == 'M':
|
||||
j_user = request.POST.get('j_user')
|
||||
|
@ -493,7 +494,7 @@ def host_edit_adm(request):
|
|||
smg = u'主机 %s 修改成功' % j_ip
|
||||
return HttpResponseRedirect('/jasset/host_detail/?id=%s' % host_id)
|
||||
|
||||
return render_to_response('jasset/host_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_edit.html', locals(), request)
|
||||
|
||||
|
||||
@require_login
|
||||
|
@ -519,7 +520,7 @@ def host_detail(request):
|
|||
log, log_more = log_all[:10], log_all[10:]
|
||||
user_permed_list = asset_perm_api(post)
|
||||
|
||||
return render_to_response('jasset/host_detail.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_detail.html', locals(), request)
|
||||
|
||||
|
||||
@require_super_user
|
||||
|
@ -531,12 +532,12 @@ def idc_add(request):
|
|||
j_comment = request.POST.get('j_comment')
|
||||
if IDC.objects.filter(name=j_idc):
|
||||
emg = u'该IDC已存在!'
|
||||
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/idc_add.html', locals(), request)
|
||||
else:
|
||||
smg = u'IDC:%s添加成功' % j_idc
|
||||
IDC.objects.create(name=j_idc, comment=j_comment)
|
||||
|
||||
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/idc_add.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -551,7 +552,7 @@ def idc_list(request):
|
|||
else:
|
||||
posts = IDC.objects.exclude(name='ALL').order_by('id')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/idc_list.html', locals(), request)
|
||||
|
||||
|
||||
@require_super_user
|
||||
|
@ -560,13 +561,15 @@ def idc_edit(request):
|
|||
header_title, path1, path2 = u'编辑IDC', u'资产管理', u'编辑IDC'
|
||||
idc_id = request.GET.get('id', '')
|
||||
idc = IDC.objects.filter(id=idc_id)
|
||||
if int(idc_id) == 1:
|
||||
return httperror(request, u'默认IDC不能编辑!')
|
||||
if idc:
|
||||
idc = idc[0]
|
||||
default = IDC.objects.get(name='默认').asset_set.all()
|
||||
default = IDC.objects.get(id=1).asset_set.all()
|
||||
eposts = Asset.objects.filter(idc=idc).order_by('ip')
|
||||
posts = [g for g in default if g not in eposts]
|
||||
else:
|
||||
emg = '此IDC不存在'
|
||||
return httperror(request, u'此IDC不存在')
|
||||
|
||||
if request.method == 'POST':
|
||||
idc_id = request.POST.get('id')
|
||||
|
@ -581,16 +584,15 @@ def idc_edit(request):
|
|||
for host_id in j_hosts:
|
||||
Asset.objects.filter(id=host_id).update(idc=idc[0])
|
||||
|
||||
i = IDC.objects.get(name='默认')
|
||||
i = IDC.objects.get(id=1)
|
||||
for host in idc_default:
|
||||
g = Asset.objects.filter(id=host).update(idc=i)
|
||||
else:
|
||||
emg = '此IDC不存在'
|
||||
return render_to_response('jasset/idc_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return httperror(request, u'此IDC不存在')
|
||||
|
||||
return HttpResponseRedirect('/jasset/idc_list/?id=%s' % idc_id)
|
||||
|
||||
return render_to_response('jasset/idc_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/idc_edit.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -611,7 +613,7 @@ def idc_detail(request):
|
|||
posts = Asset.objects.filter(idc=idc, dept=dept).order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
return render_to_response('jasset/idc_detail.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/idc_detail.html', locals(), request)
|
||||
|
||||
|
||||
@require_super_user
|
||||
|
@ -668,7 +670,7 @@ def group_add(request):
|
|||
group.asset_set.add(g)
|
||||
smg = u'主机组 %s 添加成功' % j_group
|
||||
|
||||
return render_to_response('jasset/group_add.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/group_add.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -708,7 +710,7 @@ def group_list(request):
|
|||
else:
|
||||
posts = BisGroup.objects.filter(dept=dept).order_by('id')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/group_list.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/group_list.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -749,7 +751,7 @@ def group_edit(request):
|
|||
smg = u'主机组%s修改成功' % j_group
|
||||
return HttpResponseRedirect('/jasset/group_list')
|
||||
|
||||
return render_to_response('jasset/group_edit.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/group_edit.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -765,11 +767,11 @@ def group_detail(request):
|
|||
|
||||
elif is_group_admin(request):
|
||||
if not verify(request, asset_group=[group_id]):
|
||||
return httperror(request, '您无权查看!')
|
||||
return httperror(request, u'您无权查看!')
|
||||
posts = Asset.objects.filter(bis_group=group).filter(dept=dept).order_by('ip')
|
||||
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
return render_to_response('jasset/group_detail.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/group_detail.html', locals(), request)
|
||||
|
||||
|
||||
@require_admin
|
||||
|
@ -817,6 +819,7 @@ def group_del(request):
|
|||
return HttpResponseRedirect('/jasset/group_list/')
|
||||
|
||||
|
||||
@require_admin
|
||||
def dept_host_ajax(request):
|
||||
""" 添加主机组时, 部门联动主机异步 """
|
||||
dept_id = request.GET.get('id', '')
|
||||
|
@ -828,7 +831,7 @@ def dept_host_ajax(request):
|
|||
else:
|
||||
hosts = Asset.objects.all()
|
||||
|
||||
return render_to_response('jasset/dept_host_ajax.html', locals())
|
||||
return my_render('jasset/dept_host_ajax.html', locals())
|
||||
|
||||
|
||||
@require_login
|
||||
|
@ -854,4 +857,4 @@ def host_search(request):
|
|||
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
|
||||
return render_to_response('jasset/host_search.html', locals(), context_instance=RequestContext(request))
|
||||
return my_render('jasset/host_search.html', locals(), request)
|
|
@ -1,7 +1,7 @@
|
|||
#coding: utf8
|
||||
|
||||
[base]
|
||||
ip = 192.168.20.209
|
||||
ip = 192.168.8.61
|
||||
port = 80
|
||||
key = 88aaaf7ffe3c6c04
|
||||
|
||||
|
@ -24,7 +24,7 @@ root_pw = secret234
|
|||
|
||||
|
||||
[websocket]
|
||||
web_socket_host = 192.168.173.129:3000
|
||||
web_socket_host = 192.168.8.61:3000
|
||||
|
||||
|
||||
[mail]
|
||||
|
|
|
@ -70,10 +70,13 @@ function move(from, to, from_o, to_o) {
|
|||
});
|
||||
}
|
||||
|
||||
function move_left(from, to) {
|
||||
function move_left(from, to, from_o, to_o) {
|
||||
$("#" + from + " option").each(function () {
|
||||
if ($(this).prop("selected") == true) {
|
||||
$("#" + to).append(this);
|
||||
if( typeof from_o !== 'undefined'){
|
||||
$("#"+to_o).append($("#"+from_o +" option[value='"+this.value+"']"));
|
||||
}
|
||||
}
|
||||
$(this).attr("selected",'true');
|
||||
});
|
||||
|
|
|
@ -2,6 +2,21 @@
|
|||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<script type="text/javascript">
|
||||
function search_ip(text, noselect, total){
|
||||
$("#" + noselect).children().each(
|
||||
function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#" + total).children().each(function(){
|
||||
if($(this).text().search(text) != -1){
|
||||
$("#" + noselect).append($(this).clone())
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
|
@ -26,6 +41,19 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in posts %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in eposts %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<div class="ibox-content">
|
||||
{% if emg %}
|
||||
<div class="alert alert-warning text-center">{{ emg }}</div>
|
||||
|
@ -63,35 +91,40 @@
|
|||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="hosts" class="col-lg-2 control-label">主机</label>
|
||||
<div class="col-sm-3">
|
||||
<select multiple="multiple" id="id_domains_filter" name="domains_filter" style="display: none;">
|
||||
</select>
|
||||
<div class="input-group" style="padding-bottom: 5px">
|
||||
<input type="text" size="19" class="form-control input-sm" id="search" name="keyword" placeholder="过滤">
|
||||
</div>
|
||||
<select id="hosts" size="12" class="form-control m-b" multiple>
|
||||
<label for="group_name" class="col-sm-2 control-label">过滤</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="noselect" class="form-control" oninput="search_ip(this.value, 'assets', 'assets_total')">
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
</div>
|
||||
<div id="select" class="col-sm-3">
|
||||
<input class="form-control" oninput="search_ip(this.value, 'asset_select', 'asset_select_total')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">主机<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="assets" name="assets" class="form-control m-b" size="12" multiple>
|
||||
{% for post in posts %}
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move('hosts', 'hosts_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move_left('hosts_selected', 'hosts')"><i class="fa fa-chevron-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move_left('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h4 style="padding-bottom: 5px">已选中主机</h4>
|
||||
<div>
|
||||
<select id="hosts_selected" name="j_hosts" class="form-control m-b" size="12" multiple>
|
||||
{% for post in eposts %}
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_select" name="j_hosts" class="form-control m-b" size="12" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -105,7 +138,7 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-white" type="submit"> 重置 </button>
|
||||
<button class="btn btn-primary" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
|
||||
<button class="btn btn-primary" id="submit_button" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -116,6 +149,15 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#assetForm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('#assetForm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
|
@ -140,15 +182,15 @@
|
|||
})
|
||||
}
|
||||
|
||||
$('#search').keyup(function() {
|
||||
var $rows = $('#hosts option');
|
||||
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
|
||||
$rows.show().filter(function() {
|
||||
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
||||
return !~text.indexOf(val);
|
||||
}).hide();
|
||||
});
|
||||
// $('#search').keyup(function() {
|
||||
// var $rows = $('#hosts option');
|
||||
// var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
//
|
||||
// $rows.show().filter(function() {
|
||||
// var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
||||
// return !~text.indexOf(val);
|
||||
// }).hide();
|
||||
// });
|
||||
|
||||
function change_dept(dept_id){
|
||||
$.get('/jasset/dept_host_ajax/',
|
||||
|
@ -157,6 +199,7 @@
|
|||
$('#hosts').html(data)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
|
@ -75,7 +75,78 @@
|
|||
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
|
||||
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if keyword %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?keyword={{ keyword }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page=1&id={{ group.id }}" title="第1页">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ group.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ group.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ p.num_pages }}&id={{ group.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?keyword={{ keyword }}&page={{ contacts.next_page_number }}&id={{ group.id }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}&id={{ group.id }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page=1&id={{ group.id }}" title="第1页">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ group.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ group.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}&id={{ group.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}&id={{ group.id }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -2,13 +2,58 @@
|
|||
{% load mytags %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<script type="text/javascript">
|
||||
function search_ip(text, noselect, total){
|
||||
$("#" + noselect).children().each(
|
||||
function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#" + total).children().each(function(){
|
||||
if($(this).text().search(text) != -1){
|
||||
$("#" + noselect).append($(this).clone())
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<div class="ibox float-e-margins">
|
||||
<div id="ibox-content" class="ibox-title">
|
||||
<h5> 填写主机组基本信息 </h5>
|
||||
</div>
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
<i class="fa fa-chevron-up"></i>
|
||||
</a>
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in posts %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in eposts %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<div class="ibox-content">
|
||||
{% if emg %}
|
||||
<div class="alert alert-warning text-center">{{ emg }}</div>
|
||||
|
@ -48,35 +93,46 @@
|
|||
</div>
|
||||
{% endifequal %}
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="hosts" class="col-lg-2 control-label">主机</label>
|
||||
<div class="col-sm-3">
|
||||
<div class="input-group" style="padding-bottom: 5px">
|
||||
<input type="text" size="19" class="form-control input-sm" id="search" name="keyword" placeholder="过滤">
|
||||
</div>
|
||||
<select id="hosts" size="12" class="form-control m-b" multiple>
|
||||
<label for="group_name" class="col-sm-2 control-label">过滤</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="noselect" class="form-control" oninput="search_ip(this.value, 'assets', 'assets_total')">
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
</div>
|
||||
<div id="select" class="col-sm-3">
|
||||
<input class="form-control" oninput="search_ip(this.value, 'asset_select', 'asset_select_total')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">主机<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="assets" name="assets" class="form-control m-b" size="12" multiple>
|
||||
{% for post in posts %}
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move('hosts', 'hosts_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move_left('hosts_selected', 'hosts')"><i class="fa fa-chevron-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move_left('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h4 style="padding-bottom: 5px">已选中主机</h4>
|
||||
<div>
|
||||
<select id="hosts_selected" name="j_hosts" class="form-control m-b" size="12" multiple>
|
||||
{% for post in eposts %}
|
||||
<option value="{{ post.id }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_select" name="j_hosts" class="form-control m-b" size="12" multiple>
|
||||
{% for asset in eposts %}
|
||||
<option value="{{ asset.id }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -90,7 +146,7 @@
|
|||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-white" type="submit"> 重置 </button>
|
||||
<button class="btn btn-primary" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
|
||||
<button class="btn btn-primary" id="submit_button" type="submit" onclick="on_submit('groups_selected') "> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -101,6 +157,15 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#assetForm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('#assetForm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
|
@ -125,16 +190,16 @@
|
|||
})
|
||||
}
|
||||
|
||||
$('#search').keyup(function() {
|
||||
var $rows = $('#hosts option');
|
||||
console.log($rows);
|
||||
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
|
||||
$rows.show().filter(function() {
|
||||
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
||||
return !~text.indexOf(val);
|
||||
}).hide();
|
||||
});
|
||||
// $('#search').keyup(function() {
|
||||
// var $rows = $('#hosts option');
|
||||
// console.log($rows);
|
||||
// var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
//
|
||||
// $rows.show().filter(function() {
|
||||
// var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
|
||||
// return !~text.indexOf(val);
|
||||
// }).hide();
|
||||
// });
|
||||
|
||||
function change_dept(dept_id){
|
||||
$.get('/jasset/dept_host_ajax/',
|
||||
|
|
|
@ -83,7 +83,78 @@
|
|||
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
|
||||
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
|
||||
</div>
|
||||
{% include 'paginator.html' %}
|
||||
<div class="col-sm-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
{% if keyword %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?keyword={{ keyword }}&page={{ contacts.previous_page_number }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page=1&id={{ idc.id }}" title="第1页">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ p.num_pages }}&id={{ idc.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?keyword={{ keyword }}&page={{ contacts.next_page_number }}&id={{ idc.id }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% if contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?page={{ contacts.previous_page_number }}&id={{ idc.id }}">Previous</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page=1&id={{ idc.id }}" title="第1页">1...</a></li>
|
||||
{% endifequal %}
|
||||
{% for page in page_range %}
|
||||
{% ifequal current_page page %}
|
||||
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ page }}&id={{ idc.id }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?page={{ p.num_pages }}&id={{ idc.id }}" title="第{{ page }}页">...{{ p.num_pages }}</a></li>
|
||||
{% endifequal %}
|
||||
{% if contacts.has_next %}
|
||||
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="?page={{ contacts.next_page_number }}&id={{ idc.id }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content %}
|
||||
{% include 'nav_cat_bar.html' %}
|
||||
<!--<h3 class="text-center">项目发布申请</h3>-->
|
||||
<script type="text/javascript">
|
||||
function search_ip(text, noselect, total){
|
||||
$("#" + noselect).children().each(
|
||||
function(){
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$("#" + total).children().each(function(){
|
||||
if($(this).text().search(text) != -1){
|
||||
$("#" + noselect).append($(this).clone())
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<div class="wrapper wrapper-content animated fadeInRight">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
|
@ -16,10 +29,6 @@
|
|||
<i class="fa fa-wrench"></i>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-user">
|
||||
<li><a href="#">未启用 1</a>
|
||||
</li>
|
||||
<li><a href="#">未启用 2</a>
|
||||
</li>
|
||||
</ul>
|
||||
<a class="close-link">
|
||||
<i class="fa fa-times"></i>
|
||||
|
@ -27,6 +36,18 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<select id="assets_total" name="assets" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in posts %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<select id="asset_select_total" name="j_hosts" class="form-control m-b" size="12" multiple style="display: none">
|
||||
{% for asset in eposts %}
|
||||
<option value="{{ asset.ip }}">{{ asset.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<div class="ibox-content">
|
||||
{% if emg %}
|
||||
<div class="alert alert-warning text-center">{{ emg }}</div>
|
||||
|
@ -46,10 +67,10 @@
|
|||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 部门管理员 <span class="red-fonts">*</span></label>
|
||||
<div class="form-group" id="j_da"><label class="col-sm-2 control-label"> 部门管理员 <span class="red-fonts">*</span></label>
|
||||
<div class="radio">
|
||||
{% for da in dept_da %}
|
||||
<label><input type="radio" value="{{ da.id }}" id="da" name="da"> {{ da }}</label>
|
||||
<label><input type="radio" value="{{ da.id }}" name="da"> {{ da }}</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,35 +89,40 @@
|
|||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="groups" class="col-lg-2 control-label">主机<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-3">
|
||||
<select multiple="multiple" id="id_domains_filter" name="domains_filter" style="display: none;">
|
||||
</select>
|
||||
<div class="input-group" style="padding-bottom: 5px">
|
||||
<input type="text" size="19" class="form-control input-sm" id="search" name="keyword" placeholder="过滤">
|
||||
</div>
|
||||
<select id="groups" size="12" class="form-control m-b" multiple>
|
||||
<label for="group_name" class="col-sm-2 control-label">过滤</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="noselect" class="form-control" oninput="search_ip(this.value, 'assets', 'assets_total')">
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
</div>
|
||||
<div id="select" class="col-sm-3">
|
||||
<input class="form-control" oninput="search_ip(this.value, 'asset_select', 'asset_select_total')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="" class="col-sm-2 control-label">主机<span class="red-fonts">*</span></label>
|
||||
<div class="col-sm-4">
|
||||
<div>
|
||||
<select id="assets" name="assets" class="form-control m-b" size="12" multiple>
|
||||
{% for post in posts %}
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 50px;">
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-xm btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-1">
|
||||
<div class="btn-group" style="margin-top: 60px;">
|
||||
<button type="button" class="btn btn-white" onclick="move('assets', 'asset_select', 'assets_total', 'asset_select_total' )"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move_left('asset_select', 'assets', 'asset_select_total', 'assets_total')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<h4 style="padding-bottom: 5px">已选中主机</h4>
|
||||
<div>
|
||||
<select id="groups_selected" name="hosts" class="form-control m-b" size="12" multiple>
|
||||
{% for post in eposts %}
|
||||
<option value="{{ post.ip }}">{{ post.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="asset_select" name="hosts" class="form-control m-b" size="12" multiple></select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -110,7 +136,7 @@
|
|||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
<button class="btn btn-primary" type="submit"> 提交 </button>
|
||||
<button class="btn btn-primary" id="submit_button" type="submit"> 提交 </button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -121,6 +147,32 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#submit_button").click(function(){
|
||||
$('#assetForm option').each(function(){
|
||||
$(this).prop('selected', true)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
$('#assetForm').validator({
|
||||
timely: 2,
|
||||
theme: "yellow_right_effect",
|
||||
fields: {
|
||||
"j_da": {
|
||||
rule: "required",
|
||||
tip: "选择管理员",
|
||||
ok: "",
|
||||
msg: {required: "管理员必须选择!"},
|
||||
data: {'data-ok':"ok"}
|
||||
}
|
||||
},
|
||||
valid: function(form) {
|
||||
form.submit();
|
||||
}
|
||||
});
|
||||
|
||||
var $rows = $('#groups option');
|
||||
$('#search').keyup(function() {
|
||||
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
|
||||
|
|
Loading…
Reference in New Issue