@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
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// The class on a card that owns a responsive table or block list (an image
|
|
5
|
+
// group, the status list, a workspace's containers). The card itself carries no
|
|
6
|
+
// containment, so its own box stays the plain card every other tab draws, and it
|
|
7
|
+
// start-aligns, so no flex or grid parent can stretch it to a taller sibling's
|
|
8
|
+
// height: the card is always exactly its content plus its own padding.
|
|
9
|
+
export const TABLE_CARD_CLASS = "dsh-podman-table-card";
|
|
10
|
+
// The class on that card's own content wrapper, under its title row. The wrapper
|
|
11
|
+
// is the containment context for the content below it, so the content reacts to
|
|
12
|
+
// the width it is actually given: a narrow desktop pane behaves exactly like a
|
|
13
|
+
// phone, while a viewport media query would not. Keeping the containment here
|
|
14
|
+
// means the card's own box can never be sized by it.
|
|
15
|
+
export const TABLE_CARD_CONTENT_CLASS = "dsh-podman-table-card-content";
|
|
16
|
+
// The class on a responsive table itself.
|
|
17
|
+
export const TABLE_CLASS = "dsh-podman-table";
|
|
18
|
+
// The class on one labelled line inside a row that is a block rather than one
|
|
19
|
+
// cell per field (an image's facts). On a wide card the label sits beside its
|
|
20
|
+
// value; the container query below stacks them on a narrow one.
|
|
21
|
+
export const FIELD_ROW_CLASS = "dsh-podman-field-row";
|
|
22
|
+
// The class on one mount row, in the container view's block and in the Mounts
|
|
23
|
+
// editor alike. It is that row's own containment context, so its fields react to
|
|
24
|
+
// the width the row is actually given and the two places stack identically, even
|
|
25
|
+
// where no card provides the context.
|
|
26
|
+
export const MOUNT_ROW_CLASS = "dsh-podman-mount-row";
|
|
27
|
+
// The class on a mount row's Kind field. It hugs its chip while the row has
|
|
28
|
+
// room; the container query below gives it a full line of its own once the row
|
|
29
|
+
// is narrow, the way every field beside it wraps there.
|
|
30
|
+
export const MOUNT_KIND_CLASS = "dsh-podman-mount-kind";
|
|
31
|
+
// The class on that field's value line, the line holding the chip. It reserves
|
|
32
|
+
// the height an input's line occupies beside it, so the chip sits on the input
|
|
33
|
+
// line while the label above keeps the labels' line; the container query below
|
|
34
|
+
// drops the reservation once the field has a line of its own.
|
|
35
|
+
export const MOUNT_KIND_VALUE_CLASS = "dsh-podman-mount-kind-value";
|
|
36
|
+
// The class on one labelled field of a mount row, in the container view's block
|
|
37
|
+
// and in the Mounts editor alike. It shares the row's line while there is room
|
|
38
|
+
// and takes a full line of its own on a narrow row, so the fields stack the
|
|
39
|
+
// same way wherever the row is rendered.
|
|
40
|
+
export const MOUNT_FIELD_CLASS = "dsh-podman-mount-field";
|
|
41
|
+
// The class the Destination field of a mount row adds to its own field class.
|
|
42
|
+
// The destination is the row's longest value, so on a wide row it takes a
|
|
43
|
+
// larger share of the free space than the fields beside it instead of leaving
|
|
44
|
+
// that space unused; the container query below still gives it a full line of
|
|
45
|
+
// its own on a narrow row through its field class.
|
|
46
|
+
export const MOUNT_DESTINATION_CLASS = "dsh-podman-mount-destination";
|
|
47
|
+
// The class on a field row's own trailing actions (removing a mount, a PATH
|
|
48
|
+
// entry or a port; attaching a secret). On a narrow row it claims the row's full
|
|
49
|
+
// width, so the actions read as the row's own footer rather than as a stray
|
|
50
|
+
// control beside a field.
|
|
51
|
+
export const MOUNT_ACTIONS_CLASS = "dsh-podman-mount-actions";
|
|
52
|
+
// The class on a group that lists shared rows: a container block's field group,
|
|
53
|
+
// and the editor that changes the same list. The marker is what a list needs —
|
|
54
|
+
// its rows already carry the mount row class wherever they render — for the
|
|
55
|
+
// container query below to separate its consecutive rows, in the container view
|
|
56
|
+
// and in an editor alike, and a future list gets the same hairlines by putting
|
|
57
|
+
// this marker on the wrapper that holds its rows. The marker is also the
|
|
58
|
+
// containment context for those rows, so the rule resolves in a dialog portaled
|
|
59
|
+
// outside every card, where no card is left to measure.
|
|
60
|
+
export const ROW_LIST_CLASS = "dsh-podman-row-list";
|
|
61
|
+
// Wide panes show the header row and print every field as its own column;
|
|
62
|
+
// narrow ones hide the header and print each cell's own label above its value,
|
|
63
|
+
// taken from the cell's data-label attribute. Nothing scrolls sideways: value
|
|
64
|
+
// cells may break anywhere.
|
|
65
|
+
//
|
|
66
|
+
// The card is a flex item of the tab panel, and the harness's plugin page stacks
|
|
67
|
+
// that panel in a flex too: a parent with the default `align-items: stretch`
|
|
68
|
+
// would give the card a taller sibling's height, so the card start-aligns in
|
|
69
|
+
// whatever box it lands in and measures its own content. The full width is
|
|
70
|
+
// stated because a start-aligned item in a column flex container (where the
|
|
71
|
+
// cross axis is the inline one) would otherwise shrink to its content, and the
|
|
72
|
+
// box is border-box so that width still contains the card's own padding and
|
|
73
|
+
// hairline.
|
|
74
|
+
export const TABLE_STYLES = `
|
|
75
|
+
.dsh-podman-table-card {
|
|
76
|
+
align-self: start;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
width: 100%;
|
|
79
|
+
}
|
|
80
|
+
.dsh-podman-table-card-content {
|
|
81
|
+
container-type: inline-size;
|
|
82
|
+
}
|
|
83
|
+
.dsh-podman-table {
|
|
84
|
+
width: 100%;
|
|
85
|
+
border-collapse: collapse;
|
|
86
|
+
}
|
|
87
|
+
.dsh-podman-table th,
|
|
88
|
+
.dsh-podman-table td {
|
|
89
|
+
padding: 12px 12px 12px 0;
|
|
90
|
+
text-align: left;
|
|
91
|
+
vertical-align: top;
|
|
92
|
+
overflow-wrap: anywhere;
|
|
93
|
+
}
|
|
94
|
+
.dsh-podman-table th:last-child,
|
|
95
|
+
.dsh-podman-table td:last-child {
|
|
96
|
+
padding-right: 0;
|
|
97
|
+
}
|
|
98
|
+
.dsh-podman-table thead th {
|
|
99
|
+
padding-top: 0;
|
|
100
|
+
padding-bottom: 8px;
|
|
101
|
+
font-size: 12px;
|
|
102
|
+
font-weight: 500;
|
|
103
|
+
line-height: 18px;
|
|
104
|
+
color: var(--dsw-alias-label-tertiary);
|
|
105
|
+
}
|
|
106
|
+
.dsh-podman-table tbody tr + tr > td {
|
|
107
|
+
border-top: 0.5px solid var(--dsw-alias-border-l2);
|
|
108
|
+
}
|
|
109
|
+
.dsh-podman-field-row {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-wrap: wrap;
|
|
112
|
+
gap: 2px 8px;
|
|
113
|
+
font-size: 13px;
|
|
114
|
+
line-height: 20px;
|
|
115
|
+
}
|
|
116
|
+
.dsh-podman-mount-row {
|
|
117
|
+
container-type: inline-size;
|
|
118
|
+
}
|
|
119
|
+
/* One labelled field of a mount row shares the line while there is room; the
|
|
120
|
+
container query below gives it a line of its own on a narrow row. */
|
|
121
|
+
.dsh-podman-mount-field {
|
|
122
|
+
flex: 1 1 160px;
|
|
123
|
+
}
|
|
124
|
+
/* The Destination field grows twice as much as the fields beside it and starts
|
|
125
|
+
from a wider basis, so a wide row spends its free space on the destination
|
|
126
|
+
instead of leaving it unused. It keeps width: 100% on its input and carries
|
|
127
|
+
no cap. */
|
|
128
|
+
.dsh-podman-mount-destination {
|
|
129
|
+
flex: 2 1 240px;
|
|
130
|
+
}
|
|
131
|
+
/* The Kind field's value line reserves the line an input occupies beside it —
|
|
132
|
+
32px of control box plus its 0.5px stroke on each side — so the chip centres
|
|
133
|
+
on the inputs' line instead of hugging the top of the row. */
|
|
134
|
+
.dsh-podman-mount-kind-value {
|
|
135
|
+
min-height: 33px;
|
|
136
|
+
}
|
|
137
|
+
/* The list is its own containment context, so the query below resolves against
|
|
138
|
+
the width its rows are given even when the list renders in a dialog portaled
|
|
139
|
+
to the body, which no card wraps and which would otherwise leave the rows
|
|
140
|
+
with nothing to measure. Because the list spans the same width its rows had,
|
|
141
|
+
every other query still measures what it measured before. */
|
|
142
|
+
.dsh-podman-row-list {
|
|
143
|
+
container-type: inline-size;
|
|
144
|
+
}
|
|
145
|
+
@container (max-width: 560px) {
|
|
146
|
+
.dsh-podman-table,
|
|
147
|
+
.dsh-podman-table tbody,
|
|
148
|
+
.dsh-podman-table tr,
|
|
149
|
+
.dsh-podman-table td {
|
|
150
|
+
display: block;
|
|
151
|
+
}
|
|
152
|
+
.dsh-podman-table thead {
|
|
153
|
+
display: none;
|
|
154
|
+
}
|
|
155
|
+
.dsh-podman-table tbody tr {
|
|
156
|
+
padding: 12px 0;
|
|
157
|
+
}
|
|
158
|
+
.dsh-podman-table tbody tr + tr {
|
|
159
|
+
border-top: 0.5px solid var(--dsw-alias-border-l2);
|
|
160
|
+
}
|
|
161
|
+
.dsh-podman-table tbody tr + tr > td {
|
|
162
|
+
border-top: 0;
|
|
163
|
+
}
|
|
164
|
+
.dsh-podman-table td {
|
|
165
|
+
padding: 0 0 8px;
|
|
166
|
+
}
|
|
167
|
+
.dsh-podman-table td:last-child {
|
|
168
|
+
padding-bottom: 0;
|
|
169
|
+
}
|
|
170
|
+
.dsh-podman-table td::before {
|
|
171
|
+
content: attr(data-label);
|
|
172
|
+
display: block;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
line-height: 18px;
|
|
175
|
+
color: var(--dsw-alias-label-tertiary);
|
|
176
|
+
}
|
|
177
|
+
/* A field line whose label sits beside its value on a wide card stacks the
|
|
178
|
+
label above the value once the card is narrow. */
|
|
179
|
+
.dsh-podman-field-row {
|
|
180
|
+
flex-direction: column;
|
|
181
|
+
gap: 0;
|
|
182
|
+
}
|
|
183
|
+
/* A mount row's Kind field stops hugging its chip and takes a line of its
|
|
184
|
+
own, like the fields beside it. Its flex basis is auto, so the width is
|
|
185
|
+
what gives the field that line. */
|
|
186
|
+
.dsh-podman-mount-kind {
|
|
187
|
+
width: 100%;
|
|
188
|
+
}
|
|
189
|
+
/* The Kind field now owns its line: with no input beside it to align with,
|
|
190
|
+
its value line drops the height it reserved, so a stacked chip leaves no
|
|
191
|
+
empty space under itself. */
|
|
192
|
+
.dsh-podman-mount-kind-value {
|
|
193
|
+
min-height: 0;
|
|
194
|
+
}
|
|
195
|
+
/* Every other field of a mount row — the Destination included — takes a full
|
|
196
|
+
line of its own too, so the label always reads above its value on a narrow
|
|
197
|
+
row. */
|
|
198
|
+
.dsh-podman-mount-field,
|
|
199
|
+
.dsh-podman-mount-destination {
|
|
200
|
+
flex-basis: 100%;
|
|
201
|
+
}
|
|
202
|
+
/* A mount row's actions become that row's own full-width footer. */
|
|
203
|
+
.dsh-podman-mount-actions {
|
|
204
|
+
flex-basis: 100%;
|
|
205
|
+
width: 100%;
|
|
206
|
+
}
|
|
207
|
+
/* Consecutive rows of one list — a container block's field group and the
|
|
208
|
+
editor that changes the same list — take a hairline once they stack. Side
|
|
209
|
+
by side on a wide pane the gap alone separates them, which is why the rule
|
|
210
|
+
lives in this query alone, and the padding above each ruled row keeps the
|
|
211
|
+
line in the gap instead of against the row it introduces. A group's label,
|
|
212
|
+
its empty-state line and its own add controls carry no row class, so they
|
|
213
|
+
never take a rule of their own. */
|
|
214
|
+
.dsh-podman-row-list > .dsh-podman-mount-row + .dsh-podman-mount-row {
|
|
215
|
+
border-top: 0.5px solid var(--dsw-alias-border-l2);
|
|
216
|
+
/* The margin adds to the list's own gap, so the ruled row sits further from
|
|
217
|
+
the row above it than from the one below: the line reads as the boundary
|
|
218
|
+
of the row it introduces rather than as that row's top edge. */
|
|
219
|
+
margin-top: 4px;
|
|
220
|
+
padding-top: 8px;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
/** Inject the responsive table's stylesheet for the owning plugin lifetime. */
|
|
225
|
+
export function installTableStyles(ctx) {
|
|
226
|
+
if (typeof document === "undefined")
|
|
227
|
+
return;
|
|
228
|
+
ctx.effect(() => {
|
|
229
|
+
const tag = document.createElement("style");
|
|
230
|
+
tag.dataset.plugin = "@exagone313/dsh-podman";
|
|
231
|
+
tag.textContent = TABLE_STYLES;
|
|
232
|
+
document.head.appendChild(tag);
|
|
233
|
+
return () => {
|
|
234
|
+
tag.remove();
|
|
235
|
+
};
|
|
236
|
+
}, "podman: table styles");
|
|
237
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context as ClientContext } from "@deepseek-ai/cordis";
|
|
2
|
+
export declare const TABS_CLASS = "dsh-podman-tabs";
|
|
3
|
+
export declare const TABS_STYLES = "\n.dsh-podman-tabs.dsh-podman-tabs {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n}\n.dsh-podman-tabs.dsh-podman-tabs > [role=\"tab\"] {\n flex: 1 1 100px;\n min-width: 0;\n padding: 0 8px;\n font-size: 13px;\n white-space: nowrap;\n}\n.dsh-podman-tabs.dsh-podman-tabs > span[aria-hidden=\"true\"] {\n display: none;\n}\n.dsh-podman-tabs.dsh-podman-tabs > [role=\"tab\"][aria-selected=\"true\"] {\n background: var(--dsw-alias-bg-layer-3);\n box-shadow: inset 0 0 0 0.5px var(--dsw-alias-border-l3);\n}\n";
|
|
4
|
+
/** Inject the tab strip's stylesheet for the owning plugin lifetime. */
|
|
5
|
+
export declare function installTabsStyles(ctx: ClientContext): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MIT
|
|
4
|
+
// The class passed to SegmentedTabs for the settings page's tab strip. The
|
|
5
|
+
// primitive lays its tabs out as an equal-column grid, which cannot wrap; this
|
|
6
|
+
// class turns the same tablist into a wrapping flex strip instead, so all five
|
|
7
|
+
// tabs stay visible at phone width without scrolling: each tab keeps a 100px
|
|
8
|
+
// basis and grows to share its line. The primitive's sliding indicator is
|
|
9
|
+
// absolute inside the strip (it cannot follow a wrapped tab), so it is dropped
|
|
10
|
+
// and the selected tab carries its own fill.
|
|
11
|
+
export const TABS_CLASS = "dsh-podman-tabs";
|
|
12
|
+
export const TABS_STYLES = `
|
|
13
|
+
.dsh-podman-tabs.dsh-podman-tabs {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
gap: 4px;
|
|
17
|
+
}
|
|
18
|
+
.dsh-podman-tabs.dsh-podman-tabs > [role="tab"] {
|
|
19
|
+
flex: 1 1 100px;
|
|
20
|
+
min-width: 0;
|
|
21
|
+
padding: 0 8px;
|
|
22
|
+
font-size: 13px;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
}
|
|
25
|
+
.dsh-podman-tabs.dsh-podman-tabs > span[aria-hidden="true"] {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
.dsh-podman-tabs.dsh-podman-tabs > [role="tab"][aria-selected="true"] {
|
|
29
|
+
background: var(--dsw-alias-bg-layer-3);
|
|
30
|
+
box-shadow: inset 0 0 0 0.5px var(--dsw-alias-border-l3);
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
/** Inject the tab strip's stylesheet for the owning plugin lifetime. */
|
|
34
|
+
export function installTabsStyles(ctx) {
|
|
35
|
+
if (typeof document === "undefined")
|
|
36
|
+
return;
|
|
37
|
+
ctx.effect(() => {
|
|
38
|
+
const tag = document.createElement("style");
|
|
39
|
+
tag.dataset.plugin = "@exagone313/dsh-podman";
|
|
40
|
+
tag.textContent = TABS_STYLES;
|
|
41
|
+
document.head.appendChild(tag);
|
|
42
|
+
return () => {
|
|
43
|
+
tag.remove();
|
|
44
|
+
};
|
|
45
|
+
}, "podman: tab strip styles");
|
|
46
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ContainerCardFace } from "./container-card-controller.js";
|
|
2
|
+
import { type InjectFace, type PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots";
|
|
3
|
+
import { type ReactNode } from "react";
|
|
4
|
+
export type ContainerCardToastProps = PropsRuntime<"shell.overlay"> & InjectFace<ContainerCardFace>;
|
|
5
|
+
export declare function ContainerCardToast(props: ContainerCardToastProps): ReactNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconWarningOutlineRegular, Toast, } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
3
|
+
export function ContainerCardToast(props) {
|
|
4
|
+
const toast = props.useContainerCard((state) => state.toast);
|
|
5
|
+
if (toast === null)
|
|
6
|
+
return null;
|
|
7
|
+
return (_jsx(Toast
|
|
8
|
+
// A new report remounts the banner, which restarts its hold.
|
|
9
|
+
, { text: toast.text, icon: toast.kind === "error" ? _jsx(IconWarningOutlineRegular, {}) : undefined, onDone: props.dismissToast }, `podman-card-toast-${String(toast.seq)}`));
|
|
10
|
+
}
|
|
@@ -2,14 +2,15 @@ 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, Field, namePattern,
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { ConfirmButton, countLabel, Field, namePattern, } 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, rowActions, rowDivider, rowMain, } from "./container-card-styles.js";
|
|
9
|
+
import { Button, Input, Modal } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
8
10
|
import { useId, useState } from "react";
|
|
9
11
|
export function VolumesSection(props) {
|
|
10
|
-
const { t, volumes, busy, writable, onCreate, onRemove } = props;
|
|
12
|
+
const { t, volumes, busy, writable, pendingActions, onCreate, onRemove } = props;
|
|
11
13
|
const [open, setOpen] = useState(false);
|
|
12
|
-
const [openVolume, setOpenVolume] = useState(null);
|
|
13
14
|
const [name, setName] = useState("");
|
|
14
15
|
const volumeId = useId();
|
|
15
16
|
const canCreate = namePattern.test(name);
|
|
@@ -20,22 +21,16 @@ export function VolumesSection(props) {
|
|
|
20
21
|
setName("");
|
|
21
22
|
setOpen(false);
|
|
22
23
|
};
|
|
23
|
-
return (_jsxs("
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
flexWrap: "wrap",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
gap: "8px",
|
|
33
|
-
}, children: _jsx(ConfirmButton, { t: t, label: t("removeVolume"), title: t("confirmTitle"), description: t("confirmRemoveVolume", {
|
|
34
|
-
volume: volume.name,
|
|
35
|
-
}), disabled: busy, onConfirm: () => onRemove(volume.name) }) }) }) }, volume.name)))), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t("volumesTitle"), closeLabel: t("cancel"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => setOpen(false), children: t("cancel") }), _jsx(Button, { variant: "primary", size: "sm", disabled: !canCreate, onClick: submit, children: t("createVolume") })] }), children: _jsxs(Field, { label: t("volumeName"), htmlFor: volumeId, children: [_jsx(Input, { id: volumeId, value: name, disabled: !writable || busy, autoFocus: true, onChange: (event) => setName(sanitizeName(event.target.value)), onKeyDown: (event) => {
|
|
24
|
+
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
|
+
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("noVolumes") })
|
|
26
|
+
: (_jsx("div", { style: cardList, children: volumes.map((volume, index) => (_jsxs("div", { style: index === volumes.length - 1
|
|
27
|
+
? cardRow
|
|
28
|
+
: { ...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
|
+
volume: volume.name,
|
|
30
|
+
}), confirmLabel: t("removeVolumeTitle"), pending: pendingActions.includes(scopedActionKey("volume_remove", volume.name)), onConfirm: () => onRemove(volume.name) }) })] }, volume.name))) })), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t("volumesTitle"), closeLabel: t("cancel"), footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", onClick: () => setOpen(false), children: t("cancel") }), _jsx(Button, { variant: "primary", size: "sm", disabled: !canCreate, onClick: submit, children: t("createVolume") })] }), children: _jsxs(Field, { label: t("volumeName"), htmlFor: volumeId, children: [_jsx(Input, { id: volumeId, value: name, disabled: !writable || busy, autoFocus: true, onChange: (event) => setName(event.target.value), onKeyDown: (event) => {
|
|
36
31
|
if (event.key === "Enter")
|
|
37
32
|
submit();
|
|
38
33
|
} }), name !== "" && !namePattern.test(name)
|
|
39
|
-
? _jsx("p", { style: { ...hint, margin: 0 }, children: t("invalidName") })
|
|
34
|
+
? (_jsx("p", { style: { ...hint, margin: 0 }, role: "alert", children: t("invalidName") }))
|
|
40
35
|
: null] }) })] }));
|
|
41
36
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ContainerConfig, type ContainerCreateConfig, type ContainerView, type ImageView, type WorkspaceView } from "./container-card-controller.js";
|
|
2
2
|
import { type DirectoryPickerFace } from "./directory-picker.js";
|
|
3
3
|
import type { Translate } from "./locales.js";
|
|
4
4
|
import { type ReactNode } from "react";
|
|
@@ -14,23 +14,19 @@ export declare function WorkspaceSection(props: {
|
|
|
14
14
|
name: string;
|
|
15
15
|
}[];
|
|
16
16
|
busy: boolean;
|
|
17
|
+
writable: boolean;
|
|
18
|
+
locale: string;
|
|
19
|
+
pendingActions: readonly string[];
|
|
17
20
|
defaultImage: string;
|
|
21
|
+
defaultEnv: Record<string, string>;
|
|
18
22
|
projectsRoot: string;
|
|
19
23
|
directoryPicker?: DirectoryPickerFace;
|
|
20
24
|
onRemove: (workspace: string, container: string) => void;
|
|
25
|
+
onRecreate: (workspace: string, container: string, image: string) => void;
|
|
21
26
|
onRemoveWorkspace: (workspace: string) => void;
|
|
22
|
-
onRecreate: (workspace: string, container: string, image: string, env?: Record<string, string>) => void;
|
|
23
27
|
onCreate: (workspace: WorkspaceView, config?: ContainerCreateConfig) => void;
|
|
28
|
+
onCreateSecret: (name: string, length?: number, charset?: string) => void;
|
|
24
29
|
onStartContainer: (workspace: WorkspaceView, container: string, config?: ContainerCreateConfig) => void;
|
|
25
|
-
|
|
26
|
-
onRemoveContainerMount: (workspace: string, container: string, mount: MountInput) => void;
|
|
27
|
-
onUpdateContainerMount: (workspace: string, container: string, mount: MountInput) => void;
|
|
28
|
-
onSetContainerPaths: (workspace: string, container: string, paths: readonly string[]) => void;
|
|
29
|
-
onAddContainerSecret: (workspace: string, container: string, envVar: string, secret: string) => void;
|
|
30
|
-
onRemoveContainerSecret: (workspace: string, container: string, envVar: string) => void;
|
|
31
|
-
onPublishContainerPort: (workspace: string, container: string, port: number, suggestedHostPort?: number) => void;
|
|
32
|
-
onUnpublishContainerPort: (workspace: string, container: string, port: number, protocol: string) => void;
|
|
30
|
+
onApplyContainerConfig: (workspace: string, container: string, base: ContainerConfig, next: ContainerConfig) => void;
|
|
33
31
|
gatewayUnavailable: boolean;
|
|
34
|
-
onSyncDefaults: (workspace: string) => void;
|
|
35
|
-
defaultEnvCount: number;
|
|
36
32
|
}): ReactNode;
|
|
@@ -1,24 +1,86 @@
|
|
|
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
|
+
// One workspace card in the Workspaces tab: the workspace's name, its one
|
|
6
|
+
// running/stopped status phrase, a copy button for its ID, its own actions, and
|
|
7
|
+
// its containers as stacked blocks. A workspace with no container still offers
|
|
8
|
+
// the one action that creates its default container, reads muted, and states the
|
|
9
|
+
// greyed zero it holds.
|
|
5
10
|
import { ContainerRow, CreateContainerModal } from "./container-card-row.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
11
|
+
import { countLabel } from "./container-card-shared.js";
|
|
12
|
+
import { scopedActionKey } from "./card-protocol.js";
|
|
13
|
+
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 { Button, IconCheckOutlineRegular, IconCopyOutlineRegular, RiskConfirmation, Tooltip, writeClipboard, } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
16
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
17
|
+
// The workspace's ID, copied on demand instead of printed as a bare UUID: a
|
|
18
|
+
// discreet icon button whose tooltip names the action and whose check confirms
|
|
19
|
+
// the write.
|
|
20
|
+
function CopyWorkspaceId(props) {
|
|
21
|
+
const { t, id } = props;
|
|
22
|
+
const [copied, setCopied] = useState(false);
|
|
23
|
+
const resetTimer = useRef();
|
|
24
|
+
const copy = () => {
|
|
25
|
+
void writeClipboard(id).then((ok) => {
|
|
26
|
+
if (!ok)
|
|
27
|
+
return;
|
|
28
|
+
setCopied(true);
|
|
29
|
+
if (resetTimer.current !== undefined)
|
|
30
|
+
clearTimeout(resetTimer.current);
|
|
31
|
+
resetTimer.current = setTimeout(() => setCopied(false), 1500);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
// The reset timer is cancelled on unmount, so it cannot fire against an
|
|
35
|
+
// unmounted component.
|
|
36
|
+
useEffect(() => () => {
|
|
37
|
+
if (resetTimer.current !== undefined)
|
|
38
|
+
clearTimeout(resetTimer.current);
|
|
39
|
+
}, []);
|
|
40
|
+
const label = copied ? t("copied") : t("copyWorkspaceId");
|
|
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
|
+
}
|
|
10
43
|
export function WorkspaceSection(props) {
|
|
11
|
-
const { t, workspace, containers, images, volumes, secrets, busy,
|
|
12
|
-
const [open, setOpen] = useState(false);
|
|
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;
|
|
13
45
|
const [createOpen, setCreateOpen] = useState(null);
|
|
46
|
+
const [removeWorkspaceOpen, setRemoveWorkspaceOpen] = useState(false);
|
|
47
|
+
const [removeWorkspaceAcknowledged, setRemoveWorkspaceAcknowledged] = useState(false);
|
|
48
|
+
const headingId = useId();
|
|
49
|
+
const removeWorkspacePending = pendingActions.includes(scopedActionKey("workspace_remove", workspace.workspaceSlug));
|
|
14
50
|
const hasContainer = containers.length > 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
51
|
+
// The header states one phrase: how many containers run and how many are
|
|
52
|
+
// stopped, with the stopped half greyed, or the greyed zero when the
|
|
53
|
+
// workspace holds nothing yet.
|
|
54
|
+
const running = containers.filter((container) => container.status === "running").length;
|
|
55
|
+
const stopped = containers.length - running;
|
|
56
|
+
return (_jsxs("section", { style: card, className: TABLE_CARD_CLASS, "aria-labelledby": headingId, children: [_jsxs("div", { style: hasContainer ? { ...actionRow, ...headerRule } : actionRow, children: [_jsxs("div", { style: rowMain, children: [_jsx("h3", { id: headingId, style: hasContainer ? { ...cardTitle, ...rowName } : {
|
|
57
|
+
...cardTitle,
|
|
58
|
+
...rowName,
|
|
59
|
+
color: "var(--dsw-alias-label-tertiary)",
|
|
60
|
+
}, children: workspace.projectName }), _jsx(CopyWorkspaceId, { t: t, id: workspace.workspaceSlug }), _jsxs("span", { style: hasContainer ? workspaceStatus : {
|
|
61
|
+
...workspaceStatus,
|
|
62
|
+
...statusMuted,
|
|
63
|
+
}, children: [running > 0
|
|
64
|
+
? countLabel(t, running, "countRunningContainerOne", "countRunningContainerMany")
|
|
65
|
+
: null, running > 0 && stopped > 0 ? " · " : null, stopped > 0
|
|
66
|
+
? (_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
|
|
68
|
+
? (_jsx(Button, { variant: "outline", size: "sm", disabled: removeWorkspacePending, style: destructiveAction, onClick: () => {
|
|
69
|
+
setRemoveWorkspaceAcknowledged(false);
|
|
70
|
+
setRemoveWorkspaceOpen(true);
|
|
71
|
+
}, children: removeWorkspacePending ? t("busy") : t("removeWorkspace") }))
|
|
72
|
+
: null] })] }), 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: onApplyContainerConfig, projectName: workspace.projectName, projectsRoot: projectsRoot, directoryPicker: directoryPicker, gatewayUnavailable: gatewayUnavailable }, container.containerName))) }) }))
|
|
74
|
+
: null, _jsx(RiskConfirmation, { open: removeWorkspaceOpen, title: t("removeWorkspace"), description: t("confirmRemoveWorkspace", {
|
|
75
|
+
workspace: workspace.projectName,
|
|
76
|
+
}), acknowledgeLabel: t("acknowledgeRemoveWorkspace"), cancelLabel: t("cancel"), closeLabel: t("cancel"), confirmLabel: t("removeWorkspace"), acknowledged: removeWorkspaceAcknowledged, disabled: removeWorkspacePending, onAcknowledgedChange: setRemoveWorkspaceAcknowledged, onCancel: () => {
|
|
77
|
+
setRemoveWorkspaceAcknowledged(false);
|
|
78
|
+
setRemoveWorkspaceOpen(false);
|
|
79
|
+
}, onConfirm: () => {
|
|
80
|
+
setRemoveWorkspaceAcknowledged(false);
|
|
81
|
+
setRemoveWorkspaceOpen(false);
|
|
82
|
+
onRemoveWorkspace(workspace.workspaceSlug);
|
|
83
|
+
} }), _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, onClose: () => setCreateOpen(null), onCreateSecret: onCreateSecret, onCreate: (container, config) => {
|
|
22
84
|
if (createOpen === "named") {
|
|
23
85
|
onStartContainer(workspace, container, config);
|
|
24
86
|
}
|