@exagone313/dsh-podman 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/card-route.d.ts +8 -0
- package/dist/card-route.js +19 -8
- package/dist/client/ContainerCard.js +147 -110
- package/dist/client/card-protocol.d.ts +4 -0
- package/dist/client/card-protocol.js +34 -0
- package/dist/client/container-card-caches.d.ts +1 -1
- package/dist/client/container-card-caches.js +19 -17
- package/dist/client/container-card-config.d.ts +47 -0
- package/dist/client/container-card-config.js +160 -0
- package/dist/client/container-card-controller.d.ts +35 -3
- package/dist/client/container-card-controller.js +263 -41
- package/dist/client/container-card-create-modal.d.ts +5 -1
- package/dist/client/container-card-create-modal.js +111 -94
- package/dist/client/container-card-defaults.d.ts +16 -0
- package/dist/client/container-card-defaults.js +147 -0
- package/dist/client/container-card-dialog-styles.d.ts +7 -0
- package/dist/client/container-card-dialog-styles.js +70 -0
- package/dist/client/container-card-dialog.d.ts +12 -0
- package/dist/client/container-card-dialog.js +47 -0
- package/dist/client/container-card-directory-styles.d.ts +1 -1
- package/dist/client/container-card-directory-styles.js +5 -5
- package/dist/client/container-card-directory.js +8 -7
- package/dist/client/container-card-edit-modal.d.ts +39 -0
- package/dist/client/container-card-edit-modal.js +29 -0
- package/dist/client/container-card-editors.d.ts +5 -2
- package/dist/client/container-card-editors.js +109 -134
- package/dist/client/container-card-field-styles.d.ts +7 -0
- package/dist/client/container-card-field-styles.js +63 -0
- package/dist/client/container-card-form.d.ts +47 -0
- package/dist/client/container-card-form.js +61 -0
- package/dist/client/container-card-group.d.ts +9 -0
- package/dist/client/container-card-group.js +22 -0
- package/dist/client/container-card-images.d.ts +6 -2
- package/dist/client/container-card-images.js +63 -23
- package/dist/client/container-card-paths.js +43 -52
- package/dist/client/container-card-ports.d.ts +3 -4
- package/dist/client/container-card-ports.js +74 -38
- package/dist/client/container-card-resources.d.ts +38 -0
- package/dist/client/container-card-resources.js +73 -0
- package/dist/client/container-card-row.d.ts +11 -19
- package/dist/client/container-card-row.js +122 -122
- package/dist/client/container-card-secrets.d.ts +31 -3
- package/dist/client/container-card-secrets.js +174 -56
- package/dist/client/container-card-shared.d.ts +173 -6
- package/dist/client/container-card-shared.js +616 -57
- package/dist/client/container-card-status.d.ts +18 -0
- package/dist/client/container-card-status.js +166 -0
- package/dist/client/container-card-styles.d.ts +49 -7
- package/dist/client/container-card-styles.js +396 -40
- package/dist/client/container-card-table-styles.d.ts +15 -0
- package/dist/client/container-card-table-styles.js +237 -0
- package/dist/client/container-card-tabs-styles.d.ts +5 -0
- package/dist/client/container-card-tabs-styles.js +46 -0
- package/dist/client/container-card-toast.d.ts +5 -0
- package/dist/client/container-card-toast.js +10 -0
- package/dist/client/container-card-volumes.d.ts +1 -0
- package/dist/client/container-card-volumes.js +14 -19
- package/dist/client/container-card-workspace.d.ts +8 -12
- package/dist/client/container-card-workspace.js +76 -14
- package/dist/client/index.js +6488 -3474
- package/dist/client/locales.d.ts +10 -1
- package/dist/client/locales.js +268 -114
- package/dist/client/relative-time.d.ts +10 -0
- package/dist/client/relative-time.js +74 -0
- package/dist/client/slot-contract.d.ts +8 -0
- package/dist/client/tool-views.js +1 -1
- package/dist/container-env.js +1 -1
- package/dist/env-rows.d.ts +9 -11
- package/dist/env-rows.js +72 -40
- package/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +2 -2
- package/dist/guest-terminal.js +1 -1
- package/dist/mount-enums.d.ts +11 -0
- package/dist/mount-enums.js +60 -0
- package/dist/subprocess.js +1 -1
- package/dist/terminal-sessions.js +2 -2
- package/dist/terminal-shells.js +1 -1
- package/dist/tool-handlers.js +1 -1
- package/dist/workspace-binding.js +2 -2
- package/docs/architecture.md +6 -4
- package/docs/architecture.zh.md +3 -1
- package/docs/configuration.md +28 -25
- package/docs/configuration.zh.md +15 -11
- package/docs/development-prompt.md +9 -7
- package/docs/development-prompt.zh.md +9 -7
- package/docs/development.md +25 -18
- package/docs/development.zh.md +22 -18
- package/docs/install-dsh-and-dsh-podman.md +15 -12
- package/docs/install-dsh-and-dsh-podman.zh.md +15 -9
- package/docs/uninstall.md +2 -0
- package/docs/uninstall.zh.md +2 -0
- package/docs/update.md +2 -0
- package/docs/update.zh.md +2 -0
- package/docs/usage.md +191 -39
- package/docs/usage.zh.md +150 -29
- package/package.json +8 -4
- package/dist/client/container-card-default-env.d.ts +0 -10
- package/dist/client/container-card-default-env.js +0 -69
package/dist/card-route.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { type CardSnapshot } from "./client/card-protocol.js";
|
|
2
2
|
import { type ReasonLocale } from "./approval-reasons.js";
|
|
3
3
|
import { type WorkspaceResolver } from "./workspace-binding.js";
|
|
4
|
+
export declare function containerMountView(mount: any, projectsRoot: string): {
|
|
5
|
+
projectName: string;
|
|
6
|
+
destination: string;
|
|
7
|
+
kind: string;
|
|
8
|
+
mode: string;
|
|
9
|
+
volume: string;
|
|
10
|
+
secret: string;
|
|
11
|
+
};
|
|
4
12
|
/** Build the live snapshot the card renders. */
|
|
5
13
|
export declare function cardSnapshot(resolver: WorkspaceResolver, workspaceRegistry: any, harnessVersion?: string): Promise<CardSnapshot>;
|
|
6
14
|
/**
|
package/dist/card-route.js
CHANGED
|
@@ -9,8 +9,8 @@ import { CARD_PATH, } from "./client/card-protocol.js";
|
|
|
9
9
|
import { renderCacheCleanNotice, renderDefaultEnvSyncNotice, renderPublishNotice, resolveReasonLocale, } from "./approval-reasons.js";
|
|
10
10
|
import { mergeDefaultEnv, missingDefaultEnv } from "./container-env.js";
|
|
11
11
|
import { portProtocolFromProto, portProtocolToProto } from "./publish-port.js";
|
|
12
|
-
import { defaultMountMode, mountKindToProto, mountModeToProto, } from "./mount-enums.js";
|
|
13
|
-
import { mountInputToProto, validateMountInput } from "./mount-input.js";
|
|
12
|
+
import { defaultMountMode, mountKindToProto, mountModeToProto, normalizeMountKind, normalizeMountMode, } from "./mount-enums.js";
|
|
13
|
+
import { mountInputToProto, projectMountMirror, validateMountInput, } from "./mount-input.js";
|
|
14
14
|
import { unaryGuest } from "./guest-rpc.js";
|
|
15
15
|
import { workspaceSlug } from "./workspace-binding.js";
|
|
16
16
|
import { GIT_COMMIT, VERSION } from "./generated/version.js";
|
|
@@ -75,12 +75,23 @@ function cacheCleanModeToProto(mode) {
|
|
|
75
75
|
// containerMountView and imageView rebuild the snapshot's nested objects from
|
|
76
76
|
// an explicit allow-list, so a field added to the proto later cannot reach the
|
|
77
77
|
// browser just because it exists on the wire (see AGENTS.md "Security").
|
|
78
|
-
|
|
78
|
+
//
|
|
79
|
+
// The mount kind and mode are normalised here, at the host boundary, so every
|
|
80
|
+
// snapshot carries the card's own short spelling no matter which enum spelling
|
|
81
|
+
// the decode produced. A project mount's destination is implicit on the wire:
|
|
82
|
+
// it is always the project path mirrored under the projects root, so the view
|
|
83
|
+
// computes it rather than showing an empty field.
|
|
84
|
+
export function containerMountView(mount, projectsRoot) {
|
|
85
|
+
const projectName = stringField(mount?.projectName);
|
|
86
|
+
const kind = normalizeMountKind(mount?.kind);
|
|
87
|
+
const destination = stringField(mount?.destination);
|
|
79
88
|
return {
|
|
80
|
-
projectName
|
|
81
|
-
destination:
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
projectName,
|
|
90
|
+
destination: destination === "" && kind === "project" && projectName !== ""
|
|
91
|
+
? projectMountMirror(projectsRoot, projectName)
|
|
92
|
+
: destination,
|
|
93
|
+
kind,
|
|
94
|
+
mode: normalizeMountMode(mount?.mode),
|
|
84
95
|
volume: stringField(mount?.volume),
|
|
85
96
|
secret: stringField(mount?.secret),
|
|
86
97
|
};
|
|
@@ -239,7 +250,7 @@ export async function cardSnapshot(resolver, workspaceRegistry, harnessVersion =
|
|
|
239
250
|
imageId: container.imageId ?? "",
|
|
240
251
|
status: container.status ?? "",
|
|
241
252
|
createdAt: container.createdAt ?? "",
|
|
242
|
-
mounts: (container.mounts ?? []).map(containerMountView),
|
|
253
|
+
mounts: (container.mounts ?? []).map((mount) => containerMountView(mount, resolver.getConfig().projectsRoot)),
|
|
243
254
|
paths: container.paths ?? [],
|
|
244
255
|
env: container.env ?? {},
|
|
245
256
|
secretEnv: container.secretEnv ?? {},
|
|
@@ -1,56 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
3
3
|
//
|
|
4
4
|
// SPDX-License-Identifier: MIT
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { SecretsSection } from "./container-card-secrets.js";
|
|
9
|
-
import { ConfirmButton } from "./container-card-shared.js";
|
|
10
|
-
import { banner, footerRow, hint, imageSelect, sectionTitle, } from "./container-card-styles.js";
|
|
11
|
-
import { VolumesSection } from "./container-card-volumes.js";
|
|
5
|
+
import { DefaultsSection } from "./container-card-defaults.js";
|
|
6
|
+
import { StatusSection } from "./container-card-status.js";
|
|
7
|
+
import { ImagesSection, StorageSection } from "./container-card-resources.js";
|
|
12
8
|
import { WorkspaceSection } from "./container-card-workspace.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
import { countLabel, StatusChip, } from "./container-card-shared.js";
|
|
10
|
+
import { TABS_CLASS } from "./container-card-tabs-styles.js";
|
|
11
|
+
import { actionRow, banner, hint, pageColumn, statusStrip, tabPanel, } from "./container-card-styles.js";
|
|
12
|
+
import { Button, SegmentedTabs } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
13
|
+
import { useEffect, useId, useState } from "react";
|
|
14
|
+
// The moment a workspace's newest container was created: the workspaces are
|
|
15
|
+
// ordered by it, most recent first. A timestamp the browser cannot read counts
|
|
16
|
+
// as no moment at all, so a broken row never claims the top of the list.
|
|
17
|
+
function newestContainerAt(containers) {
|
|
18
|
+
return containers.reduce((newest, container) => {
|
|
19
|
+
const at = Date.parse(container.createdAt);
|
|
20
|
+
return Number.isNaN(at) ? newest : Math.max(newest, at);
|
|
21
|
+
}, Number.NEGATIVE_INFINITY);
|
|
22
|
+
}
|
|
23
|
+
// A chip's tone and wording for a version divergence: the status table's own
|
|
24
|
+
// warn/error tones, with the divergence named in the chip's words too, so a
|
|
25
|
+
// green "ready" is the only reading that means ready and matching.
|
|
26
|
+
function versionChip(t, base, state) {
|
|
27
|
+
if (state === "major-mismatch") {
|
|
28
|
+
return {
|
|
29
|
+
tone: "error",
|
|
30
|
+
label: `${base.label} · ${t("versionIncompatible")}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (state === "minor-mismatch") {
|
|
34
|
+
return {
|
|
35
|
+
tone: "warn",
|
|
36
|
+
label: `${base.label} · ${t("versionCompatibleDifferent")}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return base;
|
|
40
|
+
}
|
|
17
41
|
export function ContainerCard(props) {
|
|
18
42
|
const { t } = props;
|
|
19
43
|
const state = props.useContainerCard((snapshot) => snapshot);
|
|
20
|
-
const [
|
|
21
|
-
const
|
|
22
|
-
const [parent, setParent] = useState("");
|
|
23
|
-
const [packages, setPackages] = useState([]);
|
|
24
|
-
const [defaultOpen, setDefaultOpen] = useState(false);
|
|
25
|
-
const [defaultImage, setDefaultImage] = useState(state.defaultImage);
|
|
26
|
-
const [copyState, setCopyState] = useState("idle");
|
|
27
|
-
const copyResetTimer = useRef();
|
|
28
|
-
// Copies the version lines as displayed, so a user can paste them into a bug
|
|
29
|
-
// report without transcribing anything.
|
|
30
|
-
const copyVersions = async () => {
|
|
31
|
-
const lines = [
|
|
32
|
-
`${t("dsh")} ${state.dshVersion || t("versionUnknown")}`,
|
|
33
|
-
`${t("cardTitle")} ${state.version}${state.commit ? ` · ${state.commit}` : ""}`,
|
|
34
|
-
`${t("orchestrator")} ${state.orchestratorVersion || t("versionUnknown")}${state.orchestratorCommit ? ` · ${state.orchestratorCommit}` : ""}`,
|
|
35
|
-
`${t("gateway")} ${state.gatewayState === "running"
|
|
36
|
-
? `${state.gatewayVersion}${state.gatewayCommit ? ` · ${state.gatewayCommit}` : ""}`
|
|
37
|
-
: state.gatewayState === "incompatible"
|
|
38
|
-
? t("gatewayIncompatible")
|
|
39
|
-
: t("gatewayNotRunning")}`,
|
|
40
|
-
];
|
|
41
|
-
setCopyState((await writeClipboard(lines.join("\n"))) ? "copied" : "failed");
|
|
42
|
-
if (copyResetTimer.current !== undefined) {
|
|
43
|
-
clearTimeout(copyResetTimer.current);
|
|
44
|
-
}
|
|
45
|
-
copyResetTimer.current = setTimeout(() => setCopyState("idle"), 1500);
|
|
46
|
-
};
|
|
47
|
-
// The reset timer is cancelled on unmount, so it cannot fire against an
|
|
48
|
-
// unmounted component.
|
|
49
|
-
useEffect(() => () => {
|
|
50
|
-
if (copyResetTimer.current !== undefined) {
|
|
51
|
-
clearTimeout(copyResetTimer.current);
|
|
52
|
-
}
|
|
53
|
-
}, []);
|
|
44
|
+
const [tab, setTab] = useState("workspaces");
|
|
45
|
+
const tabsId = useId();
|
|
54
46
|
// The Plugins page renders a one-liner in its list and this component again
|
|
55
47
|
// as the entry's page, so the orchestrator snapshot is only fetched for the
|
|
56
48
|
// page. Re-reading on every page view keeps a workspace created since the
|
|
@@ -61,73 +53,118 @@ export function ContainerCard(props) {
|
|
|
61
53
|
props.reload();
|
|
62
54
|
}, [props.view]);
|
|
63
55
|
// The list shows only the one-liner; the page heading already carries the
|
|
64
|
-
// plugin's title and description.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
56
|
+
// plugin's title and description. The one-liner reports what the snapshot
|
|
57
|
+
// actually holds, and whether the orchestrator answered it.
|
|
58
|
+
if (props.view === "summary") {
|
|
59
|
+
if (state.loadState === "loading")
|
|
60
|
+
return t("loading");
|
|
61
|
+
if (!state.available)
|
|
62
|
+
return t("unavailable");
|
|
63
|
+
return [
|
|
64
|
+
countLabel(t, state.workspaces.length, "countWorkspaceOne", "countWorkspaceMany"),
|
|
65
|
+
countLabel(t, state.containers.length, "countContainerOne", "countContainerMany"),
|
|
66
|
+
t(state.orchestratorReady
|
|
67
|
+
? "orchestratorReady"
|
|
68
|
+
: "orchestratorUnavailable"),
|
|
69
|
+
].join(" · ");
|
|
70
|
+
}
|
|
71
|
+
if (state.loadState === "loading") {
|
|
72
|
+
return (_jsx("div", { style: { padding: "8px 0", fontSize: "13px", opacity: 0.8 }, role: "status", children: _jsx("p", { style: { margin: 0 }, children: t("loading") }) }));
|
|
73
|
+
}
|
|
73
74
|
if (!state.available) {
|
|
74
|
-
return (_jsxs("div", { style: { padding: "8px 0", fontSize: "13px", opacity: 0.8 }, children: [_jsx("p", { style: { margin: 0 }, children: t("unavailable") }), state.notice === ""
|
|
75
|
-
? null
|
|
76
|
-
: (_jsxs("p", { style: { margin: "4px 0 0" }, role: "status", children: [t("notice"), ": ", state.notice] })), _jsx("div", { style: { marginTop: "8px" }, children: _jsx(Button, { variant: "outline", size: "sm", disabled: state.busy, onClick: props.reload, children: state.busy ? t("busy") : t("reload") }) })] }));
|
|
75
|
+
return (_jsxs("div", { style: { padding: "8px 0", fontSize: "13px", opacity: 0.8 }, children: [_jsx("p", { style: { margin: 0 }, role: "alert", children: t("unavailable") }), state.notice === "" ? null : (_jsxs("p", { style: { margin: "4px 0 0" }, role: state.noticeIsError ? "alert" : "status", children: [t("notice"), ": ", state.notice] })), _jsx("div", { style: { marginTop: "8px" }, children: _jsx(Button, { variant: "outline", size: "sm", disabled: state.busy, onClick: props.reload, children: state.busy ? t("busy") : t("reload") }) })] }));
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
77
|
+
const tabId = (value) => `${tabsId}-tab-${value}`;
|
|
78
|
+
const panelId = (value) => `${tabsId}-panel-${value}`;
|
|
79
|
+
// Both daemons read as ready or not ready. The orchestrator stays unknown
|
|
80
|
+
// only until its first snapshot settles; the gateway keeps the snapshot's own
|
|
81
|
+
// unknown when the orchestrator cannot report it at all, because "unknown" is
|
|
82
|
+
// then the fact rather than a state this card can resolve. A daemon that runs
|
|
83
|
+
// with a diverging version carries that divergence in the chip's own tone and
|
|
84
|
+
// words, so its version is never colour alone.
|
|
85
|
+
const orchestratorChip = state.orchestratorKnown
|
|
86
|
+
? state.orchestratorReady
|
|
87
|
+
? versionChip(t, { tone: "ok", label: t("orchestratorReady") }, state.versionState)
|
|
88
|
+
: { tone: "error", label: t("orchestratorNotReady") }
|
|
89
|
+
: { tone: "muted", label: t("orchestratorUnknown") };
|
|
90
|
+
const gatewayChip = state.gatewayState === "running"
|
|
91
|
+
? versionChip(t, { tone: "ok", label: t("gatewayReady") }, state.gatewayVersionState)
|
|
92
|
+
: state.gatewayState === "absent"
|
|
93
|
+
? { tone: "warn", label: t("gatewayNotReady") }
|
|
94
|
+
: state.gatewayState === "incompatible"
|
|
95
|
+
? { tone: "error", label: t("gatewayNotReady") }
|
|
96
|
+
: { tone: "muted", label: t("gatewayUnknown") };
|
|
97
|
+
const noWorkspace = state.workspaces.length === 0;
|
|
98
|
+
// Every known workspace is listed, including the ones without a container:
|
|
99
|
+
// the workspaces whose newest container was created most recently come first,
|
|
100
|
+
// the empty ones sort last (where they also read muted), and each workspace
|
|
101
|
+
// lists its default container first, since that is the one its own mount and
|
|
102
|
+
// create actions target.
|
|
103
|
+
const workspaceRows = state.workspaces
|
|
104
|
+
.map((workspace) => ({
|
|
105
|
+
workspace,
|
|
106
|
+
containers: state.containers
|
|
107
|
+
.filter((container) => container.workspaceSlug === workspace.workspaceSlug)
|
|
108
|
+
.sort((left, right) => Number(right.containerName === "default") -
|
|
109
|
+
Number(left.containerName === "default")),
|
|
110
|
+
}))
|
|
111
|
+
.sort((left, right) => {
|
|
112
|
+
const leftEmpty = left.containers.length === 0;
|
|
113
|
+
const rightEmpty = right.containers.length === 0;
|
|
114
|
+
// An empty workspace is always last, whatever the other holds.
|
|
115
|
+
if (leftEmpty || rightEmpty) {
|
|
116
|
+
return Number(leftEmpty) - Number(rightEmpty);
|
|
117
|
+
}
|
|
118
|
+
return newestContainerAt(right.containers) -
|
|
119
|
+
newestContainerAt(left.containers);
|
|
120
|
+
});
|
|
121
|
+
// The strip counts what it names: the workspaces that actually hold a
|
|
122
|
+
// container (an empty workspace is listed, but it has nothing to count), and
|
|
123
|
+
// the running containers alone.
|
|
124
|
+
const containerWorkspaces = workspaceRows.filter(({ containers }) => containers.length > 0).length;
|
|
125
|
+
const runningContainers = state.containers.filter((container) => container.status === "running").length;
|
|
126
|
+
return (_jsxs("div", { style: pageColumn, children: [state.notice === ""
|
|
127
|
+
? null
|
|
128
|
+
: (_jsxs("div", { style: banner, role: state.noticeIsError ? "alert" : "status", children: [t("notice"), ": ", state.notice] })), state.versionState === "ok" ? null : (_jsxs("div", { style: {
|
|
129
|
+
...banner,
|
|
108
130
|
display: "flex",
|
|
109
|
-
flexWrap: "wrap",
|
|
110
131
|
alignItems: "center",
|
|
111
132
|
gap: "8px",
|
|
112
|
-
},
|
|
113
|
-
?
|
|
114
|
-
:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
}, role: state.versionState === "major-mismatch" ? "alert" : "status", children: [_jsx(StatusChip, { tone: state.versionState === "major-mismatch" ? "error" : "warn", label: t(state.versionState === "major-mismatch"
|
|
134
|
+
? "versionIncompatible"
|
|
135
|
+
: "versionCompatibleDifferent") }), _jsx("span", { children: t(state.versionState === "major-mismatch"
|
|
136
|
+
? "versionMismatchMajor"
|
|
137
|
+
: "versionMismatchMinor") })] })), _jsxs("div", { style: statusStrip, role: "group", "aria-label": t("statusOverview"), children: [_jsx(StatusChip, { tone: "muted", label: countLabel(t, containerWorkspaces, "countWorkspaceOne", "countWorkspaceMany") }), _jsx(StatusChip, { tone: "muted", label: countLabel(t, runningContainers, "countRunningContainerOne", "countRunningContainerMany") }), _jsx(StatusChip, { tone: orchestratorChip.tone, label: orchestratorChip.label }), _jsx(StatusChip, { tone: gatewayChip.tone, label: gatewayChip.label })] }), _jsx(SegmentedTabs, { label: t("settingsTabs"), className: TABS_CLASS, value: tab, onChange: setTab, items: [
|
|
138
|
+
{
|
|
139
|
+
value: "workspaces",
|
|
140
|
+
label: t("tabWorkspaces"),
|
|
141
|
+
id: tabId("workspaces"),
|
|
142
|
+
panelId: panelId("workspaces"),
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: "images",
|
|
146
|
+
label: t("tabImages"),
|
|
147
|
+
id: tabId("images"),
|
|
148
|
+
panelId: panelId("images"),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
value: "storage",
|
|
152
|
+
label: t("tabStorage"),
|
|
153
|
+
id: tabId("storage"),
|
|
154
|
+
panelId: panelId("storage"),
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
value: "defaults",
|
|
158
|
+
label: t("tabDefaults"),
|
|
159
|
+
id: tabId("defaults"),
|
|
160
|
+
panelId: panelId("defaults"),
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: "status",
|
|
164
|
+
label: t("tabStatus"),
|
|
165
|
+
id: tabId("status"),
|
|
166
|
+
panelId: panelId("status"),
|
|
167
|
+
},
|
|
168
|
+
] }), _jsx("div", { id: panelId("workspaces"), role: "tabpanel", "aria-labelledby": tabId("workspaces"), hidden: tab !== "workspaces", style: tab === "workspaces" ? tabPanel : undefined, children: noWorkspace ? _jsx("p", { style: hint, children: t("noWorkspaces") }) : (workspaceRows.map(({ workspace, containers }) => (_jsx(WorkspaceSection, { t: t, workspace: workspace, containers: containers, images: state.images, volumes: state.volumes, secrets: state.secrets, busy: state.busy, writable: state.writable, locale: state.locale, pendingActions: state.pendingActions, defaultImage: state.defaultImage, defaultEnv: state.containerEnv, projectsRoot: state.projectsRoot, directoryPicker: state.directoryPicker, onRemove: props.remove, onRecreate: props.recreate, onRemoveWorkspace: props.removeWorkspace, onCreate: props.createContainer, onCreateSecret: props.createSecret, onStartContainer: props.startContainer, onApplyContainerConfig: props.applyContainerConfig, gatewayUnavailable: state.gatewayState === "absent" ||
|
|
169
|
+
state.gatewayState === "incompatible" }, workspace.workspaceSlug)))) }), _jsx("div", { id: panelId("images"), role: "tabpanel", "aria-labelledby": tabId("images"), hidden: tab !== "images", style: tab === "images" ? tabPanel : undefined, children: _jsx(ImagesSection, { t: t, images: state.images, busy: state.busy, pendingActions: state.pendingActions, defaultImage: state.defaultImage, locale: state.locale, onBuildImage: props.buildImage, onRebuildAllImages: props.rebuildAllImages, onRebuildBaseImage: props.rebuildBaseImage, onPullBaseImage: props.pullBaseImage, onRemoveImage: props.removeImage, onRebuildImage: props.rebuildImage, onSetDefaultImage: props.setDefaultImage }) }), _jsx("div", { id: panelId("storage"), role: "tabpanel", "aria-labelledby": tabId("storage"), hidden: tab !== "storage", style: tab === "storage" ? tabPanel : undefined, children: _jsx(StorageSection, { t: t, volumes: state.volumes, secrets: state.secrets, caches: state.caches, busy: state.busy, writable: state.writable, pendingActions: state.pendingActions, onCleanCaches: props.cleanCaches, onCreateVolume: props.createVolume, onRemoveVolume: props.removeVolume, onCreateSecret: props.createSecret, onRemoveSecret: props.removeSecret, onSetSecret: props.setSecret }) }), _jsx("div", { id: panelId("defaults"), role: "tabpanel", "aria-labelledby": tabId("defaults"), hidden: tab !== "defaults", style: tab === "defaults" ? tabPanel : undefined, children: _jsx(DefaultsSection, { t: t, images: state.images, defaultImage: state.defaultImage, env: state.containerEnv, workspaces: state.workspaces, containers: state.containers, busy: state.busy, writable: state.writable, onSetDefaultImage: props.setDefaultImage, onSaveEnv: props.saveContainerEnv, onApplyDefaultEnv: props.applyDefaultEnv }) }), _jsx("div", { id: panelId("status"), role: "tabpanel", "aria-labelledby": tabId("status"), hidden: tab !== "status", style: tab === "status" ? tabPanel : undefined, children: _jsx(StatusSection, { t: t, dshVersion: state.dshVersion, version: state.version, commit: state.commit, versionState: state.versionState, orchestratorVersion: state.orchestratorVersion, orchestratorCommit: state.orchestratorCommit, orchestratorReady: state.orchestratorReady, orchestratorKnown: state.orchestratorKnown, gatewayState: state.gatewayState, gatewayVersion: state.gatewayVersion, gatewayCommit: state.gatewayCommit, gatewayVersionState: state.gatewayVersionState }) }), _jsx("div", { style: actionRow, children: _jsx(Button, { variant: "outline", size: "sm", disabled: state.busy, onClick: props.reload, children: state.busy ? t("busy") : t("reload") }) })] }));
|
|
133
170
|
}
|
|
@@ -8,6 +8,10 @@ export interface MountInput {
|
|
|
8
8
|
secret: string;
|
|
9
9
|
}
|
|
10
10
|
export type CommandOp = "remove" | "workspace_remove" | "recreate" | "create" | "volume_create" | "volume_remove" | "image_remove" | "secret_create" | "secret_remove" | "secret_set" | "image_rebuild" | "image_rebuild_all" | "image_build" | "image_base_rebuild" | "image_base_pull" | "container_secret_add" | "container_secret_remove" | "container_mount_add" | "container_mount_remove" | "container_mount_update" | "container_publish_port" | "container_unpublish_port" | "container_path_set" | "default_env_sync" | "cache_clean";
|
|
11
|
+
export declare function containerActionKey(op: CommandOp, workspace: string, container: string): string;
|
|
12
|
+
export declare function scopedActionKey(op: CommandOp, scope: string): string;
|
|
13
|
+
export declare function bareActionKey(op: CommandOp): string;
|
|
14
|
+
export declare function containerActionPending(pendingActions: readonly string[], workspace: string, container: string): boolean;
|
|
11
15
|
export interface CommandRequest {
|
|
12
16
|
op: CommandOp;
|
|
13
17
|
workspace: string;
|
|
@@ -8,3 +8,37 @@
|
|
|
8
8
|
// registers and matches the whole pathname (a path outside `/api/` is refused
|
|
9
9
|
// at registration).
|
|
10
10
|
export const CARD_PATH = "/api/podman/card";
|
|
11
|
+
// The stable identity of one in-flight command: its operation plus the
|
|
12
|
+
// identifiers it acts on, e.g. "remove:team:default" or "volume_create:data".
|
|
13
|
+
// The controller keys its in-flight set with these builders and every control
|
|
14
|
+
// looks its own command up in CardState.pendingActions, so both halves must
|
|
15
|
+
// derive the key the same way. Identifiers never contain ":" (container and
|
|
16
|
+
// volume names, workspace slugs, cache modes), while an image id may, which is
|
|
17
|
+
// why keys are only ever compared whole.
|
|
18
|
+
export function containerActionKey(op, workspace, container) {
|
|
19
|
+
return `${op}:${workspace}:${container}`;
|
|
20
|
+
}
|
|
21
|
+
export function scopedActionKey(op, scope) {
|
|
22
|
+
return `${op}:${scope}`;
|
|
23
|
+
}
|
|
24
|
+
export function bareActionKey(op) {
|
|
25
|
+
return op;
|
|
26
|
+
}
|
|
27
|
+
// The operations keyed by containerActionKey(op, workspace, container), so a
|
|
28
|
+
// container row can tell whether any command on its own container is in flight.
|
|
29
|
+
const CONTAINER_OPS = [
|
|
30
|
+
"remove",
|
|
31
|
+
"recreate",
|
|
32
|
+
"create",
|
|
33
|
+
"container_mount_add",
|
|
34
|
+
"container_mount_remove",
|
|
35
|
+
"container_mount_update",
|
|
36
|
+
"container_path_set",
|
|
37
|
+
"container_secret_add",
|
|
38
|
+
"container_secret_remove",
|
|
39
|
+
"container_publish_port",
|
|
40
|
+
"container_unpublish_port",
|
|
41
|
+
];
|
|
42
|
+
export function containerActionPending(pendingActions, workspace, container) {
|
|
43
|
+
return CONTAINER_OPS.some((op) => pendingActions.includes(containerActionKey(op, workspace, container)));
|
|
44
|
+
}
|
|
@@ -2,8 +2,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
3
3
|
//
|
|
4
4
|
// SPDX-License-Identifier: MIT
|
|
5
|
-
import { ConfirmButton } from "./container-card-shared.js";
|
|
6
|
-
import {
|
|
5
|
+
import { ConfirmButton, countLabel } from "./container-card-shared.js";
|
|
6
|
+
import { CardGroup } from "./container-card-group.js";
|
|
7
|
+
import { scopedActionKey } from "./card-protocol.js";
|
|
8
|
+
import { cardList, cardRow, containerNameHeading, hint, rowDivider, rowMain, rowMeta, } from "./container-card-styles.js";
|
|
7
9
|
// Format a byte count with binary units, e.g. "1.2 GiB".
|
|
8
10
|
function formatBytes(bytes) {
|
|
9
11
|
if (!Number.isFinite(bytes) || bytes <= 0)
|
|
@@ -17,20 +19,20 @@ function formatBytes(bytes) {
|
|
|
17
19
|
}
|
|
18
20
|
return `${unit === 0 ? String(value) : value.toFixed(1)} ${units[unit]}`;
|
|
19
21
|
}
|
|
20
|
-
// The package-manager build caches:
|
|
21
|
-
//
|
|
22
|
+
// The package-manager build caches: one row per manager with its current size,
|
|
23
|
+
// and the two cleanup actions on the card's title row. Keeping the latest
|
|
24
|
+
// versions only prunes older files, so it reads as the warn-tinted, cautious
|
|
25
|
+
// action it is; removing every cached package stays error-coloured, because it
|
|
26
|
+
// is a full clear.
|
|
22
27
|
export function CachesSection(props) {
|
|
23
|
-
const { t, caches,
|
|
24
|
-
const disabled =
|
|
25
|
-
return (_jsxs(_Fragment, { children: [_jsx("
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
size: formatBytes(cache.bytes),
|
|
34
|
-
n: cache.files,
|
|
35
|
-
}) })] }, cache.manager)))), _jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: [_jsx(ConfirmButton, { t: t, label: t("cacheKeepLatest"), title: t("confirmTitle"), description: t("confirmCacheKeepLatest"), disabled: disabled, onConfirm: () => onClean("keep-latest") }), _jsx(ConfirmButton, { t: t, label: t("cacheRemoveAll"), title: t("confirmTitle"), description: t("confirmCacheRemoveAll"), disabled: disabled, onConfirm: () => onClean("all") })] })] })] }));
|
|
28
|
+
const { t, caches, pendingActions, onClean } = props;
|
|
29
|
+
const disabled = caches.length === 0;
|
|
30
|
+
return (_jsx(CardGroup, { title: t("cachesTitle"), summary: countLabel(t, caches.length, "countCacheOne", "countCacheMany"), hasContent: caches.length > 0, action: _jsxs(_Fragment, { children: [_jsx(ConfirmButton, { t: t, emphasis: "warn", label: t("cacheKeepLatest"), title: t("cacheKeepLatest"), description: t("confirmCacheKeepLatest"), confirmLabel: t("cacheKeepLatest"), disabled: disabled, pending: pendingActions.includes(scopedActionKey("cache_clean", "keep-latest")), onConfirm: () => onClean("keep-latest") }), _jsx(ConfirmButton, { t: t, destructive: true, label: t("cacheRemoveAll"), title: t("cacheRemoveAll"), description: t("confirmCacheRemoveAll"), confirmLabel: t("cacheRemoveAll"), disabled: disabled, pending: pendingActions.includes(scopedActionKey("cache_clean", "all")), onConfirm: () => onClean("all") })] }), children: caches.length === 0
|
|
31
|
+
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noCaches") })
|
|
32
|
+
: (_jsx("div", { style: cardList, children: caches.map((cache, index) => (_jsx("div", { style: index === caches.length - 1
|
|
33
|
+
? cardRow
|
|
34
|
+
: { ...cardRow, ...rowDivider }, children: _jsxs("div", { style: rowMain, children: [_jsx("span", { style: containerNameHeading, children: cache.manager }), _jsx("span", { style: rowMeta, children: t("cacheUsage", {
|
|
35
|
+
size: formatBytes(cache.bytes),
|
|
36
|
+
n: cache.files,
|
|
37
|
+
}) })] }) }, cache.manager))) })) }));
|
|
36
38
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ContainerView, MountInput } from "./card-protocol.js";
|
|
2
|
+
import type { ContainerPluginKey } from "./locales.js";
|
|
3
|
+
export interface PortConfig {
|
|
4
|
+
port: number;
|
|
5
|
+
protocol: string;
|
|
6
|
+
endpoint: string;
|
|
7
|
+
suggestedHostPort: number;
|
|
8
|
+
hostPort: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ContainerConfig {
|
|
11
|
+
image: string;
|
|
12
|
+
env: Record<string, string>;
|
|
13
|
+
mounts: readonly MountInput[];
|
|
14
|
+
paths: readonly string[];
|
|
15
|
+
secretEnv: Record<string, string>;
|
|
16
|
+
ports: readonly PortConfig[];
|
|
17
|
+
}
|
|
18
|
+
export declare function containerConfigFrom(container: ContainerView): ContainerConfig;
|
|
19
|
+
export declare function recordsEqual(a: Record<string, string>, b: Record<string, string>): boolean;
|
|
20
|
+
export declare function mountKey(mount: MountInput): string;
|
|
21
|
+
export declare function mountInputsEqual(a: MountInput, b: MountInput): boolean;
|
|
22
|
+
export declare function mountsEqual(a: readonly MountInput[], b: readonly MountInput[]): boolean;
|
|
23
|
+
export declare function pathsEqual(a: readonly string[], b: readonly string[]): boolean;
|
|
24
|
+
export declare function portsEqual(a: readonly PortConfig[], b: readonly PortConfig[]): boolean;
|
|
25
|
+
export declare function configsEqual(a: ContainerConfig, b: ContainerConfig): boolean;
|
|
26
|
+
export type ConfigGroupId = "image" | "env" | "mounts" | "paths" | "secretEnv" | "ports";
|
|
27
|
+
export declare const configGroupLabels: Record<ConfigGroupId, ContainerPluginKey>;
|
|
28
|
+
export declare function configChangedKeys(base: ContainerConfig, next: ContainerConfig): ConfigGroupId[];
|
|
29
|
+
export declare function configRebuildsContainer(base: ContainerConfig, next: ContainerConfig): boolean;
|
|
30
|
+
export declare function configNeedsRecreate(base: ContainerConfig, next: ContainerConfig): boolean;
|
|
31
|
+
export interface MountDiff {
|
|
32
|
+
added: MountInput[];
|
|
33
|
+
removed: MountInput[];
|
|
34
|
+
updated: MountInput[];
|
|
35
|
+
}
|
|
36
|
+
export declare function mountDiff(base: readonly MountInput[], next: readonly MountInput[]): MountDiff;
|
|
37
|
+
export interface EnvDiff {
|
|
38
|
+
added: [string, string][];
|
|
39
|
+
removed: string[];
|
|
40
|
+
changed: [string, string][];
|
|
41
|
+
}
|
|
42
|
+
export declare function envDiff(base: Record<string, string>, next: Record<string, string>): EnvDiff;
|
|
43
|
+
export interface PortDiff {
|
|
44
|
+
added: PortConfig[];
|
|
45
|
+
removed: PortConfig[];
|
|
46
|
+
}
|
|
47
|
+
export declare function portDiff(base: readonly PortConfig[], next: readonly PortConfig[]): PortDiff;
|