mirror of https://github.com/jumpserver/jumpserver
[Fixture] 拆分proxy log 为在线和离线
parent
b60e5a7ee3
commit
a57dac0706
|
@ -95,9 +95,6 @@ class TerminateConnectionView(APIView):
|
|||
proxy_log_id = d.get('proxy_log_id')
|
||||
proxy_log = get_object_or_404(ProxyLog, id=proxy_log_id)
|
||||
terminal_id = proxy_log.terminal
|
||||
proxy_log.is_finished = True
|
||||
proxy_log.date_finished = timezone.now()
|
||||
proxy_log.save()
|
||||
if terminal_id in tasks:
|
||||
tasks[terminal_id].append({'name': 'kill_proxy',
|
||||
'proxy_log_id': proxy_log_id})
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<th class="text-center">{% trans 'Name' %}</th>
|
||||
<th class="text-center">{% trans 'IP' %}</th>
|
||||
<th class="text-center">{% trans 'Type' %}</th>
|
||||
<th class="text-center">{% trans 'proxy online' %}</th>
|
||||
<th class="text-center">{% trans 'Session online' %}</th>
|
||||
<th class="text-center">{% trans 'Active' %}</th>
|
||||
<th class="text-center">{% trans 'Alive' %}</th>
|
||||
<th class="text-center">{% trans 'Action' %}</th>
|
||||
|
|
|
@ -90,8 +90,3 @@ class RecordLogViewSet(BulkModelViewSet):
|
|||
else:
|
||||
return record_store.all()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,18 +23,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select class="select2 form-control" name="user">
|
||||
<select class="select2 form-control" name="username">
|
||||
<option value="">{% trans 'User' %}</option>
|
||||
{% for u in user_list %}
|
||||
<option value="{{ u.username }}" {% if user == u.username %} selected {% endif %}>{{ u.username }}</option>
|
||||
<option value="{{ u.username }}" {% if username == u.username %} selected {% endif %}>{{ u.username }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select class="select2 form-control" name="asset">
|
||||
<select class="select2 form-control" name="ip">
|
||||
<option value="">{% trans 'Asset' %}</option>
|
||||
{% for a in asset_list %}
|
||||
<option value="{{ a.ip }}" {% if asset == a.ip %} selected {% endif %}>{{ a.ip }}</option>
|
||||
<option value="{{ a.ip }}" {% if ip == a.ip %} selected {% endif %}>{{ a.ip }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load common_tags %}
|
||||
|
||||
{% block custom_head_css_js %}
|
||||
<link href="{% static "css/plugins/footable/footable.core.css" %}" rel="stylesheet">
|
||||
|
|
|
@ -24,16 +24,16 @@
|
|||
<div class="input-group">
|
||||
<select class="select2 form-control" name="username">
|
||||
<option value="">{% trans 'User' %}</option>
|
||||
{% for user in user_list %}
|
||||
<option value="{{ user }}" {% if user == username %} selected {% endif %}>{{ user }}</option>
|
||||
{% for u in user_list %}
|
||||
<option value="{{ u }}" {% if u == username %} selected {% endif %}>{{ u }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select class="select2 form-control" name="ip">
|
||||
<option value="">{% trans 'Asset' %}</option>
|
||||
{% for asset in asset_list %}
|
||||
<option value="{{ asset }}" {% if asset == ip %} selected {% endif %}>{{ asset }}</option>
|
||||
{% for a in asset_list %}
|
||||
<option value="{{ a }}" {% if a == ip %} selected {% endif %}>{{ a }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<th class="text-center">{% trans 'Command' %}</th>
|
||||
<th class="text-center">{% trans 'Success' %}</th>
|
||||
<th class="text-center">{% trans 'Finished' %}</th>
|
||||
<th class="text-center">{% trans 'R/M' %}</th>
|
||||
<th class="text-center">{% trans 'Play' %}</th>
|
||||
<th class="text-center">{% trans 'Date start' %}</th>
|
||||
<th class="text-center">{% trans 'Time' %}</th>
|
||||
{% endblock %}
|
||||
|
@ -113,20 +113,6 @@
|
|||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content_bottom_left %}
|
||||
<div id="actions">
|
||||
<div class="input-group">
|
||||
<select class="form-control m-b" style="width: auto" id="slct_bulk_update">
|
||||
<option value="terminate">{% trans 'Terminate selected' %}</option>
|
||||
</select>
|
||||
<div class="input-group-btn pull-left" style="padding-left: 5px;">
|
||||
<button id='btn_bulk_update' style="height: 32px;" class="btn btn-sm btn-primary">
|
||||
{% trans 'Submit' %}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_foot_js %}
|
||||
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
|
||||
|
|
|
@ -24,16 +24,16 @@
|
|||
<div class="input-group">
|
||||
<select class="select2 form-control" name="username">
|
||||
<option value="">{% trans 'User' %}</option>
|
||||
{% for user in user_list %}
|
||||
<option value="{{ user }}" {% if user == username %} selected {% endif %}>{{ user }}</option>
|
||||
{% for u in user_list %}
|
||||
<option value="{{ u }}" {% if u == username %} selected {% endif %}>{{ u }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<select class="select2 form-control" name="ip">
|
||||
<option value="">{% trans 'Asset' %}</option>
|
||||
{% for asset in asset_list %}
|
||||
<option value="{{ asset }}" {% if asset == ip %} selected {% endif %}>{{ asset }}</option>
|
||||
{% for a in asset_list %}
|
||||
<option value="{{ a }}" {% if a == ip %} selected {% endif %}>{{ a }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<th class="text-center">{% trans 'Command' %}</th>
|
||||
<th class="text-center">{% trans 'Success' %}</th>
|
||||
<th class="text-center">{% trans 'Finished' %}</th>
|
||||
<th class="text-center">{% trans 'R/M' %}</th>
|
||||
<th class="text-center">{% trans 'Monitor' %}</th>
|
||||
<th class="text-center">{% trans 'Date start' %}</th>
|
||||
<th class="text-center">{% trans 'Time' %}</th>
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
import time
|
||||
from datetime import datetime
|
||||
|
||||
import pytz
|
||||
from django.views.generic import ListView, UpdateView, DeleteView, DetailView, TemplateView
|
||||
from django.views.generic.edit import SingleObjectMixin
|
||||
from django.utils.translation import ugettext as _
|
||||
|
@ -25,7 +24,7 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
|
|||
template_name = 'audits/proxy_log_online_list.html'
|
||||
context_object_name = 'proxy_log_list'
|
||||
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
||||
keyword = user = asset = system_user = date_from_s = date_to_s = ''
|
||||
keyword = username = hostname = system_user = date_from_s = date_to_s = ''
|
||||
ordering = ['is_finished', '-id']
|
||||
date_format = '%m/%d/%Y'
|
||||
|
||||
|
@ -37,8 +36,8 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
|
|||
|
||||
self.queryset = super(ProxyLogListView, self).get_queryset()
|
||||
self.keyword = self.request.GET.get('keyword', '')
|
||||
self.user = self.request.GET.get('user')
|
||||
self.asset = self.request.GET.get('asset')
|
||||
self.username = self.request.GET.get('username')
|
||||
self.ip = self.request.GET.get('ip')
|
||||
self.system_user = self.request.GET.get('system_user')
|
||||
self.date_from_s = self.request.GET.get('date_from', date_from_default)
|
||||
self.date_to_s = self.request.GET.get('date_to', date_to_default)
|
||||
|
@ -53,10 +52,10 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
|
|||
self.date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S')
|
||||
date_to = date_to.replace(tzinfo=timezone.get_current_timezone())
|
||||
filter_kwargs['date_start__lt'] = date_to
|
||||
if self.user:
|
||||
filter_kwargs['user'] = self.user
|
||||
if self.asset:
|
||||
filter_kwargs['asset'] = self.asset
|
||||
if self.username:
|
||||
filter_kwargs['user'] = self.username
|
||||
if self.ip:
|
||||
filter_kwargs['ip'] = self.ip
|
||||
if self.system_user:
|
||||
filter_kwargs['system_user'] = self.system_user
|
||||
if self.keyword:
|
||||
|
@ -81,8 +80,8 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
|
|||
'keyword': self.keyword,
|
||||
'date_from': self.date_from_s,
|
||||
'date_to': self.date_to_s,
|
||||
'user': self.user,
|
||||
'asset': self.asset,
|
||||
'username': self.username,
|
||||
'ip': self.ip,
|
||||
'system_user': self.system_user,
|
||||
}
|
||||
kwargs.update(context)
|
||||
|
@ -90,7 +89,7 @@ class ProxyLogListView(AdminUserRequiredMixin, ListView):
|
|||
|
||||
|
||||
class ProxyLogOfflineListView(ProxyLogListView):
|
||||
template_name = 'audits/proxy_log_online_list.html'
|
||||
template_name = 'audits/proxy_log_offline_list.html'
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = super(ProxyLogOfflineListView, self).get_queryset()
|
||||
|
@ -163,7 +162,7 @@ class CommandLogListView(AdminUserRequiredMixin, ListView):
|
|||
template_name = 'audits/command_log_list.html'
|
||||
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
|
||||
context_object_name = 'command_list'
|
||||
user = asset = system_user = command = date_from_s = date_to_s = ''
|
||||
username = ip = system_user = command = date_from_s = date_to_s = ''
|
||||
date_format = '%m/%d/%Y'
|
||||
ordering = ['-id']
|
||||
|
||||
|
@ -173,8 +172,8 @@ class CommandLogListView(AdminUserRequiredMixin, ListView):
|
|||
date_from_default = (date_now - timezone.timedelta(7)) \
|
||||
.strftime(self.date_format)
|
||||
self.command = self.request.GET.get('command', '')
|
||||
self.user = self.request.GET.get('user')
|
||||
self.asset = self.request.GET.get('asset')
|
||||
self.username = self.request.GET.get('username')
|
||||
self.ip = self.request.GET.get('ip')
|
||||
self.system_user = self.request.GET.get('system_user')
|
||||
self.date_from_s = \
|
||||
self.request.GET.get('date_from', date_from_default)
|
||||
|
@ -194,10 +193,10 @@ class CommandLogListView(AdminUserRequiredMixin, ListView):
|
|||
.replace(tzinfo=timezone.get_current_timezone())
|
||||
date_to_ts = time.mktime(date_to.timetuple())
|
||||
filter_kwargs['date_to_ts'] = date_to_ts
|
||||
if self.user:
|
||||
filter_kwargs['user'] = self.user
|
||||
if self.asset:
|
||||
filter_kwargs['asset'] = self.asset
|
||||
if self.username:
|
||||
filter_kwargs['user'] = self.username
|
||||
if self.ip:
|
||||
filter_kwargs['asset'] = self.ip
|
||||
if self.system_user:
|
||||
filter_kwargs['system_user'] = self.system_user
|
||||
if self.command:
|
||||
|
@ -215,8 +214,8 @@ class CommandLogListView(AdminUserRequiredMixin, ListView):
|
|||
'command': self.command,
|
||||
'date_from': self.date_from_s,
|
||||
'date_to': self.date_to_s,
|
||||
'user': self.user,
|
||||
'asset': self.asset,
|
||||
'username': self.username,
|
||||
'ip': self.ip,
|
||||
'system_user': self.system_user,
|
||||
}
|
||||
kwargs.update(context)
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
Version <strong>0.4.0</strong> GPL.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Copyright</strong> Jumpserver.org Team © 2014-2016
|
||||
<strong>Copyright</strong> Jumpserver.org Team © 2014-2017
|
||||
</div>
|
||||
</div>
|
|
@ -56,11 +56,11 @@
|
|||
<li id="audits">
|
||||
<a href="#"><i class="fa fa-files-o"></i> <span class="nav-label">{% trans 'Audits' %}</span><span class="fa arrow"></span></a>
|
||||
<ul class="nav nav-second-level">
|
||||
<li id="proxy-log-offline">
|
||||
<a href="{% url 'audits:proxy-log-offline-list' %}">{% trans 'Session online' %}</a>
|
||||
</li>
|
||||
<li id="proxy-log-online">
|
||||
<a href="{% url 'audits:proxy-log-online-list' %}">{% trans 'Session history' %}</a>
|
||||
<a href="{% url 'audits:proxy-log-online-list' %}">{% trans 'Session online' %}</a>
|
||||
</li>
|
||||
<li id="proxy-log-offline">
|
||||
<a href="{% url 'audits:proxy-log-offline-list' %}">{% trans 'Session history' %}</a>
|
||||
</li>
|
||||
<li id="command-log">
|
||||
<a href="{% url 'audits:command-log-list' %}">{% trans 'Command log' %}</a>
|
||||
|
@ -68,26 +68,26 @@
|
|||
<li id="login-log">
|
||||
<a href="{% url 'audits:login-log-list' %}">{% trans 'Login log' %}</a>
|
||||
</li>
|
||||
<li id="admin-log">
|
||||
<a href="{% url 'perms:asset-permission-list' %}">{% trans 'Admin log' %}</a>
|
||||
</li>
|
||||
{# <li id="admin-log">#}
|
||||
{# <a href="{% url 'perms:asset-permission-list' %}">{% trans 'Admin log' %}</a>#}
|
||||
{# </li>#}
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
<li id="">
|
||||
<a href="#">
|
||||
<i class="fa fa-download"></i> <span class="nav-label">{% trans 'File' %}</span><span class="fa arrow"></span>
|
||||
</a>
|
||||
<ul class="nav nav-second-level">
|
||||
<li id="upload"><a href="">{% trans 'File upload' %}</a></li>
|
||||
<li id="download"><a href="">{% trans 'File download' %}</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="">
|
||||
<a href="">
|
||||
<i class="fa fa-gears"></i> <span class="nav-label">{% trans 'Settings' %}</span><span class="label label-info pull-right"></span>
|
||||
</a>
|
||||
</li>
|
||||
{#<li id="">#}
|
||||
{# <a href="#">#}
|
||||
{# <i class="fa fa-download"></i> <span class="nav-label">{% trans 'File' %}</span><span class="fa arrow"></span>#}
|
||||
{# </a>#}
|
||||
{# <ul class="nav nav-second-level">#}
|
||||
{# <li id="upload"><a href="">{% trans 'File upload' %}</a></li>#}
|
||||
{# <li id="download"><a href="">{% trans 'File download' %}</a></li>#}
|
||||
{# </ul>#}
|
||||
{#</li>#}
|
||||
{#<li id="">#}
|
||||
{# <a href="">#}
|
||||
{# <i class="fa fa-gears"></i> <span class="nav-label">{% trans 'Settings' %}</span><span class="label label-info pull-right"></span>#}
|
||||
{# </a>#}
|
||||
{#</li>#}
|
||||
<li class="special_link">
|
||||
<a href="http://www.jumpserver.org" target="_blank"><i class="fa fa-database"></i>
|
||||
<span class="nav-label">{% trans 'Visit us' %}</span>
|
||||
|
|
Loading…
Reference in New Issue