@burdenoff/microfe-sandbox 2026.510.113

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.
Files changed (173) hide show
  1. package/dist/dev/main.d.ts +2 -0
  2. package/dist/dev/main.d.ts.map +1 -0
  3. package/dist/generated/global-operations.d.ts +2 -0
  4. package/dist/generated/global-operations.d.ts.map +1 -0
  5. package/dist/generated/global-types.d.ts +21253 -0
  6. package/dist/generated/global-types.d.ts.map +1 -0
  7. package/dist/generated/wspace-operations.d.ts +1595 -0
  8. package/dist/generated/wspace-operations.d.ts.map +1 -0
  9. package/dist/generated/wspace-operations.js +692 -0
  10. package/dist/generated/wspace-operations.js.map +1 -0
  11. package/dist/generated/wspace-types.d.ts +55214 -0
  12. package/dist/generated/wspace-types.d.ts.map +1 -0
  13. package/dist/index.d.ts +6 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +6 -0
  16. package/dist/node_modules/clsx/dist/clsx.js +18 -0
  17. package/dist/node_modules/clsx/dist/clsx.js.map +1 -0
  18. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +1674 -0
  19. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  20. package/dist/sandbox/AdminRoutes.d.ts +12 -0
  21. package/dist/sandbox/AdminRoutes.d.ts.map +1 -0
  22. package/dist/sandbox/AdminRoutes.js +45 -0
  23. package/dist/sandbox/AdminRoutes.js.map +1 -0
  24. package/dist/sandbox/SandboxAdminRoot.d.ts +21 -0
  25. package/dist/sandbox/SandboxAdminRoot.d.ts.map +1 -0
  26. package/dist/sandbox/SandboxAdminRoot.js +55 -0
  27. package/dist/sandbox/SandboxAdminRoot.js.map +1 -0
  28. package/dist/sandbox/SandboxRoot.d.ts +31 -0
  29. package/dist/sandbox/SandboxRoot.d.ts.map +1 -0
  30. package/dist/sandbox/SandboxRoot.js +61 -0
  31. package/dist/sandbox/SandboxRoot.js.map +1 -0
  32. package/dist/sandbox/SandboxRoutes.d.ts +18 -0
  33. package/dist/sandbox/SandboxRoutes.d.ts.map +1 -0
  34. package/dist/sandbox/UserRoutes.d.ts +11 -0
  35. package/dist/sandbox/UserRoutes.d.ts.map +1 -0
  36. package/dist/sandbox/UserRoutes.js +57 -0
  37. package/dist/sandbox/UserRoutes.js.map +1 -0
  38. package/dist/sandbox/components/ContainerImagePicker.d.ts +24 -0
  39. package/dist/sandbox/components/ContainerImagePicker.d.ts.map +1 -0
  40. package/dist/sandbox/components/CountdownTimer.d.ts +9 -0
  41. package/dist/sandbox/components/CountdownTimer.d.ts.map +1 -0
  42. package/dist/sandbox/components/CountdownTimer.js +75 -0
  43. package/dist/sandbox/components/CountdownTimer.js.map +1 -0
  44. package/dist/sandbox/components/ExportSandboxesDialog.d.ts +8 -0
  45. package/dist/sandbox/components/ExportSandboxesDialog.d.ts.map +1 -0
  46. package/dist/sandbox/components/ExportSandboxesDialog.js +130 -0
  47. package/dist/sandbox/components/ExportSandboxesDialog.js.map +1 -0
  48. package/dist/sandbox/components/ExtendTTLModal.d.ts +10 -0
  49. package/dist/sandbox/components/ExtendTTLModal.d.ts.map +1 -0
  50. package/dist/sandbox/components/ExtendTTLModal.js +109 -0
  51. package/dist/sandbox/components/ExtendTTLModal.js.map +1 -0
  52. package/dist/sandbox/components/PageLayout.d.ts +39 -0
  53. package/dist/sandbox/components/PageLayout.d.ts.map +1 -0
  54. package/dist/sandbox/components/PageLayout.js +75 -0
  55. package/dist/sandbox/components/PageLayout.js.map +1 -0
  56. package/dist/sandbox/components/ResourceDisplay.d.ts +17 -0
  57. package/dist/sandbox/components/ResourceDisplay.d.ts.map +1 -0
  58. package/dist/sandbox/components/ResourceDisplay.js +69 -0
  59. package/dist/sandbox/components/ResourceDisplay.js.map +1 -0
  60. package/dist/sandbox/components/RouteUtils.d.ts +28 -0
  61. package/dist/sandbox/components/RouteUtils.d.ts.map +1 -0
  62. package/dist/sandbox/components/RouteUtils.js +68 -0
  63. package/dist/sandbox/components/RouteUtils.js.map +1 -0
  64. package/dist/sandbox/components/SandboxActivityTab.d.ts +14 -0
  65. package/dist/sandbox/components/SandboxActivityTab.d.ts.map +1 -0
  66. package/dist/sandbox/components/SandboxActivityTab.js +83 -0
  67. package/dist/sandbox/components/SandboxActivityTab.js.map +1 -0
  68. package/dist/sandbox/components/SandboxAgentAppPanel.d.ts +16 -0
  69. package/dist/sandbox/components/SandboxAgentAppPanel.d.ts.map +1 -0
  70. package/dist/sandbox/components/SandboxAgentAppPanel.js +103 -0
  71. package/dist/sandbox/components/SandboxAgentAppPanel.js.map +1 -0
  72. package/dist/sandbox/components/SandboxTypeIcon.d.ts +15 -0
  73. package/dist/sandbox/components/SandboxTypeIcon.d.ts.map +1 -0
  74. package/dist/sandbox/components/SandboxTypeIcon.js +52 -0
  75. package/dist/sandbox/components/SandboxTypeIcon.js.map +1 -0
  76. package/dist/sandbox/components/SandboxTypeSelector.d.ts +35 -0
  77. package/dist/sandbox/components/SandboxTypeSelector.d.ts.map +1 -0
  78. package/dist/sandbox/components/SandboxUsageBanner.d.ts +16 -0
  79. package/dist/sandbox/components/SandboxUsageBanner.d.ts.map +1 -0
  80. package/dist/sandbox/components/SandboxUsageBanner.js +37 -0
  81. package/dist/sandbox/components/SandboxUsageBanner.js.map +1 -0
  82. package/dist/sandbox/components/StatusBadge.d.ts +15 -0
  83. package/dist/sandbox/components/StatusBadge.d.ts.map +1 -0
  84. package/dist/sandbox/components/StatusBadge.js +86 -0
  85. package/dist/sandbox/components/StatusBadge.js.map +1 -0
  86. package/dist/sandbox/components/TagsInput.d.ts +14 -0
  87. package/dist/sandbox/components/TagsInput.d.ts.map +1 -0
  88. package/dist/sandbox/components/TagsInput.js +46 -0
  89. package/dist/sandbox/components/TagsInput.js.map +1 -0
  90. package/dist/sandbox/components/ui.d.ts +6 -0
  91. package/dist/sandbox/components/ui.d.ts.map +1 -0
  92. package/dist/sandbox/components/ui.js +2 -0
  93. package/dist/sandbox/hooks/useRemainingSeconds.d.ts +12 -0
  94. package/dist/sandbox/hooks/useRemainingSeconds.d.ts.map +1 -0
  95. package/dist/sandbox/hooks/useRemainingSeconds.js +23 -0
  96. package/dist/sandbox/hooks/useRemainingSeconds.js.map +1 -0
  97. package/dist/sandbox/index.d.ts +30 -0
  98. package/dist/sandbox/index.d.ts.map +1 -0
  99. package/dist/sandbox/index.js +4 -0
  100. package/dist/sandbox/pages/AdminLandingPage.d.ts +9 -0
  101. package/dist/sandbox/pages/AdminLandingPage.d.ts.map +1 -0
  102. package/dist/sandbox/pages/AdminLandingPage.js +40 -0
  103. package/dist/sandbox/pages/AdminLandingPage.js.map +1 -0
  104. package/dist/sandbox/pages/AdminPage.d.ts +2 -0
  105. package/dist/sandbox/pages/AdminPage.d.ts.map +1 -0
  106. package/dist/sandbox/pages/AdminPage.js +448 -0
  107. package/dist/sandbox/pages/AdminPage.js.map +1 -0
  108. package/dist/sandbox/pages/AdminTemplatesPage.d.ts +7 -0
  109. package/dist/sandbox/pages/AdminTemplatesPage.d.ts.map +1 -0
  110. package/dist/sandbox/pages/AdminTemplatesPage.js +155 -0
  111. package/dist/sandbox/pages/AdminTemplatesPage.js.map +1 -0
  112. package/dist/sandbox/pages/SandboxCreatePage.d.ts +2 -0
  113. package/dist/sandbox/pages/SandboxCreatePage.d.ts.map +1 -0
  114. package/dist/sandbox/pages/SandboxCreatePage.js +1121 -0
  115. package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -0
  116. package/dist/sandbox/pages/SandboxDetailPage.d.ts +6 -0
  117. package/dist/sandbox/pages/SandboxDetailPage.d.ts.map +1 -0
  118. package/dist/sandbox/pages/SandboxDetailPage.js +822 -0
  119. package/dist/sandbox/pages/SandboxDetailPage.js.map +1 -0
  120. package/dist/sandbox/pages/SandboxLandingPage.d.ts +12 -0
  121. package/dist/sandbox/pages/SandboxLandingPage.d.ts.map +1 -0
  122. package/dist/sandbox/pages/SandboxListPage.d.ts +6 -0
  123. package/dist/sandbox/pages/SandboxListPage.d.ts.map +1 -0
  124. package/dist/sandbox/pages/SandboxListPage.js +820 -0
  125. package/dist/sandbox/pages/SandboxListPage.js.map +1 -0
  126. package/dist/sandbox/pages/TemplateDetailPage.d.ts +6 -0
  127. package/dist/sandbox/pages/TemplateDetailPage.d.ts.map +1 -0
  128. package/dist/sandbox/pages/TemplateDetailPage.js +691 -0
  129. package/dist/sandbox/pages/TemplateDetailPage.js.map +1 -0
  130. package/dist/sandbox/pages/TemplatesPage.d.ts +8 -0
  131. package/dist/sandbox/pages/TemplatesPage.d.ts.map +1 -0
  132. package/dist/sandbox/pages/UserLandingPage.d.ts +9 -0
  133. package/dist/sandbox/pages/UserLandingPage.d.ts.map +1 -0
  134. package/dist/sandbox/pages/UserLandingPage.js +52 -0
  135. package/dist/sandbox/pages/UserLandingPage.js.map +1 -0
  136. package/dist/sandbox/pages/UserTemplatesPage.d.ts +8 -0
  137. package/dist/sandbox/pages/UserTemplatesPage.d.ts.map +1 -0
  138. package/dist/sandbox/pages/UserTemplatesPage.js +121 -0
  139. package/dist/sandbox/pages/UserTemplatesPage.js.map +1 -0
  140. package/dist/sandbox/providers/SandboxProvider.d.ts +13 -0
  141. package/dist/sandbox/providers/SandboxProvider.d.ts.map +1 -0
  142. package/dist/sandbox/providers/SandboxProvider.js +78 -0
  143. package/dist/sandbox/providers/SandboxProvider.js.map +1 -0
  144. package/dist/sandbox/store/sandboxStore.d.ts +16 -0
  145. package/dist/sandbox/store/sandboxStore.d.ts.map +1 -0
  146. package/dist/sandbox/store/sandboxStore.js +24 -0
  147. package/dist/sandbox/store/sandboxStore.js.map +1 -0
  148. package/dist/sandbox/types/index.d.ts +238 -0
  149. package/dist/sandbox/types/index.d.ts.map +1 -0
  150. package/dist/sandbox/utils/cn.d.ts +8 -0
  151. package/dist/sandbox/utils/cn.d.ts.map +1 -0
  152. package/dist/sandbox/utils/cn.js +10 -0
  153. package/dist/sandbox/utils/cn.js.map +1 -0
  154. package/dist/sandbox/utils/formatters.d.ts +7 -0
  155. package/dist/sandbox/utils/formatters.d.ts.map +1 -0
  156. package/dist/sandbox/utils/formatters.js +10 -0
  157. package/dist/sandbox/utils/formatters.js.map +1 -0
  158. package/dist/sandbox/utils/i18n.d.ts +6 -0
  159. package/dist/sandbox/utils/i18n.d.ts.map +1 -0
  160. package/dist/sandbox/utils/i18n.js +15 -0
  161. package/dist/sandbox/utils/i18n.js.map +1 -0
  162. package/dist/sandbox/utils/navigation.d.ts +5 -0
  163. package/dist/sandbox/utils/navigation.d.ts.map +1 -0
  164. package/dist/sandbox/utils/navigation.js +8 -0
  165. package/dist/sandbox/utils/navigation.js.map +1 -0
  166. package/dist/sandbox/utils/sandboxEvents.d.ts +13 -0
  167. package/dist/sandbox/utils/sandboxEvents.d.ts.map +1 -0
  168. package/dist/sandbox/utils/sandboxEvents.js +20 -0
  169. package/dist/sandbox/utils/sandboxEvents.js.map +1 -0
  170. package/dist/utils/nativeBridge.d.ts +3 -0
  171. package/dist/utils/nativeBridge.d.ts.map +1 -0
  172. package/dist/utils/nativeBridge.js +2 -0
  173. package/package.json +107 -0
