mirror of
https://github.com/unraid/webgui.git
synced 2026-04-26 12:20:42 -05:00
Updates to openterminal implementation
This commit is contained in:
@@ -4,7 +4,7 @@ function addDockerContainerContext(container, image, template, started, paused,
|
||||
var opts = [];
|
||||
if (started && !paused) {
|
||||
if (webui !== '' && webui != '#') opts.push({text:_('WebUI'), icon:'fa-globe', href:webui, target:'_blank'});
|
||||
opts.push({text:_('Console'), icon:'fa-terminal', action:function(e){e.preventDefault(); openTerminal('docker',container,shell,Math.max(screen.availHeight*3/5,600),Math.max(screen.availWidth/2,900));}});
|
||||
opts.push({text:_('Console'), icon:'fa-terminal', action:function(e){e.preventDefault(); openTerminal('docker',container,shell);}});
|
||||
opts.push({divider:true});
|
||||
}
|
||||
if (update==1) {
|
||||
@@ -23,7 +23,7 @@ function addDockerContainerContext(container, image, template, started, paused,
|
||||
opts.push({text:_('Start'), icon:'fa-play', action:function(e){e.preventDefault(); eventControl({action:'start', container:id}, 'loadlist');}});
|
||||
}
|
||||
opts.push({divider:true});
|
||||
opts.push({text:_('Logs'), icon:'fa-navicon', action:function(e){e.preventDefault(); openTerminal('docker',container,id,Math.max(screen.availHeight*3/5,600),Math.max(screen.availWidth/2,900));}});
|
||||
opts.push({text:_('Logs'), icon:'fa-navicon', action:function(e){e.preventDefault(); openTerminal('docker',container,'log');}});
|
||||
if (template) {
|
||||
opts.push({text:_('Edit'), icon:'fa-wrench', action:function(e){e.preventDefault(); editContainer(container, template);}});
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ _(VFIO allow unsafe interrupts)_:
|
||||
|
||||
</div>
|
||||
<?if ($libvirt_log):?>
|
||||
<input type="button" onclick="openTerminal('log','libvirt','libvirt/libvirtd.log',600,900);" value="<?=_('View libvirt log')?>"/>
|
||||
<input type="button" onclick="openTerminal('log','libvirt','libvirt/libvirtd.log');" value="<?=_('View libvirt log')?>"/>
|
||||
<?else:?>
|
||||
|
||||
<?endif;?>
|
||||
|
||||
@@ -73,7 +73,7 @@ function addVMContext(name, uuid, template, state, vncurl, log){
|
||||
}
|
||||
opts.push({divider:true});
|
||||
if (log !== "") {
|
||||
opts.push({text:_("Logs"), icon:"fa-navicon", action:function(e){e.preventDefault(); openTerminal('log',name,log,600,900);}});
|
||||
opts.push({text:_("Logs"), icon:"fa-navicon", action:function(e){e.preventDefault(); openTerminal('log',name,log);}});
|
||||
}
|
||||
opts.push({text:_("Edit"), icon:"fa-pencil", href:path+'/UpdateVM?uuid='+uuid});
|
||||
if (state == "shutoff") {
|
||||
|
||||
@@ -17,6 +17,6 @@ Code="e936"
|
||||
?>
|
||||
<script>
|
||||
function LogButton() {
|
||||
openTerminal('syslog','syslog','',Math.max(screen.availHeight*3/5,600),Math.max(screen.availWidth/2,900));
|
||||
openTerminal('syslog','syslog','');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -18,6 +18,6 @@ Code="e93f"
|
||||
<script>
|
||||
function TerminalButton() {
|
||||
var d = new Date();
|
||||
openTerminal('ttyd','Web Terminal '+d.getTime(),'',Math.max(screen.availHeight*3/5,600),Math.max(screen.availWidth/2,900));
|
||||
openTerminal('ttyd','Web Terminal '+d.getTime(),'');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -219,15 +219,15 @@ function openWindow(cmd,title,height,width) {
|
||||
makeWindow(window_name,height,width);
|
||||
form.submit();
|
||||
}
|
||||
function openTerminal(tag,name,more,height,width) {
|
||||
function openTerminal(tag,name,more) {
|
||||
if (/MSIE|Edge/.test(navigator.userAgent)) {
|
||||
swal({title:"_(Unsupported Feature)_",text:"_(Sorry, this feature is not supported by MSIE/Edge)_.<br>_(Please try a different browser)_",html:true,type:'error',confirmButtonText:"_(Ok)_"});
|
||||
return;
|
||||
}
|
||||
// open terminal window (run in background)
|
||||
name = name.replace(/ /g,"_");
|
||||
tty_window = makeWindow(name,height,width);
|
||||
var socket = ['ttyd','syslog'].includes(tag) ? '/webterminal/'+tag+'/' : '/logterminal/'+(more.length==12 ? more : name)+'/';
|
||||
tty_window = makeWindow(name,Math.max(screen.availHeight*3/5,600),Math.max(screen.availWidth/2,900));
|
||||
var socket = ['ttyd','syslog'].includes(tag) ? '/webterminal/'+tag+'/' : '/logterminal/'+name+(more=='log'?'.log':'')+'/';
|
||||
$.get('/webGui/include/OpenTerminal.php',{tag:tag,name:name,more:more},function(){tty_window.location=socket; tty_window.focus();});
|
||||
}
|
||||
function showStatus(name,plugin,job) {
|
||||
|
||||
Reference in New Issue
Block a user