mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
支持修改窗口大小
This commit is contained in:
@@ -233,6 +233,7 @@
|
||||
layer.alert('没有授权系统用户')
|
||||
}
|
||||
else if (dataArray.length == 1 && data != 'error' && navigator.platform == 'Win32'){
|
||||
/*
|
||||
var title = 'Jumpserver Web Terminal' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
layer.open({
|
||||
type: 2,
|
||||
@@ -242,8 +243,10 @@
|
||||
area: ['628px', '420px'],
|
||||
content: new_url+data
|
||||
});
|
||||
*/
|
||||
window.open(new_url+data, '', 'width=628px, height=420px')
|
||||
} else if (dataArray.length == 1 && data != 'error'){
|
||||
layer.open({
|
||||
/*layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
maxmin: true,
|
||||
@@ -251,6 +254,9 @@
|
||||
area: ['628px', '452px'],
|
||||
content: new_url+data
|
||||
});
|
||||
*/
|
||||
window.open(new_url+data, '', 'width=628px, height=440px')
|
||||
|
||||
}
|
||||
else {
|
||||
aUrl = '';
|
||||
@@ -276,6 +282,7 @@
|
||||
var hostname = $(a).attr('value');
|
||||
var title = 'Jumpserver Web Terminal - ' + '<span class="text-info"> '+ hostname +'</span>';
|
||||
if (navigator.platform == 'Win32'){
|
||||
/*
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
@@ -284,8 +291,11 @@
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
*/
|
||||
window.open(new_url, '', 'height=628px, width=420px')
|
||||
|
||||
} else {
|
||||
/*
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: title,
|
||||
@@ -294,6 +304,8 @@
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
*/
|
||||
window.open(new_url, '', 'height=628px, width=452px')
|
||||
}
|
||||
|
||||
return false
|
||||
@@ -310,7 +322,6 @@
|
||||
shade: false,
|
||||
content: new_url
|
||||
});
|
||||
console.log(new_url);
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Jumpserver web terminal</title>
|
||||
<title>Jumpserver Web Terminal: {{ hostname }}</title>
|
||||
|
||||
<style>
|
||||
body {
|
||||
@@ -37,6 +37,8 @@
|
||||
<script type="application/javascript" src="/static/js/term.js">
|
||||
</script>
|
||||
<script type="application/javascript">
|
||||
var rowHeight = 1;
|
||||
var colWidth = 1;
|
||||
function WSSHClient() {
|
||||
}
|
||||
|
||||
@@ -101,7 +103,22 @@
|
||||
term.write(data);
|
||||
}
|
||||
}));
|
||||
rowHeight = 0.0 + 1.00 * $('.terminal').height() / 24 ;
|
||||
colWidth = 0.0 + 1.00 * $('.terminal').width() / 80;
|
||||
return {'term': term, 'client': client};
|
||||
}
|
||||
|
||||
function resize(){
|
||||
$('.terminal').css('width', window.innerWidth-25);
|
||||
console.log(window.innerWidth);
|
||||
console.log(window.innerWidth-10);
|
||||
var rows = Math.floor(window.innerHeight/rowHeight) - 1;
|
||||
var cols = Math.floor(window.innerWidth/colWidth) - 1;
|
||||
|
||||
return {rows: rows, cols: cols};
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type='application/javascript'>
|
||||
@@ -110,7 +127,17 @@
|
||||
};
|
||||
|
||||
$('#ssh').show();
|
||||
openTerminal(options);
|
||||
var term_client = openTerminal(options);
|
||||
console.log(rowHeight);
|
||||
|
||||
window.onresize = function(){
|
||||
var geom = resize();
|
||||
console.log(geom);
|
||||
term_client.term.resize(geom.cols, geom.rows);
|
||||
term_client.client.send({'resize': {'roles': geom.rows, 'cols': geom.cols}});
|
||||
$('#ssh').show();
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -325,7 +325,10 @@
|
||||
|
||||
$('.push_failed').click(function() {
|
||||
var fail_reason = $(this).attr('title');
|
||||
layer.alert(fail_reason)
|
||||
layer.alert(fail_reason, {
|
||||
skin: 'layui-layer-molv',
|
||||
area: '500px'
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user