@@ -0,0 +1,691 @@
1
+ import { useSandbox as e } from "../providers/SandboxProvider.js";
2
+ import { joinPath as t } from "../utils/navigation.js";
3
+ import { Badge as n, Button as r, Card as i, CardContent as a } from "../components/ui.js";
4
+ import { tWithFallback as o } from "../utils/i18n.js";
5
+ import { PageLayout as s } from "../components/PageLayout.js";
6
+ import { useCreateSandboxTemplateMutation as c, useGetSandboxTemplateQuery as l, useUpdateSandboxTemplateMutation as u } from "../../generated/wspace-operations.js";
7
+ import { useEffect as d, useState as f } from "react";
8
+ import { AlertCircle as p, ArrowLeft as m, CheckCircle2 as h, Container as g, Cpu as _, Database as v, Image as ee, Info as y, LayoutTemplate as b, Loader2 as x, MemoryStick as S, Plus as C, Save as w, Timer as T, Trash2 as E, X as D } from "lucide-react";
9
+ import { useParams as O } from "react-router-dom";
10
+ import { useI18n as k } from "@burdenoff/fe-libs/shared/providers/shell";
11
+ import { jsx as A, jsxs as j } from "react/jsx-runtime";
12
+ //#region src/sandbox/pages/TemplateDetailPage.tsx
13
+ var M = {
14
+ name: "",
15
+ image: "",
16
+ ports: [],
17
+ env: [],
18
+ requestsCpu: "",
19
+ requestsMemory: "",
20
+ limitsCpu: "",
21
+ limitsMemory: ""
22
+ };
23
+ function N() {
24
+ let { templateId: N } = O(), { basePath: P = "/", navigate: F, workspaceId: I } = e(), { t: L } = k(), R = !!N && N !== "new", [z] = c(), [B] = u(), { data: V } = l({
25
+ variables: {
26
+ context: { workspaceId: I },
27
+ id: N
28
+ },
29
+ skip: !R || !N || !I
30
+ }), [H, U] = f({
31
+ name: "",
32
+ description: "",
33
+ template: "AI_BUILDER",
34
+ isDefault: !1,
35
+ cpuRequest: "500m",
36
+ cpuLimit: "2",
37
+ memoryRequest: "1Gi",
38
+ memoryLimit: "4Gi",
39
+ ttlSeconds: 14400,
40
+ containers: [{
41
+ ...M,
42
+ name: "main"
43
+ }],
44
+ storageMode: "NONE",
45
+ storageSizeGi: 10,
46
+ storageMountPath: "/data",
47
+ storageRetainOnDelete: !1,
48
+ allowedImages: []
49
+ });
50
+ d(() => {
51
+ let e = V?.getSandboxTemplate;
52
+ e && U({
53
+ name: e.name ?? "",
54
+ description: e.description ?? "",
55
+ template: e.template ?? "AI_BUILDER",
56
+ isDefault: e.isDefault ?? !1,
57
+ cpuRequest: e.resources?.cpuRequest ?? "500m",
58
+ cpuLimit: e.resources?.cpuLimit ?? "2",
59
+ memoryRequest: e.resources?.memoryRequest ?? "1Gi",
60
+ memoryLimit: e.resources?.memoryLimit ?? "4Gi",
61
+ ttlSeconds: e.ttlSeconds ?? 14400,
62
+ containers: e.containers && e.containers.length > 0 ? e.containers.map((e) => ({
63
+ name: e.name ?? "",
64
+ image: e.image ?? "",
65
+ ports: e.ports?.map((e) => ({
66
+ containerPort: e.containerPort,
67
+ name: e.name ?? ""
68
+ })) ?? [],
69
+ env: e.env ?? [],
70
+ requestsCpu: e.resources?.requestsCpu ?? "",
71
+ requestsMemory: e.resources?.requestsMemory ?? "",
72
+ limitsCpu: e.resources?.limitsCpu ?? "",
73
+ limitsMemory: e.resources?.limitsMemory ?? ""
74
+ })) : [{
75
+ ...M,
76
+ name: "main"
77
+ }],
78
+ storageMode: e.storage?.mode ?? "NONE",
79
+ storageSizeGi: e.storage?.sizeGi ?? 10,
80
+ storageMountPath: e.storage?.mountPath ?? "/data",
81
+ storageRetainOnDelete: e.storage?.retainOnDelete ?? !1,
82
+ allowedImages: e.allowedImages ?? []
83
+ });
84
+ }, [V]);
85
+ let [W, G] = f({}), [K, q] = f(null), [J, Y] = f(!1), X = (e, t) => {
86
+ q({
87
+ type: e,
88
+ message: t
89
+ }), setTimeout(() => q(null), 5e3);
90
+ }, Z = (e, t) => {
91
+ U((n) => ({
92
+ ...n,
93
+ [e]: t
94
+ })), typeof t == "string" && W[e] && G((t) => {
95
+ let n = { ...t };
96
+ return delete n[e], n;
97
+ });
98
+ }, Q = () => {
99
+ U((e) => ({
100
+ ...e,
101
+ containers: [...e.containers, { ...M }]
102
+ }));
103
+ }, te = (e) => {
104
+ U((t) => ({
105
+ ...t,
106
+ containers: t.containers.filter((t, n) => n !== e)
107
+ }));
108
+ }, $ = (e, t, n) => {
109
+ U((r) => ({
110
+ ...r,
111
+ containers: r.containers.map((r, i) => i === e ? {
112
+ ...r,
113
+ [t]: n
114
+ } : r)
115
+ }));
116
+ }, ne = () => {
117
+ U((e) => ({
118
+ ...e,
119
+ allowedImages: [...e.allowedImages, ""]
120
+ }));
121
+ }, re = (e) => {
122
+ U((t) => ({
123
+ ...t,
124
+ allowedImages: t.allowedImages.filter((t, n) => n !== e)
125
+ }));
126
+ }, ie = (e, t) => {
127
+ U((n) => ({
128
+ ...n,
129
+ allowedImages: n.allowedImages.map((n, r) => r === e ? t : n)
130
+ }));
131
+ }, ae = () => {
132
+ let e = {};
133
+ return H.name.trim() || (e.name = o(L, "sandbox.template.errors.nameRequired", "Name is required")), H.cpuRequest.trim() || (e.cpuRequest = o(L, "sandbox.template.errors.cpuRequestRequired", "CPU request is required")), H.cpuLimit.trim() || (e.cpuLimit = o(L, "sandbox.template.errors.cpuLimitRequired", "CPU limit is required")), H.memoryRequest.trim() || (e.memoryRequest = o(L, "sandbox.template.errors.memoryRequestRequired", "Memory request is required")), H.memoryLimit.trim() || (e.memoryLimit = o(L, "sandbox.template.errors.memoryLimitRequired", "Memory limit is required")), G(e), Object.keys(e).length === 0;
134
+ };
135
+ return /* @__PURE__ */ j(s, {
136
+ showHeader: !1,
137
+ children: [
138
+ K && /* @__PURE__ */ j("div", {
139
+ className: `fixed top-4 right-4 z-50 flex items-center gap-3 px-5 py-3 rounded-xl shadow-2xl border-2 animate-in slide-in-from-top-4 duration-300 ${K.type === "success" ? "bg-status-success-bg-subtle text-status-success-text border-border-default" : "bg-status-error-bg-subtle text-status-error-text border-border-default"}`,
140
+ children: [
141
+ K.type === "success" ? /* @__PURE__ */ A(h, { size: 20 }) : /* @__PURE__ */ A(p, { size: 20 }),
142
+ /* @__PURE__ */ A("span", {
143
+ className: "font-medium",
144
+ children: K.message
145
+ }),
146
+ /* @__PURE__ */ A("button", {
147
+ onClick: () => q(null),
148
+ className: "ml-2 p-1 rounded-md hover:bg-accent",
149
+ children: /* @__PURE__ */ A(D, { size: 16 })
150
+ })
151
+ ]
152
+ }),
153
+ /* @__PURE__ */ A("div", {
154
+ className: "relative overflow-hidden rounded-xl bg-gradient-to-br from-primary/5 via-primary/3 to-background border border-border/50 p-6 shadow-sm",
155
+ children: /* @__PURE__ */ j("div", {
156
+ className: "relative z-10 flex items-center gap-4",
157
+ children: [/* @__PURE__ */ A("button", {
158
+ onClick: () => F?.(t(P, "templates")),
159
+ className: "p-2.5 hover:bg-accent rounded-lg transition-all duration-200 hover:scale-110",
160
+ "aria-label": o(L, "sandbox.template.actions.backToTemplates", "Back to templates"),
161
+ children: /* @__PURE__ */ A(m, { size: 20 })
162
+ }), /* @__PURE__ */ j("div", {
163
+ className: "flex items-center gap-3",
164
+ children: [/* @__PURE__ */ A("div", {
165
+ className: "p-2.5 rounded-lg bg-primary/10",
166
+ children: /* @__PURE__ */ A(b, {
167
+ size: 24,
168
+ className: "text-primary"
169
+ })
170
+ }), /* @__PURE__ */ A("h1", {
171
+ className: "text-2xl sm:text-3xl font-bold",
172
+ children: R ? o(L, "sandbox.template.title.edit", "Edit Template") : o(L, "sandbox.template.title.create", "Create Template")
173
+ })]
174
+ })]
175
+ })
176
+ }),
177
+ /* @__PURE__ */ j("form", {
178
+ onSubmit: async (e) => {
179
+ if (e.preventDefault(), !ae()) {
180
+ X("error", o(L, "sandbox.template.errors.fixFormErrors", "Please fix the form errors"));
181
+ return;
182
+ }
183
+ Y(!0);
184
+ try {
185
+ let e = H.containers.filter((e) => e.name.trim() && e.image.trim()).map((e) => ({
186
+ name: e.name,
187
+ image: e.image,
188
+ ports: e.ports.length > 0 ? e.ports : void 0,
189
+ env: e.env.length > 0 ? e.env.filter((e) => e.name.trim()) : void 0,
190
+ resources: e.requestsCpu || e.requestsMemory || e.limitsCpu || e.limitsMemory ? {
191
+ requestsCpu: e.requestsCpu || void 0,
192
+ requestsMemory: e.requestsMemory || void 0,
193
+ limitsCpu: e.limitsCpu || void 0,
194
+ limitsMemory: e.limitsMemory || void 0
195
+ } : void 0
196
+ })), n = {
197
+ context: { workspaceId: I },
198
+ name: H.name,
199
+ description: H.description || void 0,
200
+ template: H.template,
201
+ isDefault: H.isDefault,
202
+ containers: e,
203
+ resources: {
204
+ cpuRequest: H.cpuRequest,
205
+ cpuLimit: H.cpuLimit,
206
+ memoryRequest: H.memoryRequest,
207
+ memoryLimit: H.memoryLimit
208
+ },
209
+ storage: {
210
+ mode: H.storageMode,
211
+ sizeGi: H.storageMode === "NONE" ? void 0 : H.storageSizeGi,
212
+ mountPath: H.storageMode === "NONE" ? void 0 : H.storageMountPath,
213
+ retainOnDelete: H.storageMode === "PERSISTENT" ? H.storageRetainOnDelete : !1
214
+ },
215
+ allowedImages: H.allowedImages.filter((e) => e.trim()),
216
+ ttlSeconds: H.ttlSeconds
217
+ };
218
+ R ? await B({ variables: { input: {
219
+ id: N,
220
+ ...n
221
+ } } }) : await z({ variables: { input: n } }), X("success", R ? o(L, "sandbox.template.success.updated", "Template updated!") : o(L, "sandbox.template.success.created", "Template created!")), setTimeout(() => F?.(t(P, "templates")), 1500);
222
+ } catch {
223
+ X("error", o(L, "sandbox.template.errors.saveFailed", "Failed to save template"));
224
+ } finally {
225
+ Y(!1);
226
+ }
227
+ },
228
+ className: "space-y-6",
229
+ children: [
230
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
231
+ className: "p-6 space-y-5",
232
+ children: [
233
+ /* @__PURE__ */ j("h2", {
234
+ className: "text-lg font-bold flex items-center gap-2",
235
+ children: [/* @__PURE__ */ A(y, {
236
+ size: 18,
237
+ className: "text-primary"
238
+ }), o(L, "sandbox.template.sections.info", "Template Information")]
239
+ }),
240
+ /* @__PURE__ */ j("div", { children: [
241
+ /* @__PURE__ */ j("label", {
242
+ htmlFor: "name",
243
+ className: "block text-sm font-semibold mb-2",
244
+ children: ["Name ", /* @__PURE__ */ A("span", {
245
+ className: "text-destructive",
246
+ children: "*"
247
+ })]
248
+ }),
249
+ /* @__PURE__ */ A("input", {
250
+ type: "text",
251
+ id: "name",
252
+ value: H.name,
253
+ onChange: (e) => Z("name", e.target.value),
254
+ className: `w-full px-4 py-2.5 border-2 rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all ${W.name ? "border-destructive" : "border-border focus:border-primary"}`,
255
+ placeholder: "AI Builder - Standard"
256
+ }),
257
+ W.name && /* @__PURE__ */ j("p", {
258
+ className: "text-sm text-destructive mt-1 flex items-center gap-1",
259
+ children: [/* @__PURE__ */ A(p, { size: 14 }), W.name]
260
+ })
261
+ ] }),
262
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
263
+ htmlFor: "description",
264
+ className: "block text-sm font-semibold mb-2",
265
+ children: "Description"
266
+ }), /* @__PURE__ */ A("textarea", {
267
+ id: "description",
268
+ value: H.description,
269
+ onChange: (e) => Z("description", e.target.value),
270
+ rows: 3,
271
+ className: "w-full px-4 py-2.5 border-2 border-border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
272
+ placeholder: "Template description..."
273
+ })] }),
274
+ /* @__PURE__ */ j("div", {
275
+ className: "grid grid-cols-1 sm:grid-cols-2 gap-5",
276
+ children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
277
+ htmlFor: "template",
278
+ className: "block text-sm font-semibold mb-2",
279
+ children: "Template Type"
280
+ }), /* @__PURE__ */ j("select", {
281
+ id: "template",
282
+ value: H.template,
283
+ onChange: (e) => Z("template", e.target.value),
284
+ className: "w-full px-4 py-2.5 border-2 border-border rounded-lg bg-background focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
285
+ children: [
286
+ /* @__PURE__ */ A("option", {
287
+ value: "AI_BUILDER",
288
+ children: "AI Builder"
289
+ }),
290
+ /* @__PURE__ */ A("option", {
291
+ value: "WORKFLOW_MULTI_NODE",
292
+ children: "Workflow Multi-Node"
293
+ }),
294
+ /* @__PURE__ */ A("option", {
295
+ value: "MISC_SHELL",
296
+ children: "Misc Shell"
297
+ }),
298
+ /* @__PURE__ */ A("option", {
299
+ value: "CUSTOM",
300
+ children: "Custom"
301
+ })
302
+ ]
303
+ })] }), /* @__PURE__ */ j("div", {
304
+ className: "flex items-center gap-3 pt-7",
305
+ children: [/* @__PURE__ */ A("input", {
306
+ type: "checkbox",
307
+ id: "isDefault",
308
+ checked: H.isDefault,
309
+ onChange: (e) => Z("isDefault", e.target.checked),
310
+ className: "w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
311
+ }), /* @__PURE__ */ A("label", {
312
+ htmlFor: "isDefault",
313
+ className: "text-sm font-medium",
314
+ children: "Set as default template for this type"
315
+ })]
316
+ })]
317
+ })
318
+ ]
319
+ }) }),
320
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
321
+ className: "p-6 space-y-5",
322
+ children: [/* @__PURE__ */ j("div", {
323
+ className: "flex items-center justify-between",
324
+ children: [/* @__PURE__ */ j("h2", {
325
+ className: "text-lg font-bold flex items-center gap-2",
326
+ children: [
327
+ /* @__PURE__ */ A(g, {
328
+ size: 18,
329
+ className: "text-primary"
330
+ }),
331
+ o(L, "sandbox.template.sections.containers", "Default Containers"),
332
+ /* @__PURE__ */ A(n, {
333
+ variant: "secondary",
334
+ children: H.containers.length
335
+ })
336
+ ]
337
+ }), /* @__PURE__ */ j(r, {
338
+ type: "button",
339
+ variant: "outline",
340
+ size: "sm",
341
+ onClick: Q,
342
+ children: [/* @__PURE__ */ A(C, { size: 14 }), "Add Container"]
343
+ })]
344
+ }), /* @__PURE__ */ A("div", {
345
+ className: "space-y-4",
346
+ children: H.containers.map((e, t) => /* @__PURE__ */ j("div", {
347
+ className: "p-4 rounded-lg border-2 border-border/50 bg-muted/20 space-y-3",
348
+ children: [
349
+ /* @__PURE__ */ j("div", {
350
+ className: "flex items-center justify-between",
351
+ children: [/* @__PURE__ */ j("h3", {
352
+ className: "font-semibold text-sm",
353
+ children: [
354
+ "Container #",
355
+ t + 1,
356
+ e.name && `: ${e.name}`
357
+ ]
358
+ }), H.containers.length > 1 && /* @__PURE__ */ A(r, {
359
+ type: "button",
360
+ variant: "ghost",
361
+ size: "icon",
362
+ className: "text-destructive hover:text-destructive h-7 w-7",
363
+ onClick: () => te(t),
364
+ children: /* @__PURE__ */ A(E, { size: 14 })
365
+ })]
366
+ }),
367
+ /* @__PURE__ */ j("div", {
368
+ className: "grid grid-cols-1 sm:grid-cols-2 gap-3",
369
+ children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
370
+ className: "block text-xs font-semibold mb-1",
371
+ children: "Name"
372
+ }), /* @__PURE__ */ A("input", {
373
+ type: "text",
374
+ value: e.name,
375
+ onChange: (e) => $(t, "name", e.target.value),
376
+ className: "w-full px-3 py-2 border-2 border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
377
+ placeholder: "main"
378
+ })] }), /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
379
+ className: "block text-xs font-semibold mb-1",
380
+ children: "Image"
381
+ }), /* @__PURE__ */ A("input", {
382
+ type: "text",
383
+ value: e.image,
384
+ onChange: (e) => $(t, "image", e.target.value),
385
+ className: "w-full px-3 py-2 border-2 border-border rounded-lg bg-background text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
386
+ placeholder: "harbor-internal.burdenoff.com/sandbox/python:3.12"
387
+ })] })]
388
+ }),
389
+ /* @__PURE__ */ j("div", {
390
+ className: "grid grid-cols-2 sm:grid-cols-4 gap-3",
391
+ children: [
392
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
393
+ className: "block text-xs text-muted-foreground mb-1",
394
+ children: "CPU Req"
395
+ }), /* @__PURE__ */ A("input", {
396
+ type: "text",
397
+ value: e.requestsCpu,
398
+ onChange: (e) => $(t, "requestsCpu", e.target.value),
399
+ className: "w-full px-3 py-1.5 border rounded-lg bg-background text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/20",
400
+ placeholder: "250m"
401
+ })] }),
402
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
403
+ className: "block text-xs text-muted-foreground mb-1",
404
+ children: "CPU Lim"
405
+ }), /* @__PURE__ */ A("input", {
406
+ type: "text",
407
+ value: e.limitsCpu,
408
+ onChange: (e) => $(t, "limitsCpu", e.target.value),
409
+ className: "w-full px-3 py-1.5 border rounded-lg bg-background text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/20",
410
+ placeholder: "1"
411
+ })] }),
412
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
413
+ className: "block text-xs text-muted-foreground mb-1",
414
+ children: "Mem Req"
415
+ }), /* @__PURE__ */ A("input", {
416
+ type: "text",
417
+ value: e.requestsMemory,
418
+ onChange: (e) => $(t, "requestsMemory", e.target.value),
419
+ className: "w-full px-3 py-1.5 border rounded-lg bg-background text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/20",
420
+ placeholder: "512Mi"
421
+ })] }),
422
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
423
+ className: "block text-xs text-muted-foreground mb-1",
424
+ children: "Mem Lim"
425
+ }), /* @__PURE__ */ A("input", {
426
+ type: "text",
427
+ value: e.limitsMemory,
428
+ onChange: (e) => $(t, "limitsMemory", e.target.value),
429
+ className: "w-full px-3 py-1.5 border rounded-lg bg-background text-xs font-mono focus:outline-none focus:ring-2 focus:ring-primary/20",
430
+ placeholder: "2Gi"
431
+ })] })
432
+ ]
433
+ })
434
+ ]
435
+ }, t))
436
+ })]
437
+ }) }),
438
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
439
+ className: "p-6 space-y-5",
440
+ children: [
441
+ /* @__PURE__ */ j("h2", {
442
+ className: "text-lg font-bold flex items-center gap-2",
443
+ children: [/* @__PURE__ */ A(_, {
444
+ size: 18,
445
+ className: "text-primary"
446
+ }), o(L, "sandbox.template.sections.resources", "Default Pod Resources")]
447
+ }),
448
+ /* @__PURE__ */ j("div", {
449
+ className: "grid grid-cols-1 sm:grid-cols-2 gap-5",
450
+ children: [
451
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("label", {
452
+ htmlFor: "cpuRequest",
453
+ className: "text-sm font-semibold flex items-center gap-2",
454
+ children: [/* @__PURE__ */ A(_, {
455
+ size: 14,
456
+ className: "text-status-info-text"
457
+ }), " CPU Request"]
458
+ }), /* @__PURE__ */ A("input", {
459
+ type: "text",
460
+ id: "cpuRequest",
461
+ value: H.cpuRequest,
462
+ onChange: (e) => Z("cpuRequest", e.target.value),
463
+ className: `w-full px-4 py-2.5 mt-2 border-2 rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all ${W.cpuRequest ? "border-destructive" : "border-border focus:border-primary"}`,
464
+ placeholder: "500m"
465
+ })] }),
466
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("label", {
467
+ htmlFor: "cpuLimit",
468
+ className: "text-sm font-semibold flex items-center gap-2",
469
+ children: [/* @__PURE__ */ A(_, {
470
+ size: 14,
471
+ className: "text-status-info-text"
472
+ }), " CPU Limit"]
473
+ }), /* @__PURE__ */ A("input", {
474
+ type: "text",
475
+ id: "cpuLimit",
476
+ value: H.cpuLimit,
477
+ onChange: (e) => Z("cpuLimit", e.target.value),
478
+ className: `w-full px-4 py-2.5 mt-2 border-2 rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all ${W.cpuLimit ? "border-destructive" : "border-border focus:border-primary"}`,
479
+ placeholder: "2"
480
+ })] }),
481
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("label", {
482
+ htmlFor: "memoryRequest",
483
+ className: "text-sm font-semibold flex items-center gap-2",
484
+ children: [/* @__PURE__ */ A(S, {
485
+ size: 14,
486
+ className: "text-accent-purple-subtle"
487
+ }), " Memory Request"]
488
+ }), /* @__PURE__ */ A("input", {
489
+ type: "text",
490
+ id: "memoryRequest",
491
+ value: H.memoryRequest,
492
+ onChange: (e) => Z("memoryRequest", e.target.value),
493
+ className: `w-full px-4 py-2.5 mt-2 border-2 rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all ${W.memoryRequest ? "border-destructive" : "border-border focus:border-primary"}`,
494
+ placeholder: "1Gi"
495
+ })] }),
496
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("label", {
497
+ htmlFor: "memoryLimit",
498
+ className: "text-sm font-semibold flex items-center gap-2",
499
+ children: [/* @__PURE__ */ A(S, {
500
+ size: 14,
501
+ className: "text-accent-purple-subtle"
502
+ }), " Memory Limit"]
503
+ }), /* @__PURE__ */ A("input", {
504
+ type: "text",
505
+ id: "memoryLimit",
506
+ value: H.memoryLimit,
507
+ onChange: (e) => Z("memoryLimit", e.target.value),
508
+ className: `w-full px-4 py-2.5 mt-2 border-2 rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 transition-all ${W.memoryLimit ? "border-destructive" : "border-border focus:border-primary"}`,
509
+ placeholder: "4Gi"
510
+ })] })
511
+ ]
512
+ }),
513
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ j("label", {
514
+ htmlFor: "ttlSeconds",
515
+ className: "text-sm font-semibold flex items-center gap-2",
516
+ children: [
517
+ /* @__PURE__ */ A(T, {
518
+ size: 14,
519
+ className: "text-status-info-text"
520
+ }),
521
+ " Default TTL",
522
+ /* @__PURE__ */ A(n, {
523
+ variant: "outline",
524
+ className: "text-xs ml-auto",
525
+ children: ((e) => {
526
+ let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60);
527
+ return t > 0 && n > 0 ? `${t}h ${n}m` : t > 0 ? `${t}h` : `${n}m`;
528
+ })(H.ttlSeconds)
529
+ })
530
+ ]
531
+ }), /* @__PURE__ */ A("input", {
532
+ type: "range",
533
+ id: "ttlSeconds",
534
+ min: 600,
535
+ max: 86400,
536
+ step: 600,
537
+ value: H.ttlSeconds,
538
+ onChange: (e) => Z("ttlSeconds", Number(e.target.value)),
539
+ className: "w-full mt-2 accent-primary"
540
+ })] })
541
+ ]
542
+ }) }),
543
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
544
+ className: "p-6 space-y-5",
545
+ children: [
546
+ /* @__PURE__ */ j("h2", {
547
+ className: "text-lg font-bold flex items-center gap-2",
548
+ children: [/* @__PURE__ */ A(v, {
549
+ size: 18,
550
+ className: "text-primary"
551
+ }), o(L, "sandbox.template.sections.storage", "Default Storage")]
552
+ }),
553
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
554
+ className: "block text-sm font-semibold mb-3",
555
+ children: "Mode"
556
+ }), /* @__PURE__ */ A("div", {
557
+ className: "grid grid-cols-3 gap-3",
558
+ children: [
559
+ "NONE",
560
+ "EPHEMERAL",
561
+ "PERSISTENT"
562
+ ].map((e) => /* @__PURE__ */ A("button", {
563
+ type: "button",
564
+ onClick: () => Z("storageMode", e),
565
+ className: `p-3 rounded-lg border-2 text-left transition-all duration-200 ${H.storageMode === e ? "border-primary bg-primary/5 shadow-sm" : "border-border hover:border-primary/50 hover:bg-muted/50"}`,
566
+ children: /* @__PURE__ */ A("p", {
567
+ className: "font-medium text-sm",
568
+ children: {
569
+ NONE: "None",
570
+ EPHEMERAL: "Ephemeral",
571
+ PERSISTENT: "Persistent"
572
+ }[e]
573
+ })
574
+ }, e))
575
+ })] }),
576
+ H.storageMode !== "NONE" && /* @__PURE__ */ j("div", {
577
+ className: "grid grid-cols-1 sm:grid-cols-2 gap-5",
578
+ children: [
579
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
580
+ className: "block text-sm font-semibold mb-2",
581
+ children: "Size (GiB)"
582
+ }), /* @__PURE__ */ A("input", {
583
+ type: "number",
584
+ value: H.storageSizeGi,
585
+ onChange: (e) => Z("storageSizeGi", Number(e.target.value)),
586
+ min: 1,
587
+ max: 200,
588
+ className: "w-full px-4 py-2.5 border-2 border-border rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all"
589
+ })] }),
590
+ /* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A("label", {
591
+ className: "block text-sm font-semibold mb-2",
592
+ children: "Mount Path"
593
+ }), /* @__PURE__ */ A("input", {
594
+ type: "text",
595
+ value: H.storageMountPath,
596
+ onChange: (e) => Z("storageMountPath", e.target.value),
597
+ className: "w-full px-4 py-2.5 border-2 border-border rounded-lg bg-background font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
598
+ placeholder: "/data"
599
+ })] }),
600
+ H.storageMode === "PERSISTENT" && /* @__PURE__ */ j("div", {
601
+ className: "flex items-center gap-3 sm:col-span-2",
602
+ children: [/* @__PURE__ */ A("input", {
603
+ type: "checkbox",
604
+ id: "storageRetainOnDelete",
605
+ checked: H.storageRetainOnDelete,
606
+ onChange: (e) => Z("storageRetainOnDelete", e.target.checked),
607
+ className: "w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
608
+ }), /* @__PURE__ */ A("label", {
609
+ htmlFor: "storageRetainOnDelete",
610
+ className: "text-sm font-medium",
611
+ children: "Retain volume data when sandbox is deleted"
612
+ })]
613
+ })
614
+ ]
615
+ })
616
+ ]
617
+ }) }),
618
+ /* @__PURE__ */ A(i, { children: /* @__PURE__ */ j(a, {
619
+ className: "p-6 space-y-5",
620
+ children: [
621
+ /* @__PURE__ */ j("div", {
622
+ className: "flex items-center justify-between",
623
+ children: [/* @__PURE__ */ j("h2", {
624
+ className: "text-lg font-bold flex items-center gap-2",
625
+ children: [
626
+ /* @__PURE__ */ A(ee, {
627
+ size: 18,
628
+ className: "text-primary"
629
+ }),
630
+ o(L, "sandbox.template.sections.allowedImages", "Allowed Images"),
631
+ H.allowedImages.length > 0 && /* @__PURE__ */ A(n, {
632
+ variant: "secondary",
633
+ children: H.allowedImages.length
634
+ })
635
+ ]
636
+ }), /* @__PURE__ */ j(r, {
637
+ type: "button",
638
+ variant: "outline",
639
+ size: "sm",
640
+ onClick: ne,
641
+ children: [/* @__PURE__ */ A(C, { size: 14 }), "Add Image"]
642
+ })]
643
+ }),
644
+ /* @__PURE__ */ A("p", {
645
+ className: "text-xs text-muted-foreground",
646
+ children: o(L, "sandbox.template.allowedImages.hint", "Restrict which container images can be used with this template. Leave empty to allow any image.")
647
+ }),
648
+ H.allowedImages.map((e, t) => /* @__PURE__ */ j("div", {
649
+ className: "flex items-center gap-2",
650
+ children: [/* @__PURE__ */ A("input", {
651
+ type: "text",
652
+ value: e,
653
+ onChange: (e) => ie(t, e.target.value),
654
+ className: "flex-1 px-4 py-2 border-2 border-border rounded-lg bg-background text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-all",
655
+ placeholder: "harbor-internal.burdenoff.com/sandbox/*"
656
+ }), /* @__PURE__ */ A("button", {
657
+ type: "button",
658
+ onClick: () => re(t),
659
+ className: "p-2 text-destructive hover:bg-destructive/10 rounded-lg",
660
+ children: /* @__PURE__ */ A(E, { size: 14 })
661
+ })]
662
+ }, t))
663
+ ]
664
+ }) }),
665
+ /* @__PURE__ */ j("div", {
666
+ className: "flex flex-col sm:flex-row gap-3 pt-2",
667
+ children: [/* @__PURE__ */ j(r, {
668
+ type: "submit",
669
+ disabled: J,
670
+ size: "lg",
671
+ children: [J ? /* @__PURE__ */ A(x, {
672
+ size: 18,
673
+ className: "animate-spin"
674
+ }) : /* @__PURE__ */ A(w, { size: 18 }), R ? o(L, "sandbox.template.actions.saveChanges", "Save Changes") : o(L, "sandbox.template.actions.create", "Create Template")]
675
+ }), /* @__PURE__ */ A(r, {
676
+ type: "button",
677
+ variant: "outline",
678
+ onClick: () => F?.(t(P, "templates")),
679
+ disabled: J,
680
+ children: o(L, "sandbox.template.actions.cancel", "Cancel")
681
+ })]
682
+ })
683
+ ]
684
+ })
685
+ ]
686
+ });
687
+ }
688
+ //#endregion
689
+ export { N as TemplateDetailPage };
690
+
691
+ //# sourceMappingURL=TemplateDetailPage.js.map