Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
7de6af89
Commit
7de6af89
authored
May 10, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 使用xterm.js替换原来的term.js
parent
0a9af987
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
51 additions
and
54 deletions
+51
-54
admin_user_assets.html
apps/assets/templates/assets/admin_user_assets.html
+1
-1
system_user_detail.html
apps/assets/templates/assets/system_user_detail.html
+1
-1
api.py
apps/ops/api.py
+8
-1
adhoc_history_detail.html
apps/ops/templates/ops/adhoc_history_detail.html
+1
-1
celery_task_log.html
apps/ops/templates/ops/celery_task_log.html
+31
-44
task_adhoc.html
apps/ops/templates/ops/task_adhoc.html
+1
-1
task_detail.html
apps/ops/templates/ops/task_detail.html
+1
-1
task_history.html
apps/ops/templates/ops/task_history.html
+1
-1
task_list.html
apps/ops/templates/ops/task_list.html
+1
-1
views.py
apps/ops/views.py
+3
-0
xterm.css
apps/static/js/plugins/xterm/xterm.css
+0
-0
xterm.js
apps/static/js/plugins/xterm/xterm.js
+0
-0
xterm.js.map
apps/static/js/plugins/xterm/xterm.js.map
+0
-0
session_detail.html
apps/terminal/templates/terminal/session_detail.html
+1
-1
session_list.html
apps/terminal/templates/terminal/session_list.html
+1
-1
No files found.
apps/assets/templates/assets/admin_user_assets.html
View file @
7de6af89
...
@@ -124,7 +124,7 @@ $(document).ready(function () {
...
@@ -124,7 +124,7 @@ $(document).ready(function () {
var
success
=
function
(
data
)
{
var
success
=
function
(
data
)
{
var
task_id
=
data
.
task
;
var
task_id
=
data
.
task
;
var
url
=
'{% url "ops:celery-task-log" pk=DEFAULT_PK %}'
.
replace
(
"{{ DEFAULT_PK }}"
,
task_id
);
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
({
APIUpdateAttr
({
url
:
the_url
,
url
:
the_url
,
...
...
apps/assets/templates/assets/system_user_detail.html
View file @
7de6af89
...
@@ -296,7 +296,7 @@ $(document).ready(function () {
...
@@ -296,7 +296,7 @@ $(document).ready(function () {
var
success
=
function
(
data
)
{
var
success
=
function
(
data
)
{
var
task_id
=
data
.
task
;
var
task_id
=
data
.
task
;
var
url
=
'{% url "ops:celery-task-log" pk=DEFAULT_PK %}'
.
replace
(
"{{ DEFAULT_PK }}"
,
task_id
);
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
({
APIUpdateAttr
({
url
:
the_url
,
url
:
the_url
,
...
...
apps/ops/api.py
View file @
7de6af89
...
@@ -70,9 +70,16 @@ class CeleryTaskLogApi(generics.RetrieveAPIView):
...
@@ -70,9 +70,16 @@ class CeleryTaskLogApi(generics.RetrieveAPIView):
end
=
False
end
=
False
queryset
=
CeleryTask
.
objects
.
all
()
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
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
mark
=
request
.
query_params
.
get
(
"mark"
)
or
str
(
uuid
.
uuid4
())
mark
=
request
.
query_params
.
get
(
"mark"
)
or
str
(
uuid
.
uuid4
())
task
=
s
uper
()
.
get_object
()
task
=
s
elf
.
get_object
()
log_path
=
task
.
full_log_path
log_path
=
task
.
full_log_path
if
not
log_path
or
not
os
.
path
.
isfile
(
log_path
):
if
not
log_path
or
not
os
.
path
.
isfile
(
log_path
):
...
...
apps/ops/templates/ops/adhoc_history_detail.html
View file @
7de6af89
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<a
href=
"{% url 'ops:adhoc-history-detail' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history detail' %}
</a>
<a
href=
"{% url 'ops:adhoc-history-detail' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history detail' %}
</a>
</li>
</li>
<li>
<li>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.pk %}','', 'width=800,height=600')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Output' %}
</a>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.pk %}','', 'width=800,height=600
,left=400,top=400
')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Output' %}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
apps/ops/templates/ops/celery_task_log.html
View file @
7de6af89
...
@@ -2,38 +2,25 @@
...
@@ -2,38 +2,25 @@
<head>
<head>
<title>
term.js
</title>
<title>
term.js
</title>
<script
src=
"{% static 'js/jquery-2.1.1.js' %}"
></script>
<script
src=
"{% static 'js/jquery-2.1.1.js' %}"
></script>
<script
src=
"{% static 'js/plugins/xterm/xterm.js' %}"
></script>
<link
rel=
"stylesheet"
href=
"{% static 'js/plugins/xterm/xterm.css' %}"
/>
<style>
<style>
html
{
body
{
background
:
#000
;
background-color
:
black
;
}
}
h1
{
.xterm-rows
{
margin-bottom
:
20px
;
{#
padding
:
15px
;
#
}
font
:
20px
/
1.5
sans-serif
;
font-family
:
"Bitstream Vera Sans Mono"
,
Monaco
,
"Consolas"
,
Courier
,
monospace
;
}
font-size
:
13px
;
.terminal
{
}
float
:
left
;
font-family
:
'Monaco'
,
'Consolas'
,
"DejaVu Sans Mono"
,
"Liberation Mono"
,
monospace
;
font-size
:
12px
;
color
:
#f0f0f0
;
background-color
:
#555
;
padding
:
20px
20px
20px
;
}
.terminal-cursor
{
color
:
#000
;
background
:
#f0f0f0
;
}
</style>
</style>
</head>
</head>
<div
class=
"container"
>
<div
id=
"term"
style=
"height: 100%;width: 100%"
>
<div
id=
"term"
>
</div>
</div>
</div>
<script
src=
"{% static 'js/term.js' %}"
></script>
<script>
<script>
var
rowHeight
=
1
;
var
rowHeight
=
1
8
;
var
colWidth
=
1
;
var
colWidth
=
1
0
;
var
mark
=
''
;
var
mark
=
''
;
var
url
=
"{% url 'api-ops:celery-task-log' pk=object.id %}"
;
var
url
=
"{% url 'api-ops:celery-task-log' pk=object.id %}"
;
var
term
;
var
term
;
...
@@ -42,13 +29,16 @@
...
@@ -42,13 +29,16 @@
var
interval
=
200
;
var
interval
=
200
;
function
calWinSize
()
{
function
calWinSize
()
{
var
t
=
$
(
'
.terminal
'
);
var
t
=
$
(
'
#marker
'
);
rowHeight
=
1.00
*
t
.
height
()
/
24
;
{
#
rowHeight
=
1.00
*
t
.
height
();
#
}
colWidth
=
1.00
*
t
.
width
()
/
80
;
{
#
colWidth
=
1.00
*
t
.
width
()
/
6
;
#
}
}
}
function
resize
()
{
function
resize
()
{
var
rows
=
Math
.
floor
(
window
.
innerHeight
/
rowHeight
)
-
2
;
{
#
console
.
log
(
rowHeight
,
window
.
innerHeight
);
#
}
var
cols
=
Math
.
floor
(
window
.
innerWidth
/
colWidth
)
-
10
;
{
#
console
.
log
(
colWidth
,
window
.
innerWidth
);
#
}
var
rows
=
Math
.
floor
(
window
.
innerHeight
/
rowHeight
)
-
1
;
var
cols
=
Math
.
floor
(
window
.
innerWidth
/
colWidth
)
-
2
;
console
.
log
(
rows
,
cols
);
term
.
resize
(
cols
,
rows
);
term
.
resize
(
cols
,
rows
);
}
}
function
requestAndWrite
()
{
function
requestAndWrite
()
{
...
@@ -74,21 +64,18 @@
...
@@ -74,21 +64,18 @@
}
}
}
}
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
term
=
new
Terminal
({
term
=
new
Terminal
();
cols
:
80
,
term
.
open
(
document
.
getElementById
(
'term'
));
rows
:
24
,
term
.
resize
(
80
,
24
);
useStyle
:
true
,
resize
();
screenKeys
:
false
,
convertEol
:
false
,
cursorBlink
:
false
});
term
.
open
();
term
.
on
(
'data'
,
function
(
data
)
{
term
.
on
(
'data'
,
function
(
data
)
{
term
.
write
(
data
.
replace
(
'
\
r'
,
'
\
r
\
n'
))
{
#
term
.
write
(
data
.
replace
(
'
\
r'
,
'
\
r
\
n'
))
#
}
term
.
write
(
data
);
});
});
calWinSize
();
window
.
onresize
=
function
()
{
resize
();
resize
()
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
};
{
#
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
#
}
setInterval
(
function
()
{
setInterval
(
function
()
{
requestAndWrite
()
requestAndWrite
()
},
interval
)
},
interval
)
...
...
apps/ops/templates/ops/task_adhoc.html
View file @
7de6af89
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
</li>
</li>
<li>
<li>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600
,left=400,top=400
')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
apps/ops/templates/ops/task_detail.html
View file @
7de6af89
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
</li>
</li>
<li>
<li>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600
,left=400,top=400
')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
apps/ops/templates/ops/task_history.html
View file @
7de6af89
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
<a
href=
"{% url 'ops:task-history' pk=object.pk %}"
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Run history' %}
</a>
</li>
</li>
<li>
<li>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
<a
class=
"text-center celery-task-log"
onclick=
"window.open('{% url 'ops:celery-task-log' pk=object.latest_history.pk %}','', 'width=800,height=600
,left=400,top=400
')"
><i
class=
"fa fa-laptop"
></i>
{% trans 'Last run output' %}
</a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
apps/ops/templates/ops/task_list.html
View file @
7de6af89
...
@@ -115,7 +115,7 @@ $(document).ready(function() {
...
@@ -115,7 +115,7 @@ $(document).ready(function() {
var
success
=
function
(
data
)
{
var
success
=
function
(
data
)
{
var
task_id
=
data
.
task
;
var
task_id
=
data
.
task
;
var
url
=
'{% url "ops:celery-task-log" pk=DEFAULT_PK %}'
.
replace
(
"{{ DEFAULT_PK }}"
,
task_id
);
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
({
APIUpdateAttr
({
url
:
the_url
,
url
:
the_url
,
...
...
apps/ops/views.py
View file @
7de6af89
...
@@ -124,3 +124,6 @@ class AdHocHistoryDetailView(AdminUserRequiredMixin, DetailView):
...
@@ -124,3 +124,6 @@ class AdHocHistoryDetailView(AdminUserRequiredMixin, DetailView):
class
CeleryTaskLogView
(
AdminUserRequiredMixin
,
DetailView
):
class
CeleryTaskLogView
(
AdminUserRequiredMixin
,
DetailView
):
template_name
=
'ops/celery_task_log.html'
template_name
=
'ops/celery_task_log.html'
model
=
CeleryTask
model
=
CeleryTask
def
get_object
(
self
,
queryset
=
None
):
return
CeleryTask
(
id
=
"4cae9ad8-1116-45e7-b019-9b1856696fd7"
)
apps/static/js/plugins/xterm/xterm.css
0 → 100644
View file @
7de6af89
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/xterm/xterm.js
0 → 100644
View file @
7de6af89
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/xterm/xterm.js.map
0 → 100644
View file @
7de6af89
This source diff could not be displayed because it is too large. You can
view the blob
instead.
apps/terminal/templates/terminal/session_detail.html
View file @
7de6af89
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
<td>
{% trans 'Replay session' %}:
</td>
<td>
{% trans 'Replay session' %}:
</td>
<td>
<td>
<span
class=
"pull-right"
>
<span
class=
"pull-right"
>
<button
type=
"button"
onclick=
"window.open('/luna/replay/{{ object.id }}','luna', 'height=600, width=800, top=
0, left=
0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-primary btn-xs"
id=
"btn_reset_password"
style=
"width: 54px"
>
{% trans 'Go' %}
</button>
<button
type=
"button"
onclick=
"window.open('/luna/replay/{{ object.id }}','luna', 'height=600, width=800, top=
400, left=40
0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-primary btn-xs"
id=
"btn_reset_password"
style=
"width: 54px"
>
{% trans 'Go' %}
</button>
</span>
</span>
</td>
</td>
</tr>
</tr>
...
...
apps/terminal/templates/terminal/session_list.html
View file @
7de6af89
...
@@ -99,7 +99,7 @@
...
@@ -99,7 +99,7 @@
<td
class=
"text-center"
>
{{ session.date_start|time_util_with_seconds:session.date_end }}
</td>
<td
class=
"text-center"
>
{{ session.date_start|time_util_with_seconds:session.date_end }}
</td>
<td>
<td>
{% if session.is_finished %}
{% if session.is_finished %}
<a
onclick=
"window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=
0, left=
0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-xs btn-warning btn-replay"
>
{% trans "Replay" %}
</a>
<a
onclick=
"window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=
400, left=40
0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-xs btn-warning btn-replay"
>
{% trans "Replay" %}
</a>
{% else %}
{% else %}
<!--<a onclick="window.open('/luna/monitor/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-monitor" >{% trans "Monitor" %}</a>-->
<!--<a onclick="window.open('/luna/monitor/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-monitor" >{% trans "Monitor" %}</a>-->
<a
class=
"btn btn-xs btn-danger btn-term"
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
<a
class=
"btn btn-xs btn-danger btn-term"
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment