Diff -- /var/www/vhosts/3dshawn.com/site1/containers.cgi

O Operator
Diff

/var/www/vhosts/3dshawn.com/site1/containers.cgi

added on local at 2026-07-10 18:57:29

Added
+30
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to eab41703f6bc
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1#!/usr/bin/perl
2use strict; use warnings; use CGI ();
3use MODS::Config; use MODS::DBConnect; use MODS::Template; use MODS::PageWrapper;
4my $db = MODS::DBConnect->new; my $tpl = MODS::Template->new;
5$|=1; print "Content-Type: text/html; charset=utf-8\nCache-Control: no-cache\n\n";
6my $dbh = $db->db_connect or die "DB connect failed\n";
7my @rows = $db->db_readwrite_multiple($dbh, q~
8 SELECT c.container_target_id AS id, c.orchestrator, c.container_id, c.container_name,
9 c.image, c.is_monitored, c.overlay_upper_path,
10 DATE_FORMAT(c.started_at, '%b %d %H:%i') AS started_h,
11 DATE_FORMAT(c.stopped_at, '%b %d %H:%i') AS stopped_h,
12 s.server_name
13 FROM CONTAINER_TARGETS c LEFT JOIN SERVERS s ON s.server_id = c.server_id
14 ORDER BY c.stopped_at IS NULL DESC, c.started_at DESC LIMIT 200
15~, __FILE__, __LINE__);
16foreach my $r (@rows) {
17 $r->{status_pill} = $r->{stopped_h} ? 'pill-mute' : 'pill-ok';
18 $r->{status_lbl} = $r->{stopped_h} ? 'STOPPED' : 'RUNNING';
19 $r->{monitor_pill} = $r->{is_monitored} ? 'pill-ok' : 'pill-mute';
20 $r->{monitor_lbl} = $r->{is_monitored} ? 'WATCHING' : 'IGNORED';
21 $r->{container_short} = substr($r->{container_id} // '', 0, 12);
22}
23$db->db_disconnect($dbh);
24
25my @body = $tpl->template('containers.html',
26 { rows => \@rows, has_rows => scalar(@rows) ? 1 : 0, total => scalar @rows });
27MODS::PageWrapper->new->wrapper(
28 page_title => 'Containers', page_key => 'containers',
29 body_html => join('', @body), userinfo => { display_name => 'Operator' },
30);