@burdenoff/microfe-sandbox 2026.625.1 → 2026.625.3

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.
@@ -3,20 +3,20 @@ import { joinPath as t } from "../utils/navigation.js";
3
3
  import { Badge as n, Button as r, CTAOverflowMenu as i, GlassCard as a } from "../components/ui.js";
4
4
  import { tWithFallback as o } from "../utils/i18n.js";
5
5
  import { SandboxTypeIcon as s } from "../components/SandboxTypeIcon.js";
6
- import { EmptyState as c, PageLayout as l } from "../components/PageLayout.js";
7
- import { useDeleteSandboxTemplateMutation as u, useListSandboxTemplatesQuery as d } from "../../generated/wspace-operations.js";
8
- import { formatTTL as f } from "../utils/formatters.js";
9
- import { useState as p } from "react";
10
- import { Container as m, LayoutTemplate as h, Loader2 as g, Pencil as _, Plus as v, Star as y, Trash2 as b } from "lucide-react";
11
- import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell";
12
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
13
- import { AlertDialog as w, AlertDialogAction as T, AlertDialogCancel as E, AlertDialogContent as D, AlertDialogDescription as O, AlertDialogFooter as k, AlertDialogHeader as A, AlertDialogTitle as j } from "@burdenoff/fe-libs/ui";
6
+ import { PageLayout as c } from "../components/PageLayout.js";
7
+ import { useDeleteSandboxTemplateMutation as l, useListSandboxTemplatesQuery as u } from "../../generated/wspace-operations.js";
8
+ import { formatTTL as d } from "../utils/formatters.js";
9
+ import { useState as f } from "react";
10
+ import { Container as p, LayoutTemplate as m, Loader2 as h, Pencil as g, Plus as _, Star as v, Trash2 as y } from "lucide-react";
11
+ import { useI18n as b } from "@burdenoff/fe-libs/shared/providers/shell";
12
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
13
+ import { AlertDialog as C, AlertDialogAction as w, AlertDialogCancel as T, AlertDialogContent as E, AlertDialogDescription as D, AlertDialogFooter as O, AlertDialogHeader as k, AlertDialogTitle as A, IllustratedEmptyState as j } from "@burdenoff/fe-libs/ui";
14
14
  //#region src/sandbox/pages/AdminTemplatesPage.tsx
