diff --git a/emhttp/plugins/dynamix.docker.manager/DockerContainers.page b/emhttp/plugins/dynamix.docker.manager/DockerContainers.page index 6e9f853f3..536ab8521 100755 --- a/emhttp/plugins/dynamix.docker.manager/DockerContainers.page +++ b/emhttp/plugins/dynamix.docker.manager/DockerContainers.page @@ -4,7 +4,7 @@ Tag="cubes" Cond="is_file('/var/run/dockerd.pid')" Markdown="false" Nchan="docker_load,tailscale_status" -Tabs="false" +Focus="dockerFixedHeightFix" --- isTopNavTheme() ? -58: -44; // $themeHelper set in Defa $top = $themeHelper->isTopNavTheme() ? 40 : 20; $busy = " "._('Please wait')."... "._('starting up containers').""; $cpus = cpu_list(); + +// if a plugin adds a new tab and settings are in non-tabbed view, then force automatic listing height on the docker containers table. Fixed height doesn't make sense in this situation. +$dockerFixedHeight = _var($display,'resize'); +if ( (count($pages??[]) > 2) && !$tabbed) $dockerFixedHeight = false; + ?> @@ -131,7 +136,12 @@ function scheduleNextLoad(delay) { } setTimeout(loadlist, delay); } -function loadlist(init) { +var dockerLoading = false; +function loadlist(init,focus=false) { + // A focus reload is only there to re-render the list once the tab is visible. If a request is already + // in flight its response will do that, so don't start an overlapping request. + if (focus && dockerLoading) return; + dockerLoading = true; timers.docker = setTimeout(function(){$('div.spinner.fixed').show('slow');},500); docker = []; $.get('/plugins/dynamix.docker.manager/include/DockerContainers.php',function(d) { @@ -178,8 +188,10 @@ function loadlist(init) { } listview(); $('div.spinner.fixed').hide('slow'); - if (data[2]==1) {$('#busy').show(); scheduleNextLoad(5000);} else if ($('#busy').is(':visible')) {$('#busy').hide(); scheduleNextLoad(3000);} - + if ( !focus ) { + if (data[2]==1) {$('#busy').show(); scheduleNextLoad(5000);} else if ($('#busy').is(':visible')) {$('#busy').hide(); scheduleNextLoad(3000);} + } + function resizeTableColumns() { // Handle table header fixed positioning after resize $('#docker_containers thead,#docker_containers tbody').removeClass('fixed'); $('#docker_containers thead tr th').each(function(){$(this).width($(this).width());}); @@ -192,7 +204,7 @@ function loadlist(init) { '.js-actions', '#docker_containers thead', ], - manualSpacingOffset: 30, // without this, the main content will still be scrollable by like 20px + manualSpacingOffset: 100, // without this, the main content will still be scrollable by like 20px }); resizeTableColumns() if (init) { @@ -203,7 +215,7 @@ function loadlist(init) { if (!update) $('input#updateAll').prop('disabled',true); if (rebuild) rebuildAll(); - }); + }).always(function(){dockerLoading = false;}); } function contSizes() { // show spinner over window @@ -237,5 +249,7 @@ $(function() { dockerload.start(); tailscaleStatus.start(); }); - +function dockerFixedHeightFix() { + loadlist(false,true); +}