Skip to content

Commit

Permalink
ver1.7.1 优化界面;修复客户端SSH连接部分BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Aug 29, 2019
1 parent afaec7e commit 52e16d9
Show file tree
Hide file tree
Showing 87 changed files with 1,002 additions and 436 deletions.
344 changes: 178 additions & 166 deletions .idea/workspace.xml

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,34 +38,6 @@ sh start_docker.sh
![效果](https://github.com/leffss/devops/blob/master/screenshots/9.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/10.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/11.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/12.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/13.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/14.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/15.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/16.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/17.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/18.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/19.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/20.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/21.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/22.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/23.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/24.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/25.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/26.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/27.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/28.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/29.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/30.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/31.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/32.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/33.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/34.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/35.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/36.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/37.JPG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/38.PNG?raw=true)
![效果](https://github.com/leffss/devops/blob/master/screenshots/39.PNG?raw=true)


# TODO LISTS
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
Binary file modified devops/__pycache__/settings.cpython-37.pyc
Binary file not shown.
4 changes: 0 additions & 4 deletions devops/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
if not os.path.isdir(TMP_DIR):
os.makedirs(TMP_DIR)

TERMINAL_LOGS = os.path.join(BASE_DIR, 'terminal_logs')
if not os.path.isdir(TERMINAL_LOGS):
os.makedirs(TERMINAL_LOGS)

MEDIA_ROOT = os.path.join(BASE_DIR, 'terminal_logs')
if not os.path.isdir(MEDIA_ROOT):
os.makedirs(MEDIA_ROOT)
Expand Down
Binary file modified screenshots/1.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/10.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshots/11.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/12.PNG
Binary file not shown.
Binary file removed screenshots/13.PNG
Binary file not shown.
Binary file removed screenshots/14.PNG
Binary file not shown.
Binary file removed screenshots/15.PNG
Binary file not shown.
Binary file removed screenshots/16.PNG
Binary file not shown.
Binary file removed screenshots/17.PNG
Binary file not shown.
Binary file removed screenshots/18.PNG
Binary file not shown.
Binary file removed screenshots/19.PNG
Binary file not shown.
Binary file modified screenshots/2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/20.PNG
Binary file not shown.
Binary file removed screenshots/21.PNG
Binary file not shown.
Binary file removed screenshots/22.PNG
Binary file not shown.
Binary file removed screenshots/23.PNG
Binary file not shown.
Binary file removed screenshots/24.PNG
Binary file not shown.
Binary file removed screenshots/25.PNG
Binary file not shown.
Binary file removed screenshots/26.PNG
Binary file not shown.
Binary file removed screenshots/27.PNG
Binary file not shown.
Binary file removed screenshots/28.PNG
Binary file not shown.
Binary file removed screenshots/29.PNG
Binary file not shown.
Binary file modified screenshots/3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/30.PNG
Binary file not shown.
Binary file removed screenshots/31.PNG
Binary file not shown.
Binary file removed screenshots/32.PNG
Diff not rendered.
Binary file removed screenshots/33.PNG
Diff not rendered.
Binary file removed screenshots/34.PNG
Diff not rendered.
Binary file removed screenshots/35.PNG
Diff not rendered.
Binary file removed screenshots/36.PNG
Diff not rendered.
Binary file removed screenshots/37.JPG
Diff not rendered.
Binary file removed screenshots/38.PNG
Diff not rendered.
Binary file removed screenshots/39.PNG
Diff not rendered.
Binary file modified screenshots/4.PNG
Binary file modified screenshots/5.PNG
Binary file modified screenshots/6.PNG
Binary file modified screenshots/7.PNG
Binary file modified screenshots/8.PNG
Binary file modified screenshots/9.PNG
Binary file modified server/__pycache__/views.cpython-37.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions server/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from util.tool import login_required, admin_required
from .models import RemoteUserBindHost, RemoteUser
from user.models import User, Group
from webssh.models import TerminalSession
from django.db.models import Q
# Create your views here.

Expand All @@ -11,6 +12,7 @@ def index(request):
host_count = RemoteUserBindHost.objects.all().count()
user_count = User.objects.all().count()
group_count = Group.objects.all().count()
session_count = TerminalSession.objects.all().count()
return render(request, 'server/index.html', locals())


Expand Down
18 changes: 4 additions & 14 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h4 class="text-center mt-3">确定要退出吗?</h4>
<button type="button" class="btn btn-block btn-secondary btn-flat" data-iziModal-close>取消</button>
</div>
<div class="col-6 p-3">
<a href="{% url 'user:logout' %}"><button type="button" class="btn btn-block btn-success btn-flat">退出</button></a>
<a href="{% url 'user:logout' %}"><button type="button" class="btn btn-block btn-success btn-flat">确定</button></a>
</div>
</div>
</div>
Expand Down Expand Up @@ -233,20 +233,15 @@ <h4 class="text-center mt-3">确定要退出吗?</h4>
</p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="{% url 'server:hosts' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;批量命令 - x</p>
</a>
</li>
<li class="nav-item">
<a href="{% url 'webssh:hosts' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;web终端</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;终端登陆</p>
</a>
</li>
{% if request.session.issuperuser %}
<li class="nav-item">
<a href="{% url 'webssh:sessions' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在线会话</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在线终端</p>
</a>
</li>
{% endif %}
Expand All @@ -266,15 +261,10 @@ <h4 class="text-center mt-3">确定要退出吗?</h4>
<a href="{% url 'user:logs' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;操作日志</p>
</a>
</li>
<li class="nav-item">
<a href="{% url 'server:hosts' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;批量命令日志 - x</p>
</a>
</li>
<li class="nav-item">
<a href="{% url 'webssh:logs' %}" class="nav-link">
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;web终端日志</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;终端日志</p>
</a>
</li>
</ul>
Expand Down
13 changes: 12 additions & 1 deletion templates/server/hosts.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,18 @@ <h3 class="card-title">
<td>{{ host.get_env_display }}</td>
<td>{{ host.ip }}</td>
<td>{% if host.enabled %}<span class="badge badge-success">启用</span>{% else %}<span class="badge badge-danger">禁用</span>{% endif %}</td>
<td><span class="badge badge-success">{{ host.get_protocol_display }}</span></td>
<td>
{% if host.get_protocol_display == 'ssh' %}
<span class="badge badge-success">{{ host.get_protocol_display }}</span>
{% elif host.get_protocol_display == 'sftp' %}
<span class="badge badge-info">{{ host.get_protocol_display }}</span>
{% elif host.get_protocol_display == 'telnet' %}
<span class="badge badge-primary">{{ host.get_protocol_display }}</span>
{% else %}
<span class="badge badge-secondary">{{ host.get_protocol_display }}</span>
{% endif %}

</td>
<td>{{ host.port }}</td>
<td>{{ host.release }}</td>
{% if host.remote_user %}
Expand Down
8 changes: 4 additions & 4 deletions templates/server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ <h3>{{ group_count }}</h3>
<!-- ./col -->
<div class="col-lg-3 col-6">
<!-- small box -->
<div class="small-box bg-danger">
<div class="small-box bg-secondary">
<div class="inner">
<h3>0</h3>
<p>告警</p>
<h3>{{ session_count }}</h3>
<p>在线终端</p>
</div>
<div class="icon">
<i class="fas fa-bell"></i>
<i class="fas fa-terminal"></i>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates/user/logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static %}

{% block title %}
<title>用户日志</title>
<title>操作日志</title>
{% endblock title %}

{% block navheader %}
Expand All @@ -12,7 +12,7 @@
<div class="col-12">
<ol class="breadcrumb">
<li class="breadcrumb-item">日志审计</li>
<li class="breadcrumb-item active">用户日志</li>
<li class="breadcrumb-item active">操作日志</li>
</ol>
</div>
</div>
Expand All @@ -23,7 +23,7 @@
{% block content %}
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">用户日志</h3>
<h3 class="card-title">操作日志</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-widget="collapse">
<i class="fas fa-minus"></i>
Expand Down
52 changes: 33 additions & 19 deletions templates/webssh/hosts.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load static %}