15
15
  function M() {
16
- let { basePath: M = "/", navigate: N, workspaceId: P } = e(), { t: F } = x(), { data: I, loading: L, refetch: R } = d({
16
+ let { basePath: M = "/", navigate: N, workspaceId: P } = e(), { t: F } = b(), { data: I, loading: L, refetch: R } = u({
17
17
  variables: { context: { workspaceId: P } },
18
18
  skip: !P
19
- }), [z] = u(), B = I?.listSandboxTemplates?.items ?? [], [V, H] = p(null), U = () => {
19
+ }), [z] = l(), B = I?.listSandboxTemplates?.items ?? [], [V, H] = f(null), U = () => {
20
20
  N?.(t(M, "templates/new"));
21
21
  }, W = (e) => {
22
22
  N?.(t(M, `templates/${e}`));
@@ -31,104 +31,104 @@ function M() {
31
31
  console.error("[Sandbox] Failed to delete template:", e), window.alert(o(F, "sandbox.adminTemplates.actions.delete.error", "Failed to delete template. Please try again."));
32
32
  }
33
33
  };
34
- return /* @__PURE__ */ C(l, {
34
+ return /* @__PURE__ */ S(c, {
35
35
  title: o(F, "sandbox.adminTemplates.title", "Templates"),
36
36
  subtitle: o(F, "sandbox.adminTemplates.subtitle", "Manage sandbox templates - create, edit, and configure predefined configurations"),
37
- icon: /* @__PURE__ */ S(h, { size: 24 }),
38
- headerActions: /* @__PURE__ */ C(r, {
37
+ icon: /* @__PURE__ */ x(m, { size: 24 }),
38
+ headerActions: /* @__PURE__ */ S(r, {
39
39
  onClick: U,
40
40
  size: "lg",
41
- children: [/* @__PURE__ */ S(v, { size: 18 }), o(F, "sandbox.adminTemplates.actions.create", "Create Template")]
41
+ children: [/* @__PURE__ */ x(_, { size: 18 }), o(F, "sandbox.adminTemplates.actions.create", "Create Template")]
42
42
  }),
43
- headerContent: /* @__PURE__ */ S(n, {
43
+ headerContent: /* @__PURE__ */ x(n, {
44
44
  variant: "secondary",
45
45
  children: o(F, "sandbox.adminTemplates.header.count", "{count} templates", { count: B.length })
46
46
  }),
47
- children: [L ? /* @__PURE__ */ S("div", {
47
+ children: [L ? /* @__PURE__ */ x("div", {
48
48
  className: "flex items-center justify-center min-h-[200px]",
49
- children: /* @__PURE__ */ S(g, { className: "size-8 animate-spin text-primary" })
50
- }) : B.length > 0 ? /* @__PURE__ */ S("div", {
49
+ children: /* @__PURE__ */ x(h, { className: "size-8 animate-spin text-primary" })
50
+ }) : B.length > 0 ? /* @__PURE__ */ x("div", {
51
51
  className: "grid grid-cols-1 md:grid-cols-2 gap-4",
52
- children: B.map((e, t) => /* @__PURE__ */ S(a, {
52
+ children: B.map((e, t) => /* @__PURE__ */ x(a, {
53
53
  treatment: "insight",
54
54
  className: "group animate-in fade-in-0 slide-in-from-bottom-2",
55
55
  style: { animationDelay: `${t * 50}ms` },
56
- children: /* @__PURE__ */ C("div", {
56
+ children: /* @__PURE__ */ S("div", {
57
57
  className: "p-5",
58
58
  children: [
59
- /* @__PURE__ */ C("div", {
59
+ /* @__PURE__ */ S("div", {
60
60
  className: "flex items-start justify-between mb-3",
61
- children: [/* @__PURE__ */ C("div", {
61
+ children: [/* @__PURE__ */ S("div", {
62
62
  className: "flex items-center gap-3",
63
- children: [/* @__PURE__ */ S("div", {
63
+ children: [/* @__PURE__ */ x("div", {
64
64
  className: "p-2 rounded-lg bg-bg-sunken/50",
65
- children: /* @__PURE__ */ S(s, {
65
+ children: /* @__PURE__ */ x(s, {
66
66
  type: e.template,
67
67
  size: 20
68
68
  })
69
- }), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("div", {
69
+ }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("div", {
70
70
  className: "flex items-center gap-2",
71
- children: [/* @__PURE__ */ S("h3", {
71
+ children: [/* @__PURE__ */ x("h3", {
72
72
  className: "font-semibold",
73
73
  children: e.name
74
- }), e.isDefault && /* @__PURE__ */ C(n, {
74
+ }), e.isDefault && /* @__PURE__ */ S(n, {
75
75
  variant: "default",
76
76
  className: "gap-1 text-xs bg-status-warning-bg-subtle text-status-warning-text border-border-default",
77
- children: [/* @__PURE__ */ S(y, { size: 10 }), o(F, "sandbox.adminTemplates.badges.default", "Default")]
77
+ children: [/* @__PURE__ */ x(v, { size: 10 }), o(F, "sandbox.adminTemplates.badges.default", "Default")]
78
78
  })]
79
- }), /* @__PURE__ */ S(s, {
79
+ }), /* @__PURE__ */ x(s, {
80
80
  type: e.template,
81
81
  size: 12,
82
82
  showLabel: !0,
83
83
  className: "mt-0.5"
84
84
  })] })]
85
- }), /* @__PURE__ */ S(i, { actions: [{
85
+ }), /* @__PURE__ */ x(i, { actions: [{
86
86
  label: o(F, "sandbox.adminTemplates.actions.edit.label", "Edit"),
87
87
  onSelect: () => W(e.id),
88
- icon: /* @__PURE__ */ S(_, { size: 14 })
88
+ icon: /* @__PURE__ */ x(g, { size: 14 })
89
89
  }, {
90
90
  label: o(F, "sandbox.adminTemplates.actions.delete.label", "Delete"),
91
91
  onSelect: () => H({
92
92
  id: e.id,
93
93
  name: e.name
94
94
  }),
95
- icon: /* @__PURE__ */ S(b, { size: 14 }),
95
+ icon: /* @__PURE__ */ x(y, { size: 14 }),
96
96
  intent: "destructive"
97
97
  }] })]
98
98
  }),
99
- e.description && /* @__PURE__ */ S("p", {
99
+ e.description && /* @__PURE__ */ x("p", {
100
100
  className: "text-sm text-text-secondary mb-3 line-clamp-2",
101
101
  children: e.description
102
102
  }),
103
- /* @__PURE__ */ C("div", {
103
+ /* @__PURE__ */ S("div", {
104
104
  className: "flex flex-wrap items-center gap-2",
105
105
  children: [
106
- /* @__PURE__ */ C(n, {
106
+ /* @__PURE__ */ S(n, {
107
107
  variant: "outline",
108
108
  className: "text-xs gap-1",
109
109
  children: [e.resources?.cpuRequest ?? "?", " CPU"]
110
110
  }),
111
- /* @__PURE__ */ C(n, {
111
+ /* @__PURE__ */ S(n, {
112
112
  variant: "outline",
113
113
  className: "text-xs gap-1",
114
114
  children: [e.resources?.memoryRequest ?? "?", " mem"]
115
115
  }),
116
- /* @__PURE__ */ C(n, {
116
+ /* @__PURE__ */ S(n, {
117
117
  variant: "outline",
118
118
  className: "text-xs gap-1",
119
- children: [/* @__PURE__ */ S(m, { size: 10 }), o(F, "sandbox.adminTemplates.meta.containers", "{count} containers", { count: e.containers?.length ?? 0 })]
119
+ children: [/* @__PURE__ */ x(p, { size: 10 }), o(F, "sandbox.adminTemplates.meta.containers", "{count} containers", { count: e.containers?.length ?? 0 })]
120
120
  }),
121
- /* @__PURE__ */ C(n, {
121
+ /* @__PURE__ */ S(n, {
122
122
  variant: "outline",
123
123
  className: "text-xs gap-1",
124
- children: [f(e.ttlSeconds), " TTL"]
124
+ children: [d(e.ttlSeconds), " TTL"]
125
125
  }),
126
- e.storage?.mode && e.storage.mode !== "NONE" && /* @__PURE__ */ C(n, {
126
+ e.storage?.mode && e.storage.mode !== "NONE" && /* @__PURE__ */ S(n, {
127
127
  variant: "outline",
128
128
  className: "text-xs gap-1",
129
129
  children: [e.storage.mode === "EPHEMERAL" ? o(F, "sandbox.adminTemplates.storage.ephemeral", "Ephemeral") : o(F, "sandbox.adminTemplates.storage.persistent", "Persistent"), e.storage.sizeGi ? ` ${e.storage.sizeGi}Gi` : ""]
130
130
  }),
131
- (e.allowedImages?.length ?? 0) > 0 && /* @__PURE__ */ S(n, {
131
+ (e.allowedImages?.length ?? 0) > 0 && /* @__PURE__ */ x(n, {
132
132
  variant: "outline",
133
133
  className: "text-xs gap-1",
134
134
  children: o(F, "sandbox.adminTemplates.meta.allowedImages", "{count} allowed images", { count: e.allowedImages.length })
@@ -138,20 +138,20 @@ function M() {
138
138
  ]
139
139
  })
140
140
  }, e.id))
141
- }) : /* @__PURE__ */ S(c, {
142
- icon: /* @__PURE__ */ S(h, { size: 48 }),
141
+ }) : /* @__PURE__ */ x(j, {
142
+ illustration: "onboarding",
143
143
  title: o(F, "sandbox.adminTemplates.empty.title", "No templates yet"),
144
144
  description: o(F, "sandbox.adminTemplates.empty.description", "Create templates for commonly used sandbox configurations to speed up provisioning."),
145
- action: /* @__PURE__ */ C(r, {
145
+ action: /* @__PURE__ */ S(r, {
146
146
  onClick: U,
147
- children: [/* @__PURE__ */ S(v, { size: 16 }), o(F, "sandbox.adminTemplates.empty.action", "Create First Template")]
147
+ children: [/* @__PURE__ */ x(_, { size: 16 }), o(F, "sandbox.adminTemplates.empty.action", "Create First Template")]
148
148
  })
149
- }), /* @__PURE__ */ S(w, {
149
+ }), /* @__PURE__ */ x(C, {
150
150
  open: V !== null,
151
151
  onOpenChange: (e) => {
152
152
  e || H(null);
153
153
  },
154
- children: /* @__PURE__ */ C(D, { children: [/* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: o(F, "sandbox.adminTemplates.actions.delete.ariaLabel", "Delete template") }), /* @__PURE__ */ S(O, { children: o(F, "sandbox.adminTemplates.actions.delete.confirm", "Delete template \"{name}\"? This cannot be undone.", { name: V?.name ?? "" }) })] }), /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(E, { children: "Cancel" }), /* @__PURE__ */ S(T, {
154
+ children: /* @__PURE__ */ S(E, { children: [/* @__PURE__ */ S(k, { children: [/* @__PURE__ */ x(A, { children: o(F, "sandbox.adminTemplates.actions.delete.ariaLabel", "Delete template") }), /* @__PURE__ */ x(D, { children: o(F, "sandbox.adminTemplates.actions.delete.confirm", "Delete template \"{name}\"? This cannot be undone.", { name: V?.name ?? "" }) })] }), /* @__PURE__ */ S(O, { children: [/* @__PURE__ */ x(T, { children: "Cancel" }), /* @__PURE__ */ x(w, {
155
155
  className: "bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90",
156
156
  onClick: () => {
157
157
  V && G(V.id);
@@ -1 +1 @@
1
- {"version":3,"file":"AdminTemplatesPage.js","names":[],"sources":["../../../src/sandbox/pages/AdminTemplatesPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Plus, LayoutTemplate, Pencil, Trash2, Star, Container, Loader2 } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from '@burdenoff/fe-libs/ui';\nimport { Button, Badge, GlassCard, CTAOverflowMenu } from '../components/ui';\nimport { SandboxTypeIcon } from '../components/SandboxTypeIcon';\nimport { useSandbox } from '../providers/SandboxProvider';\nimport { joinPath } from '../utils/navigation';\nimport { formatTTL } from '../utils/formatters';\nimport { tWithFallback } from '../utils/i18n';\nimport { PageLayout, EmptyState } from '../components/PageLayout';\nimport {\n useListSandboxTemplatesQuery,\n useDeleteSandboxTemplateMutation,\n} from '../../generated/wspace-operations';\nimport type { SandboxTemplate } from '../types';\n\n/**\n * Admin Templates Page\n * Full CRUD template management for workspace admins.\n * Admins can create, edit, and delete sandbox templates.\n */\nexport function AdminTemplatesPage() {\n const { basePath = '/', navigate, workspaceId } = useSandbox();\n const { t } = useI18n();\n const { data, loading, refetch } = useListSandboxTemplatesQuery({\n variables: { context: { workspaceId } },\n skip: !workspaceId,\n });\n const [deleteTemplate] = useDeleteSandboxTemplateMutation();\n const templates = (data?.listSandboxTemplates?.items ?? []) as SandboxTemplate[];\n const [pendingDelete, setPendingDelete] = useState<{ id: string; name: string } | null>(null);\n\n const handleCreate = () => {\n navigate?.(joinPath(basePath, 'templates/new'));\n };\n\n const handleEdit = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const performDelete = async (templateId: string) => {\n setPendingDelete(null);\n try {\n await deleteTemplate({\n variables: { context: { workspaceId }, id: templateId },\n });\n await refetch();\n } catch (err) {\n console.error('[Sandbox] Failed to delete template:', err);\n window.alert(\n tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.error',\n 'Failed to delete template. Please try again.'\n )\n );\n }\n };\n\n return (\n <PageLayout\n title={tWithFallback(t, 'sandbox.adminTemplates.title', 'Templates')}\n subtitle={tWithFallback(\n t,\n 'sandbox.adminTemplates.subtitle',\n 'Manage sandbox templates - create, edit, and configure predefined configurations'\n )}\n icon={<LayoutTemplate size={24} />}\n headerActions={\n <Button onClick={handleCreate} size=\"lg\">\n <Plus size={18} />\n {tWithFallback(t, 'sandbox.adminTemplates.actions.create', 'Create Template')}\n </Button>\n }\n headerContent={\n <Badge variant=\"secondary\">\n {tWithFallback(t, 'sandbox.adminTemplates.header.count', '{count} templates', {\n count: templates.length,\n })}\n </Badge>\n }\n >\n {loading ? (\n <div className=\"flex items-center justify-center min-h-[200px]\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n ) : templates.length > 0 ? (\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {templates.map((template, index) => (\n <GlassCard\n key={template.id}\n treatment=\"insight\"\n className=\"group animate-in fade-in-0 slide-in-from-bottom-2\"\n style={{ animationDelay: `${index * 50}ms` }}\n >\n <div className=\"p-5\">\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-bg-sunken/50\">\n <SandboxTypeIcon type={template.template} size={20} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold\">{template.name}</h3>\n {template.isDefault && (\n <Badge\n variant=\"default\"\n className=\"gap-1 text-xs bg-status-warning-bg-subtle text-status-warning-text border-border-default\"\n >\n <Star size={10} />\n {tWithFallback(t, 'sandbox.adminTemplates.badges.default', 'Default')}\n </Badge>\n )}\n </div>\n <SandboxTypeIcon\n type={template.template}\n size={12}\n showLabel\n className=\"mt-0.5\"\n />\n </div>\n </div>\n\n {/* Admin Actions — progressive disclosure via overflow menu */}\n <CTAOverflowMenu\n actions={[\n {\n label: tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.edit.label',\n 'Edit'\n ),\n onSelect: () => handleEdit(template.id),\n icon: <Pencil size={14} />,\n },\n {\n label: tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.label',\n 'Delete'\n ),\n onSelect: () => setPendingDelete({ id: template.id, name: template.name }),\n icon: <Trash2 size={14} />,\n intent: 'destructive',\n },\n ]}\n />\n </div>\n\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n\n {/* Resources & Info */}\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.resources?.cpuRequest ?? '?'} CPU\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.resources?.memoryRequest ?? '?'} mem\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n <Container size={10} />\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.meta.containers',\n '{count} containers',\n { count: template.containers?.length ?? 0 }\n )}\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {formatTTL(template.ttlSeconds)} TTL\n </Badge>\n {template.storage?.mode && template.storage.mode !== 'NONE' && (\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.storage.mode === 'EPHEMERAL'\n ? tWithFallback(t, 'sandbox.adminTemplates.storage.ephemeral', 'Ephemeral')\n : tWithFallback(\n t,\n 'sandbox.adminTemplates.storage.persistent',\n 'Persistent'\n )}\n {template.storage.sizeGi ? ` ${template.storage.sizeGi}Gi` : ''}\n </Badge>\n )}\n {(template.allowedImages?.length ?? 0) > 0 && (\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.meta.allowedImages',\n '{count} allowed images',\n { count: template.allowedImages!.length }\n )}\n </Badge>\n )}\n </div>\n </div>\n </GlassCard>\n ))}\n </div>\n ) : (\n <EmptyState\n icon={<LayoutTemplate size={48} />}\n title={tWithFallback(t, 'sandbox.adminTemplates.empty.title', 'No templates yet')}\n description={tWithFallback(\n t,\n 'sandbox.adminTemplates.empty.description',\n 'Create templates for commonly used sandbox configurations to speed up provisioning.'\n )}\n action={\n <Button onClick={handleCreate}>\n <Plus size={16} />\n {tWithFallback(t, 'sandbox.adminTemplates.empty.action', 'Create First Template')}\n </Button>\n }\n />\n )}\n <AlertDialog\n open={pendingDelete !== null}\n onOpenChange={(open) => {\n if (!open) setPendingDelete(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.ariaLabel',\n 'Delete template'\n )}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.confirm',\n 'Delete template \"{name}\"? This cannot be undone.',\n { name: pendingDelete?.name ?? '' }\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n className=\"bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90\"\n onClick={() => {\n if (pendingDelete) void performDelete(pendingDelete.id);\n }}\n >\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+BA,SAAgB,IAAqB;CACnC,IAAM,EAAE,cAAW,KAAK,aAAU,mBAAgB,GAAY,EACxD,EAAE,SAAM,GAAS,EACjB,EAAE,SAAM,YAAS,eAAY,EAA6B;EAC9D,WAAW,EAAE,SAAS,EAAE,gBAAa,EAAE;EACvC,MAAM,CAAC;EACR,CAAC,EACI,CAAC,KAAkB,GAAkC,EACrD,IAAa,GAAM,sBAAsB,SAAS,EAAE,EACpD,CAAC,GAAe,KAAoB,EAA8C,KAAK,EAEvF,UAAqB;AACzB,MAAW,EAAS,GAAU,gBAAgB,CAAC;IAG3C,KAAc,MAAuB;AACzC,MAAW,EAAS,GAAU,aAAa,IAAa,CAAC;IAGrD,IAAgB,OAAO,MAAuB;AAClD,IAAiB,KAAK;AACtB,MAAI;AAIF,GAHA,MAAM,EAAe,EACnB,WAAW;IAAE,SAAS,EAAE,gBAAa;IAAE,IAAI;IAAY,EACxD,CAAC,EACF,MAAM,GAAS;WACR,GAAK;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AAO,MAAM,GACvD;;SAER,EAAS,eAAe,UAAU,KAAK,KACvC,kBAAC,GAAD;SAAO,SAAQ;SAAU,WAAU;mBAChC,EACC,GACA,6CACA,0BACA,EAAE,OAAO,EAAS,cAAe,QAAQ,CAC1C;SACK,CAAA;QAEN;;MACF;;IACI,EA7GL,EAAS,GA6GJ,CACZ;GACE,CAAA,GAEN,kBAAC,GAAD;GACE,MAAM,kBAAC,GAAD,EAAgB,MAAM,IAAM,CAAA;GAClC,OAAO,EAAc,GAAG,sCAAsC,mBAAmB;GACjF,aAAa,EACX,GACA,4CACA,sFACD;GACD,QACE,kBAAC,GAAD;IAAQ,SAAS;cAAjB,CACE,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA,EACjB,EAAc,GAAG,uCAAuC,wBAAwB,CAC1E;;GAEX,CAAA,EAEJ,kBAAC,GAAD;GACE,MAAM,MAAkB;GACxB,eAAe,MAAS;AACtB,IAAK,KAAM,EAAiB,KAAK;;aAGnC,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACG,EACC,GACA,mDACA,kBACD,EACgB,CAAA,EACnB,kBAAC,GAAD,EAAA,UACG,EACC,GACA,iDACA,sDACA,EAAE,MAAM,GAAe,QAAQ,IAAI,CACpC,EACsB,CAAA,CACP,EAAA,CAAA,EACpB,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UAAmB,UAA0B,CAAA,EAC7C,kBAAC,GAAD;IACE,WAAU;IACV,eAAe;AACb,KAAI,KAAoB,EAAc,EAAc,GAAG;;cAE1D;IAEmB,CAAA,CACF,EAAA,CAAA,CACD,EAAA,CAAA;GACT,CAAA,CACH"}
1
+ {"version":3,"file":"AdminTemplatesPage.js","names":[],"sources":["../../../src/sandbox/pages/AdminTemplatesPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Plus, LayoutTemplate, Pencil, Trash2, Star, Container, Loader2 } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\nimport { Button, Badge, GlassCard, CTAOverflowMenu } from '../components/ui';\nimport { SandboxTypeIcon } from '../components/SandboxTypeIcon';\nimport { useSandbox } from '../providers/SandboxProvider';\nimport { joinPath } from '../utils/navigation';\nimport { formatTTL } from '../utils/formatters';\nimport { tWithFallback } from '../utils/i18n';\nimport { PageLayout } from '../components/PageLayout';\nimport {\n useListSandboxTemplatesQuery,\n useDeleteSandboxTemplateMutation,\n} from '../../generated/wspace-operations';\nimport type { SandboxTemplate } from '../types';\n\n/**\n * Admin Templates Page\n * Full CRUD template management for workspace admins.\n * Admins can create, edit, and delete sandbox templates.\n */\nexport function AdminTemplatesPage() {\n const { basePath = '/', navigate, workspaceId } = useSandbox();\n const { t } = useI18n();\n const { data, loading, refetch } = useListSandboxTemplatesQuery({\n variables: { context: { workspaceId } },\n skip: !workspaceId,\n });\n const [deleteTemplate] = useDeleteSandboxTemplateMutation();\n const templates = (data?.listSandboxTemplates?.items ?? []) as SandboxTemplate[];\n const [pendingDelete, setPendingDelete] = useState<{ id: string; name: string } | null>(null);\n\n const handleCreate = () => {\n navigate?.(joinPath(basePath, 'templates/new'));\n };\n\n const handleEdit = (templateId: string) => {\n navigate?.(joinPath(basePath, `templates/${templateId}`));\n };\n\n const performDelete = async (templateId: string) => {\n setPendingDelete(null);\n try {\n await deleteTemplate({\n variables: { context: { workspaceId }, id: templateId },\n });\n await refetch();\n } catch (err) {\n console.error('[Sandbox] Failed to delete template:', err);\n window.alert(\n tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.error',\n 'Failed to delete template. Please try again.'\n )\n );\n }\n };\n\n return (\n <PageLayout\n title={tWithFallback(t, 'sandbox.adminTemplates.title', 'Templates')}\n subtitle={tWithFallback(\n t,\n 'sandbox.adminTemplates.subtitle',\n 'Manage sandbox templates - create, edit, and configure predefined configurations'\n )}\n icon={<LayoutTemplate size={24} />}\n headerActions={\n <Button onClick={handleCreate} size=\"lg\">\n <Plus size={18} />\n {tWithFallback(t, 'sandbox.adminTemplates.actions.create', 'Create Template')}\n </Button>\n }\n headerContent={\n <Badge variant=\"secondary\">\n {tWithFallback(t, 'sandbox.adminTemplates.header.count', '{count} templates', {\n count: templates.length,\n })}\n </Badge>\n }\n >\n {loading ? (\n <div className=\"flex items-center justify-center min-h-[200px]\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n ) : templates.length > 0 ? (\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n {templates.map((template, index) => (\n <GlassCard\n key={template.id}\n treatment=\"insight\"\n className=\"group animate-in fade-in-0 slide-in-from-bottom-2\"\n style={{ animationDelay: `${index * 50}ms` }}\n >\n <div className=\"p-5\">\n <div className=\"flex items-start justify-between mb-3\">\n <div className=\"flex items-center gap-3\">\n <div className=\"p-2 rounded-lg bg-bg-sunken/50\">\n <SandboxTypeIcon type={template.template} size={20} />\n </div>\n <div>\n <div className=\"flex items-center gap-2\">\n <h3 className=\"font-semibold\">{template.name}</h3>\n {template.isDefault && (\n <Badge\n variant=\"default\"\n className=\"gap-1 text-xs bg-status-warning-bg-subtle text-status-warning-text border-border-default\"\n >\n <Star size={10} />\n {tWithFallback(t, 'sandbox.adminTemplates.badges.default', 'Default')}\n </Badge>\n )}\n </div>\n <SandboxTypeIcon\n type={template.template}\n size={12}\n showLabel\n className=\"mt-0.5\"\n />\n </div>\n </div>\n\n {/* Admin Actions — progressive disclosure via overflow menu */}\n <CTAOverflowMenu\n actions={[\n {\n label: tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.edit.label',\n 'Edit'\n ),\n onSelect: () => handleEdit(template.id),\n icon: <Pencil size={14} />,\n },\n {\n label: tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.label',\n 'Delete'\n ),\n onSelect: () => setPendingDelete({ id: template.id, name: template.name }),\n icon: <Trash2 size={14} />,\n intent: 'destructive',\n },\n ]}\n />\n </div>\n\n {template.description && (\n <p className=\"text-sm text-text-secondary mb-3 line-clamp-2\">\n {template.description}\n </p>\n )}\n\n {/* Resources & Info */}\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.resources?.cpuRequest ?? '?'} CPU\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.resources?.memoryRequest ?? '?'} mem\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n <Container size={10} />\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.meta.containers',\n '{count} containers',\n { count: template.containers?.length ?? 0 }\n )}\n </Badge>\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {formatTTL(template.ttlSeconds)} TTL\n </Badge>\n {template.storage?.mode && template.storage.mode !== 'NONE' && (\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {template.storage.mode === 'EPHEMERAL'\n ? tWithFallback(t, 'sandbox.adminTemplates.storage.ephemeral', 'Ephemeral')\n : tWithFallback(\n t,\n 'sandbox.adminTemplates.storage.persistent',\n 'Persistent'\n )}\n {template.storage.sizeGi ? ` ${template.storage.sizeGi}Gi` : ''}\n </Badge>\n )}\n {(template.allowedImages?.length ?? 0) > 0 && (\n <Badge variant=\"outline\" className=\"text-xs gap-1\">\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.meta.allowedImages',\n '{count} allowed images',\n { count: template.allowedImages!.length }\n )}\n </Badge>\n )}\n </div>\n </div>\n </GlassCard>\n ))}\n </div>\n ) : (\n <IllustratedEmptyState\n illustration=\"onboarding\"\n title={tWithFallback(t, 'sandbox.adminTemplates.empty.title', 'No templates yet')}\n description={tWithFallback(\n t,\n 'sandbox.adminTemplates.empty.description',\n 'Create templates for commonly used sandbox configurations to speed up provisioning.'\n )}\n action={\n <Button onClick={handleCreate}>\n <Plus size={16} />\n {tWithFallback(t, 'sandbox.adminTemplates.empty.action', 'Create First Template')}\n </Button>\n }\n />\n )}\n <AlertDialog\n open={pendingDelete !== null}\n onOpenChange={(open) => {\n if (!open) setPendingDelete(null);\n }}\n >\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.ariaLabel',\n 'Delete template'\n )}\n </AlertDialogTitle>\n <AlertDialogDescription>\n {tWithFallback(\n t,\n 'sandbox.adminTemplates.actions.delete.confirm',\n 'Delete template \"{name}\"? This cannot be undone.',\n { name: pendingDelete?.name ?? '' }\n )}\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n className=\"bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90\"\n onClick={() => {\n if (pendingDelete) void performDelete(pendingDelete.id);\n }}\n >\n Delete\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAgCA,SAAgB,IAAqB;CACnC,IAAM,EAAE,cAAW,KAAK,aAAU,mBAAgB,GAAY,EACxD,EAAE,SAAM,GAAS,EACjB,EAAE,SAAM,YAAS,eAAY,EAA6B;EAC9D,WAAW,EAAE,SAAS,EAAE,gBAAa,EAAE;EACvC,MAAM,CAAC;EACR,CAAC,EACI,CAAC,KAAkB,GAAkC,EACrD,IAAa,GAAM,sBAAsB,SAAS,EAAE,EACpD,CAAC,GAAe,KAAoB,EAA8C,KAAK,EAEvF,UAAqB;AACzB,MAAW,EAAS,GAAU,gBAAgB,CAAC;IAG3C,KAAc,MAAuB;AACzC,MAAW,EAAS,GAAU,aAAa,IAAa,CAAC;IAGrD,IAAgB,OAAO,MAAuB;AAClD,IAAiB,KAAK;AACtB,MAAI;AAIF,GAHA,MAA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