pull/6/head
halcyon 2015-03-12 18:54:26 +08:00
parent fd490bd685
commit 691271c74f
4 changed files with 47 additions and 8 deletions

View File

@ -149,12 +149,11 @@ def list_host(request):
Q(bis_group__name__contains=keyword) | Q(comment__contains=keyword)).distinct().order_by('ip')
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))
else:
posts = Asset.objects.all().order_by('ip')
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 render_to_response('jasset/host_list.html', locals(), context_instance=RequestContext(request))
def host_del(request, offset):
@ -253,7 +252,11 @@ def add_idc(request):
def list_idc(request):
header_title, path1, path2 = u'查看IDC', u'资产管理', u'查看IDC'
posts = IDC.objects.all().order_by('id')
keyword = request.GET.get('keyword', '')
if keyword:
posts = IDC.objects.filter(Q(name__contains=keyword) | Q(comment__contains=keyword))
else:
posts = IDC.objects.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))
@ -323,7 +326,11 @@ def add_group(request):
def list_group(request):
header_title, path1, path2 = u'查看主机组', u'资产管理', u'查看主机组'
posts = BisGroup.objects.filter(type='A').order_by('id')
keyword = request.GET.get('keyword', '')
if keyword:
posts = BisGroup.objects.filter(Q(name__contains=keyword) | Q(comment__contains=keyword))
else:
posts = BisGroup.objects.filter(type='A').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))

View File

@ -20,8 +20,13 @@ def log_list_online(request):
header_title, path1, path2 = u'查看日志', u'查看日志', u'在线用户'
keyword = request.GET.get('keyword')
web_socket_host = CONF.get('websocket', 'web_socket_host')
posts = Log.objects.filter(is_finished=0).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
if keyword:
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
.filter(is_finished=0).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
else:
posts = Log.objects.filter(is_finished=0).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
return render_to_response('jlog/log_online.html', locals())
@ -30,8 +35,13 @@ def log_list_offline(request):
header_title, path1, path2 = u'查看日志', u'查看日志', u'历史记录'
keyword = request.GET.get('keyword')
web_socket_host = CONF.get('websocket', 'web_socket_host')
posts = Log.objects.filter(is_finished=1).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
if keyword:
posts = contact_list = Log.objects.filter(Q(user__contains=keyword) | Q(host__contains=keyword)) \
.filter(is_finished=1).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
else:
posts = Log.objects.filter(is_finished=1).order_by('-start_time')
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
return render_to_response('jlog/log_offline.html', locals())

View File

@ -9,6 +9,17 @@
<div class="ibox-content">
<div class="">
<a target="_blank" href="/jasset/jgroup_add" class="btn btn-sm btn-primary "> 添加主机组 </a>
<form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
<input type="text" style="display: none">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
Search
</button>
</div>
</div>
</form>
</div>
<form id="contents_form" name="contents_form">

View File

@ -9,6 +9,17 @@
<div class="ibox-content">
<div class="">
<a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加IDC </a>
<form id="search_form" method="get" action="" class="pull-right mail-search">
<div class="input-group">
<input type="text" class="form-control input-sm" id="search_input" name="keyword" placeholder="Search">
<input type="text" style="display: none">
<div class="input-group-btn">
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
Search
</button>
</div>
</div>
</form>
</div>
<form id="contents_form" name="contents_form">