jumpserver/templates/jlog/log_offline.html

223 lines
11 KiB
HTML
Raw Normal View History

2015-04-20 02:12:11 +00:00
{% extends 'base.html' %}
2015-10-27 15:18:26 +00:00
{% block self_head_css_js %}
2015-11-26 15:26:11 +00:00
<link href="/static/css/plugins/datepicker/datepicker3.css" rel="stylesheet">
2015-10-28 11:24:02 +00:00
<link href="/static/css/plugins/chosen/chosen.css" rel="stylesheet">
<script src="/static/js/plugins/chosen/chosen.jquery.js"></script>
2015-10-27 15:18:26 +00:00
{% endblock %}
2015-04-20 02:12:11 +00:00
{% block content %}
{% include 'nav_cat_bar.html' %}
2015-10-27 12:25:18 +00:00
2015-04-20 02:12:11 +00:00
<style>
.bootstrap-dialog-body {
background-color: rgba(0, 0, 0, 0);
}
.bootstrap-dialog-message {
color: #00FF00;
2015-04-20 02:12:11 +00:00
}
.modal-content {
background-color: rgba(0, 0, 0, 0.6);
}
.modal-dialog {
background-color: rgba(0, 0, 0, 0);
width: 800px;
}
.modal-body {
background-color: rgba(0, 0, 0, 0);
}
.modal-header {
background-color: #FFFFFF;
}
2015-04-20 02:12:11 +00:00
</style>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div id="ibox-content" class="ibox-title">
<h5> 用户日志详细信息列表 </h5>
<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>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<div class="ibox-content">
<div class="panel-options">
<ul class="nav nav-tabs">
<li><a href="/jlog/log_list/online/" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li class="active"><a href="/jlog/log_list/offline/" class="text-center"><i class="fa fa-bar-chart-o"></i> 历史记录 </a></li>
</ul>
</div>
<br/>
2015-10-28 11:24:02 +00:00
<form class="form-inline" action="" method="get">
2015-11-26 15:26:11 +00:00
<div class="form-group" id="date_5">
2015-10-28 11:24:02 +00:00
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" style="width: 100px;" name="start" value="{{ date_seven_day }}">
<span class="input-group-addon">to</span>
2015-11-26 15:26:11 +00:00
<input type="text" class="input-sm form-control" style="width: 100px;" name="end" value="{{ date_now_str }}">
2015-10-28 11:24:02 +00:00
</div>
</div>
<div class="form-group">
<div class="input-group">
2015-10-28 14:32:16 +00:00
<select name="username" data-placeholder="用户名" class="chosen-select" multiple style="width:200px;" tabindex="2">
{% for username in username_all %}
<option value="{{ username }}"{% if username in username_list %}selected{% endif %}>{{ username }}</option>
{% endfor %}
2015-10-28 11:24:02 +00:00
</select>
</div>
</div>
<div class="form-group">
<div class="input-group">
2015-10-28 14:32:16 +00:00
<select name="host" data-placeholder="主机" class="chosen-select" multiple style="width:200px;" tabindex="4">
{% for ip in ip_all %}
<option value="{{ ip }}" {% if ip in host_list %}selected{% endif %}>{{ ip }}</option>
{% endfor %}
2015-10-28 11:24:02 +00:00
</select>
</div>
</div>
<div class="form-group">
2015-10-28 14:32:16 +00:00
<input id="cmd" name="cmd" placeholder="命令" type="text" class="form-control" value="{{ cmd }}" style="width: 200px;">
2015-10-28 11:24:02 +00:00
</div>
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
Search
</button>
</form>
2015-04-20 02:12:11 +00:00
<div class="tab-content">
<table class="table table-striped table-bordered table-hover ">
<thead>
<tr>
2015-11-26 11:06:17 +00:00
<th class="text-center"> ID </th>
2015-04-20 02:12:11 +00:00
<th class="text-center"> 用户名 </th>
<th class="text-center"> 登录主机 </th>
<th class="text-center"> 来源IP </th>
2015-11-26 11:49:23 +00:00
<th class="text-center"> 登陆方式 </th>
2015-04-20 02:12:11 +00:00
{% ifnotequal session_role_id 0 %}
2015-11-26 11:49:23 +00:00
<th class="text-center"> 命令 </th>
2015-04-20 02:12:11 +00:00
{% endifnotequal %}
2015-11-26 11:49:23 +00:00
<th class="text-center"> 录像 </th>
2015-04-20 02:12:11 +00:00
<th class="text-center"> 登录时间 </th>
<th class="text-center"> 结束时间 </th>
</tr>
</thead>
<tbody>
2015-10-28 11:24:02 +00:00
2015-04-20 02:12:11 +00:00
{% for post in contacts.object_list %}
<tr class="gradeX">
2015-11-26 15:26:11 +00:00
<td class="text-center"> {{ post.id }} </td>
2015-11-26 11:06:17 +00:00
<td class="text-center username"> {{ post.user }} </td>
<td class="text-center ip"> {{ post.host }} </td>
<td class="text-center remote_ip"> {{ post.remote_ip }} </td>
2015-11-26 11:49:23 +00:00
<td class="text-center"> {{ post.login_type }} </td>
2015-04-20 02:12:11 +00:00
{% ifnotequal session_role_id 0 %}
2015-11-26 11:49:23 +00:00
<td class="text-center"><a href="/jlog/history/?id={{ post.id }}" class="log_command"> 统计 </a></td>
2015-04-20 02:12:11 +00:00
{% endifnotequal %}
2015-10-27 12:25:18 +00:00
<td class="text-center"><a value="/jlog/record/?id={{ post.id }}" class="log_record"> 回放 </a></td>
2015-11-26 11:06:17 +00:00
<td class="text-center start_time"> {{ post.start_time|date:"Y-m-d H:i:s"}} </td>
<td class="text-center end_time"> {{ post.end_time|date:"Y-m-d H:i:s" }} </td>
2015-04-20 02:12:11 +00:00
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-sm-6">
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
2015-10-27 12:25:18 +00:00
$('.log_record').click(function(){
var url = $(this).attr('value');
2015-11-26 11:06:17 +00:00
//window.open(url, '播放', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
var username = $(this).closest('tr').find('.username')[0].innerHTML;
var ip = $(this).closest('tr').find('.ip')[0].innerHTML;
var start_time = $(this).closest('tr').find('.start_time')[0].innerHTML;
var end_time = $(this).closest('tr').find('.end_time')[0].innerHTML;
var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>';
var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>';
var div_time = ' 时间: ' + '<span class="text-info">'+start_time +'</span>' +' - <span class="text-info">' + end_time + '</span>';
var title = 'JumpServer录像回放 '+ div_username + div_ip + div_time;
layer.open({
type: 2,
title: title,
maxmin: true,
shade: false,
area: ['800px', '520px'],
content: url
});
2015-10-27 12:25:18 +00:00
return false;
});
$('.log_command').on('click',function(){
2015-11-26 11:06:17 +00:00
var url = $(this).attr('href');
var username = $(this).closest('tr').find('.username')[0].innerHTML;
var ip = $(this).closest('tr').find('.ip')[0].innerHTML;
var start_time = $(this).closest('tr').find('.start_time')[0].innerHTML;
var end_time = $(this).closest('tr').find('.end_time')[0].innerHTML;
var div_username = ' 用户名: '+'<span class="text-info">'+username+'' + '</span>';
var div_ip = ' 主机: '+'<span class="text-info">' + ip + '</span>';
var div_time = ' 开始时间: ' + '<span class="text-info">'+start_time +'</span>' + ' 结束时间: ' +'<span class="text-info">' + end_time + '</span>';
var title = 'JumpServer命令统计 '+ div_username + div_ip + div_time;
2015-10-27 12:25:18 +00:00
$.ajax({url:url,
success:function(data){
var tag = $('<div style="height: 500px;overflow: auto;background-color: rgba(0, 0, 0, 0);"></div>').html(data.replace(/\n/g,"<br />"));
BootstrapDialog.show({title: title, message:tag[0]});
2015-02-09 11:02:25 +00:00
}});
return false;
2015-04-20 07:56:49 +00:00
});
2015-04-20 02:12:11 +00:00
function log_search(){
$.ajax({
type: "GET",
url: "/jlog/search/?env=offline",
data: $("#search_form").serialize(),
success: function (data) {
$(".tab-content").html(data);
}
});
}
2015-10-27 15:18:26 +00:00
{# $("#search_input").keydown(function(e){#}
{# if(e.keyCode==13){#}
{# log_search()#}
{# }#}
{# });#}
2015-10-27 12:25:18 +00:00
2015-11-26 15:26:11 +00:00
$('#date_5 .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
2015-10-27 12:25:18 +00:00
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
2015-04-20 02:12:11 +00:00
2015-10-28 11:24:02 +00:00
var config = {
'.chosen-select' : {},
'.chosen-select-deselect' : {allow_single_deselect:true},
'.chosen-select-no-single' : {disable_search_threshold:10},
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
'.chosen-select-width' : {width:"95%"}
};
for (var selector in config) {
$(selector).chosen(config[selector]);
}
2015-04-20 02:12:11 +00:00
</script>
2015-10-27 12:25:18 +00:00
{% endblock %}
{% block self_footer_js %}
2015-10-27 15:18:26 +00:00
<script src="/static/js/cropper/cropper.min.js"></script>
<script src="/static/js/datapicker/bootstrap-datepicker.js"></script>
2015-04-20 02:12:11 +00:00
{% endblock %}