{% block title %}
<title>web终端</title>
<title>终端登陆</title>
{% endblock title %}

{% block navheader %}
Expand All @@ -12,7 +12,7 @@
<div class="col-12">
<ol class="breadcrumb">
<li class="breadcrumb-item">作业中心</li>
<li class="breadcrumb-item active">web终端</li>
<li class="breadcrumb-item active">终端登陆</li>
</ol>
</div>
</div>
Expand All @@ -23,7 +23,7 @@
{% block content %}
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">web终端</h3>
<h3 class="card-title">终端登陆</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-widget="collapse">
<i class="fas fa-minus"></i>
Expand Down Expand Up @@ -60,7 +60,17 @@ <h3 class="card-title">web终端</h3>
<td>{{ host.get_type_display }}</td>
<td>{{ host.get_env_display }}</td>
<td>{{ host.ip }}</td>
<td><span class="badge badge-info">{{ host.get_protocol_display }}</span></td>
<td>
{% if host.get_protocol_display == 'ssh' %}
<span class="badge badge-success">{{ host.get_protocol_display }}</span>
{% elif host.get_protocol_display == 'sftp' %}
<span class="badge badge-info">{{ host.get_protocol_display }}</span>
{% elif host.get_protocol_display == 'telnet' %}
<span class="badge badge-primary">{{ host.get_protocol_display }}</span>
{% else %}
<span class="badge badge-secondary">{{ host.get_protocol_display }}</span>
{% endif %}
</td>
<td>{{ host.port }}</td>
<td>{{ host.release }}</td>
{% if host.remote_user %}
Expand All @@ -71,33 +81,37 @@ <h3 class="card-title">web终端</h3>
<td>{{ host.create_time|date:"Y/m/d H:i:s" }}</td>
<td>
{% if host.remote_user and host.enabled %}
{% if host.get_protocol_display == 'ssh' %}
<form method="post" action="{% url 'webssh:terminal' %}" target="_blank" style="display:inline;">
{% elif host.get_protocol_display == 'telnet' %}
<form method="post" action="{% url 'webtelnet:terminal' %}" target="_blank" style="display:inline;">
{% else %}
<form method="post" action="#" onsubmit="return false;" style="display:inline;">
{% endif %}
{% csrf_token %}
<input type="text" name="hostid" value="{{ host.id }}" hidden>
<button type="submit" class="btn btn-sm btn-success btn-flat"><i class="fas fa-terminal"></i> web终端</button>
</form>
{% if host.get_protocol_display == 'ssh' %}
<form method="post" action="{% url 'webssh:terminal' %}" target="_blank" style="display:inline;">
{% elif host.get_protocol_display == 'telnet' %}
<form method="post" action="{% url 'webtelnet:terminal' %}" target="_blank" style="display:inline;">
{% else %}
<form method="post" action="#" onsubmit="return false;" style="display:inline;">
{% endif %}
{% csrf_token %}
<input type="text" name="hostid" value="{{ host.id }}" hidden>
<button type="submit" class="btn btn-sm btn-success btn-flat"><i class="fas fa-terminal"></i> web终端</button>
</form>
{% else %}
<button class="btn btn-sm btn-secondary btn-flat disabled"><i class="fas fa-terminal"></i> web终端</button>
<button class="btn btn-sm btn-success btn-flat disabled"><i class="fas fa-terminal"></i> web终端</button>
{% endif %}

