@exagone313/dsh-podman 1.5.1 → 1.6.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/client/container-card-workspace.d.ts +1 -0
- package/dist/client/container-card-workspace.js +2 -2
- package/dist/client/container-panel-scope.d.ts +13 -0
- package/dist/client/container-panel-scope.js +45 -0
- package/dist/client/containers-tab.d.ts +26 -0
- package/dist/client/containers-tab.js +39 -0
- package/dist/client/index.js +673 -295
- package/dist/client/locales.d.ts +1 -1
- package/dist/client/locales.js +12 -0
- package/dist/client/plugin-navigation.d.ts +24 -0
- package/dist/client/plugin-navigation.js +44 -0
- package/dist/client/podman-containers-guide.d.ts +5 -0
- package/dist/client/podman-containers-guide.js +73 -0
- package/dist/client/podman-containers-styles.d.ts +5 -0
- package/dist/client/podman-containers-styles.js +33 -0
- package/dist/client/podman-containers.d.ts +11 -0
- package/dist/client/podman-containers.js +113 -0
- package/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +2 -2
- package/docs/usage.md +38 -17
- package/docs/usage.zh.md +24 -4
- package/package.json +1 -1
|
@@ -29,4 +29,5 @@ export declare function WorkspaceSection(props: {
|
|
|
29
29
|
onStartContainer: (workspace: WorkspaceView, container: string, config?: ContainerCreateConfig) => void;
|
|
30
30
|
onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) => void;
|
|
31
31
|
gatewayUnavailable: boolean;
|
|
32
|
+
extraAction?: ReactNode;
|
|
32
33
|
}): ReactNode;
|
|
@@ -41,7 +41,7 @@ function CopyWorkspaceId(props) {
|
|
|
41
41
|
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
42
|
}
|
|
43
43
|
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, } = 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
45
|
const [createOpen, setCreateOpen] = useState(null);
|
|
46
46
|
const [removeWorkspaceOpen, setRemoveWorkspaceOpen] = useState(false);
|
|
47
47
|
const [removeWorkspaceAcknowledged, setRemoveWorkspaceAcknowledged] = useState(false);
|
|
@@ -69,7 +69,7 @@ export function WorkspaceSection(props) {
|
|
|
69
69
|
setRemoveWorkspaceAcknowledged(false);
|
|
70
70
|
setRemoveWorkspaceOpen(true);
|
|
71
71
|
}, children: removeWorkspacePending ? t("busy") : t("removeWorkspace") }))
|
|
72
|
-
: null] })] }), hasContainer
|
|
72
|
+
: null, extraAction] })] }), hasContainer
|
|
73
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: onApplyContainerConfig, projectName: workspace.projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, gatewayUnavailable: gatewayUnavailable }, container.containerName))) }) }))
|
|
74
74
|
: null, _jsx(RiskConfirmation, { open: removeWorkspaceOpen, title: t("removeWorkspace"), description: t("confirmRemoveWorkspace", {
|
|
75
75
|
workspace: workspace.projectName,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ContainerView } from "./card-protocol.js";
|
|
2
|
+
import type { TerminalTargetView } from "./terminal-protocol.js";
|
|
3
|
+
/**
|
|
4
|
+
* The containers the Containers panel lists for one resolved workspace.
|
|
5
|
+
*
|
|
6
|
+
* The default container sorts first, as it does in the settings card, and the
|
|
7
|
+
* named ones follow in name order. An unknown session (no resolved target, or a
|
|
8
|
+
* target with no slug) has no workspace to scope to and yields nothing.
|
|
9
|
+
* @param containers - container rows from the card snapshot.
|
|
10
|
+
* @param target - the host-resolved workspace, or undefined until it arrives.
|
|
11
|
+
* @returns that workspace's containers only.
|
|
12
|
+
*/
|
|
13
|
+
export declare function containersInWorkspace(containers: readonly ContainerView[], target: TerminalTargetView | undefined): ContainerView[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// The workspace scope of the Containers panel, kept free of React and the DOM so
|
|
5
|
+
// it can be unit-tested from the host program.
|
|
6
|
+
//
|
|
7
|
+
// A Session belongs to exactly one workspace and its side panes are that
|
|
8
|
+
// workspace's own, so the panel never offers a workspace picker: the host route
|
|
9
|
+
// resolves the session's workspace once (`fetchTerminalTarget`, the same route
|
|
10
|
+
// the terminal uses) and this helper reduces the card snapshot to the rows that
|
|
11
|
+
// workspace may show. A row without a slug and the shared, workspace-less PTC
|
|
12
|
+
// container are never part of any workspace, and another workspace's rows are
|
|
13
|
+
// never shown — even when the snapshot is the whole deployment's state.
|
|
14
|
+
import { PTC_CONTAINER_NAME } from "./card-protocol.js";
|
|
15
|
+
/**
|
|
16
|
+
* The containers the Containers panel lists for one resolved workspace.
|
|
17
|
+
*
|
|
18
|
+
* The default container sorts first, as it does in the settings card, and the
|
|
19
|
+
* named ones follow in name order. An unknown session (no resolved target, or a
|
|
20
|
+
* target with no slug) has no workspace to scope to and yields nothing.
|
|
21
|
+
* @param containers - container rows from the card snapshot.
|
|
22
|
+
* @param target - the host-resolved workspace, or undefined until it arrives.
|
|
23
|
+
* @returns that workspace's containers only.
|
|
24
|
+
*/
|
|
25
|
+
export function containersInWorkspace(containers, target) {
|
|
26
|
+
if (target === undefined || target.workspaceSlug === "")
|
|
27
|
+
return [];
|
|
28
|
+
const workspaceSlug = target.workspaceSlug;
|
|
29
|
+
return containers
|
|
30
|
+
.filter((container) => container.workspaceSlug === workspaceSlug &&
|
|
31
|
+
// Defensive: a row without a workspace belongs to no scope, and the
|
|
32
|
+
// shared PTC container belongs to none by definition.
|
|
33
|
+
container.workspaceSlug !== "" &&
|
|
34
|
+
container.containerName !== "" &&
|
|
35
|
+
container.containerName !== PTC_CONTAINER_NAME)
|
|
36
|
+
.sort(byDefaultThenName);
|
|
37
|
+
}
|
|
38
|
+
// The default container first, then the named ones in a stable order.
|
|
39
|
+
function byDefaultThenName(left, right) {
|
|
40
|
+
const leftDefault = left.containerName === "default";
|
|
41
|
+
const rightDefault = right.containerName === "default";
|
|
42
|
+
if (leftDefault !== rightDefault)
|
|
43
|
+
return leftDefault ? -1 : 1;
|
|
44
|
+
return left.containerName.localeCompare(right.containerName);
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Page kind `openTab` names; unique among the tab types in force. */
|
|
2
|
+
export declare const PODMAN_CONTAINERS_KIND = "podman-containers";
|
|
3
|
+
/** Implementation id the body registers under; distinct from the terminal's. */
|
|
4
|
+
export declare const PODMAN_CONTAINERS_TAB_ID = "@exagone313/dsh-podman#containers";
|
|
5
|
+
export interface ContainersNavigator<Target> {
|
|
6
|
+
commandTarget(target: unknown): Target | undefined;
|
|
7
|
+
openTabFromTarget(kind: string, target: Target): void;
|
|
8
|
+
}
|
|
9
|
+
/** What resolving the open action settled on. */
|
|
10
|
+
export type ContainersOpenResolution = {
|
|
11
|
+
readonly status: "blocked";
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: "handled";
|
|
14
|
+
readonly run: () => void;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Capture the current pane and prepare to open the Containers panel in it.
|
|
18
|
+
*
|
|
19
|
+
* The capture happens during resolve (the live input target is only valid
|
|
20
|
+
* then); the returned `run` opens the panel at that captured target, so the
|
|
21
|
+
* command opens in the focused pane.
|
|
22
|
+
* @param navigator - the right Sidebar's capture and open face.
|
|
23
|
+
* @param target - the live input element, if any.
|
|
24
|
+
* @returns a blocked resolution without a capturable session, else the run.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveContainersOpen<Target>(navigator: ContainersNavigator<Target>, target: unknown): ContainersOpenResolution;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// The Containers tab type's identity and the pure half of its open action. The
|
|
5
|
+
// tab type is registered under `PODMAN_CONTAINERS_TAB_ID` (its implementation
|
|
6
|
+
// id, unique across registrations) while `openTab` names
|
|
7
|
+
// `PODMAN_CONTAINERS_KIND`. Both live here so the registration in index.ts and
|
|
8
|
+
// the body agree without importing one another, and so the action stays
|
|
9
|
+
// testable without the DOM or React.
|
|
10
|
+
//
|
|
11
|
+
// The panel has no keyboard binding: it opens from its Start panel card or from
|
|
12
|
+
// its command, and this module only holds the command's target capture. Keeping
|
|
13
|
+
// the open action free of a binding is what lets the command palette entry stay
|
|
14
|
+
// without claiming keys the user did not choose.
|
|
15
|
+
/** Page kind `openTab` names; unique among the tab types in force. */
|
|
16
|
+
export const PODMAN_CONTAINERS_KIND = "podman-containers";
|
|
17
|
+
/** Implementation id the body registers under; distinct from the terminal's. */
|
|
18
|
+
export const PODMAN_CONTAINERS_TAB_ID = "@exagone313/dsh-podman#containers";
|
|
19
|
+
/**
|
|
20
|
+
* Capture the current pane and prepare to open the Containers panel in it.
|
|
21
|
+
*
|
|
22
|
+
* The capture happens during resolve (the live input target is only valid
|
|
23
|
+
* then); the returned `run` opens the panel at that captured target, so the
|
|
24
|
+
* command opens in the focused pane.
|
|
25
|
+
* @param navigator - the right Sidebar's capture and open face.
|
|
26
|
+
* @param target - the live input element, if any.
|
|
27
|
+
* @returns a blocked resolution without a capturable session, else the run.
|
|
28
|
+
*/
|
|
29
|
+
export function resolveContainersOpen(navigator, target) {
|
|
30
|
+
const captured = navigator.commandTarget(target);
|
|
31
|
+
if (captured === undefined)
|
|
32
|
+
return { status: "blocked" };
|
|
33
|
+
return {
|
|
34
|
+
status: "handled",
|
|
35
|
+
run: () => {
|
|
36
|
+
navigator.openTabFromTarget(PODMAN_CONTAINERS_KIND, captured);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|