Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions emhttp/plugins/dynamix.docker.manager/DockerContainers.page
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tag="cubes"
Cond="is_file('/var/run/dockerd.pid')"
Markdown="false"
Nchan="docker_load,tailscale_status"
Tabs="false"
Focus="dockerFixedHeightFix"
---
<?PHP
/* Copyright 2005-2025, Lime Technology
Expand All @@ -26,6 +26,11 @@ $width = $themeHelper->isTopNavTheme() ? -58: -44; // $themeHelper set in Defa
$top = $themeHelper->isTopNavTheme() ? 40 : 20;
$busy = "<i class='fa fa-spin fa-circle-o-notch'></i> <span class='font-sans'>"._('Please wait')."... "._('starting up containers')."</span>";
$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;

?>
<link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.switchbutton.css')?>">

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 (_var($display,'resize')):?>
if ( !focus ) {
if (data[2]==1) {$('#busy').show(); scheduleNextLoad(5000);} else if ($('#busy').is(':visible')) {$('#busy').hide(); scheduleNextLoad(3000);}
}
<?if ($dockerFixedHeight):?>
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());});
Expand All @@ -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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
resizeTableColumns()
if (init) {
Expand All @@ -203,7 +215,7 @@ function loadlist(init) {
<?endif;?>
if (!update) $('input#updateAll').prop('disabled',true);
if (rebuild) rebuildAll();
});
}).always(function(){dockerLoading = false;});
}
function contSizes() {
// show spinner over window
Expand Down Expand Up @@ -237,5 +249,7 @@ $(function() {
dockerload.start();
tailscaleStatus.start();
});

function dockerFixedHeightFix() {
loadlist(false,true);
}
</script>
Loading