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
116a04da
Commit
116a04da
authored
May 10, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'term_js' into dev
parents
8e74a042
7de6af89
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 @
116a04da
...
...
@@ -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
,
...
...
apps/assets/templates/assets/system_user_detail.html
View file @
116a04da
...
...
@@ -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
,
...
...
apps/ops/api.py
View file @
116a04da
...
...
@@ -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
=
s
uper
()
.
get_object
()
task
=
s
elf
.
get_object
()
log_path
=
task
.
full_log_path
if
not
log_path
or
not
os
.
path
.
isfile
(
log_path
):
...
...
apps/ops/templates/ops/adhoc_history_detail.html
View file @
116a04da
...
...
@@ -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>
</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>
</ul>
</div>
...
...
apps/ops/templates/ops/celery_task_log.html
View file @
116a04da
...
...
@@ -2,38 +2,25 @@
<head>
<title>
term.js
</title>
<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>
html
{
background
:
#000
;
}
h1
{
margin-bottom
:
20px
;
font
:
20px
/
1.5
sans-serif
;
}
.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
;
}
body
{
background-color
:
black
;
}
.xterm-rows
{
{#
padding
:
15px
;
#
}
font-family
:
"Bitstream Vera Sans Mono"
,
Monaco
,
"Consolas"
,
Courier
,
monospace
;
font-size
:
13px
;
}
</style>
</head>
<div
class=
"container"
>
<div
id=
"term"
>
<div
id=
"term"
style=
"height: 100%;width: 100%"
>
</div>
</div>
<script
src=
"{% static 'js/term.js' %}"
></script>
<script>
var
rowHeight
=
1
;
var
colWidth
=
1
;
var
rowHeight
=
1
8
;
var
colWidth
=
1
0
;
var
mark
=
''
;
var
url
=
"{% url 'api-ops:celery-task-log' pk=object.id %}"
;
var
term
;
...
...
@@ -42,13 +29,16 @@
var
interval
=
200
;
function
calWinSize
()
{
var
t
=
$
(
'
.terminal
'
);
rowHeight
=
1.00
*
t
.
height
()
/
24
;
colWidth
=
1.00
*
t
.
width
()
/
80
;
var
t
=
$
(
'
#marker
'
);
{
#
rowHeight
=
1.00
*
t
.
height
();
#
}
{
#
colWidth
=
1.00
*
t
.
width
()
/
6
;
#
}
}
function
resize
()
{
var
rows
=
Math
.
floor
(
window
.
innerHeight
/
rowHeight
)
-
2
;
var
cols
=
Math
.
floor
(
window
.
innerWidth
/
colWidth
)
-
10
;
{
#
console
.
log
(
rowHeight
,
window
.
innerHeight
);
#
}
{
#
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
);
}
function
requestAndWrite
()
{
...
...
@@ -74,21 +64,18 @@
}
}
$
(
document
).
ready
(
function
()
{
term
=
new
Terminal
({
cols
:
80
,
rows
:
24
,
useStyle
:
true
,
screenKeys
:
false
,
convertEol
:
false
,
cursorBlink
:
false
});
term
.
open
();
term
=
new
Terminal
();
term
.
open
(
document
.
getElementById
(
'term'
));
term
.
resize
(
80
,
24
);
resize
();
term
.
on
(
'data'
,
function
(
data
)
{
term
.
write
(
data
.
replace
(
'
\
r'
,
'
\
r
\
n'
))
{
#
term
.
write
(
data
.
replace
(
'
\
r'
,
'
\
r
\
n'
))
#
}
term
.
write
(
data
);
});
calWinSize
();
resize
();
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
window
.
onresize
=
function
()
{
resize
()
};
{
#
$
(
'.terminal'
).
detach
().
appendTo
(
'#term'
);
#
}
setInterval
(
function
()
{
requestAndWrite
()
},
interval
)
...
...
apps/ops/templates/ops/task_adhoc.html
View file @
116a04da
...
...
@@ -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>
</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>
</ul>
</div>
...
...
apps/ops/templates/ops/task_detail.html
View file @
116a04da
...
...
@@ -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>
</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>
</ul>
</div>
...
...
apps/ops/templates/ops/task_history.html
View file @
116a04da
...
...
@@ -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>
</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>
</ul>
</div>
...
...
apps/ops/templates/ops/task_list.html
View file @
116a04da
...
...
@@ -115,7 +115,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
,
...
...
apps/ops/views.py
View file @
116a04da
...
...
@@ -124,3 +124,6 @@ class AdHocHistoryDetailView(AdminUserRequiredMixin, DetailView):
class
CeleryTaskLogView
(
AdminUserRequiredMixin
,
DetailView
):
template_name
=
'ops/celery_task_log.html'
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 @
116a04da
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/xterm/xterm.js
0 → 100644
View file @
116a04da
This diff is collapsed.
Click to expand it.
apps/static/js/plugins/xterm/xterm.js.map
0 → 100644
View file @
116a04da
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 @
116a04da
...
...
@@ -88,7 +88,7 @@
<td>
{% trans 'Replay session' %}:
</td>
<td>
<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>
</td>
</tr>
...
...
apps/terminal/templates/terminal/session_list.html
View file @
116a04da
...
...
@@ -99,7 +99,7 @@
<td
class=
"text-center"
>
{{ session.date_start|time_util_with_seconds:session.date_end }}
</td>
<td>
{% 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 %}
<!--<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>
...
...
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