@exagone313/dsh-podman 1.7.0 → 1.8.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/cordis.patch.yml +3 -1
- package/dist/approval-reasons.d.ts +37 -0
- package/dist/approval-reasons.js +128 -0
- package/dist/approval-template-summary.d.ts +8 -0
- package/dist/approval-template-summary.js +163 -0
- package/dist/approval.d.ts +8 -4
- package/dist/approval.js +104 -10
- package/dist/client/ContainerCard.js +8 -2
- package/dist/client/container-card-controller.d.ts +13 -5
- package/dist/client/container-card-controller.js +60 -24
- package/dist/client/container-card-create-config.d.ts +23 -0
- package/dist/client/container-card-create-config.js +48 -0
- package/dist/client/container-card-create-modal.d.ts +9 -1
- package/dist/client/container-card-create-modal.js +37 -41
- package/dist/client/container-card-create-volume.d.ts +10 -0
- package/dist/client/container-card-create-volume.js +34 -0
- package/dist/client/container-card-dialog-styles.d.ts +4 -2
- package/dist/client/container-card-dialog-styles.js +47 -4
- package/dist/client/container-card-edit-modal.d.ts +5 -1
- package/dist/client/container-card-edit-modal.js +55 -19
- package/dist/client/container-card-editors.d.ts +9 -0
- package/dist/client/container-card-editors.js +300 -43
- package/dist/client/container-card-form.d.ts +2 -1
- package/dist/client/container-card-form.js +26 -8
- package/dist/client/container-card-images.js +9 -31
- package/dist/client/container-card-mount-actions.d.ts +12 -0
- package/dist/client/container-card-mount-actions.js +35 -0
- package/dist/client/container-card-mount-sources.d.ts +34 -0
- package/dist/client/container-card-mount-sources.js +180 -0
- package/dist/client/container-card-names.d.ts +2 -0
- package/dist/client/container-card-names.js +12 -0
- package/dist/client/container-card-row.d.ts +16 -1
- package/dist/client/container-card-row.js +69 -25
- package/dist/client/container-card-secrets.d.ts +2 -0
- package/dist/client/container-card-secrets.js +60 -17
- package/dist/client/container-card-shared.d.ts +17 -9
- package/dist/client/container-card-shared.js +122 -93
- package/dist/client/container-card-styles.d.ts +6 -0
- package/dist/client/container-card-styles.js +22 -0
- package/dist/client/container-card-table-styles.d.ts +2 -1
- package/dist/client/container-card-table-styles.js +14 -0
- package/dist/client/container-card-templates.d.ts +81 -0
- package/dist/client/container-card-templates.js +1004 -0
- package/dist/client/container-card-toast.js +1 -1
- package/dist/client/container-card-volumes.js +6 -20
- package/dist/client/container-card-workspace.d.ts +10 -2
- package/dist/client/container-card-workspace.js +98 -5
- package/dist/client/container-template-ui.d.ts +163 -0
- package/dist/client/container-template-ui.js +579 -0
- package/dist/client/download.d.ts +1 -0
- package/dist/client/download.js +23 -0
- package/dist/client/image-facts.d.ts +18 -0
- package/dist/client/image-facts.js +44 -0
- package/dist/client/index.js +13478 -3438
- package/dist/client/locales.d.ts +1 -1
- package/dist/client/locales.js +120 -0
- package/dist/client/podman-containers.js +47 -18
- package/dist/client/podman-terminal-guide.js +4 -2
- package/dist/client/podman-terminal.js +4 -2
- package/dist/client/template-client.d.ts +9 -0
- package/dist/client/template-client.js +52 -0
- package/dist/client/template-protocol.d.ts +60 -0
- package/dist/client/template-protocol.js +4 -0
- package/dist/client/terminal-errors.d.ts +11 -0
- package/dist/client/terminal-errors.js +26 -0
- package/dist/client/terminal-protocol.d.ts +5 -0
- package/dist/client/terminal-protocol.js +5 -0
- package/dist/client/terminal-styles.d.ts +2 -1
- package/dist/client/terminal-styles.js +9 -1
- package/dist/client/terminal-transport.d.ts +17 -2
- package/dist/client/terminal-transport.js +31 -8
- package/dist/client/tool-presentations.d.ts +32 -0
- package/dist/client/tool-presentations.js +33 -0
- package/dist/client/tool-views.js +17 -7
- package/dist/client/workspace-target.d.ts +54 -0
- package/dist/client/workspace-target.js +86 -0
- package/dist/container-template.d.ts +153 -0
- package/dist/container-template.js +1058 -0
- package/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +2 -2
- package/dist/grpc/proto/dshguest/v1/guest.proto +11 -0
- package/dist/guest-rpc.d.ts +1 -0
- package/dist/guest-rpc.js +12 -0
- package/dist/index.js +7 -1
- package/dist/mount-enums.d.ts +2 -0
- package/dist/mount-enums.js +17 -0
- package/dist/mount-order.d.ts +14 -0
- package/dist/mount-order.js +49 -0
- package/dist/project-path.d.ts +14 -0
- package/dist/project-path.js +25 -0
- package/dist/template-apply.d.ts +21 -0
- package/dist/template-apply.js +102 -0
- package/dist/template-files.d.ts +23 -0
- package/dist/template-files.js +186 -0
- package/dist/template-image.d.ts +22 -0
- package/dist/template-image.js +80 -0
- package/dist/template-route.d.ts +9 -0
- package/dist/template-route.js +278 -0
- package/dist/terminal-route.js +49 -7
- package/dist/tool-defs.js +27 -1
- package/dist/tool-handlers.js +69 -1
- package/dist/tool-params.d.ts +38 -0
- package/dist/tool-params.js +30 -0
- package/docs/README.md +4 -3
- package/docs/architecture.md +42 -12
- package/docs/architecture.zh.md +22 -8
- package/docs/configuration.md +19 -20
- package/docs/configuration.zh.md +3 -4
- package/docs/development-prompt.md +49 -45
- package/docs/development-prompt.zh.md +47 -43
- package/docs/development.md +45 -28
- package/docs/development.zh.md +59 -46
- package/docs/uninstall.md +3 -3
- package/docs/uninstall.zh.md +2 -2
- package/docs/usage.md +155 -23
- package/docs/usage.zh.md +104 -14
- package/package.json +6 -5
|
@@ -6,5 +6,5 @@ export function ContainerCardToast(props) {
|
|
|
6
6
|
return null;
|
|
7
7
|
return (_jsx(Toast
|
|
8
8
|
// A new report remounts the banner, which restarts its hold.
|
|
9
|
-
, { text: toast.text, icon: toast.kind === "
|
|
9
|
+
, { text: toast.text, icon: toast.kind === "ok" ? undefined : _jsx(IconWarningOutlineRegular, {}), onDone: props.dismissToast }, `podman-card-toast-${String(toast.seq)}`));
|
|
10
10
|
}
|
|
@@ -1,36 +1,22 @@
|
|
|
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 { ConfirmButton, countLabel
|
|
5
|
+
import { ConfirmButton, countLabel } from "./container-card-shared.js";
|
|
6
6
|
import { CardGroup } from "./container-card-group.js";
|
|
7
|
+
import { CreateVolumeModal } from "./container-card-create-volume.js";
|
|
7
8
|
import { scopedActionKey } from "./card-protocol.js";
|
|
8
9
|
import { cardList, cardRow, containerNameHeading, hint, rowActions, rowDivider, rowMain, } from "./container-card-styles.js";
|
|
9
|
-
import { Button
|
|
10
|
-
import {
|
|
10
|
+
import { Button } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
11
|
+
import { useState } from "react";
|
|
11
12
|
export function VolumesSection(props) {
|
|
12
13
|
const { t, volumes, busy, writable, pendingActions, onCreate, onRemove } = props;
|
|
13
14
|
const [open, setOpen] = useState(false);
|
|
14
|
-
const [name, setName] = useState("");
|
|
15
|
-
const volumeId = useId();
|
|
16
|
-
const canCreate = namePattern.test(name);
|
|
17
|
-
const submit = () => {
|
|
18
|
-
if (!namePattern.test(name))
|
|
19
|
-
return;
|
|
20
|
-
onCreate(name.trim());
|
|
21
|
-
setName("");
|
|
22
|
-
setOpen(false);
|
|
23
|
-
};
|
|
24
15
|
return (_jsxs(CardGroup, { title: t("volumesTitle"), summary: countLabel(t, volumes.length, "countVolumeOne", "countVolumeMany"), hasContent: volumes.length > 0, action: _jsx(Button, { variant: "primary", size: "sm", disabled: !writable || busy, onClick: () => setOpen(true), children: t("createVolume") }), children: [volumes.length === 0
|
|
25
16
|
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noVolumes") })
|
|
26
17
|
: (_jsx("div", { style: cardList, children: volumes.map((volume, index) => (_jsxs("div", { style: index === volumes.length - 1
|
|
27
18
|
? cardRow
|
|
28
19
|
: { ...cardRow, ...rowDivider }, children: [_jsx("div", { style: rowMain, children: _jsx("span", { style: containerNameHeading, children: volume.name }) }), _jsx("div", { style: rowActions, children: _jsx(ConfirmButton, { t: t, destructive: true, label: t("removeVolume"), title: t("removeVolumeTitle"), description: t("confirmRemoveVolume", {
|
|
29
20
|
volume: volume.name,
|
|
30
|
-
}), confirmLabel: t("removeVolumeTitle"), pending: pendingActions.includes(scopedActionKey("volume_remove", volume.name)), onConfirm: () => onRemove(volume.name) }) })] }, volume.name))) })), _jsx(
|
|
31
|
-
if (event.key === "Enter")
|
|
32
|
-
submit();
|
|
33
|
-
} }), name !== "" && !namePattern.test(name)
|
|
34
|
-
? (_jsx("p", { style: { ...hint, margin: 0 }, role: "alert", children: t("invalidName") }))
|
|
35
|
-
: null] }) })] }));
|
|
21
|
+
}), confirmLabel: t("removeVolumeTitle"), pending: pendingActions.includes(scopedActionKey("volume_remove", volume.name)), onConfirm: () => onRemove(volume.name) }) })] }, volume.name))) })), _jsx(CreateVolumeModal, { t: t, open: open, busy: busy, writable: writable, onCreate: onCreate, onClose: () => setOpen(false) })] }));
|
|
36
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TemplateActions } from "./container-card-templates.js";
|
|
1
2
|
import { type ContainerConfig, type ContainerCreateConfig, type ContainerView, type ImageView, type WorkspaceView } from "./container-card-controller.js";
|
|
2
3
|
import { type DirectoryPickerFace } from "./directory-picker.js";
|
|
3
4
|
import type { Translate } from "./locales.js";
|
|
@@ -25,9 +26,16 @@ export declare function WorkspaceSection(props: {
|
|
|
25
26
|
onRecreate: (workspace: string, container: string, image: string) => void;
|
|
26
27
|
onRemoveWorkspace: (workspace: string) => void;
|
|
27
28
|
onCreate: (workspace: WorkspaceView, config?: ContainerCreateConfig) => void;
|
|
28
|
-
|
|
29
|
+
onCreateVolume: (name: string) => Promise<boolean>;
|
|
30
|
+
onCreateSecret: (name: string, length?: number, charset?: string) => Promise<boolean>;
|
|
29
31
|
onStartContainer: (workspace: WorkspaceView, container: string, config?: ContainerCreateConfig) => void;
|
|
30
|
-
onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) =>
|
|
32
|
+
onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) => Promise<boolean>;
|
|
31
33
|
gatewayUnavailable: boolean;
|
|
34
|
+
templateActions: TemplateActions;
|
|
35
|
+
onBuildImage: (imageId: string, parent: string, packages: string[]) => void;
|
|
36
|
+
onRebuildImage: (imageId: string) => void;
|
|
37
|
+
onRebuildBaseImage: (name: string) => void;
|
|
38
|
+
onPullBaseImage: (name: string) => void;
|
|
39
|
+
onReload: () => void;
|
|
32
40
|
extraAction?: ReactNode;
|
|
33
41
|
}): ReactNode;
|
|
@@ -8,10 +8,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
// the one action that creates its default container, reads muted, and states the
|
|
9
9
|
// greyed zero it holds.
|
|
10
10
|
import { ContainerRow, CreateContainerModal } from "./container-card-row.js";
|
|
11
|
+
import { LoadTemplateModal, } from "./container-card-templates.js";
|
|
11
12
|
import { countLabel } from "./container-card-shared.js";
|
|
12
13
|
import { scopedActionKey } from "./card-protocol.js";
|
|
13
14
|
import { TABLE_CARD_CLASS, TABLE_CARD_CONTENT_CLASS, } from "./container-card-table-styles.js";
|
|
14
|
-
import { actionRow, card, cardContent, cardList, cardTitle, destructiveAction, headerRule, rowActions, rowMain, rowName, statusMuted, workspaceStatus, } from "./container-card-styles.js";
|
|
15
|
+
import { actionRow, card, cardContent, cardList, cardTitle, destructiveAction, headerRule, rowActions, rowMain, rowName, statusMuted, templateAction, workspaceStatus, } from "./container-card-styles.js";
|
|
15
16
|
import { Button, IconCheckOutlineRegular, IconCopyOutlineRegular, RiskConfirmation, Tooltip, writeClipboard, } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
16
17
|
import { useEffect, useId, useRef, useState } from "react";
|
|
17
18
|
// The workspace's ID, copied on demand instead of printed as a bare UUID: a
|
|
@@ -41,8 +42,18 @@ function CopyWorkspaceId(props) {
|
|
|
41
42
|
return (_jsx(Tooltip, { label: label, children: _jsx(Button, { variant: "ghost", size: "sm", icon: copied ? _jsx(IconCheckOutlineRegular, {}) : _jsx(IconCopyOutlineRegular, {}), "aria-label": label, disabled: id === "", onClick: copy }) }));
|
|
42
43
|
}
|
|
43
44
|
export function WorkspaceSection(props) {
|
|
44
|
-
const { t, workspace, containers, images, volumes, secrets, busy, writable, locale, pendingActions, defaultImage, defaultEnv, projectsRoot, directoryPicker, onRemove, onRecreate, onRemoveWorkspace, onCreate, onCreateSecret, onStartContainer, onApplyContainerConfig, gatewayUnavailable, extraAction, } = props;
|
|
45
|
+
const { t, workspace, containers, images, volumes, secrets, busy, writable, locale, pendingActions, defaultImage, defaultEnv, projectsRoot, directoryPicker, onRemove, onRecreate, onRemoveWorkspace, onCreate, onCreateVolume, onCreateSecret, onStartContainer, onApplyContainerConfig, gatewayUnavailable, templateActions, onBuildImage, onRebuildImage, onRebuildBaseImage, onPullBaseImage, onReload, extraAction, } = props;
|
|
45
46
|
const [createOpen, setCreateOpen] = useState(null);
|
|
47
|
+
const [templateOpen, setTemplateOpen] = useState(false);
|
|
48
|
+
// What the Load template popup's Continue handed the editor, kept while that
|
|
49
|
+
// editor is open so its Back can reopen the popup's details step exactly as
|
|
50
|
+
// the user left it. It is dropped when the popup closes or the flow applies.
|
|
51
|
+
const [templateResume, setTemplateResume] = useState(null);
|
|
52
|
+
// A one-shot draft the Load template popup's Continue hands to the create or
|
|
53
|
+
// edit editor; the editor saves nothing until its own Apply.
|
|
54
|
+
const [createPrefill, setCreatePrefill] = useState(null);
|
|
55
|
+
const [editPrefill, setEditPrefill] = useState(null);
|
|
56
|
+
const editToken = useRef(0);
|
|
46
57
|
const [removeWorkspaceOpen, setRemoveWorkspaceOpen] = useState(false);
|
|
47
58
|
const [removeWorkspaceAcknowledged, setRemoveWorkspaceAcknowledged] = useState(false);
|
|
48
59
|
const headingId = useId();
|
|
@@ -64,13 +75,55 @@ export function WorkspaceSection(props) {
|
|
|
64
75
|
? countLabel(t, running, "countRunningContainerOne", "countRunningContainerMany")
|
|
65
76
|
: null, running > 0 && stopped > 0 ? " · " : null, stopped > 0
|
|
66
77
|
? (_jsx("span", { style: statusMuted, children: countLabel(t, stopped, "countStoppedContainerOne", "countStoppedContainerMany") }))
|
|
67
|
-
: null, hasContainer ? null : (_jsx("span", { style: statusMuted, children: countLabel(t, 0, "countContainerOne", "countContainerMany") }))] })] }), _jsxs("div", { style: rowActions, children: [_jsx(Button, { variant: "primary", size: "sm", disabled: busy, onClick: () => setCreateOpen(hasContainer ? "named" : "default"), children: hasContainer ? t("addContainer") : t("createContainer") }), hasContainer
|
|
78
|
+
: null, hasContainer ? null : (_jsx("span", { style: statusMuted, children: countLabel(t, 0, "countContainerOne", "countContainerMany") }))] })] }), _jsxs("div", { style: rowActions, children: [_jsx(Button, { variant: "primary", size: "sm", disabled: busy, onClick: () => setCreateOpen(hasContainer ? "named" : "default"), children: hasContainer ? t("addContainer") : t("createContainer") }), _jsx(Button, { variant: "outline", size: "sm", disabled: busy, style: templateAction, onClick: () => setTemplateOpen(true), children: t("loadTemplate") }), hasContainer
|
|
68
79
|
? (_jsx(Button, { variant: "outline", size: "sm", disabled: removeWorkspacePending, style: destructiveAction, onClick: () => {
|
|
69
80
|
setRemoveWorkspaceAcknowledged(false);
|
|
70
81
|
setRemoveWorkspaceOpen(true);
|
|
71
82
|
}, children: removeWorkspacePending ? t("busy") : t("removeWorkspace") }))
|
|
72
83
|
: null, extraAction] })] }), hasContainer
|
|
73
|
-
? (_jsx("div", { className: TABLE_CARD_CONTENT_CLASS, style: cardContent, children: _jsx("div", { style: cardList, children: containers.map((container, index) => (_jsx(ContainerRow, { t: t, container: container, images: images, volumes: volumes, secrets: secrets, pendingActions: pendingActions, locale: locale, last: index === containers.length - 1, writable: writable, onRemove: onRemove, onRecreate: onRecreate, onCreateSecret: onCreateSecret, onApplyContainerConfig:
|
|
84
|
+
? (_jsx("div", { className: TABLE_CARD_CONTENT_CLASS, style: cardContent, children: _jsx("div", { style: cardList, children: containers.map((container, index) => (_jsx(ContainerRow, { t: t, container: container, images: images, volumes: volumes, secrets: secrets, pendingActions: pendingActions, locale: locale, last: index === containers.length - 1, writable: writable, onRemove: onRemove, onRecreate: onRecreate, createVolume: onCreateVolume, onCreateSecret: onCreateSecret, onApplyContainerConfig: async (workspace, container, base, next) => {
|
|
85
|
+
const applied = await onApplyContainerConfig(workspace, container, base, next);
|
|
86
|
+
const prefill = editPrefill;
|
|
87
|
+
if (!applied || prefill === null ||
|
|
88
|
+
prefill.container !== container) {
|
|
89
|
+
return applied;
|
|
90
|
+
}
|
|
91
|
+
// The template flow is over once its draft applied, so a
|
|
92
|
+
// later Load template starts at the picker with a fresh
|
|
93
|
+
// draft rather than resuming this one.
|
|
94
|
+
setTemplateResume(null);
|
|
95
|
+
if (prefill.source === undefined)
|
|
96
|
+
return applied;
|
|
97
|
+
// The editor is the one edit-apply path: ports are not in
|
|
98
|
+
// its draft, so the template's own are published here.
|
|
99
|
+
setEditPrefill((current) => current !== null && current.container === container
|
|
100
|
+
? { ...current, source: undefined }
|
|
101
|
+
: current);
|
|
102
|
+
await templateActions.publishTemplate({
|
|
103
|
+
op: "publish",
|
|
104
|
+
workspace,
|
|
105
|
+
container,
|
|
106
|
+
name: prefill.source.name,
|
|
107
|
+
yaml: prefill.source.yaml,
|
|
108
|
+
});
|
|
109
|
+
return applied;
|
|
110
|
+
}, projectName: workspace.projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, gatewayUnavailable: gatewayUnavailable, prefill: editPrefill !== null &&
|
|
111
|
+
editPrefill.container === container.containerName
|
|
112
|
+
? { token: editPrefill.token, config: editPrefill.config }
|
|
113
|
+
: undefined, forcedProject: editPrefill !== null &&
|
|
114
|
+
editPrefill.container === container.containerName &&
|
|
115
|
+
container.containerName === "default"
|
|
116
|
+
? workspace.projectName
|
|
117
|
+
: undefined, onEditBack: templateResume === null ? undefined : () => {
|
|
118
|
+
// Back drops the editor without applying, clears the
|
|
119
|
+
// one-shot prefill and reopens the popup on its recorded
|
|
120
|
+
// draft; the resume payload itself stays for that reopen.
|
|
121
|
+
setEditPrefill(null);
|
|
122
|
+
setTemplateOpen(true);
|
|
123
|
+
}, onEditClosed: () => {
|
|
124
|
+
setEditPrefill(null);
|
|
125
|
+
setTemplateResume(null);
|
|
126
|
+
} }, container.containerName))) }) }))
|
|
74
127
|
: null, _jsx(RiskConfirmation, { open: removeWorkspaceOpen, title: t("removeWorkspace"), description: t("confirmRemoveWorkspace", {
|
|
75
128
|
workspace: workspace.projectName,
|
|
76
129
|
}), acknowledgeLabel: t("acknowledgeRemoveWorkspace"), cancelLabel: t("cancel"), closeLabel: t("cancel"), confirmLabel: t("removeWorkspace"), acknowledged: removeWorkspaceAcknowledged, disabled: removeWorkspacePending, onAcknowledgedChange: setRemoveWorkspaceAcknowledged, onCancel: () => {
|
|
@@ -80,7 +133,45 @@ export function WorkspaceSection(props) {
|
|
|
80
133
|
setRemoveWorkspaceAcknowledged(false);
|
|
81
134
|
setRemoveWorkspaceOpen(false);
|
|
82
135
|
onRemoveWorkspace(workspace.workspaceSlug);
|
|
83
|
-
} }), _jsx(
|
|
136
|
+
} }), _jsx(LoadTemplateModal, { t: t, locale: locale, open: templateOpen, workspace: workspace, containers: containers, images: images, volumes: volumes, secrets: secrets, defaultEnv: defaultEnv, projectsRoot: projectsRoot, directoryPicker: directoryPicker, busy: busy, writable: writable, gatewayUnavailable: gatewayUnavailable, actions: templateActions, onBuildImage: onBuildImage, onRebuildImage: onRebuildImage, onRebuildBaseImage: onRebuildBaseImage, onPullBaseImage: onPullBaseImage, onCreateSecret: onCreateSecret, createVolume: onCreateVolume, onReload: onReload, resume: templateResume, onClose: () => {
|
|
137
|
+
setTemplateOpen(false);
|
|
138
|
+
setTemplateResume(null);
|
|
139
|
+
}, onContinue: (mode, container, config, source, resume) => {
|
|
140
|
+
setTemplateOpen(false);
|
|
141
|
+
setTemplateResume(resume ?? null);
|
|
142
|
+
if (mode === "create") {
|
|
143
|
+
setCreateOpen(container === "default" ? "default" : "named");
|
|
144
|
+
setCreatePrefill({
|
|
145
|
+
name: container === "default" ? "" : container,
|
|
146
|
+
config,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
editToken.current += 1;
|
|
151
|
+
setEditPrefill({
|
|
152
|
+
container,
|
|
153
|
+
token: editToken.current,
|
|
154
|
+
config,
|
|
155
|
+
...(source === undefined ? {} : { source }),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
} }), _jsx(CreateContainerModal, { t: t, workspace: workspace, images: images, volumes: volumes, secrets: secrets, busy: busy, writable: writable, defaultImage: defaultImage, defaultEnv: defaultEnv, projectsRoot: projectsRoot, directoryPicker: directoryPicker, named: createOpen === "named", existing: containers.map((container) => container.containerName), gatewayUnavailable: gatewayUnavailable, open: createOpen !== null, initial: createPrefill ?? undefined, forcedProject: createOpen === "default"
|
|
159
|
+
? workspace.projectName
|
|
160
|
+
: undefined, onBack: templateResume === null || createPrefill === null
|
|
161
|
+
? undefined
|
|
162
|
+
: () => {
|
|
163
|
+
// Back drops the editor without creating anything and reopens the
|
|
164
|
+
// popup on the draft Continue handed on.
|
|
165
|
+
setCreateOpen(null);
|
|
166
|
+
setCreatePrefill(null);
|
|
167
|
+
setTemplateOpen(true);
|
|
168
|
+
}, onClose: () => {
|
|
169
|
+
setCreateOpen(null);
|
|
170
|
+
setCreatePrefill(null);
|
|
171
|
+
// Closing the editor ends the template flow, so its recorded draft
|
|
172
|
+
// must not resurface on the next Load template.
|
|
173
|
+
setTemplateResume(null);
|
|
174
|
+
}, createVolume: onCreateVolume, onCreateSecret: onCreateSecret, onCreate: (container, config) => {
|
|
84
175
|
if (createOpen === "named") {
|
|
85
176
|
onStartContainer(workspace, container, config);
|
|
86
177
|
}
|
|
@@ -88,5 +179,7 @@ export function WorkspaceSection(props) {
|
|
|
88
179
|
onCreate(workspace, config);
|
|
89
180
|
}
|
|
90
181
|
setCreateOpen(null);
|
|
182
|
+
setCreatePrefill(null);
|
|
183
|
+
setTemplateResume(null);
|
|
91
184
|
} })] }));
|
|
92
185
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type ContainerTemplate, type EffectiveImage, type TemplateImagePlan, type TemplateMount, type TemplateMountInput, type TemplatePort } from "../container-template.js";
|
|
2
|
+
import type { TemplateInspectionView } from "./template-protocol.js";
|
|
3
|
+
import type { Translate } from "./locales.js";
|
|
4
|
+
import { type ProjectPathDecision, type ProjectPathRejection } from "../project-path.js";
|
|
5
|
+
export interface TemplateEditorPort {
|
|
6
|
+
port: number;
|
|
7
|
+
protocol: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
suggestedHostPort: number;
|
|
10
|
+
hostPort: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TemplateEditorConfig {
|
|
13
|
+
image: string;
|
|
14
|
+
env: Record<string, string>;
|
|
15
|
+
mounts: TemplateMountInput[];
|
|
16
|
+
paths: string[];
|
|
17
|
+
secretEnv: Record<string, string>;
|
|
18
|
+
ports: TemplateEditorPort[];
|
|
19
|
+
}
|
|
20
|
+
export interface TemplateCurrentConfig {
|
|
21
|
+
env: Record<string, string>;
|
|
22
|
+
mounts: readonly TemplateMountInput[];
|
|
23
|
+
paths: readonly string[];
|
|
24
|
+
secretEnv: Record<string, string>;
|
|
25
|
+
ports: readonly TemplateEditorPort[];
|
|
26
|
+
}
|
|
27
|
+
export interface TemplateSource {
|
|
28
|
+
name: string;
|
|
29
|
+
yaml: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TemplateImageFacts {
|
|
32
|
+
imageId: string;
|
|
33
|
+
status: string;
|
|
34
|
+
builtAt: string;
|
|
35
|
+
source: string;
|
|
36
|
+
packages: readonly string[] | undefined;
|
|
37
|
+
}
|
|
38
|
+
export declare function templateImageFacts(plan: TemplateImagePlan, images: readonly TemplateImageCandidate[]): TemplateImageFacts;
|
|
39
|
+
export interface TemplateImageCandidate {
|
|
40
|
+
imageId: string;
|
|
41
|
+
parent: string;
|
|
42
|
+
primitive: string;
|
|
43
|
+
packages: readonly string[];
|
|
44
|
+
builtAt: string;
|
|
45
|
+
status: string;
|
|
46
|
+
isBase: boolean;
|
|
47
|
+
basePublic: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface TemplateImageChoice {
|
|
50
|
+
imageId: string;
|
|
51
|
+
isBase: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function templateImageCandidates(plan: TemplateImagePlan | null, images: readonly TemplateImageChoice[]): string[];
|
|
54
|
+
export declare function templateDraftImageFacts(plan: TemplateImagePlan, draftImage: string, images: readonly TemplateImageCandidate[]): TemplateImageFacts;
|
|
55
|
+
export declare function templateDisplayName(fileName: string): string;
|
|
56
|
+
export interface TemplateSpecFacts {
|
|
57
|
+
envNames: string[];
|
|
58
|
+
mounts: string[];
|
|
59
|
+
paths: string[];
|
|
60
|
+
ports: string[];
|
|
61
|
+
secrets: string[];
|
|
62
|
+
}
|
|
63
|
+
export type TemplateSpecSummary = ({
|
|
64
|
+
valid: true;
|
|
65
|
+
image: EffectiveImage;
|
|
66
|
+
packages: number;
|
|
67
|
+
} & TemplateSpecFacts) | {
|
|
68
|
+
valid: false;
|
|
69
|
+
reason: string;
|
|
70
|
+
};
|
|
71
|
+
export declare function invalidTemplateReason(error: unknown): string;
|
|
72
|
+
export declare function templateSecretNames(template: ContainerTemplate): string[];
|
|
73
|
+
export declare function templateEnvNames(template: ContainerTemplate): string[];
|
|
74
|
+
export declare function templateMountSource(mount: TemplateMount): string;
|
|
75
|
+
export declare function templatePortRowValue(port: TemplatePort): string;
|
|
76
|
+
export declare function templateSpecSummary(yaml: string): TemplateSpecSummary;
|
|
77
|
+
export declare function templateChoiceActionable(summary: TemplateSpecSummary | undefined, busy: boolean): boolean;
|
|
78
|
+
export interface TemplateSummarySegment {
|
|
79
|
+
label: string;
|
|
80
|
+
values: string[];
|
|
81
|
+
count?: number;
|
|
82
|
+
}
|
|
83
|
+
export declare function templateSummarySegments(t: Translate, summary: TemplateSpecSummary): TemplateSummarySegment[];
|
|
84
|
+
export declare function templateSummarySegmentValue(segment: TemplateSummarySegment): string;
|
|
85
|
+
export declare function templateSummarySegmentText(segment: TemplateSummarySegment): string;
|
|
86
|
+
export declare function templateSummaryLineText(segments: readonly TemplateSummarySegment[]): string;
|
|
87
|
+
export declare function templateSummaryAccessibleLabel(t: Translate, name: string, summary: TemplateSpecSummary | undefined): string;
|
|
88
|
+
export interface TemplateDraftReference {
|
|
89
|
+
kind: "project" | "secret" | "volume";
|
|
90
|
+
name: string;
|
|
91
|
+
mountIndex?: number;
|
|
92
|
+
env?: string;
|
|
93
|
+
}
|
|
94
|
+
export declare function templateDraftReferences(draft: TemplateEditorConfig): TemplateDraftReference[];
|
|
95
|
+
export interface TemplateDraftKnown {
|
|
96
|
+
secrets: readonly {
|
|
97
|
+
name: string;
|
|
98
|
+
}[];
|
|
99
|
+
volumes: readonly {
|
|
100
|
+
name: string;
|
|
101
|
+
}[];
|
|
102
|
+
projects: readonly string[];
|
|
103
|
+
}
|
|
104
|
+
export declare function templateDraftMissingReferences(references: readonly TemplateDraftReference[], known: TemplateDraftKnown): TemplateDraftReference[];
|
|
105
|
+
export declare function templateProjectPathDecision(options: {
|
|
106
|
+
project: string;
|
|
107
|
+
projectsRoot: string;
|
|
108
|
+
listDirectory?: (path: string) => Promise<unknown>;
|
|
109
|
+
}): Promise<ProjectPathDecision>;
|
|
110
|
+
export declare function templateProjectPathError(t: Translate, project: string, reason: ProjectPathRejection): string;
|
|
111
|
+
export type TemplateProjectCheck = {
|
|
112
|
+
state: "pending";
|
|
113
|
+
project: string;
|
|
114
|
+
} | {
|
|
115
|
+
state: "ok";
|
|
116
|
+
project: string;
|
|
117
|
+
} | {
|
|
118
|
+
state: "error";
|
|
119
|
+
project: string;
|
|
120
|
+
error: string;
|
|
121
|
+
};
|
|
122
|
+
export declare function templateProjectChecksEqual(left: Readonly<Record<number, TemplateProjectCheck>>, right: Readonly<Record<number, TemplateProjectCheck>>): boolean;
|
|
123
|
+
export declare function templateConfigForEditor(template: ContainerTemplate, imageId: string, options?: {
|
|
124
|
+
defaultEnv?: Record<string, string>;
|
|
125
|
+
current?: TemplateCurrentConfig;
|
|
126
|
+
}): TemplateEditorConfig;
|
|
127
|
+
export type TemplateBlockReason = "loading" | "build" | "build-failed" | "image-missing" | "checking" | "missing-references" | "no-container";
|
|
128
|
+
export declare function templateBlockReason(options: {
|
|
129
|
+
inspection: TemplateInspectionView | null;
|
|
130
|
+
draftImage: string;
|
|
131
|
+
images: readonly {
|
|
132
|
+
imageId: string;
|
|
133
|
+
}[];
|
|
134
|
+
buildInProgress: boolean;
|
|
135
|
+
buildFailed: string;
|
|
136
|
+
pendingReferences: number;
|
|
137
|
+
missingReferences: number;
|
|
138
|
+
mode: "create" | "replace";
|
|
139
|
+
replaceTarget: string;
|
|
140
|
+
}): TemplateBlockReason | undefined;
|
|
141
|
+
export type TemplateBuildAction = "none" | "build" | "building" | "rebuild" | "rebuilding";
|
|
142
|
+
export declare function templateBuildAction(options: {
|
|
143
|
+
plan: TemplateImagePlan | null;
|
|
144
|
+
draftImage: string;
|
|
145
|
+
building: boolean;
|
|
146
|
+
buildFailed: string;
|
|
147
|
+
}): TemplateBuildAction;
|
|
148
|
+
export type TemplateImageAction = "none" | "build" | "building" | "rebuild" | "rebuilding" | "pull";
|
|
149
|
+
export type TemplateImageCommand = "none" | "template-build" | "template-rebuild" | "custom-build" | "custom-rebuild" | "base-build" | "base-rebuild" | "base-pull";
|
|
150
|
+
export interface TemplateImageActionDecision {
|
|
151
|
+
action: TemplateImageAction;
|
|
152
|
+
command: TemplateImageCommand;
|
|
153
|
+
}
|
|
154
|
+
export declare function templateImageAction(options: {
|
|
155
|
+
plan: TemplateImagePlan | null;
|
|
156
|
+
draftImage: string;
|
|
157
|
+
images: readonly TemplateImageCandidate[];
|
|
158
|
+
building: boolean;
|
|
159
|
+
buildFailed?: string;
|
|
160
|
+
}): TemplateImageActionDecision;
|
|
161
|
+
export declare function missingSecretNames(secretEnv: Record<string, string>, secrets: readonly {
|
|
162
|
+
name: string;
|
|
163
|
+
}[]): string[];
|