jumpserver/templates/jlog/log_offline.html

229 lines
11 KiB
HTML
Raw Normal View History

2015-04-20 02:12:11 +00:00
{% extends 'base.html' %}
2015-12-19 09:26:34 +00:00
{% block self_head_css_js %}
<link href="/static/css/plugins/datepicker/datepicker3.css" rel="stylesheet">
<link href="/static/css/plugins/chosen/chosen.css" rel="stylesheet">
<script src="/static/js/plugins/chosen/chosen.jquery.js"></script>
{% endblock %}
2015-04-20 02:12:11 +00:00
{% block content %}
{% include 'nav_cat_bar.html' %}
2015-12-19 09:26:34 +00:00
2015-04-20 02:12:11 +00:00
<style>
2016-03-25 15:52:48 +00:00
iframe {
overflow:hidden;
}
2015-04-20 02:12:11 +00:00
.bootstrap-dialog-body {
background-color: rgba(0, 0, 0, 0);
}
.bootstrap-dialog-message {
2015-12-19 09:26:34 +00:00
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-12-19 09:26:34 +00:00
2015-04-20 02:12:11 +00:00
</style>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
2015-12-19 09:26:34 +00:00
<div class="col-sm-12">
2015-04-20 02:12:11 +00:00
<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">
2015-12-19 09:26:34 +00:00
<li><a href="{% url 'log_list' 'online' %}" class="text-center"><i class="fa fa-laptop"></i> 在线 </a></li>
<li class="active"><a href="{% url 'log_list' 'offline' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 登录历史</a></li>
<li><a href="{% url 'log_list' 'exec' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 命令记录 </a></li>
<li><a href="{% url 'log_list' 'file' %}" class="text-center"><i class="fa fa-bar-chart-o"></i> 上传下载 </a></li>
2015-04-20 02:12:11 +00:00
</ul>
</div>
2015-12-19 09:26:34 +00:00
<form class="form-inline" action="" method="get">
<div class="form-group" id="date_5">
<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>
<input type="text" class="input-sm form-control" style="width: 100px;" name="end" value="{{ date_now_str }}">
</div>
</div>
<div class="form-group">
<div class="input-group">
<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 %}
</select>
</div>
</div>
<div class="form-group">
<div class="input-group">
<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 %}
</select>
</div>
</div>
<div class="form-group">
<input id="cmd" name="cmd" placeholder="命令" type="text" class="form-control" value="{{ cmd }}" style="width: 200px;">
</div>
<button id='search_btn' type="submit" class="btn btn-sm btn-primary">
- 搜索 -
</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-12-19 09:26:34 +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-12-19 09:26:34 +00:00
<th class="text-center"> 登陆方式 </th>
2015-04-20 02:12:11 +00:00
{% ifnotequal session_role_id 0 %}
2015-12-19 09:26:34 +00:00
<th class="text-center"> 命令 </th>
2015-04-20 02:12:11 +00:00
{% endifnotequal %}
2015-12-19 09:26:34 +00:00
<th class="text-center"> 录像 </th>
2015-04-20 02:12:11 +00:00
<th class="text-center"> 登录时间 </th>
2015-12-19 09:26:34 +00:00
<th class="text-center"> 时长</th>
2015-04-20 02:12:11 +00:00
</tr>
</thead>
<tbody>
2015-12-19 09:26:34 +00:00
2015-04-20 02:12:11 +00:00
{% for post in contacts.object_list %}
<tr class="gradeX">
2015-12-19 09:26:34 +00:00
<td class="text-center"> {{ post.id }} </td>
<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>
<td class="text-center"> {{ post.login_type }} </td>
2015-04-20 02:12:11 +00:00
{% ifnotequal session_role_id 0 %}
2015-12-19 09:26:34 +00:00
<td class="text-center"><a href="{% url 'log_history' %}?id={{ post.id }}" class="log_command"> 统计 </a></td>
2015-04-20 02:12:11 +00:00
{% endifnotequal %}
2015-12-19 09:26:34 +00:00
<td class="text-center"><a value="{% url 'log_record' %}?id={{ post.id }}" class="log_record"> 回放 </a></td>
<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|timeuntil:post.start_time }} </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>
2016-03-25 15:52:48 +00:00
</div>
2015-04-20 02:12:11 +00:00
</div>
</div>
</div>
</div>
</div>
<script>
2015-12-19 09:26:34 +00:00
$('.log_record').click(function(){
var url = $(this).attr('value');
//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,
2016-03-25 15:52:48 +00:00
area: ['620px', '450px'],
2015-12-19 09:26:34 +00:00
content: url
});
return false;
});
$('.log_command').on('click',function(){
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;
$.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-12-19 09:26:34 +00:00
{# $("#search_input").keydown(function(e){#}
{# if(e.keyCode==13){#}
{# log_search()#}
{# }#}
{# });#}
$('#date_5 .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
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-12-19 09:26:34 +00:00
{% endblock %}
{% block self_footer_js %}
<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 %}