mirror of https://github.com/jumpserver/jumpserver
bugs
parent
75f06f9b62
commit
fd490bd685
|
@ -11,6 +11,7 @@ urlpatterns = patterns('',
|
|||
url(r"^(\d+.\d+.\d+.\d+)/$", jlist_ip),
|
||||
url(r'^idc_add/$', add_idc),
|
||||
url(r'^idc_list/$', list_idc),
|
||||
url(r'^idc_edit/$', edit_idc),
|
||||
url(r'^idc_detail/$', detail_idc),
|
||||
url(r'^idc_del/(\w+)/$', del_idc),
|
||||
url(r'^jgroup_add/$', add_group),
|
||||
|
|
|
@ -143,10 +143,18 @@ def batch_host_edit(request):
|
|||
def list_host(request):
|
||||
header_title, path1, path2 = u'查看主机', u'资产管理', u'查看主机'
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
posts = Asset.objects.all().order_by('ip')
|
||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||
keyword = request.GET.get('keyword', '')
|
||||
if keyword:
|
||||
posts = Asset.objects.filter(Q(ip__contains=keyword) | Q(idc__name__contains=keyword) |
|
||||
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))
|
||||
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))
|
||||
|
||||
|
||||
def host_del(request, offset):
|
||||
|
@ -250,6 +258,34 @@ def list_idc(request):
|
|||
return render_to_response('jasset/idc_list.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def edit_idc(request):
|
||||
header_title, path1, path2 = u'编辑IDC', u'资产管理', u'编辑IDC'
|
||||
edit = 1
|
||||
idc_id = request.GET.get('id')
|
||||
j_idc = IDC.objects.get(id=idc_id)
|
||||
default = IDC.objects.get(name='默认').asset_set.all()
|
||||
eposts = contact_list = Asset.objects.filter(idc=j_idc).order_by('ip')
|
||||
posts = [g for g in default if g not in eposts]
|
||||
if request.method == 'POST':
|
||||
j_group = request.POST.get('j_idc')
|
||||
j_hosts = request.POST.getlist('j_hosts')
|
||||
j_comment = request.POST.get('j_comment')
|
||||
idc_default = request.POST.getlist('idc_default')
|
||||
|
||||
for host in j_hosts:
|
||||
g = Asset.objects.get(id=host)
|
||||
Asset.objects.filter(id=host).update(idc=j_idc)
|
||||
|
||||
for host in idc_default:
|
||||
g = Asset.objects.get(id=host)
|
||||
i = IDC.objects.get(name='默认')
|
||||
Asset.objects.filter(id=host).update(idc=i)
|
||||
|
||||
return HttpResponseRedirect('/jasset/idc_detail/?id=%s' % idc_id)
|
||||
|
||||
return render_to_response('jasset/idc_add.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def del_idc(request, offset):
|
||||
if offset == 'multi':
|
||||
len_list = request.POST.get("len_list")
|
||||
|
@ -374,8 +410,6 @@ def group_del(request, offset):
|
|||
return HttpResponseRedirect('/jasset/jgroup_list/')
|
||||
|
||||
|
||||
|
||||
|
||||
def host_search(request):
|
||||
keyword = request.GET.get('keyword')
|
||||
login_types = {'L': 'LDAP', 'S': 'SSH_KEY', 'P': 'PASSWORD', 'M': 'MAP'}
|
||||
|
|
|
@ -18,6 +18,7 @@ CONF.read('%s/jumpserver.conf' % BASE_DIR)
|
|||
|
||||
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)
|
||||
|
@ -27,6 +28,7 @@ def log_list_online(request):
|
|||
|
||||
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)
|
||||
|
|
|
@ -45,7 +45,7 @@ def getDaysByNum(num):
|
|||
for i in range(0, num):
|
||||
today = today-oneday
|
||||
li_date.append(today)
|
||||
li_str.append(str(today)[0:10])
|
||||
li_str.append(str(today)[5:10])
|
||||
li_date.reverse()
|
||||
li_str.reverse()
|
||||
t = (li_date, li_str)
|
||||
|
@ -103,8 +103,6 @@ def index(request):
|
|||
return render_to_response('index.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
|
||||
|
||||
def skin_config(request):
|
||||
return render_to_response('skin_config.html')
|
||||
|
||||
|
|
|
@ -58,12 +58,13 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="top10" style="width:100%;height:400px;"></div>
|
||||
<div id="usertop10" style="width:100%;height:400px;margin-top:170px"></div>
|
||||
<br/>
|
||||
<div id="hosttop10" style="width:100%;height:400px;"></div>
|
||||
<br/>
|
||||
<div id="dynamic" style="width:100%;height:400px;"></div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6" id="top10" style="width:50%;height:400px;"></div>
|
||||
<div class="col-lg-6" id="usertop10" style="width:50%;height:400px;"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-6" id="hosttop10" style="width:50%;height:400px; margin-top: 20px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -71,8 +72,11 @@
|
|||
var cate = {{ li_str|safe }};
|
||||
$(function () {
|
||||
$('#top10').highcharts({
|
||||
chart: {
|
||||
type: 'column'
|
||||
},
|
||||
title: {
|
||||
text: '数据总览',
|
||||
text: '一周数据总览',
|
||||
x: -20 //center
|
||||
},
|
||||
subtitle: {
|
||||
|
@ -101,12 +105,6 @@ $(function () {
|
|||
tooltip: {
|
||||
valueSuffix: '次'
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0
|
||||
},
|
||||
navigation: {
|
||||
buttonOptions: {
|
||||
align: 'right'
|
||||
|
@ -149,12 +147,6 @@ $(function () {
|
|||
tooltip: {
|
||||
valueSuffix: '次'
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0
|
||||
},
|
||||
series: [
|
||||
{% for k,v in user_dic.items %}
|
||||
{
|
||||
|
@ -192,12 +184,6 @@ $(function () {
|
|||
tooltip: {
|
||||
valueSuffix: '次'
|
||||
},
|
||||
legend: {
|
||||
layout: 'vertical',
|
||||
align: 'right',
|
||||
verticalAlign: 'middle',
|
||||
borderWidth: 0
|
||||
},
|
||||
series: [
|
||||
{% for k,v in host_dic.items %}
|
||||
{
|
||||
|
@ -227,7 +213,7 @@ $(function () {
|
|||
});
|
||||
};
|
||||
|
||||
setInterval(update, 1000); //5秒钟执行一次
|
||||
setInterval(update, 5000); //5秒钟执行一次
|
||||
update();
|
||||
|
||||
});
|
||||
|
|
|
@ -88,6 +88,9 @@
|
|||
<a href="#">Previous</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% ifequal show_first 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?id={{ group_id }}&page=1" 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="?id={{ group_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
|
@ -95,6 +98,9 @@
|
|||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?id={{ group_id }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% ifequal show_end 1 %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?id={{ group_id }}&page={{ p.num_pages }}" 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="?id={{ group_id }}&page={{ contacts.next_page_number }}">Next</a>
|
||||
|
|
|
@ -40,7 +40,45 @@
|
|||
<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 contacts.has_previous %}
|
||||
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
|
||||
<a href="?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="?page=1" 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 }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" 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 }}" 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 }}">Next</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
|
||||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -35,14 +35,43 @@
|
|||
{% endif %}
|
||||
<form id="assetForm" method="post" class="form-horizontal">
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> IDC名 </label>
|
||||
<div class="col-sm-8"><input type="text" value="{{ j_ip }}" placeholder="北京联通" name="j_idc" class="form-control"></div>
|
||||
<div class="col-sm-8"><input type="text" value="{{ j_idc.name }}" placeholder="北京联通" name="j_idc" class="form-control"></div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-2 control-label"> 备注 </label>
|
||||
<div class="col-sm-8"><input type="text" value="{{ s_port }}" placeholder="核心联通机房" name="j_comment" class="form-control"></div>
|
||||
<div class="col-sm-8"><input type="text" value="{{ j_idc.comment }}" placeholder="核心联通机房" name="j_comment" class="form-control"></div>
|
||||
</div>
|
||||
|
||||
{% if edit %}
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<label for="groups" class="col-lg-2 control-label">主机</label>
|
||||
<div class="col-sm-3">
|
||||
<select id="groups" name="idc_default" size="12" class="form-control m-b" multiple>
|
||||
{% for post in posts %}
|
||||
<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-white" onclick="move('groups', 'groups_selected')"><i class="fa fa-chevron-right"></i></button>
|
||||
<button type="button" class="btn btn-white" onclick="move_left('groups_selected', 'groups')"><i class="fa fa-chevron-left"></i> </button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div>
|
||||
<select id="groups_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>
|
||||
{% endif %}
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-4 col-sm-offset-5">
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<td class="text-center"> {{ post.comment }} </td>
|
||||
<td class="text-center">
|
||||
<a href="/jasset/idc_detail/?id={{ post.id }}" class="iframe btn btn-xs btn-primary">详情</a>
|
||||
<a href="/jasset/idc_edit/?id={{ post.id }}" class="btn btn-xs btn-info">编辑</a>
|
||||
<a href="/jasset/idc_del/{{ post.id }}" class="btn btn-xs btn-danger">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -97,8 +97,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
</div>
|
||||
<div class="col-sm-6"></div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -23,25 +23,7 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-sm-offset-6">
|
||||
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
|
||||
<ul class="pagination" style="margin-top: 0; float: right">
|
||||
|
||||
{% if contacts.has_previous %}
|
||||
<li><a href="?page={{ contacts.previous_page_number }}">«</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% for page in p.page_range %}
|
||||
{% ifequal offset1 page %}
|
||||
<li class="active"><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="?page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% endifequal %}
|
||||
{% endfor %}
|
||||
{% if contacts.has_next %}
|
||||
<li><a href="?page={{ contacts.next_page_number }}">»</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-6 "></div>
|
||||
{% include 'paginator.html' %}
|
||||
</div>
|
||||
</div>
|
|
@ -1,7 +1,40 @@
|
|||
<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 }}&ppage=1" 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 }}" title="第{{ page }}页">{{ page }}</a></li>
|
||||
{% else %}
|
||||
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" 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 }}" 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 }}">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 }}">Previous</a>
|
||||
|
@ -33,6 +66,7 @@
|
|||
<a href="#">Next</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue