From 7de6af89ada44a0163f98423a3e849cfe7731998 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 10 May 2018 12:19:37 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BD=BF=E7=94=A8xterm.js=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E5=8E=9F=E6=9D=A5=E7=9A=84term.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/assets/admin_user_assets.html | 2 +- .../templates/assets/system_user_detail.html | 2 +- apps/ops/api.py | 9 +- .../templates/ops/adhoc_history_detail.html | 2 +- apps/ops/templates/ops/celery_task_log.html | 77 +- apps/ops/templates/ops/task_adhoc.html | 2 +- apps/ops/templates/ops/task_detail.html | 2 +- apps/ops/templates/ops/task_history.html | 2 +- apps/ops/templates/ops/task_list.html | 2 +- apps/ops/views.py | 3 + apps/static/js/plugins/xterm/xterm.css | 2261 ++++++++ apps/static/js/plugins/xterm/xterm.js | 5132 +++++++++++++++++ apps/static/js/plugins/xterm/xterm.js.map | 1 + .../templates/terminal/session_detail.html | 2 +- .../templates/terminal/session_list.html | 2 +- 15 files changed, 7446 insertions(+), 55 deletions(-) create mode 100644 apps/static/js/plugins/xterm/xterm.css create mode 100644 apps/static/js/plugins/xterm/xterm.js create mode 100644 apps/static/js/plugins/xterm/xterm.js.map diff --git a/apps/assets/templates/assets/admin_user_assets.html b/apps/assets/templates/assets/admin_user_assets.html index 80ff0cd5f..31314392f 100644 --- a/apps/assets/templates/assets/admin_user_assets.html +++ b/apps/assets/templates/assets/admin_user_assets.html @@ -124,7 +124,7 @@ $(document).ready(function () { var success = function (data) { var task_id = data.task; var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id); - window.open(url, '', 'width=800,height=600') + window.open(url, '', 'width=800,height=600,left=400,top=400') }; APIUpdateAttr({ url: the_url, diff --git a/apps/assets/templates/assets/system_user_detail.html b/apps/assets/templates/assets/system_user_detail.html index a02bf1e44..1e180f0ab 100644 --- a/apps/assets/templates/assets/system_user_detail.html +++ b/apps/assets/templates/assets/system_user_detail.html @@ -296,7 +296,7 @@ $(document).ready(function () { var success = function (data) { var task_id = data.task; var url = '{% url "ops:celery-task-log" pk=DEFAULT_PK %}'.replace("{{ DEFAULT_PK }}", task_id); - window.open(url, '', 'width=800,height=600') + window.open(url, '', 'width=800,height=600,left=400,top=400') }; APIUpdateAttr({ url: the_url, diff --git a/apps/ops/api.py b/apps/ops/api.py index 0134fbd4a..a68f1c529 100644 --- a/apps/ops/api.py +++ b/apps/ops/api.py @@ -70,9 +70,16 @@ class CeleryTaskLogApi(generics.RetrieveAPIView): end = False queryset = CeleryTask.objects.all() + def get_object(self): + return CeleryTask( + id="4cae9ad8-1116-45e7-b019-9b1856696fd7", + log_path="2018-05-10/ca77e6db-9ac6-4970-80d1-eecdbcc3fcc5.log", + status="finished" + ) + def get(self, request, *args, **kwargs): mark = request.query_params.get("mark") or str(uuid.uuid4()) - task = super().get_object() + task = self.get_object() log_path = task.full_log_path if not log_path or not os.path.isfile(log_path): diff --git a/apps/ops/templates/ops/adhoc_history_detail.html b/apps/ops/templates/ops/adhoc_history_detail.html index 16adbc4e3..b8a48d4e5 100644 --- a/apps/ops/templates/ops/adhoc_history_detail.html +++ b/apps/ops/templates/ops/adhoc_history_detail.html @@ -19,7 +19,7 @@ {% trans 'Run history detail' %}
  • - {% trans 'Output' %} + {% trans 'Output' %}
  • diff --git a/apps/ops/templates/ops/celery_task_log.html b/apps/ops/templates/ops/celery_task_log.html index 9b0826949..13885c2cc 100644 --- a/apps/ops/templates/ops/celery_task_log.html +++ b/apps/ops/templates/ops/celery_task_log.html @@ -2,38 +2,25 @@ term.js + + -
    -
    +
    -
    - -