mirror of https://github.com/jumpserver/jumpserver
[Change] Rename applications -> terminal
parent
19051d36dc
commit
61a8d95f46
|
@ -5,4 +5,4 @@ from users.utils import AdminUserRequiredMixin
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from assets.models import Asset, SystemUser
|
from assets.models import Asset, SystemUser
|
||||||
from users.permissions import IsSuperUserOrAppUser, IsAppUser
|
from users.permissions import IsSuperUserOrAppUser, IsAppUser
|
||||||
from applications.models import Terminal
|
from terminal.models import Terminal
|
||||||
|
|
|
@ -33,7 +33,7 @@ app.conf.update(
|
||||||
'args': (),
|
'args': (),
|
||||||
},
|
},
|
||||||
'clean_terminal_history': {
|
'clean_terminal_history': {
|
||||||
'task': 'applications.tasks.clean_terminal_history',
|
'task': 'terminal.tasks.clean_terminal_history',
|
||||||
'schedule': 60*60*60,
|
'schedule': 60*60*60,
|
||||||
'args': (),
|
'args': (),
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ from django.shortcuts import HttpResponse
|
||||||
|
|
||||||
|
|
||||||
DEMO_MODE = os.environ.get("DEMO_MODE", "")
|
DEMO_MODE = os.environ.get("DEMO_MODE", "")
|
||||||
SAFE_URL = r'^/users/login|^/api/applications/v1/.*|/api/audits/.*|/api/users/v1/auth/|/api/users/v1/profile/'
|
SAFE_URL = r'^/users/login|^/api/terminal/v1/.*|/api/audits/.*|/api/users/v1/auth/|/api/users/v1/profile/'
|
||||||
|
|
||||||
|
|
||||||
class TimezoneMiddleware(MiddlewareMixin):
|
class TimezoneMiddleware(MiddlewareMixin):
|
||||||
|
|
|
@ -61,7 +61,7 @@ INSTALLED_APPS = [
|
||||||
'ops.apps.OpsConfig',
|
'ops.apps.OpsConfig',
|
||||||
'audits.apps.AuditsConfig',
|
'audits.apps.AuditsConfig',
|
||||||
'common.apps.CommonConfig',
|
'common.apps.CommonConfig',
|
||||||
'applications.apps.ApplicationsConfig',
|
'terminal.apps.ApplicationsConfig',
|
||||||
'rest_framework',
|
'rest_framework',
|
||||||
'rest_framework_swagger',
|
'rest_framework_swagger',
|
||||||
'django_filters',
|
'django_filters',
|
||||||
|
@ -363,8 +363,8 @@ CAPTCHA_FOREGROUND_COLOR = '#001100'
|
||||||
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
|
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
|
||||||
CAPTCHA_TEST_MODE = CONFIG.CAPTCHA_TEST_MODE
|
CAPTCHA_TEST_MODE = CONFIG.CAPTCHA_TEST_MODE
|
||||||
|
|
||||||
COMMAND_STORE_BACKEND = 'applications.backends.command.db'
|
COMMAND_STORE_BACKEND = 'terminal.backends.command.db'
|
||||||
RECORD_STORE_BACKEND = 'applications.backends.replay.db'
|
RECORD_STORE_BACKEND = 'terminal.backends.replay.db'
|
||||||
|
|
||||||
|
|
||||||
# Django bootstrap3 setting, more see http://django-bootstrap3.readthedocs.io/en/latest/settings.html
|
# Django bootstrap3 setting, more see http://django-bootstrap3.readthedocs.io/en/latest/settings.html
|
||||||
|
|
|
@ -17,7 +17,7 @@ urlpatterns = [
|
||||||
url(r'^assets/', include('assets.urls.views_urls', namespace='assets')),
|
url(r'^assets/', include('assets.urls.views_urls', namespace='assets')),
|
||||||
url(r'^perms/', include('perms.urls.views_urls', namespace='perms')),
|
url(r'^perms/', include('perms.urls.views_urls', namespace='perms')),
|
||||||
url(r'^audits/', include('audits.urls.views_urls', namespace='audits')),
|
url(r'^audits/', include('audits.urls.views_urls', namespace='audits')),
|
||||||
url(r'^applications/', include('applications.urls.views_urls', namespace='applications')),
|
url(r'^terminal/', include('terminal.urls.views_urls', namespace='terminal')),
|
||||||
url(r'^ops/', include('ops.urls.view_urls', namespace='ops')),
|
url(r'^ops/', include('ops.urls.view_urls', namespace='ops')),
|
||||||
|
|
||||||
# Api url view map
|
# Api url view map
|
||||||
|
@ -25,7 +25,7 @@ urlpatterns = [
|
||||||
url(r'^api/assets/', include('assets.urls.api_urls', namespace='api-assets')),
|
url(r'^api/assets/', include('assets.urls.api_urls', namespace='api-assets')),
|
||||||
url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')),
|
url(r'^api/perms/', include('perms.urls.api_urls', namespace='api-perms')),
|
||||||
url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')),
|
url(r'^api/audits/', include('audits.urls.api_urls', namespace='api-audits')),
|
||||||
url(r'^api/applications/', include('applications.urls.api_urls', namespace='api-applications')),
|
url(r'^api/terminal/', include('terminal.urls.api_urls', namespace='api-terminal')),
|
||||||
url(r'^api/ops/', include('ops.urls.api_urls', namespace='api-ops')),
|
url(r'^api/ops/', include('ops.urls.api_urls', namespace='api-ops')),
|
||||||
url(r'^captcha/', include('captcha.urls')),
|
url(r'^captcha/', include('captcha.urls')),
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="applications">
|
<li id="terminal">
|
||||||
<a>
|
<a>
|
||||||
<i class="fa fa-rocket"></i> <span class="nav-label">{% trans 'Applications' %}</span><span class="fa arrow"></span>
|
<i class="fa fa-rocket"></i> <span class="nav-label">{% trans 'Terminal' %}</span><span class="fa arrow"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="nav nav-second-level">
|
<ul class="nav nav-second-level">
|
||||||
<li id="terminal"><a href="{% url 'applications:terminal-list' %}">{% trans 'Terminal' %}</a></li>
|
<li id="terminal"><a href="{% url 'terminal:terminal-list' %}">{% trans 'Terminal' %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from django.utils import timezone
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from common.utils import get_object_or_none
|
from common.utils import get_object_or_none
|
||||||
from .models import Terminal, TerminalStatus, TerminalSession, TerminalTask
|
from .models import Terminal, Status, Session, Task
|
||||||
from .serializers import TerminalSerializer, TerminalStatusSerializer, \
|
from .serializers import TerminalSerializer, TerminalStatusSerializer, \
|
||||||
TerminalSessionSerializer, TerminalTaskSerializer
|
TerminalSessionSerializer, TerminalTaskSerializer
|
||||||
from .hands import IsSuperUserOrAppUser, IsAppUser, ProxyLog, \
|
from .hands import IsSuperUserOrAppUser, IsAppUser, ProxyLog, \
|
||||||
|
@ -65,7 +65,7 @@ class TerminalViewSet(viewsets.ModelViewSet):
|
||||||
|
|
||||||
|
|
||||||
class TerminalStatusViewSet(viewsets.ModelViewSet):
|
class TerminalStatusViewSet(viewsets.ModelViewSet):
|
||||||
queryset = TerminalStatus.objects.all()
|
queryset = Status.objects.all()
|
||||||
serializer_class = TerminalStatusSerializer
|
serializer_class = TerminalStatusSerializer
|
||||||
permission_classes = (IsSuperUserOrAppUser,)
|
permission_classes = (IsSuperUserOrAppUser,)
|
||||||
session_serializer_class = TerminalSessionSerializer
|
session_serializer_class = TerminalSessionSerializer
|
||||||
|
@ -79,7 +79,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet):
|
||||||
for session_data in self.request.data.get("sessions", []):
|
for session_data in self.request.data.get("sessions", []):
|
||||||
session_data["terminal"] = self.request.user.terminal.id
|
session_data["terminal"] = self.request.user.terminal.id
|
||||||
_id = session_data["id"]
|
_id = session_data["id"]
|
||||||
session = get_object_or_none(TerminalSession, id=_id)
|
session = get_object_or_none(Session, id=_id)
|
||||||
if session:
|
if session:
|
||||||
serializer = TerminalSessionSerializer(data=session_data,
|
serializer = TerminalSessionSerializer(data=session_data,
|
||||||
instance=session)
|
instance=session)
|
||||||
|
@ -95,7 +95,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet):
|
||||||
if not session_data["is_finished"]:
|
if not session_data["is_finished"]:
|
||||||
sessions_active.append(session_data["id"])
|
sessions_active.append(session_data["id"])
|
||||||
|
|
||||||
sessions_in_db_active = TerminalSession.objects.filter(
|
sessions_in_db_active = Session.objects.filter(
|
||||||
is_finished=False, terminal=self.request.user.terminal.id
|
is_finished=False, terminal=self.request.user.terminal.id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class TerminalStatusViewSet(viewsets.ModelViewSet):
|
||||||
|
|
||||||
|
|
||||||
class TerminalSessionViewSet(viewsets.ModelViewSet):
|
class TerminalSessionViewSet(viewsets.ModelViewSet):
|
||||||
queryset = TerminalSession.objects.all()
|
queryset = Session.objects.all()
|
||||||
serializers_class = TerminalSessionSerializer
|
serializers_class = TerminalSessionSerializer
|
||||||
permission_classes = (IsSuperUserOrAppUser,)
|
permission_classes = (IsSuperUserOrAppUser,)
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class TerminalSessionViewSet(viewsets.ModelViewSet):
|
||||||
|
|
||||||
|
|
||||||
class TerminalTaskViewSet(viewsets.ModelViewSet):
|
class TerminalTaskViewSet(viewsets.ModelViewSet):
|
||||||
queryset = TerminalTask.objects.all()
|
queryset = Task.objects.all()
|
||||||
serializer_class = TerminalTaskSerializer
|
serializer_class = TerminalTaskSerializer
|
||||||
permission_classes = (IsSuperUserOrAppUser,)
|
permission_classes = (IsSuperUserOrAppUser,)
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class SessionReplayAPI(APIView):
|
||||||
|
|
||||||
def post(self, request, **kwargs):
|
def post(self, request, **kwargs):
|
||||||
session_id = kwargs.get("pk", None)
|
session_id = kwargs.get("pk", None)
|
||||||
session = get_object_or_404(TerminalSession, id=session_id)
|
session = get_object_or_404(Session, id=session_id)
|
||||||
record_dir = settings.CONFIG.SESSION_RECORDE_DIR
|
record_dir = settings.CONFIG.SESSION_RECORDE_DIR
|
||||||
date = session.date_start.strftime("%Y-%m-%d")
|
date = session.date_start.strftime("%Y-%m-%d")
|
||||||
record_dir = os.path.join(record_dir, date, str(session.id))
|
record_dir = os.path.join(record_dir, date, str(session.id))
|
|
@ -4,4 +4,4 @@ from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class ApplicationsConfig(AppConfig):
|
class ApplicationsConfig(AppConfig):
|
||||||
name = 'applications'
|
name = 'terminal'
|
|
@ -9,8 +9,8 @@ from .base import CommandBase
|
||||||
class CommandStore(CommandBase):
|
class CommandStore(CommandBase):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
from applications.models import SessionCommand
|
from terminal.models import Command
|
||||||
self.model = SessionCommand
|
self.model = Command
|
||||||
|
|
||||||
def save(self, command):
|
def save(self, command):
|
||||||
"""
|
"""
|
|
@ -58,9 +58,10 @@ class Terminal(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ('is_accepted',)
|
ordering = ('is_accepted',)
|
||||||
|
db_table = "terminal"
|
||||||
|
|
||||||
|
|
||||||
class TerminalStatus(models.Model):
|
class Status(models.Model):
|
||||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||||
session_online = models.IntegerField(verbose_name=_("Session Online"), default=0)
|
session_online = models.IntegerField(verbose_name=_("Session Online"), default=0)
|
||||||
cpu_used = models.FloatField(verbose_name=_("CPU Usage"))
|
cpu_used = models.FloatField(verbose_name=_("CPU Usage"))
|
||||||
|
@ -75,7 +76,7 @@ class TerminalStatus(models.Model):
|
||||||
db_table = 'terminal_status'
|
db_table = 'terminal_status'
|
||||||
|
|
||||||
|
|
||||||
class TerminalSession(models.Model):
|
class Session(models.Model):
|
||||||
LOGIN_FROM_CHOICES = (
|
LOGIN_FROM_CHOICES = (
|
||||||
('ST', 'SSH Terminal'),
|
('ST', 'SSH Terminal'),
|
||||||
('WT', 'Web Terminal'),
|
('WT', 'Web Terminal'),
|
||||||
|
@ -100,7 +101,7 @@ class TerminalSession(models.Model):
|
||||||
return "{0.id} of {0.user} to {0.asset}".format(self)
|
return "{0.id} of {0.user} to {0.asset}".format(self)
|
||||||
|
|
||||||
|
|
||||||
class TerminalTask(models.Model):
|
class Task(models.Model):
|
||||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||||
name = models.CharField(max_length=128, verbose_name=_("Name"))
|
name = models.CharField(max_length=128, verbose_name=_("Name"))
|
||||||
args = models.CharField(max_length=1024, verbose_name=_("Task Args"))
|
args = models.CharField(max_length=1024, verbose_name=_("Task Args"))
|
||||||
|
@ -113,7 +114,7 @@ class TerminalTask(models.Model):
|
||||||
db_table = "terminal_task"
|
db_table = "terminal_task"
|
||||||
|
|
||||||
|
|
||||||
class SessionCommand(AbstractSessionCommand):
|
class Command(AbstractSessionCommand):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = "session_command"
|
db_table = "terminal_command"
|
|
@ -4,7 +4,7 @@
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from .models import Terminal, TerminalStatus, TerminalSession, TerminalTask
|
from .models import Terminal, Status, Session, Task
|
||||||
from .hands import ProxyLog
|
from .hands import ProxyLog
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class TerminalSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_session_connected(obj):
|
def get_session_connected(obj):
|
||||||
return TerminalSession.objects.filter(terminal=obj.id, is_finished=False)
|
return Session.objects.filter(terminal=obj.id, is_finished=False)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_is_alive(obj):
|
def get_is_alive(obj):
|
||||||
|
@ -33,7 +33,7 @@ class TerminalSerializer(serializers.ModelSerializer):
|
||||||
class TerminalSessionSerializer(serializers.ModelSerializer):
|
class TerminalSessionSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TerminalSession
|
model = Session
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ class TerminalStatusSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
model = TerminalStatus
|
model = Status
|
||||||
|
|
||||||
|
|
||||||
class TerminalTaskSerializer(serializers.ModelSerializer):
|
class TerminalTaskSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
model = TerminalTask
|
model = Task
|
|
@ -39,7 +39,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% include 'applications/terminal_modal_accept.html' %}
|
{% include 'terminal/terminal_modal_accept.html' %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block custom_foot_js %}
|
{% block custom_foot_js %}
|
||||||
|
@ -51,7 +51,7 @@ $(document).ready(function(){
|
||||||
buttons: [],
|
buttons: [],
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{targets: 1, createdCell: function (td, cellData, rowData) {
|
{targets: 1, createdCell: function (td, cellData, rowData) {
|
||||||
var detail_btn = '<a href="{% url "applications:terminal-detail" pk=99991937 %}">' + cellData + '</a>';
|
var detail_btn = '<a href="{% url "terminal:terminal-detail" pk=99991937 %}">' + cellData + '</a>';
|
||||||
$(td).html(detail_btn.replace('99991937', rowData.id));
|
$(td).html(detail_btn.replace('99991937', rowData.id));
|
||||||
}},
|
}},
|
||||||
{targets: 6, createdCell: function (td, cellData) {
|
{targets: 6, createdCell: function (td, cellData) {
|
||||||
|
@ -69,7 +69,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{targets: 8, createdCell: function (td, cellData, rowData) {
|
{targets: 8, createdCell: function (td, cellData, rowData) {
|
||||||
var update_btn = '<a href="{% url "applications:terminal-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
|
var update_btn = '<a href="{% url "terminal:terminal-update" pk=99991937 %}" class="btn btn-xs btn-info">{% trans "Update" %}</a>'
|
||||||
.replace('99991937', cellData);
|
.replace('99991937', cellData);
|
||||||
var delete_btn = '<a class="btn btn-xs btn-danger m-l-xs btn-del" data-id="99991937" data-name="99991938">{% trans "Delete" %}</a>'
|
var delete_btn = '<a class="btn btn-xs btn-danger m-l-xs btn-del" data-id="99991937" data-name="99991938">{% trans "Delete" %}</a>'
|
||||||
.replace('99991937', cellData)
|
.replace('99991937', cellData)
|
||||||
|
@ -94,7 +94,7 @@ $(document).ready(function(){
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
],
|
],
|
||||||
ajax_url: '{% url "api-applications:terminal-list" %}',
|
ajax_url: '{% url "api-terminal:terminal-list" %}',
|
||||||
columns: [{data: function(){return ""}}, {data: "name" }, {data: "remote_addr" }, {data: "ssh_port"}, {data: "http_port"},
|
columns: [{data: function(){return ""}}, {data: "name" }, {data: "remote_addr" }, {data: "ssh_port"}, {data: "http_port"},
|
||||||
{data: "session_connected"}, {data: "is_accepted" }, {data: 'is_alive'}, {data: "id"}],
|
{data: "session_connected"}, {data: "is_accepted" }, {data: 'is_alive'}, {data: "id"}],
|
||||||
op_html: $('#actions').html()
|
op_html: $('#actions').html()
|
||||||
|
@ -117,13 +117,13 @@ $(document).ready(function(){
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var id = $this.data('id');
|
var id = $this.data('id');
|
||||||
var name = $(this).data('name');
|
var name = $(this).data('name');
|
||||||
var the_url = '{% url "api-applications:terminal-detail" pk=99991937 %}'.replace('99991937', id);
|
var the_url = '{% url "api-terminal:terminal-detail" pk=99991937 %}'.replace('99991937', id);
|
||||||
objectDelete($this, name, the_url)
|
objectDelete($this, name, the_url)
|
||||||
|
|
||||||
}).on('click', '.btn-accept', function () {
|
}).on('click', '.btn-accept', function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var terminal_id = $this.data('id');
|
var terminal_id = $this.data('id');
|
||||||
var the_url = "{% url 'api-applications:terminal-detail' pk=99991937 %}".replace('99991937', terminal_id);
|
var the_url = "{% url 'api-terminal:terminal-detail' pk=99991937 %}".replace('99991937', terminal_id);
|
||||||
var post_url = $('#form_terminal_accept').attr('action').replace('99991937', terminal_id);
|
var post_url = $('#form_terminal_accept').attr('action').replace('99991937', terminal_id);
|
||||||
console.log(post_url);
|
console.log(post_url);
|
||||||
$.ajax({
|
$.ajax({
|
|
@ -5,7 +5,7 @@
|
||||||
{% block modal_title%}{% trans "Accept terminal registration" %}{% endblock %}
|
{% block modal_title%}{% trans "Accept terminal registration" %}{% endblock %}
|
||||||
{% block modal_body %}
|
{% block modal_body %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
<form action="{% url 'applications:terminal-modal-accept' pk="99991937" %}" method="post" class="form-horizontal" id="form_terminal_accept" enctype="multipart/form-data">
|
<form action="{% url 'terminal:terminal-modal-accept' pk="99991937" %}" method="post" class="form-horizontal" id="form_terminal_accept" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p class="alert alert-danger" id="modal-error" style="display: none"></p>
|
<p class="alert alert-danger" id="modal-error" style="display: none"></p>
|
||||||
{% bootstrap_field form.name layout="horizontal" %}
|
{% bootstrap_field form.name layout="horizontal" %}
|
|
@ -7,7 +7,7 @@ from rest_framework import routers
|
||||||
|
|
||||||
from .. import api
|
from .. import api
|
||||||
|
|
||||||
app_name = 'applications'
|
app_name = 'terminal'
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register(r'v1/terminal/(?P<terminal>[0-9]+)?/?status', api.TerminalStatusViewSet, 'terminal-status')
|
router.register(r'v1/terminal/(?P<terminal>[0-9]+)?/?status', api.TerminalStatusViewSet, 'terminal-status')
|
|
@ -6,7 +6,7 @@ from django.conf.urls import url
|
||||||
|
|
||||||
from .. import views
|
from .. import views
|
||||||
|
|
||||||
app_name = 'applications'
|
app_name = 'terminal'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^terminal/$', views.TerminalListView.as_view(), name='terminal-list'),
|
url(r'^terminal/$', views.TerminalListView.as_view(), name='terminal-list'),
|
|
@ -15,7 +15,7 @@ from .hands import AdminUserRequiredMixin
|
||||||
|
|
||||||
class TerminalListView(LoginRequiredMixin, ListView):
|
class TerminalListView(LoginRequiredMixin, ListView):
|
||||||
model = Terminal
|
model = Terminal
|
||||||
template_name = 'applications/terminal_list.html'
|
template_name = 'terminal/terminal_list.html'
|
||||||
form_class = TerminalForm
|
form_class = TerminalForm
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -31,24 +31,24 @@ class TerminalListView(LoginRequiredMixin, ListView):
|
||||||
class TerminalUpdateView(AdminUserRequiredMixin, UpdateView):
|
class TerminalUpdateView(AdminUserRequiredMixin, UpdateView):
|
||||||
model = Terminal
|
model = Terminal
|
||||||
form_class = TerminalForm
|
form_class = TerminalForm
|
||||||
template_name = 'applications/terminal_update.html'
|
template_name = 'terminal/terminal_update.html'
|
||||||
success_url = reverse_lazy('applications:terminal-list')
|
success_url = reverse_lazy('terminal:terminal-list')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(TerminalUpdateView, self).get_context_data(**kwargs)
|
context = super(TerminalUpdateView, self).get_context_data(**kwargs)
|
||||||
context.update({'app': _('Applications'), 'action': _('Update terminal')})
|
context.update({'app': _('Terminal'), 'action': _('Update terminal')})
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
class TerminalDetailView(LoginRequiredMixin, DetailView):
|
class TerminalDetailView(LoginRequiredMixin, DetailView):
|
||||||
model = Terminal
|
model = Terminal
|
||||||
template_name = 'applications/terminal_detail.html'
|
template_name = 'terminal/terminal_detail.html'
|
||||||
context_object_name = 'terminal'
|
context_object_name = 'terminal'
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(TerminalDetailView, self).get_context_data(**kwargs)
|
context = super(TerminalDetailView, self).get_context_data(**kwargs)
|
||||||
context.update({
|
context.update({
|
||||||
'app': _('Applications'),
|
'app': _('Terminal'),
|
||||||
'action': _('Terminal detail')
|
'action': _('Terminal detail')
|
||||||
})
|
})
|
||||||
return context
|
return context
|
||||||
|
@ -57,13 +57,13 @@ class TerminalDetailView(LoginRequiredMixin, DetailView):
|
||||||
class TerminalDeleteView(AdminUserRequiredMixin, DeleteView):
|
class TerminalDeleteView(AdminUserRequiredMixin, DeleteView):
|
||||||
model = Terminal
|
model = Terminal
|
||||||
template_name = 'assets/delete_confirm.html'
|
template_name = 'assets/delete_confirm.html'
|
||||||
success_url = reverse_lazy('applications:applications-list')
|
success_url = reverse_lazy('terminal:terminal-list')
|
||||||
|
|
||||||
|
|
||||||
class TerminalModelAccept(AdminUserRequiredMixin, JSONResponseMixin, UpdateView):
|
class TerminalModelAccept(AdminUserRequiredMixin, JSONResponseMixin, UpdateView):
|
||||||
model = Terminal
|
model = Terminal
|
||||||
form_class = TerminalForm
|
form_class = TerminalForm
|
||||||
template_name = 'applications/terminal_modal_test.html'
|
template_name = 'Terminal/terminal_modal_test.html'
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
terminal = form.save()
|
terminal = form.save()
|
||||||
|
@ -103,7 +103,7 @@ class TerminalConnectView(LoginRequiredMixin, DetailView):
|
||||||
'messages': _('You should use your ssh client tools '
|
'messages': _('You should use your ssh client tools '
|
||||||
'connect terminal: {} <br /> <br />'
|
'connect terminal: {} <br /> <br />'
|
||||||
'{}'.format(self.object.name, self.object.url)),
|
'{}'.format(self.object.name, self.object.url)),
|
||||||
'redirect_url': reverse('applications:terminal-list')
|
'redirect_url': reverse('terminal:terminal-list')
|
||||||
}
|
}
|
||||||
|
|
||||||
kwargs.update(context)
|
kwargs.update(context)
|
|
@ -10,7 +10,7 @@
|
||||||
:license: GPL v2, see LICENSE for more details.
|
:license: GPL v2, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from applications.models import Terminal
|
from terminal.models import Terminal
|
||||||
from audits.tasks import write_login_log_async
|
from audits.tasks import write_login_log_async
|
||||||
from users.models import User
|
from users.models import User
|
||||||
# from perms.models import AssetPermission
|
# from perms.models import AssetPermission
|
||||||
|
|
Loading…
Reference in New Issue