@exagone313/dsh-podman 1.2.1 → 1.4.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 +6491 -3474
- package/dist/client/locales.d.ts +10 -1
- package/dist/client/locales.js +270 -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 +2 -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 +4 -4
- package/docs/architecture.zh.md +1 -1
- package/docs/configuration.md +26 -25
- package/docs/configuration.zh.md +13 -11
- package/docs/development-prompt.md +7 -7
- package/docs/development-prompt.zh.md +7 -7
- package/docs/development.md +20 -16
- package/docs/development.zh.md +17 -16
- package/docs/install-dsh-and-dsh-podman.md +13 -12
- package/docs/install-dsh-and-dsh-podman.zh.md +13 -9
- package/docs/usage.md +189 -39
- package/docs/usage.zh.md +148 -29
- package/package.json +35 -31
- package/dist/client/container-card-default-env.d.ts +0 -10
- package/dist/client/container-card-default-env.js +0 -69
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
3
|
+
//
|
|
4
|
+
// SPDX-License-Identifier: MIT
|
|
5
|
+
// The two resource tabs: Images lists the images a container can be built from,
|
|
6
|
+
// Storage the volumes, secrets and package caches the container references.
|
|
7
|
+
// They are separate tabs because choosing an image and freeing storage are
|
|
8
|
+
// different tasks even though both act on the same build machinery.
|
|
9
|
+
import { BaseImageRow, ImageBuildModal, ImageItem, } from "./container-card-images.js";
|
|
10
|
+
import { CachesSection } from "./container-card-caches.js";
|
|
11
|
+
import { SecretsSection } from "./container-card-secrets.js";
|
|
12
|
+
import { VolumesSection } from "./container-card-volumes.js";
|
|
13
|
+
import { CardGroup } from "./container-card-group.js";
|
|
14
|
+
import { countLabel } from "./container-card-shared.js";
|
|
15
|
+
import { TABLE_CARD_CLASS } from "./container-card-table-styles.js";
|
|
16
|
+
import { actionRow, cardList, emphasisAction, hint, } from "./container-card-styles.js";
|
|
17
|
+
import { bareActionKey } from "./card-protocol.js";
|
|
18
|
+
import { Button, RiskConfirmation, } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
export function ImagesSection(props) {
|
|
21
|
+
const { t, images, busy, pendingActions, defaultImage, locale, onBuildImage, onRebuildAllImages, onRebuildBaseImage, onPullBaseImage, onRemoveImage, onRebuildImage, onSetDefaultImage, } = props;
|
|
22
|
+
const [buildOpen, setBuildOpen] = useState(false);
|
|
23
|
+
const [imageId, setImageId] = useState("");
|
|
24
|
+
const [parent, setParent] = useState("");
|
|
25
|
+
const [packages, setPackages] = useState([]);
|
|
26
|
+
const [rebuildAllOpen, setRebuildAllOpen] = useState(false);
|
|
27
|
+
const [rebuildAllAcknowledged, setRebuildAllAcknowledged] = useState(false);
|
|
28
|
+
const rebuildAllPending = pendingActions.includes(bareActionKey("image_rebuild_all"));
|
|
29
|
+
const baseImages = images.filter((image) => image.isBase);
|
|
30
|
+
const customImages = images.filter((image) => !image.isBase);
|
|
31
|
+
// Rebuilding covers every image, so it acts on the image set as a whole and
|
|
32
|
+
// stays on the tab's toolbar; building makes a custom image, so its action
|
|
33
|
+
// lives on that card's own title row instead.
|
|
34
|
+
const openBuild = () => {
|
|
35
|
+
// A build always starts from a real image: the configured default when it is
|
|
36
|
+
// still a candidate, and the first listed image otherwise. The parent field
|
|
37
|
+
// then never opens on an empty choice.
|
|
38
|
+
const candidates = [...baseImages, ...customImages].map((image) => image.imageId);
|
|
39
|
+
setImageId("");
|
|
40
|
+
setParent(candidates.includes(defaultImage) ? defaultImage : candidates[0] ?? "");
|
|
41
|
+
setPackages([]);
|
|
42
|
+
setBuildOpen(true);
|
|
43
|
+
};
|
|
44
|
+
const openRebuildAll = () => {
|
|
45
|
+
setRebuildAllAcknowledged(false);
|
|
46
|
+
setRebuildAllOpen(true);
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { style: actionRow, children: _jsx(Button, { variant: "outline", size: "sm", disabled: rebuildAllPending,
|
|
49
|
+
// A deliberate build action rather than a removal: it carries the
|
|
50
|
+
// business state colour, so it is not read as a neutral control.
|
|
51
|
+
style: emphasisAction.business, onClick: openRebuildAll, children: rebuildAllPending ? t("busy") : t("rebuildAllImages") }) }), _jsx(CardGroup, { title: t("baseImagesTitle"), summary: countLabel(t, baseImages.length, "countImageOne", "countImageMany"), hasContent: baseImages.length > 0, className: TABLE_CARD_CLASS, children: baseImages.length === 0
|
|
52
|
+
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noBaseImages") })
|
|
53
|
+
: (_jsx("div", { style: cardList, children: baseImages.map((image, index) => (_jsx(BaseImageRow, { t: t, image: image, defaultImage: defaultImage, locale: locale, last: index === baseImages.length - 1, pendingActions: pendingActions, onRebuild: onRebuildBaseImage, onPull: onPullBaseImage, onSetDefault: onSetDefaultImage }, image.imageId))) })) }), _jsx(CardGroup, { title: t("customImagesTitle"), summary: countLabel(t, customImages.length, "countImageOne", "countImageMany"), hasContent: customImages.length > 0, action: _jsx(Button, { variant: "primary", size: "sm", disabled: busy, onClick: openBuild, children: t("buildImage") }), className: TABLE_CARD_CLASS, children: customImages.length === 0
|
|
54
|
+
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noCustomImages") })
|
|
55
|
+
: (_jsx("div", { style: cardList, children: customImages.map((image, index) => (_jsx(ImageItem, { t: t, image: image, defaultImage: defaultImage, locale: locale, last: index === customImages.length - 1, pendingActions: pendingActions, onRemove: onRemoveImage, onRebuild: onRebuildImage, onSetDefault: onSetDefaultImage }, image.imageId))) })) }), _jsx(RiskConfirmation, { open: rebuildAllOpen, title: t("rebuildAllImagesTitle"), description: t("confirmRebuildAllImages"), acknowledgeLabel: t("acknowledgeRebuildAllImages"), cancelLabel: t("cancel"), closeLabel: t("cancel"), confirmLabel: t("rebuildAllImages"), acknowledged: rebuildAllAcknowledged, disabled: rebuildAllPending, onAcknowledgedChange: setRebuildAllAcknowledged, onCancel: () => {
|
|
56
|
+
setRebuildAllAcknowledged(false);
|
|
57
|
+
setRebuildAllOpen(false);
|
|
58
|
+
}, onConfirm: () => {
|
|
59
|
+
setRebuildAllAcknowledged(false);
|
|
60
|
+
setRebuildAllOpen(false);
|
|
61
|
+
onRebuildAllImages();
|
|
62
|
+
} }), _jsx(ImageBuildModal, { t: t, images: images, open: buildOpen, imageId: imageId, parent: parent, packages: packages, onImageId: setImageId, onParent: setParent, onPackages: setPackages, onClose: () => setBuildOpen(false), onBuild: () => {
|
|
63
|
+
onBuildImage(imageId.trim(), parent.trim(), packages);
|
|
64
|
+
setImageId("");
|
|
65
|
+
setParent("");
|
|
66
|
+
setPackages([]);
|
|
67
|
+
setBuildOpen(false);
|
|
68
|
+
} })] }));
|
|
69
|
+
}
|
|
70
|
+
export function StorageSection(props) {
|
|
71
|
+
const { t, volumes, secrets, caches, busy, writable, pendingActions, onCleanCaches, onCreateVolume, onRemoveVolume, onCreateSecret, onRemoveSecret, onSetSecret, } = props;
|
|
72
|
+
return (_jsxs(_Fragment, { children: [_jsx(VolumesSection, { t: t, volumes: volumes, busy: busy, writable: writable, pendingActions: pendingActions, onCreate: onCreateVolume, onRemove: onRemoveVolume }), _jsx(SecretsSection, { t: t, secrets: secrets, busy: busy, writable: writable, pendingActions: pendingActions, onCreate: onCreateSecret, onRemove: onRemoveSecret, onSet: onSetSecret }), _jsx(CachesSection, { t: t, caches: caches, pendingActions: pendingActions, onClean: onCleanCaches })] }));
|
|
73
|
+
}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import { type ContainerView, type
|
|
1
|
+
import { type ContainerView, type ImageView } from "./container-card-controller.js";
|
|
2
|
+
import { type ContainerConfig } from "./container-card-config.js";
|
|
2
3
|
import { type DirectoryPickerFace } from "./directory-picker.js";
|
|
3
|
-
import { type
|
|
4
|
+
import { type Translate } from "./locales.js";
|
|
4
5
|
import { type ReactNode } from "react";
|
|
5
|
-
export declare function mountSummaries(mounts: readonly ContainerView["mounts"][number][]): {
|
|
6
|
-
key: ContainerPluginKey;
|
|
7
|
-
values: string[];
|
|
8
|
-
}[];
|
|
9
6
|
export declare function ContainerRow(props: {
|
|
10
7
|
t: Translate;
|
|
11
8
|
container: ContainerView;
|
|
12
|
-
images: readonly
|
|
13
|
-
imageId: string;
|
|
14
|
-
}[];
|
|
9
|
+
images: readonly ImageView[];
|
|
15
10
|
volumes: readonly {
|
|
16
11
|
name: string;
|
|
17
12
|
}[];
|
|
18
13
|
secrets: readonly {
|
|
19
14
|
name: string;
|
|
20
15
|
}[];
|
|
21
|
-
|
|
16
|
+
pendingActions: readonly string[];
|
|
17
|
+
locale: string;
|
|
18
|
+
last: boolean;
|
|
19
|
+
writable: boolean;
|
|
22
20
|
onRemove: (workspace: string, container: string) => void;
|
|
23
|
-
onRecreate: (workspace: string, container: string, image: string
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
onUpdateContainerMount: (workspace: string, container: string, mount: MountInput) => void;
|
|
27
|
-
onSetContainerPaths: (workspace: string, container: string, paths: readonly string[]) => void;
|
|
28
|
-
onAddContainerSecret: (workspace: string, container: string, envVar: string, secret: string) => void;
|
|
29
|
-
onRemoveContainerSecret: (workspace: string, container: string, envVar: string) => void;
|
|
30
|
-
onPublishContainerPort: (workspace: string, container: string, port: number, suggestedHostPort?: number) => void;
|
|
31
|
-
onUnpublishContainerPort: (workspace: string, container: string, port: number, protocol: string) => void;
|
|
21
|
+
onRecreate: (workspace: string, container: string, image: string) => void;
|
|
22
|
+
onCreateSecret: (name: string, length?: number, charset?: string) => void;
|
|
23
|
+
onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) => void;
|
|
32
24
|
gatewayUnavailable: boolean;
|
|
33
25
|
projectName: string;
|
|
34
26
|
projectsRoot: string;
|
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ConfirmButton,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const buckets = new Map(MOUNT_ROWS.map(({ kind }) => [kind, []]));
|
|
22
|
-
for (const mount of mounts) {
|
|
23
|
-
const kind = mountKindShort(mount.kind);
|
|
24
|
-
const values = buckets.get(kind);
|
|
25
|
-
if (values === undefined)
|
|
26
|
-
continue;
|
|
27
|
-
const identifier = kind === "project"
|
|
28
|
-
? mount.projectName
|
|
29
|
-
: kind === "volume"
|
|
30
|
-
? mount.volume
|
|
31
|
-
: kind === "secret"
|
|
32
|
-
? mount.secret
|
|
33
|
-
: mount.destination;
|
|
34
|
-
if (identifier === "")
|
|
35
|
-
continue;
|
|
36
|
-
values.push(kind === "tmpfs" || mount.destination === ""
|
|
37
|
-
? identifier
|
|
38
|
-
: `${identifier} → ${mount.destination}`);
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { containerActionKey, containerActionPending } from "./card-protocol.js";
|
|
3
|
+
import { configChangedKeys, configGroupLabels, configRebuildsContainer, configsEqual, containerConfigFrom, } from "./container-card-config.js";
|
|
4
|
+
import { ContainerEditModal } from "./container-card-edit-modal.js";
|
|
5
|
+
import { ConfirmButton, containerStatusLabel, containerStatusTone, CopyButton, EnvRow, ImageRow, MountRow, mountViewToInput, orderedMounts, PathRow, PortRow, SecretEnvRow, StatusChip, } from "./container-card-shared.js";
|
|
6
|
+
import { actionRow, blockFields, blockWrapper, cardBlockRow, cardTitle, fieldGroup, fieldGroupLabel, missingValue, rowActions, rowDivider, rowMain, rowMeta, } from "./container-card-styles.js";
|
|
7
|
+
import { ROW_LIST_CLASS } from "./container-card-table-styles.js";
|
|
8
|
+
import { orderedEnvEntries } from "../env-rows.js";
|
|
9
|
+
import { relativeTimeLabel } from "./relative-time.js";
|
|
10
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
11
|
+
import { useEffect, useRef, useState } from "react";
|
|
12
|
+
// One labelled group of a container block: the group's own label above the rows
|
|
13
|
+
// it holds, so a long list only makes the block taller. A group with no rows at
|
|
14
|
+
// all renders nothing, so its label and gap never reserve empty height. It
|
|
15
|
+
// carries the shared list marker, so the narrow query separates its consecutive
|
|
16
|
+
// rows the way it does in the editor that changes the same list.
|
|
17
|
+
function FieldGroup(props) {
|
|
18
|
+
const { label, children } = props;
|
|
19
|
+
if (children === null || children === undefined || children === false) {
|
|
20
|
+
return null;
|
|
39
21
|
}
|
|
40
|
-
return
|
|
41
|
-
const values = buckets.get(kind) ?? [];
|
|
42
|
-
return values.length === 0 ? [] : [{ key, values }];
|
|
43
|
-
});
|
|
22
|
+
return (_jsxs("div", { className: ROW_LIST_CLASS, style: fieldGroup, children: [_jsx("span", { style: fieldGroupLabel, children: label }), children] }));
|
|
44
23
|
}
|
|
24
|
+
// The placeholder one empty list of a container block reads with.
|
|
25
|
+
function NoEntries(props) {
|
|
26
|
+
return _jsx("span", { style: missingValue, children: props.t("valueMissing") });
|
|
27
|
+
}
|
|
28
|
+
// One container of a workspace: a stacked block whose identity line is the
|
|
29
|
+
// name, its state chip, its age and its own Edit/Recreate/Remove actions,
|
|
30
|
+
// followed by one group per field in the canonical order — image, environment
|
|
31
|
+
// variables, mounts, PATH variable additions, secret environment variables and
|
|
32
|
+
// published ports, each entry with its own copyable fields. A long list only
|
|
33
|
+
// makes the block taller. Edit opens the dialog holding every editor; its one
|
|
34
|
+
// primary action applies the draft (rebuilding the container when the change
|
|
35
|
+
// reaches what it runs, updating it in place otherwise) and Discard drops it.
|
|
36
|
+
// Recreate rebuilds the container as it is, without touching the draft.
|
|
45
37
|
export function ContainerRow(props) {
|
|
46
|
-
const { t, container, images, volumes, secrets,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
38
|
+
const { t, container, images, volumes, secrets, pendingActions, locale, last, writable, onRemove, onRecreate, onCreateSecret, onApplyContainerConfig, gatewayUnavailable, projectName, projectsRoot, directoryPicker, } = props;
|
|
39
|
+
// The row edits one draft of the container's whole configuration and applies
|
|
40
|
+
// it with the dialog's one primary action. The draft starts from the snapshot
|
|
41
|
+
// and resyncs only while the user has nothing local, so a refresh never
|
|
42
|
+
// clobbers an edit or a change being applied.
|
|
43
|
+
const server = containerConfigFrom(container);
|
|
44
|
+
const serverKey = JSON.stringify(server);
|
|
45
|
+
const [draft, setDraft] = useState(server);
|
|
46
|
+
const [staged, setStaged] = useState(server);
|
|
47
|
+
const draftRef = useRef(draft);
|
|
48
|
+
draftRef.current = draft;
|
|
49
|
+
const stagedRef = useRef(staged);
|
|
50
|
+
stagedRef.current = staged;
|
|
51
|
+
const prevServerRef = useRef(server);
|
|
58
52
|
useEffect(() => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
const previous = prevServerRef.current;
|
|
54
|
+
prevServerRef.current = server;
|
|
55
|
+
const current = draftRef.current;
|
|
56
|
+
const saved = stagedRef.current;
|
|
57
|
+
// Adopt the snapshot when nothing is local, or when the staged copy is
|
|
58
|
+
// exactly what just arrived (the apply succeeded); keep both otherwise.
|
|
59
|
+
if (configsEqual(current, saved) &&
|
|
60
|
+
(configsEqual(saved, previous) || configsEqual(saved, server))) {
|
|
61
|
+
setDraft(server);
|
|
62
|
+
setStaged(server);
|
|
63
|
+
}
|
|
64
|
+
}, [serverKey]);
|
|
65
|
+
const dirty = !configsEqual(draft, staged);
|
|
66
|
+
const pending = !configsEqual(server, staged);
|
|
67
|
+
// The draft's own changes, named by the dialog's staged marker and used to
|
|
68
|
+
// tell whether applying it rebuilds the container or updates it in place.
|
|
69
|
+
const changedKeys = configChangedKeys(server, draft);
|
|
70
|
+
const stagedMarker = changedKeys.length === 0
|
|
71
|
+
? undefined
|
|
72
|
+
: t("stagedChanges", {
|
|
73
|
+
fields: changedKeys.map((id) => t(configGroupLabels[id])).join(", "),
|
|
74
|
+
});
|
|
75
|
+
// A row the editors flagged as conflicting — unnamed or named twice — refuses
|
|
76
|
+
// the apply; the dialog's footer says why instead of naming the staged fields.
|
|
77
|
+
const [blockingError, setBlockingError] = useState(undefined);
|
|
78
|
+
const markerError = blockingError !== undefined;
|
|
79
|
+
const marker = blockingError === undefined
|
|
80
|
+
? stagedMarker
|
|
81
|
+
: t(blockingError.key, blockingError.params);
|
|
82
|
+
const rebuilds = configRebuildsContainer(server, draft);
|
|
83
|
+
const [open, setOpen] = useState(false);
|
|
84
|
+
// The editors share the container-scoped commands, so any of them in flight
|
|
85
|
+
// gates the whole row; the staged commands run from the apply action.
|
|
86
|
+
const containerBusy = containerActionPending(pendingActions, container.workspaceSlug, container.containerName);
|
|
87
|
+
const usable = container.workspaceSlug !== "";
|
|
88
|
+
const enabled = usable && !containerBusy;
|
|
89
|
+
const removePending = pendingActions.includes(containerActionKey("remove", container.workspaceSlug, container.containerName));
|
|
90
|
+
const recreatePending = pendingActions.includes(containerActionKey("recreate", container.workspaceSlug, container.containerName));
|
|
69
91
|
// Publishing needs a live guest agent to create the forwarding socket, and a
|
|
70
92
|
// running gateway to bind the host port; the editor reflects both.
|
|
71
93
|
const canPublish = enabled && container.status === "running" &&
|
|
72
94
|
!gatewayUnavailable;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
// What the row shows about the container: every value is its own read-only
|
|
96
|
+
// field with its own copy control, never a merged string; a long list only
|
|
97
|
+
// adds rows. The environment maps read in a fixed name order and the mounts in
|
|
98
|
+
// the one shared order the editors use too.
|
|
99
|
+
const envEntries = orderedEnvEntries(container.env);
|
|
100
|
+
const secretEnvEntries = orderedEnvEntries(container.secretEnv);
|
|
101
|
+
const mounts = orderedMounts(container.mounts.map(mountViewToInput), projectName);
|
|
102
|
+
// The dialog's one primary action stages the draft and applies it.
|
|
103
|
+
const apply = () => {
|
|
104
|
+
setStaged(draft);
|
|
105
|
+
onApplyContainerConfig(container.workspaceSlug, container.containerName, server, draft);
|
|
106
|
+
};
|
|
107
|
+
const discard = () => {
|
|
108
|
+
if (dirty)
|
|
109
|
+
setDraft(staged);
|
|
110
|
+
else if (pending) {
|
|
111
|
+
setDraft(server);
|
|
112
|
+
setStaged(server);
|
|
113
|
+
}
|
|
82
114
|
};
|
|
83
|
-
return (_jsxs(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
? _jsx("option", { value: "", children: t("none") })
|
|
101
|
-
: null, images.map((image) => (_jsx("option", { value: image.imageId, children: image.imageId }, image.imageId)))] }), _jsx(ConfirmButton, { t: t, label: t("recreateWithImage"), title: t("confirmTitle"), description: t("confirmRecreate", {
|
|
102
|
-
workspace: projectName,
|
|
103
|
-
container: container.containerName,
|
|
104
|
-
}), disabled: !enabled || selected === "", onConfirm: () => onRecreate(container.workspaceSlug, container.containerName, selected, env) })] }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("envTitle"), open: envOpen, expandable: true, onToggle: () => setEnvOpen(!envOpen), children: _jsx("div", { style: wsBody, children: _jsx(EnvEditor, { t: t, env: env, busy: busy, onChange: setEnv }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("mountsTitle"), open: mountOpen, expandable: true, onToggle: () => setMountOpen(!mountOpen), children: _jsx("div", { style: wsBody, children: _jsx(MountsEditor, { t: t, mounts: container.mounts.map(mountViewToInput), volumes: volumes, secrets: secrets, busy: busy, enabled: enabled, projectsRoot: projectsRoot, directoryPicker: directoryPicker, confirmRemove: true, primaryProject: container.containerName === "default"
|
|
105
|
-
? projectName
|
|
106
|
-
: "", onUpdate: (mount) => onUpdateContainerMount(container.workspaceSlug, container.containerName, mount), onRemove: (mount) => onRemoveContainerMount(container.workspaceSlug, container.containerName, mount), onAdd: (mount) => onAddContainerMount(container.workspaceSlug, container.containerName, mount) }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("pathsTitle"), open: pathOpen, expandable: true, onToggle: () => setPathOpen(!pathOpen), children: _jsx("div", { style: wsBody, children: _jsx(PathsEditor, { t: t, paths: container.paths, busy: busy, enabled: enabled, onApply: (paths) => onSetContainerPaths(container.workspaceSlug, container.containerName, paths) }) }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("containerSecretsTitle"), open: secretOpen, expandable: true, onToggle: () => setSecretOpen(!secretOpen), children: _jsxs("div", { style: wsBody, children: [secretEntries.map(([envVar, secretName]) => (_jsxs("div", { style: {
|
|
107
|
-
display: "flex",
|
|
108
|
-
flexWrap: "wrap",
|
|
109
|
-
alignItems: "center",
|
|
110
|
-
gap: "8px",
|
|
111
|
-
}, children: [_jsxs("code", { style: {
|
|
112
|
-
...greyId,
|
|
113
|
-
flex: 1,
|
|
114
|
-
fontSize: "13px",
|
|
115
|
-
color: "var(--dsw-alias-label-primary)",
|
|
116
|
-
}, children: [envVar, "=", secretName] }), _jsx(ConfirmButton, { t: t, label: t("detachSecret"), title: t("confirmTitle"), description: t("confirmDetachSecret", {
|
|
117
|
-
env: envVar,
|
|
118
|
-
secret: secretName,
|
|
119
|
-
}), disabled: busy, onConfirm: () => onRemoveContainerSecret(container.workspaceSlug, container.containerName, envVar) })] }, envVar))), _jsxs("div", { style: {
|
|
120
|
-
display: "flex",
|
|
121
|
-
flexWrap: "wrap",
|
|
122
|
-
alignItems: "center",
|
|
123
|
-
gap: "8px",
|
|
124
|
-
paddingTop: "8px",
|
|
125
|
-
}, children: [_jsxs("select", { style: imageSelect, value: attachSecret, disabled: !enabled, onChange: (event) => setAttachSecret(event.target.value), "aria-label": t("attachSecret"), children: [secrets.length === 0
|
|
126
|
-
? _jsx("option", { value: "", children: t("none") })
|
|
127
|
-
: null, secrets.map((secret) => (_jsx("option", { value: secret.name, children: secret.name }, secret.name)))] }), _jsx(Input, { value: attachVar, disabled: !enabled, placeholder: t("secretEnvName"), onChange: (event) => setAttachVar(event.target.value), onKeyDown: (event) => {
|
|
128
|
-
if (event.key === "Enter")
|
|
129
|
-
attach();
|
|
130
|
-
}, style: { width: "200px" } }), _jsx(Button, { variant: "outline", size: "sm", disabled: !enabled || attachVar.trim() === "" ||
|
|
131
|
-
attachSecret === "", onClick: attach, children: t("attachSecret") })] })] }) }), _jsx(DisclosureRow, { icon: _jsx("span", {}), title: t("portsTitle"), open: portOpen, expandable: true, onToggle: () => setPortOpen(!portOpen), children: _jsx("div", { style: wsBody, children: _jsx(PortsEditor, { t: t, ports: container.publishedPorts, busy: busy, enabled: enabled, canPublish: canPublish, gatewayUnavailable: gatewayUnavailable, onPublish: (port, suggestedHostPort) => onPublishContainerPort(container.workspaceSlug, container.containerName, port, suggestedHostPort), onUnpublish: (port, protocol) => onUnpublishContainerPort(container.workspaceSlug, container.containerName, port, protocol) }) }) })] }));
|
|
115
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { style: last ? cardBlockRow : { ...cardBlockRow, ...rowDivider }, children: _jsxs("div", { style: blockWrapper, children: [_jsxs("div", { style: actionRow, children: [_jsxs("div", { style: rowMain, children: [_jsx("h4", { style: { ...cardTitle, overflowWrap: "anywhere" }, children: container.containerName }), _jsx(StatusChip, { tone: containerStatusTone(container.status), label: containerStatusLabel(t, container.status) }), _jsx("span", { style: rowMeta, title: container.createdAt, children: relativeTimeLabel(container.createdAt, locale) }), _jsx(CopyButton, { t: t, value: container.createdAt, label: t("copyCreated") })] }), _jsxs("div", { style: rowActions, children: [_jsx(Button, { variant: "outline", size: "sm", disabled: !usable, onClick: () => setOpen(true), children: t("edit") }), _jsx(ConfirmButton, { t: t, emphasis: "business", label: t("recreate"), title: t("recreate"), description: t("confirmRecreate", {
|
|
116
|
+
workspace: projectName,
|
|
117
|
+
container: container.containerName,
|
|
118
|
+
}), confirmLabel: t("recreate"), disabled: !usable || containerBusy, pending: recreatePending, onConfirm: () => onRecreate(container.workspaceSlug, container.containerName, container.imageId) }), _jsx(ConfirmButton, { t: t, destructive: true, label: t("remove"), title: t("removeContainerTitle"), description: t("confirmRemoveContainer", {
|
|
119
|
+
workspace: projectName,
|
|
120
|
+
container: container.containerName,
|
|
121
|
+
}), confirmLabel: t("removeContainerTitle"), disabled: !usable, pending: removePending, onConfirm: () => onRemove(container.workspaceSlug, container.containerName) })] })] }), _jsxs("div", { style: blockFields, children: [_jsx(ImageRow, { t: t, mode: "view", image: container.imageId }), _jsx(FieldGroup, { label: t("envTitle"), children: envEntries.length === 0
|
|
122
|
+
? _jsx(NoEntries, { t: t })
|
|
123
|
+
: envEntries.map(([name, value]) => (_jsx(EnvRow, { t: t, mode: "view", name: name, value: value }, name))) }), _jsx(FieldGroup, { label: t("mountsTitle"), children: mounts.length === 0
|
|
124
|
+
? _jsx(NoEntries, { t: t })
|
|
125
|
+
: mounts.map(({ mount, index }) => (_jsx(MountRow, { t: t, mode: "view", mount: mount, destination: container.mounts[index]?.destination ?? "" }, index))) }), _jsx(FieldGroup, { label: t("pathsTitle"), children: container.paths.length === 0
|
|
126
|
+
? _jsx(NoEntries, { t: t })
|
|
127
|
+
: container.paths.map((path, index) => (_jsx(PathRow, { t: t, mode: "view", path: path }, index))) }), _jsx(FieldGroup, { label: t("containerSecretsTitle"), children: secretEnvEntries.length === 0
|
|
128
|
+
? _jsx(NoEntries, { t: t })
|
|
129
|
+
: secretEnvEntries.map(([name, value]) => (_jsx(SecretEnvRow, { t: t, mode: "view", name: name, secret: value }, name))) }), _jsx(FieldGroup, { label: t("portsTitle"), children: container.publishedPorts.length === 0
|
|
130
|
+
? _jsx(NoEntries, { t: t })
|
|
131
|
+
: container.publishedPorts.map((port) => (_jsx(PortRow, { t: t, mode: "view", port: port.port, protocol: port.protocol, hostPort: port.hostPort }, `${port.protocol}/${port.port}`))) })] })] }) }), _jsx(ContainerEditModal, { t: t, open: open, container: container, images: images, volumes: volumes, secrets: secrets, busy: containerBusy, enabled: enabled, usable: usable, canPublish: canPublish, gatewayUnavailable: gatewayUnavailable, projectName: projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, writable: writable, draft: draft, dirty: dirty, pending: pending, marker: marker, markerError: markerError, onBlockingError: setBlockingError, rebuilds: rebuilds, recreatePending: recreatePending, onCreateSecret: onCreateSecret, onChange: setDraft, onDiscard: discard, onApply: apply, onClose: () => setOpen(false) })] }));
|
|
132
132
|
}
|
|
133
133
|
export { CreateContainerModal } from "./container-card-create-modal.js";
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
-
import type { Translate } from "./locales.js";
|
|
1
|
+
import type { Translate, Translation } from "./locales.js";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
export declare function SecretRow(props: {
|
|
4
4
|
t: Translate;
|
|
5
5
|
name: string;
|
|
6
|
-
busy: boolean;
|
|
7
6
|
writable: boolean;
|
|
8
|
-
|
|
7
|
+
last: boolean;
|
|
8
|
+
pendingActions: readonly string[];
|
|
9
|
+
onEdit: (name: string) => void;
|
|
9
10
|
onRemove: (name: string) => void;
|
|
10
11
|
}): ReactNode;
|
|
12
|
+
export declare function SecretModal(props: {
|
|
13
|
+
t: Translate;
|
|
14
|
+
mode: "create" | "edit";
|
|
15
|
+
name?: string;
|
|
16
|
+
open: boolean;
|
|
17
|
+
busy: boolean;
|
|
18
|
+
writable: boolean;
|
|
19
|
+
onCreate?: (name: string, length?: number, charset?: string) => void;
|
|
20
|
+
onSet?: (name: string, value: string) => void;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
}): ReactNode;
|
|
23
|
+
export declare function SecretEnvEditor(props: {
|
|
24
|
+
t: Translate;
|
|
25
|
+
secretEnv: Record<string, string>;
|
|
26
|
+
secrets: readonly {
|
|
27
|
+
name: string;
|
|
28
|
+
}[];
|
|
29
|
+
busy: boolean;
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
writable: boolean;
|
|
32
|
+
onCreateSecret: (name: string, length?: number, charset?: string) => void;
|
|
33
|
+
onChange: (next: Record<string, string>) => void;
|
|
34
|
+
onBlockingError?: (error: Translation | undefined) => void;
|
|
35
|
+
otherNames?: readonly string[];
|
|
36
|
+
onNames?: (names: readonly string[]) => void;
|
|
37
|
+
}): ReactNode;
|
|
11
38
|
export declare function SecretsSection(props: {
|
|
12
39
|
t: Translate;
|
|
13
40
|
secrets: readonly {
|
|
@@ -15,6 +42,7 @@ export declare function SecretsSection(props: {
|
|
|
15
42
|
}[];
|
|
16
43
|
busy: boolean;
|
|
17
44
|
writable: boolean;
|
|
45
|
+
pendingActions: readonly string[];
|
|
18
46
|
onCreate: (name: string, length?: number, charset?: string) => void;
|
|
19
47
|
onRemove: (name: string) => void;
|
|
20
48
|
onSet: (name: string, value: string) => void;
|