&nbsp;&nbsp;
{% if host.remote_user and host.enabled %}
{% if host.get_protocol_display == 'ssh' %}
<form method="post" target="_blank" onsubmit="clishell(this);return false;" style="display:inline;">
{% csrf_token %}
<input type="text" name="hostid" value="{{ host.id }}" hidden>
<button type="submit" class="btn btn-sm btn-primary btn-flat"><i class="fas fa-network-wired"></i> 客户端终端</button>
<button type="submit" class="btn btn-sm btn-primary btn-flat"><i class="fas fa-network-wired"></i> 客户端ssh</button>
</form>
&nbsp;&nbsp;
<button type="submit" class="btn btn-sm btn-info btn-flat"><i class="fas fa-network-wired"></i> 客户端sftp</button>
{% endif %}
{% else %}
<button class="btn btn-sm btn-secondary btn-flat disabled"><i class="fas fa-network-wired"></i> 客户端终端</button>
<button class="btn btn-sm btn-primary btn-flat disabled"><i class="fas fa-network-wired"></i> 客户端ssh</button>
&nbsp;&nbsp;
<button class="btn btn-sm btn-info btn-flat disabled"><i class="fas fa-network-wired"></i> 客户端sftp</button>
{% endif %}

</td>
</tr>
{% endfor %}
Expand Down
Loading

0 comments on commit 52e16d9

Please sign in to comment.