Files
webgui/plugins/dynamix/DashboardApps.page
2018-09-03 12:57:44 -07:00

78 lines
3.6 KiB
Plaintext

Menu="Dashboard:1"
Title="Apps"
Tag="map"
Cond="(((pgrep('dockerd')!==false) || (pgrep('libvirtd')!==false)) && ($display['dashapps']!='none'))"
Markdown="false"
---
<?
$width = strstr('white,black',$display['theme']) ? -58: -44;
?>
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.ui.css')?>">
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">
<style>
body{-webkit-overflow-scrolling:touch}
label{display:inline}
iframe{overflow:scroll;-webkit-overflow-scrolling:touch}
h2{color:#625D5D;letter-spacing:0;font-size:32px;line-height:1.2em;font-weight:300;padding:0 0 20px;margin:0}
.iconstatus{position:absolute;z-index:2;bottom:-4px;right:-4px;font-size:1.3em;text-shadow:0 0 2px #FFF}
img.started{opacity:1.0}
img.stopped{opacity:0.3}
img.paused{opacity:0.6}
.started{color:#009900}
.stopped{color:#EF3D47}
.paused{color:#F0DD33}
.update{color:#3300FF}
.show{display:block}
div.Panel{float:none;display:inline-block;margin:0 18px 15px 0;height:90px;overflow:hidden;vertical-align:top;width:94px;word-wrap:break-word;border:none}
div.Panel:hover{overflow:visible;z-index:10;background-color:unset}
#noapps{display:none;font-style:italic;font-size:16px;opacity:0.5;padding:5px}
.switch-button-label.off{color:inherit}
.switch-button-label.on{color:#009900}
</style>
<form method="POST" id="formStartStop" action="/update.php" target="progressFrame">
<input type="hidden" id="cmdStartStop" name="#command" value="">
<input type="hidden" id="cmdArg1" name="#arg[1]" value="">
<input type="hidden" id="cmdArg2" name="#arg[2]" value="">
</form>
<form method="POST" id="formAutostart" action="/plugins/dynamix.docker.manager/include/UpdateConfig.php" target="progressFrame">
<input type="hidden" name="action" value="autostart" />
<input type="hidden" name="container" value="none" />
</form>
<div id="dialog-confirm" style="display:none;" title="Dialog Title"></div>
<div id="iframe-popup" style="display:none;-webkit-overflow-scrolling:touch;"></div>
<span class="status" style="margin-top:<?=$width?>px;margin-right:0"><input type="checkbox" class="appview"></span>
<div id="apps_icons" style="display:none"></div><div id="noapps">No apps available to show</div>
<script src="<?autov('/webGui/javascript/jquery.switchbutton.js')?>"></script>
<script src="<?autov('/plugins/dynamix.docker.manager/javascript/docker.js')?>"></script>
<script src="<?autov('/plugins/dynamix.vm.manager/javascript/vmmanager.js')?>"></script>
<script>
function loadlist() {
$.post('/webGui/include/DashboardApps.php',{display:'<?=$display['dashapps']?>'},function(d) {
var data = d.split(/\0/);
$('#apps_icons').html(data[0]);
$('head').append('<script>'+data[1]+'<\/script>');
if ($.cookie('dashapps_view_mode')=='startedonly') {
$('.Panel.stopped').hide();
if ($('.Panel.started').length===0 && $('.Panel.paused').length===0) $('#noapps').show();
}
if ($('.Panel').length===0) $('#noapps').show();
$('#apps_icons').slideDown('fast');
context.init({preventDoubleContext:false});
});
}
$(function() {
$('.appview').switchButton({labels_placement:"left", on_label:'Started Only', off_label:'All Apps', checked:$.cookie('dashapps_view_mode') == 'startedonly'});
$('.appview').change(function() {
$('.Panel.stopped').finish().toggle('fast');
if ($('.Panel').length===0 || ($('.appview').is(':checked') && $('.Panel.started').length===0 && $('.Panel.paused').length===0)) {
$('#noapps').slideDown('fast');
} else {
$('#noapps').slideUp('fast');
}
$.cookie('dashapps_view_mode',$('.appview').is(':checked') ? 'startedonly':'allapps',{expires:3650});
});
loadlist();
});
</script>