From 56441f0c1cb2c24d7aa9b67da7ed6077ef15f35f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 26 Jan 2025 04:48:03 +0100 Subject: [PATCH 1/3] Add screenReaderText to container actions table column This fixes the avalanche of > Th: Table headers must have an accessible name. If the Th is intended to be visually empty, pass in screenReaderText. If the Th contains only non-text, interactive content such as a checkbox or expand toggle, pass in an aria-label. console messages, which completely drown any actually useful messages for debugging. --- src/Containers.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Containers.jsx b/src/Containers.jsx index 8ab26f8a..0076cdd2 100644 --- a/src/Containers.jsx +++ b/src/Containers.jsx @@ -575,7 +575,7 @@ class Containers extends React.Component { { title: _("CPU"), sortable: true, props: { className: 'ct-numeric-column' } }, { title: _("Memory"), sortable: true, props: { className: 'ct-numeric-column' } }, { title: _("State"), sortable: true }, - '' + { title: "", sortable: false, props: { screenReaderText: _("Actions") } }, ]; const partitionedContainers = { 'no-pod': [] }; let filtered = []; From deae997583a96fb32a45e6e170b963e9f18fd09d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 24 Jan 2025 21:53:04 +0100 Subject: [PATCH 2/3] Fix XTerm.js crash on undefined `dimensions` During terminal initialization, the `_renderService` or its `.dimensions` attribute may not yet be defined. Exit the resizing function in this case instead of crashing with a `TypeError`. Add a reference to the upstream issue about this internal API hackery. --- src/ContainerLogs.jsx | 3 +++ src/ContainerTerminal.jsx | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/ContainerLogs.jsx b/src/ContainerLogs.jsx index 78431da4..1907ca73 100644 --- a/src/ContainerLogs.jsx +++ b/src/ContainerLogs.jsx @@ -80,11 +80,14 @@ class ContainerLogs extends React.Component { } resize(width) { + if (!this.term?._core?._renderService?.dimensions) + return; // 24 PF padding * 4 // 3 line border // 21 inner padding of xterm.js // xterm.js scrollbar 20 const padding = 24 * 4 + 3 + 21 + 20; + // missing API: https://github.com/xtermjs/xterm.js/issues/702 const realWidth = this.view._core._renderService.dimensions.css.cell.width; const cols = Math.floor((width - padding) / realWidth); this.view.resize(cols, 24); diff --git a/src/ContainerTerminal.jsx b/src/ContainerTerminal.jsx index d69ab728..c6145a31 100644 --- a/src/ContainerTerminal.jsx +++ b/src/ContainerTerminal.jsx @@ -103,11 +103,14 @@ class ContainerTerminal extends React.Component { } resize(width) { + if (!this.term?._core?._renderService?.dimensions) + return; // 24 PF padding * 4 // 3 line border // 21 inner padding of xterm.js // xterm.js scrollbar 20 const padding = 24 * 4 + 3 + 21 + 20; + // missing API: https://github.com/xtermjs/xterm.js/issues/702 const realWidth = this.term._core._renderService.dimensions.css.cell.width; const cols = Math.floor((width - padding) / realWidth); this.term.resize(cols, 24); From 3b86a819890a51fbc5a8a0aab8ff2c81438e78a7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 26 Jan 2025 12:29:25 +0100 Subject: [PATCH 3/3] Improve console log messages --- src/app.jsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index 2f3733f0..a2e19871 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -200,7 +200,8 @@ class Application extends React.Component { }); this.updateContainerStats(system); }) - .catch(console.log); + .catch(e => console.warn("initContainers", system ? "system" : "user", + "getContainers failed:", e.toString())); } updateImages(system) { @@ -272,7 +273,8 @@ class Application extends React.Component { details.State.Status = "restarting"; this.updateState("containers", idx, details); }) - .catch(console.log); + .catch(e => console.warn("updateContainer", system ? "system" : "user", + "inspectContainer failed:", e.toString())); this.pendingUpdateContainer[idx] = new_wait; new_wait.finally(() => { delete this.pendingUpdateContainer[idx] }); @@ -473,7 +475,7 @@ class Application extends React.Component { this.cleanupAfterService(system); }) .catch(e => { - console.log(e); + console.error("init", system ? "system" : "user", "streamEvents failed:", e.toString()); this.setState({ [system ? "systemServiceAvailable" : "userServiceAvailable"]: false }); this.cleanupAfterService(system); }); @@ -481,13 +483,17 @@ class Application extends React.Component { // Listen if podman is still running const ch = cockpit.channel({ superuser: system ? "require" : null, payload: "stream", unix: client.getAddress(system) }); ch.addEventListener("close", () => { + console.log("init", system ? "system" : "user", "podman service closed"); this.setState({ [system ? "systemServiceAvailable" : "userServiceAvailable"]: false }); this.cleanupAfterService(system); }); ch.send("GET " + client.VERSION + "libpod/events HTTP/1.0\r\nContent-Length: 0\r\n\r\n"); }) - .catch(() => { + .catch(err => { + if (!system || err.problem != 'access-denied') + console.warn("init", system ? "system" : "user", "getInfo failed:", err.toString()); + this.setState({ [system ? "systemServiceAvailable" : "userServiceAvailable"]: false, [system ? "systemContainersLoaded" : "userContainersLoaded"]: true,