mirror of https://github.com/jumpserver/jumpserver
commit
6436fab837
|
@ -9,7 +9,6 @@ from django.http import HttpResponseNotFound
|
||||||
from jlog.log_api import renderTemplate
|
from jlog.log_api import renderTemplate
|
||||||
|
|
||||||
from jlog.models import Log, ExecLog, FileLog
|
from jlog.models import Log, ExecLog, FileLog
|
||||||
from jumpserver.settings import WEB_SOCKET_URL
|
|
||||||
|
|
||||||
|
|
||||||
@require_role('admin')
|
@require_role('admin')
|
||||||
|
@ -66,8 +65,6 @@ def log_list(request, offset):
|
||||||
|
|
||||||
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
contact_list, p, contacts, page_range, current_page, show_first, show_end = pages(posts, request)
|
||||||
|
|
||||||
web_monitor_url = '%s/monitor' % WEB_SOCKET_URL
|
|
||||||
web_kill_url = '/kill'
|
|
||||||
session_id = request.session.session_key
|
session_id = request.session.session_key
|
||||||
return render_to_response('jlog/log_%s.html' % offset, locals(), context_instance=RequestContext(request))
|
return render_to_response('jlog/log_%s.html' % offset, locals(), context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,5 @@
|
||||||
} else {
|
} else {
|
||||||
$("#"+s1).addClass('active');
|
$("#"+s1).addClass('active');
|
||||||
$('#'+s1+' .'+s2).addClass('active');
|
$('#'+s1+' .'+s2).addClass('active');
|
||||||
console.log(s1)
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -128,17 +128,17 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{#<script src="http://{{ web_socket_host }}/socket.io/socket.io.js"></script>#}
|
|
||||||
<script>
|
<script>
|
||||||
{# $(document).ready(function(){#}
|
|
||||||
{# $('.monitor').click(function(){#}
|
|
||||||
{# window.open('/jlog/monitor/', '监控', 'height=500, width=910, top=89px, left=99px,toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');#}
|
|
||||||
{# })#}
|
|
||||||
{# });#}
|
|
||||||
function init(obj){
|
function init(obj){
|
||||||
|
if (window.location.protocol == 'https:') {
|
||||||
|
var protocol = 'wss://';
|
||||||
|
} else {
|
||||||
|
var protocol = 'ws://';
|
||||||
|
}
|
||||||
|
|
||||||
|
var endpoint = protocol + document.URL.match(RegExp('//(.*?)/'))[1] + '/monitor';
|
||||||
var file_path = obj.attr('file_path');
|
var file_path = obj.attr('file_path');
|
||||||
var wsUri = '{{ web_monitor_url }}';
|
var socket = new WebSocket(endpoint + '?file_path=' + file_path);
|
||||||
var socket = new WebSocket(wsUri + '?file_path=' + file_path);
|
|
||||||
|
|
||||||
var term = new Terminal({
|
var term = new Terminal({
|
||||||
cols: 80,
|
cols: 80,
|
||||||
|
@ -165,7 +165,6 @@
|
||||||
|
|
||||||
BootstrapDialog.show({message: function(){
|
BootstrapDialog.show({message: function(){
|
||||||
//服务器端认证
|
//服务器端认证
|
||||||
{# socket.send('login', {userid:message.id, filename:message.filename,username:username,seed:seed});#}
|
|
||||||
window.setTimeout(function(){
|
window.setTimeout(function(){
|
||||||
$('.terminal').detach().appendTo('#term');
|
$('.terminal').detach().appendTo('#term');
|
||||||
socket.onmessage = function(evt){
|
socket.onmessage = function(evt){
|
||||||
|
@ -204,9 +203,11 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function cut(num, login_type){
|
function cut(num, login_type){
|
||||||
console.log(login_type);
|
var protocol = window.location.protocol;
|
||||||
|
var endpoint = protocol + '//' + document.URL.match(RegExp('//(.*?)/'))[1] + '/kill';
|
||||||
if (login_type=='web'){
|
if (login_type=='web'){
|
||||||
var g_url = '{{ web_kill_url }}' + '?id=' + num;
|
var g_url = endpoint + '?id=' + num;
|
||||||
|
console.log(g_url);
|
||||||
} else {
|
} else {
|
||||||
var g_url = "{% url 'log_kill' %}?id=" + num;
|
var g_url = "{% url 'log_kill' %}?id=" + num;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue