Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
420f3c0c
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
420f3c0c
编写于
6月 04, 2020
作者:
B
Bai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Update] 添加celery task log view
上级
9b2c5cb3
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
120 addition
and
1 deletion
+120
-1
apps/jumpserver/urls.py
apps/jumpserver/urls.py
+1
-0
apps/ops/templates/ops/celery_task_log.html
apps/ops/templates/ops/celery_task_log.html
+91
-0
apps/ops/urls/view_urls.py
apps/ops/urls/view_urls.py
+6
-1
apps/ops/views.py
apps/ops/views.py
+22
-0
未找到文件。
apps/jumpserver/urls.py
浏览文件 @
420f3c0c
...
...
@@ -31,6 +31,7 @@ api_v2 = [
app_view_patterns
=
[
path
(
'auth/'
,
include
(
'authentication.urls.view_urls'
),
name
=
'auth'
),
path
(
'ops/'
,
include
(
'ops.urls.view_urls'
),
name
=
'ops'
)
]
...
...
apps/ops/templates/ops/celery_task_log.html
0 → 100644
浏览文件 @
420f3c0c
{% load static %}
{% load i18n %}
<head>
<title>
{% trans 'Task log' %}
</title>
<script
src=
"{% static 'js/jquery-3.1.1.min.js' %}"
></script>
<script
src=
"{% static 'js/plugins/xterm/xterm.js' %}"
></script>
<script
src=
"{% static 'js/plugins/xterm/addons/fit/fit.js' %}"
></script>
<link
rel=
"stylesheet"
href=
"{% static 'js/plugins/xterm/xterm.css' %}"
/>
<link
rel=
"shortcut icon"
href=
"{{ FAVICON_URL }}"
type=
"image/x-icon"
>
<style>
body
{
background-color
:
black
;
}
.xterm-rows
{
font-family
:
"Bitstream Vera Sans Mono"
,
Monaco
,
"Consolas"
,
Courier
,
monospace
;
font-size
:
13px
;
}
.terminal
.xterm-viewport
{
background-color
:
#1f1b1b
;
overflow
:
auto
;
}
body
::-webkit-scrollbar-track
{
-webkit-box-shadow
:
inset
0
0
2px
rgba
(
0
,
0
,
0
,
0.3
);
background-color
:
#272323
;
border-radius
:
6px
;
}
body
::-webkit-scrollbar
{
width
:
8px
;
height
:
8px
;
}
body
::-webkit-scrollbar-thumb
{
background-color
:
#494141
;
border-radius
:
6px
;
}
</style>
</head>
<div
id=
"term"
style=
"height: 100%;width: 100%"
>
</div>
<script>
var
scheme
=
document
.
location
.
protocol
===
"
https:
"
?
"
wss
"
:
"
ws
"
;
var
port
=
document
.
location
.
port
?
"
:
"
+
document
.
location
.
port
:
""
;
var
taskId
=
"
{{ task_id }}
"
;
var
url
=
"
/ws/ops/tasks/log/
"
;
var
wsURL
=
scheme
+
"
://
"
+
document
.
location
.
hostname
+
port
+
url
;
var
failOverPort
=
"
{{ ws_port }}
"
;
var
failOverWsURL
=
scheme
+
"
://
"
+
document
.
location
.
hostname
+
'
:
'
+
failOverPort
+
url
;
var
term
;
var
ws
;
$
(
document
).
ready
(
function
()
{
term
=
new
Terminal
({
cursorBlink
:
false
,
screenKeys
:
false
,
fontFamily
:
'
"Monaco", "Consolas", "monospace"
'
,
fontSize
:
13
,
lineHeight
:
1.2
,
rightClickSelectsWord
:
true
,
disableStdin
:
true
});
term
.
open
(
document
.
getElementById
(
'
term
'
));
window
.
fit
.
fit
(
term
);
ws
=
new
WebSocket
(
wsURL
);
ws
.
onmessage
=
function
(
e
)
{
var
data
=
JSON
.
parse
(
e
.
data
);
term
.
write
(
data
.
message
);
};
ws
.
onopen
=
function
()
{
var
msg
=
{
"
task
"
:
taskId
};
ws
.
send
(
JSON
.
stringify
(
msg
))
};
ws
.
onerror
=
function
(
e
)
{
ws
=
new
WebSocket
(
failOverWsURL
);
ws
.
onmessage
=
function
(
e
)
{
var
data
=
JSON
.
parse
(
e
.
data
);
term
.
write
(
data
.
message
);
};
ws
.
onerror
=
function
(
e
)
{
term
.
write
(
"
Connect websocket server error
"
)
}
}
}).
on
(
'
resize
'
,
window
,
function
()
{
window
.
fit
.
fit
(
term
);
});
</script>
\ No newline at end of file
apps/ops/urls/view_urls.py
浏览文件 @
420f3c0c
# ~*~ coding: utf-8 ~*~
from
__future__
import
unicode_literals
from
django.urls
import
path
from
..
import
views
__all__
=
[
"urlpatterns"
]
app_name
=
"ops"
urlpatterns
=
[
# Resource Task url
path
(
'celery/task/<uuid:pk>/log/'
,
views
.
CeleryTaskLogView
.
as_view
(),
name
=
'celery-task-log'
),
]
\ No newline at end of file
apps/ops/views.py
0 → 100644
浏览文件 @
420f3c0c
# -*- coding: utf-8 -*-
#
from
django.views.generic
import
TemplateView
from
django.conf
import
settings
from
common.permissions
import
PermissionsMixin
,
IsOrgAdmin
,
IsOrgAuditor
__all__
=
[
'CeleryTaskLogView'
]
class
CeleryTaskLogView
(
PermissionsMixin
,
TemplateView
):
template_name
=
'ops/celery_task_log.html'
permission_classes
=
[
IsOrgAdmin
|
IsOrgAuditor
]
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
context
.
update
({
'task_id'
:
self
.
kwargs
.
get
(
'pk'
),
'ws_port'
:
settings
.
WS_LISTEN_PORT
})
return
context
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录