@burdenoff/microfe-sandbox 2026.623.1 → 2026.624.1
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/sandbox/components/FilesFolderPicker.js +11 -11
- package/dist/sandbox/components/FilesFolderPicker.js.map +1 -1
- package/dist/sandbox/components/PageLayout.js +3 -3
- package/dist/sandbox/components/PageLayout.js.map +1 -1
- package/dist/sandbox/components/ResourceDisplay.js +3 -3
- package/dist/sandbox/components/ResourceDisplay.js.map +1 -1
- package/dist/sandbox/components/RouteUtils.js +5 -5
- package/dist/sandbox/components/RouteUtils.js.map +1 -1
- package/dist/sandbox/components/SandboxActivityTab.js +1 -1
- package/dist/sandbox/components/SandboxActivityTab.js.map +1 -1
- package/dist/sandbox/components/SandboxAgentAppPanel.js +1 -1
- package/dist/sandbox/components/SandboxAgentAppPanel.js.map +1 -1
- package/dist/sandbox/components/SandboxScriptRunnerPanel.js +13 -13
- package/dist/sandbox/components/SandboxScriptRunnerPanel.js.map +1 -1
- package/dist/sandbox/components/StatusBadge.js +2 -2
- package/dist/sandbox/components/StatusBadge.js.map +1 -1
- package/dist/sandbox/components/TagsInput.js +1 -1
- package/dist/sandbox/components/TagsInput.js.map +1 -1
- package/dist/sandbox/pages/AdminTemplatesPage.js +3 -3
- package/dist/sandbox/pages/AdminTemplatesPage.js.map +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.js +70 -70
- package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -1
- package/dist/sandbox/pages/SandboxDetailPage.js +46 -46
- package/dist/sandbox/pages/SandboxDetailPage.js.map +1 -1
- package/dist/sandbox/pages/SandboxListPage.js +22 -22
- package/dist/sandbox/pages/SandboxListPage.js.map +1 -1
- package/dist/sandbox/pages/TemplateDetailPage.js +32 -32
- package/dist/sandbox/pages/TemplateDetailPage.js.map +1 -1
- package/dist/sandbox/pages/UserTemplatesPage.js +2 -2
- package/dist/sandbox/pages/UserTemplatesPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,28 +27,28 @@ function v({ value: v, onChange: y }) {
|
|
|
27
27
|
}), v !== null && /* @__PURE__ */ h("button", {
|
|
28
28
|
type: "button",
|
|
29
29
|
onClick: () => y(null),
|
|
30
|
-
className: "text-xs text-
|
|
30
|
+
className: "text-xs text-text-secondary hover:text-text-primary transition-colors",
|
|
31
31
|
children: n(b, "sandbox.create.fields.filesFolder.clear", "Clear")
|
|
32
32
|
})]
|
|
33
33
|
}),
|
|
34
34
|
/* @__PURE__ */ h("p", {
|
|
35
|
-
className: "text-xs text-
|
|
35
|
+
className: "text-xs text-text-secondary",
|
|
36
36
|
children: n(b, "sandbox.create.fields.filesFolder.help", "When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.")
|
|
37
37
|
}),
|
|
38
38
|
A && /* @__PURE__ */ g("div", {
|
|
39
|
-
className: "flex items-center gap-2 text-xs text-
|
|
39
|
+
className: "flex items-center gap-2 text-xs text-status-error-text",
|
|
40
40
|
children: [/* @__PURE__ */ h(c, { className: "size-4" }), A.message]
|
|
41
41
|
}),
|
|
42
42
|
/* @__PURE__ */ g("div", {
|
|
43
|
-
className: "border-2 border-border rounded-lg bg-
|
|
43
|
+
className: "border-2 border-border-subtle rounded-lg bg-bg-surface max-h-56 overflow-y-auto",
|
|
44
44
|
children: [k && F.length === 0 ? /* @__PURE__ */ g("div", {
|
|
45
|
-
className: "flex items-center justify-center py-6 text-
|
|
45
|
+
className: "flex items-center justify-center py-6 text-text-secondary",
|
|
46
46
|
children: [/* @__PURE__ */ h(f, { className: "size-4 animate-spin mr-2" }), /* @__PURE__ */ h("span", {
|
|
47
47
|
className: "text-sm",
|
|
48
48
|
children: n(b, "sandbox.create.fields.filesFolder.loading", "Loading folders…")
|
|
49
49
|
})]
|
|
50
50
|
}) : F.length === 0 ? /* @__PURE__ */ h("div", {
|
|
51
|
-
className: "px-4 py-6 text-sm text-
|
|
51
|
+
className: "px-4 py-6 text-sm text-text-secondary text-center",
|
|
52
52
|
children: n(b, "sandbox.create.fields.filesFolder.empty", "No folders yet — create one below.")
|
|
53
53
|
}) : /* @__PURE__ */ h("ul", {
|
|
54
54
|
className: "divide-y divide-border",
|
|
@@ -57,16 +57,16 @@ function v({ value: v, onChange: y }) {
|
|
|
57
57
|
return /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g("button", {
|
|
58
58
|
type: "button",
|
|
59
59
|
onClick: () => y(e.id),
|
|
60
|
-
className: `w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-
|
|
60
|
+
className: `w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-bg-sunken ${t ? "bg-action-primary-bg/10" : ""}`,
|
|
61
61
|
children: [
|
|
62
|
-
t ? /* @__PURE__ */ h(d, { className: "size-4 text-primary" }) : /* @__PURE__ */ h(u, { className: "size-4 text-
|
|
62
|
+
t ? /* @__PURE__ */ h(d, { className: "size-4 text-primary" }) : /* @__PURE__ */ h(u, { className: "size-4 text-text-secondary" }),
|
|
63
63
|
/* @__PURE__ */ g("div", {
|
|
64
64
|
className: "flex-1 min-w-0",
|
|
65
65
|
children: [/* @__PURE__ */ h("p", {
|
|
66
66
|
className: "text-sm font-medium truncate",
|
|
67
67
|
children: e.name
|
|
68
68
|
}), e.path && /* @__PURE__ */ h("p", {
|
|
69
|
-
className: "text-xs text-
|
|
69
|
+
className: "text-xs text-text-secondary truncate",
|
|
70
70
|
children: e.path
|
|
71
71
|
})]
|
|
72
72
|
}),
|
|
@@ -75,7 +75,7 @@ function v({ value: v, onChange: y }) {
|
|
|
75
75
|
}) }, e.id);
|
|
76
76
|
})
|
|
77
77
|
}), I && /* @__PURE__ */ h("div", {
|
|
78
|
-
className: "border-t border-border p-2",
|
|
78
|
+
className: "border-t border-border-subtle p-2",
|
|
79
79
|
children: /* @__PURE__ */ g(e, {
|
|
80
80
|
type: "button",
|
|
81
81
|
variant: "ghost",
|
|
@@ -148,7 +148,7 @@ function v({ value: v, onChange: y }) {
|
|
|
148
148
|
children: [/* @__PURE__ */ h(p, { className: "size-3 mr-2" }), n(b, "sandbox.create.fields.filesFolder.createNew", "Create folder")]
|
|
149
149
|
}),
|
|
150
150
|
E && /* @__PURE__ */ g("div", {
|
|
151
|
-
className: "flex items-center gap-2 text-xs text-
|
|
151
|
+
className: "flex items-center gap-2 text-xs text-status-error-text",
|
|
152
152
|
children: [/* @__PURE__ */ h(c, { className: "size-4" }), E]
|
|
153
153
|
})
|
|
154
154
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesFolderPicker.js","names":[],"sources":["../../../src/sandbox/components/FilesFolderPicker.tsx"],"sourcesContent":["import { useState, useMemo, useRef } from 'react';\nimport { FolderOpen, Folder, Plus, Loader2, Check, AlertCircle } from 'lucide-react';\nimport { Button, Input } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useSandboxGetFoldersQuery,\n useSandboxCreateFolderMutation,\n} from '../../generated/wspace-operations';\n\nconst PAGE_SIZE = 20;\n\ninterface FilesFolderPickerProps {\n /** Currently selected folder id (uncontrolled-leaning controlled). */\n value: string | null;\n /** Fired with the selected folder id (or null when cleared). */\n onChange: (folderId: string | null) => void;\n}\n\n/**\n * Picks a files-svc folder for sandbox volume export on stop.\n *\n * Behaviour:\n * - Lists folders from the workspaces gateway via `getFolders` (offset paging\n * — wspace.graphql exposes limit/offset, not cursor).\n * - \"Load more\" appends; \"Create folder\" inline action calls `createFolder`\n * and selects the newly created folder.\n * - Selection writes the folder id back through `onChange`.\n *\n * Styling sticks to semantic tokens (`bg-card`, `text-muted-foreground`,\n * `border-border`, `text-primary`) — no raw colours.\n */\nexport function FilesFolderPicker({ value, onChange }: FilesFolderPickerProps) {\n const { t } = useI18n();\n const offsetRef = useRef(0);\n const [creating, setCreating] = useState(false);\n const [newFolderName, setNewFolderName] = useState('');\n const [createError, setCreateError] = useState<string | null>(null);\n\n const { data, loading, error, fetchMore, refetch } = useSandboxGetFoldersQuery({\n variables: { pagination: { limit: PAGE_SIZE, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createFolderMutation, { loading: createLoading }] = useSandboxCreateFolderMutation();\n\n interface FolderRow {\n id: string;\n name: string;\n path: string;\n parentFolderId?: string | null;\n }\n const folders: FolderRow[] = useMemo(\n () => (data?.getFolders.folders ?? []) as FolderRow[],\n [data]\n );\n const hasMore = data?.getFolders.hasMore ?? false;\n\n const handleLoadMore = async (): Promise<void> => {\n const next = offsetRef.current + PAGE_SIZE;\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: next } },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n getFolders: {\n ...fetchMoreResult.getFolders,\n folders: [...prev.getFolders.folders, ...fetchMoreResult.getFolders.folders],\n },\n };\n },\n });\n offsetRef.current = next;\n };\n\n const handleCreate = async (): Promise<void> => {\n const name = newFolderName.trim();\n if (!name) return;\n setCreateError(null);\n try {\n const result = await createFolderMutation({ variables: { input: { name } } });\n const created = result.data?.createFolder;\n if (created) {\n onChange(created.id);\n setNewFolderName('');\n setCreating(false);\n await refetch();\n }\n } catch (err) {\n setCreateError(err instanceof Error ? err.message : String(err));\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between\">\n <label className=\"block text-sm font-semibold\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.label', 'Export folder (files-svc)')}\n </label>\n {value !== null && (\n <button\n type=\"button\"\n onClick={() => onChange(null)}\n className=\"text-xs text-muted-foreground hover:text-foreground transition-colors\"\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.clear', 'Clear')}\n </button>\n )}\n </div>\n\n <p className=\"text-xs text-muted-foreground\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.help',\n 'When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.'\n )}\n </p>\n\n {error && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"size-4\" />\n {error.message}\n </div>\n )}\n\n <div className=\"border-2 border-border rounded-lg bg-background max-h-56 overflow-y-auto\">\n {loading && folders.length === 0 ? (\n <div className=\"flex items-center justify-center py-6 text-muted-foreground\">\n <Loader2 className=\"size-4 animate-spin mr-2\" />\n <span className=\"text-sm\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loading', 'Loading folders…')}\n </span>\n </div>\n ) : folders.length === 0 ? (\n <div className=\"px-4 py-6 text-sm text-muted-foreground text-center\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.empty',\n 'No folders yet — create one below.'\n )}\n </div>\n ) : (\n <ul className=\"divide-y divide-border\">\n {folders.map((folder) => {\n const isSelected = folder.id === value;\n return (\n <li key={folder.id}>\n <button\n type=\"button\"\n onClick={() => onChange(folder.id)}\n className={`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-muted ${\n isSelected ? 'bg-primary/10' : ''\n }`}\n >\n {isSelected ? (\n <FolderOpen className=\"size-4 text-primary\" />\n ) : (\n <Folder className=\"size-4 text-muted-foreground\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">{folder.name}</p>\n {folder.path && (\n <p className=\"text-xs text-muted-foreground truncate\">{folder.path}</p>\n )}\n </div>\n {isSelected && <Check className=\"size-4 text-primary\" />}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n\n {hasMore && (\n <div className=\"border-t border-border p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleLoadMore}\n disabled={loading}\n className=\"w-full\"\n >\n {loading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loadMore', 'Load more')}\n </Button>\n </div>\n )}\n </div>\n\n {creating ? (\n <div className=\"flex items-center gap-2\">\n <Input\n value={newFolderName}\n onChange={(e) => setNewFolderName(e.target.value)}\n placeholder={tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.newPlaceholder',\n 'Folder name'\n )}\n className=\"flex-1\"\n autoFocus\n />\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={handleCreate}\n disabled={createLoading || newFolderName.trim().length === 0}\n >\n {createLoading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createConfirm', 'Create')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setCreating(false);\n setNewFolderName('');\n setCreateError(null);\n }}\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.cancel', 'Cancel')}\n </Button>\n </div>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setCreating(true)}>\n <Plus className=\"size-3 mr-2\" />\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createNew', 'Create folder')}\n </Button>\n )}\n\n {createError && (\n <div className=\"flex items-center gap-2 text-xs text-destructive\">\n <AlertCircle className=\"size-4\" />\n {createError}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,IAAY;AAsBlB,SAAgB,EAAkB,EAAE,UAAO,eAAoC;CAC7E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAY,EAAO,EAAE,EACrB,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAe,KAAoB,EAAS,GAAG,EAChD,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,EAAE,SAAM,YAAS,UAAO,cAAW,eAAY,EAA0B;EAC7E,WAAW,EAAE,YAAY;GAAE,OAAO;GAAW,QAAQ;GAAG,EAAE;EAC1D,aAAa;EACb,6BAA6B;EAC9B,CAAC,EAEI,CAAC,GAAsB,EAAE,SAAS,OAAmB,GAAgC,EAQrF,IAAuB,QACpB,GAAM,WAAW,WAAW,EAAE,EACrC,CAAC,EAAK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ACZ,WAAe,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,CAAC;;;;MAsH1D,UAAU,KAAiB,EAAc,MAAM,CAAC,WAAW;gBAJ7D,CAMG,IAAgB,kBAAC,GAAD,EAAS,WAAU,4BAA6B,CAAA,GAAG,MACnE,EAAc,GAAG,mDAAmD,SAAS,CACvE;;KACT,kBAAC,GAAD;MACE,MAAK;MACL,MAAK;MACL,SAAQ;MACR,eAAe;AAGb,OAFA,EAAY,GAAM,EAClB,EAAiB,GAAG,EACpB,EAAe,KAAK;;gBAGrB,EAAc,GAAG,4CAA4C,SAAS;MAChE,CAAA;KACL;QAEN,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,MAAK;IAAK,eAAe,EAAY,GAAK;cAAlF,CACE,kBAAC,GAAD,EAAM,WAAU,eAAgB,CAAA,EAC/B,EAAc,GAAG,+CAA+C,gBAAgB,CAC1E;;GAGV,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA,EACjC,EACG;;GAEJ"}
|
|
1
|
+
{"version":3,"file":"FilesFolderPicker.js","names":[],"sources":["../../../src/sandbox/components/FilesFolderPicker.tsx"],"sourcesContent":["import { useState, useMemo, useRef } from 'react';\nimport { FolderOpen, Folder, Plus, Loader2, Check, AlertCircle } from 'lucide-react';\nimport { Button, Input } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n useSandboxGetFoldersQuery,\n useSandboxCreateFolderMutation,\n} from '../../generated/wspace-operations';\n\nconst PAGE_SIZE = 20;\n\ninterface FilesFolderPickerProps {\n /** Currently selected folder id (uncontrolled-leaning controlled). */\n value: string | null;\n /** Fired with the selected folder id (or null when cleared). */\n onChange: (folderId: string | null) => void;\n}\n\n/**\n * Picks a files-svc folder for sandbox volume export on stop.\n *\n * Behaviour:\n * - Lists folders from the workspaces gateway via `getFolders` (offset paging\n * — wspace.graphql exposes limit/offset, not cursor).\n * - \"Load more\" appends; \"Create folder\" inline action calls `createFolder`\n * and selects the newly created folder.\n * - Selection writes the folder id back through `onChange`.\n *\n * Styling sticks to semantic tokens (`bg-bg-surface`, `text-text-secondary`,\n * `border-border-subtle`, `text-primary`) — no raw colours.\n */\nexport function FilesFolderPicker({ value, onChange }: FilesFolderPickerProps) {\n const { t } = useI18n();\n const offsetRef = useRef(0);\n const [creating, setCreating] = useState(false);\n const [newFolderName, setNewFolderName] = useState('');\n const [createError, setCreateError] = useState<string | null>(null);\n\n const { data, loading, error, fetchMore, refetch } = useSandboxGetFoldersQuery({\n variables: { pagination: { limit: PAGE_SIZE, offset: 0 } },\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createFolderMutation, { loading: createLoading }] = useSandboxCreateFolderMutation();\n\n interface FolderRow {\n id: string;\n name: string;\n path: string;\n parentFolderId?: string | null;\n }\n const folders: FolderRow[] = useMemo(\n () => (data?.getFolders.folders ?? []) as FolderRow[],\n [data]\n );\n const hasMore = data?.getFolders.hasMore ?? false;\n\n const handleLoadMore = async (): Promise<void> => {\n const next = offsetRef.current + PAGE_SIZE;\n await fetchMore({\n variables: { pagination: { limit: PAGE_SIZE, offset: next } },\n updateQuery: (prev, { fetchMoreResult }) => {\n if (!fetchMoreResult) return prev;\n return {\n ...fetchMoreResult,\n getFolders: {\n ...fetchMoreResult.getFolders,\n folders: [...prev.getFolders.folders, ...fetchMoreResult.getFolders.folders],\n },\n };\n },\n });\n offsetRef.current = next;\n };\n\n const handleCreate = async (): Promise<void> => {\n const name = newFolderName.trim();\n if (!name) return;\n setCreateError(null);\n try {\n const result = await createFolderMutation({ variables: { input: { name } } });\n const created = result.data?.createFolder;\n if (created) {\n onChange(created.id);\n setNewFolderName('');\n setCreating(false);\n await refetch();\n }\n } catch (err) {\n setCreateError(err instanceof Error ? err.message : String(err));\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-between\">\n <label className=\"block text-sm font-semibold\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.label', 'Export folder (files-svc)')}\n </label>\n {value !== null && (\n <button\n type=\"button\"\n onClick={() => onChange(null)}\n className=\"text-xs text-text-secondary hover:text-text-primary transition-colors\"\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.clear', 'Clear')}\n </button>\n )}\n </div>\n\n <p className=\"text-xs text-text-secondary\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.help',\n 'When the sandbox stops, the volume contents are best-effort copied to this folder. Leave empty to skip export.'\n )}\n </p>\n\n {error && (\n <div className=\"flex items-center gap-2 text-xs text-status-error-text\">\n <AlertCircle className=\"size-4\" />\n {error.message}\n </div>\n )}\n\n <div className=\"border-2 border-border-subtle rounded-lg bg-bg-surface max-h-56 overflow-y-auto\">\n {loading && folders.length === 0 ? (\n <div className=\"flex items-center justify-center py-6 text-text-secondary\">\n <Loader2 className=\"size-4 animate-spin mr-2\" />\n <span className=\"text-sm\">\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loading', 'Loading folders…')}\n </span>\n </div>\n ) : folders.length === 0 ? (\n <div className=\"px-4 py-6 text-sm text-text-secondary text-center\">\n {tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.empty',\n 'No folders yet — create one below.'\n )}\n </div>\n ) : (\n <ul className=\"divide-y divide-border\">\n {folders.map((folder) => {\n const isSelected = folder.id === value;\n return (\n <li key={folder.id}>\n <button\n type=\"button\"\n onClick={() => onChange(folder.id)}\n className={`w-full flex items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-bg-sunken ${\n isSelected ? 'bg-action-primary-bg/10' : ''\n }`}\n >\n {isSelected ? (\n <FolderOpen className=\"size-4 text-primary\" />\n ) : (\n <Folder className=\"size-4 text-text-secondary\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">{folder.name}</p>\n {folder.path && (\n <p className=\"text-xs text-text-secondary truncate\">{folder.path}</p>\n )}\n </div>\n {isSelected && <Check className=\"size-4 text-primary\" />}\n </button>\n </li>\n );\n })}\n </ul>\n )}\n\n {hasMore && (\n <div className=\"border-t border-border-subtle p-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleLoadMore}\n disabled={loading}\n className=\"w-full\"\n >\n {loading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.loadMore', 'Load more')}\n </Button>\n </div>\n )}\n </div>\n\n {creating ? (\n <div className=\"flex items-center gap-2\">\n <Input\n value={newFolderName}\n onChange={(e) => setNewFolderName(e.target.value)}\n placeholder={tWithFallback(\n t,\n 'sandbox.create.fields.filesFolder.newPlaceholder',\n 'Folder name'\n )}\n className=\"flex-1\"\n autoFocus\n />\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={handleCreate}\n disabled={createLoading || newFolderName.trim().length === 0}\n >\n {createLoading ? <Loader2 className=\"size-3 animate-spin mr-2\" /> : null}\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createConfirm', 'Create')}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => {\n setCreating(false);\n setNewFolderName('');\n setCreateError(null);\n }}\n >\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.cancel', 'Cancel')}\n </Button>\n </div>\n ) : (\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={() => setCreating(true)}>\n <Plus className=\"size-3 mr-2\" />\n {tWithFallback(t, 'sandbox.create.fields.filesFolder.createNew', 'Create folder')}\n </Button>\n )}\n\n {createError && (\n <div className=\"flex items-center gap-2 text-xs text-status-error-text\">\n <AlertCircle className=\"size-4\" />\n {createError}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,IAAY;AAsBlB,SAAgB,EAAkB,EAAE,UAAO,eAAoC;CAC7E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAY,EAA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,EACX,GACA,oDACA,cACD;MACD,WAAU;MACV,WAAA;MACA,CAAA;KACF,kBAAC,GAAD;MACE,MAAK;MACL,MAAK;MACL,SAnIW,YAA2B;OAC9C,IAAM,IAAO,EAAc,MAAM;AAC5B,cACL;UAAe,KAAK;AACpB,YAAI;SAEF,IAAM,KADS,MAAM,EAAqB,EAAE,WAAW,EAAE,OAAO,EAAE,SAAM,EAAE,EAAE,CAAC,EACtD,MAAM;AAC7B,SAAI,MACF,EAAS,EAAQ,GAAG,EACpB,EAAiB,GAAG,EACpB,EAAY,GAAM,EAClB,MAAM,GAAS;iBAEV,GAAK;AACZ,WAAe,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,CAAC;;;;MAsH1D,UAAU,KAAiB,EAAc,MAAM,CAAC,WAAW;gBAJ7D,CAMG,IAAgB,kBAAC,GAAD,EAAS,WAAU,4BAA6B,CAAA,GAAG,MACnE,EAAc,GAAG,mDAAmD,SAAS,CACvE;;KACT,kBAAC,GAAD;MACE,MAAK;MACL,MAAK;MACL,SAAQ;MACR,eAAe;AAGb,OAFA,EAAY,GAAM,EAClB,EAAiB,GAAG,EACpB,EAAe,KAAK;;gBAGrB,EAAc,GAAG,4CAA4C,SAAS;MAChE,CAAA;KACL;QAEN,kBAAC,GAAD;IAAQ,MAAK;IAAS,SAAQ;IAAU,MAAK;IAAK,eAAe,EAAY,GAAK;cAAlF,CACE,kBAAC,GAAD,EAAM,WAAU,eAAgB,CAAA,EAC/B,EAAc,GAAG,+CAA+C,gBAAgB,CAC1E;;GAGV,KACC,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD,EAAa,WAAU,UAAW,CAAA,EACjC,EACG;;GAEJ"}
|
|
@@ -25,14 +25,14 @@ function a({ children: r, title: a, subtitle: o, icon: s, headerActions: c, head
|
|
|
25
25
|
children: [(a || s) && /* @__PURE__ */ n("div", {
|
|
26
26
|
className: "flex items-center gap-3",
|
|
27
27
|
children: [s && /* @__PURE__ */ t("div", {
|
|
28
|
-
className: "flex-shrink-0 p-2.5 rounded-xl bg-primary/10 text-primary",
|
|
28
|
+
className: "flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary",
|
|
29
29
|
children: s
|
|
30
30
|
}), a && /* @__PURE__ */ t("h1", {
|
|
31
|
-
className: "text-2xl sm:text-3xl font-bold tracking-tight text-
|
|
31
|
+
className: "text-2xl sm:text-3xl font-bold tracking-tight text-text-primary",
|
|
32
32
|
children: a
|
|
33
33
|
})]
|
|
34
34
|
}), o && /* @__PURE__ */ t("p", {
|
|
35
|
-
className: "text-sm sm:text-base text-
|
|
35
|
+
className: "text-sm sm:text-base text-text-secondary max-w-2xl",
|
|
36
36
|
children: o
|
|
37
37
|
})]
|
|
38
38
|
}), c && /* @__PURE__ */ t("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/sandbox/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { EmptyState as CanonicalEmptyState } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm',\n md: 'max-w-screen-md',\n lg: 'max-w-screen-lg',\n xl: 'max-w-screen-xl',\n '2xl': 'max-w-screen-2xl',\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n 'min-h-screen w-full bg-bg-surface text-text-primary',\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n 'py-6 sm:py-8 lg:py-10',\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-500',\n className\n )}\n >\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-primary/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-
|
|
1
|
+
{"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/sandbox/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { EmptyState as CanonicalEmptyState } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm',\n md: 'max-w-screen-md',\n lg: 'max-w-screen-lg',\n xl: 'max-w-screen-xl',\n '2xl': 'max-w-screen-2xl',\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n 'min-h-screen w-full bg-bg-surface text-text-primary',\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n 'py-6 sm:py-8 lg:py-10',\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-500',\n className\n )}\n >\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-text-primary\">\n {title}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-text-secondary max-w-2xl\">{subtitle}</p>\n )}\n </div>\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * Local wrapper around the canonical `EmptyState` from `@burdenoff/fe-libs/ui`.\n * Keeps the existing microfe-sandbox call sites stable while routing all\n * empty-state rendering through the shared primitive.\n */\nexport function EmptyState({\n icon,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n return (\n <div className={className}>\n <CanonicalEmptyState icon={icon} title={title} description={description} action={action} />\n </div>\n );\n}\n"],"mappings":";;;;AA0BA,IAAM,IAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACP;AAKD,SAAgB,EAAW,EACzB,aACA,UACA,aACA,SACA,kBACA,kBACA,cAAW,MACX,gBAAa,IACb,cACA,uBACkB;AAClB,QACE,kBAAC,OAAD;EACE,WAAW,EACT,uDACA,iCACA,yBACA,4DACA,EACD;YAED,kBAAC,OAAD;GAAK,WAAW,EAAG,kBAAkB,EAAgB,IAAW,EAAiB;aAAjF,CACG,MAAe,KAAS,MACvB,kBAAC,UAAD;IAAQ,WAAU;cAAlB,CACE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,OAAD;MAAK,WAAU;gBAAf,EACI,KAAS,MACT,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACG,KACC,kBAAC,OAAD;QAAK,WAAU;kBACZ;QACG,CAAA,EAEP,KACC,kBAAC,MAAD;QAAI,WAAU;kBACX;QACE,CAAA,CAEH;UAEP,KACC,kBAAC,KAAD;OAAG,WAAU;iBAAsD;OAAa,CAAA,CAE9E;SACL,KACC,kBAAC,OAAD;MAAK,WAAU;gBAAyC;MAAoB,CAAA,CAE1E;QACL,KAAiB,kBAAC,OAAD;KAAK,WAAU;eAAQ;KAAoB,CAAA,CACtD;OAKX,kBAAC,OAAD;IAAK,WAAU;IAAa;IAAe,CAAA,CACvC;;EACF,CAAA;;AASV,SAAgB,EAAW,EACzB,SACA,UACA,gBACA,WACA,gBAOC;AACD,QACE,kBAAC,OAAD;EAAgB;YACd,kBAAC,GAAD;GAA2B;GAAa;GAAoB;GAAqB;GAAU,CAAA;EACvF,CAAA"}
|
|
@@ -26,14 +26,14 @@ var o = ({ cpuRequest: o, cpuLimit: s, memoryRequest: c, memoryLimit: l, contain
|
|
|
26
26
|
return f === "grid" ? /* @__PURE__ */ i("div", {
|
|
27
27
|
className: e("grid grid-cols-3 gap-3", d),
|
|
28
28
|
children: p.map((e) => /* @__PURE__ */ a("div", {
|
|
29
|
-
className: "flex flex-col items-center gap-1 p-2 rounded-lg bg-
|
|
29
|
+
className: "flex flex-col items-center gap-1 p-2 rounded-lg bg-bg-sunken/50",
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ i(e.icon, {
|
|
32
32
|
size: 16,
|
|
33
33
|
className: e.color
|
|
34
34
|
}),
|
|
35
35
|
/* @__PURE__ */ i("span", {
|
|
36
|
-
className: "text-xs text-
|
|
36
|
+
className: "text-xs text-text-secondary",
|
|
37
37
|
children: e.label
|
|
38
38
|
}),
|
|
39
39
|
/* @__PURE__ */ i("span", {
|
|
@@ -56,7 +56,7 @@ var o = ({ cpuRequest: o, cpuLimit: s, memoryRequest: c, memoryLimit: l, contain
|
|
|
56
56
|
children: e.value
|
|
57
57
|
}),
|
|
58
58
|
t < p.length - 1 && /* @__PURE__ */ i("span", {
|
|
59
|
-
className: "ml-2 text-
|
|
59
|
+
className: "ml-2 text-text-secondary/40",
|
|
60
60
|
children: "|"
|
|
61
61
|
})
|
|
62
62
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceDisplay.js","names":[],"sources":["../../../src/sandbox/components/ResourceDisplay.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Cpu, MemoryStick, Container } from 'lucide-react';\nimport { cn } from '../utils/cn';\n\ninterface ResourceDisplayProps {\n cpuRequest: string;\n cpuLimit?: string;\n memoryRequest: string;\n memoryLimit?: string;\n containerCount?: number;\n className?: string;\n layout?: 'inline' | 'grid';\n}\n\n/**\n * Compact display for sandbox resource allocation (CPU / Memory / Containers)\n */\nexport const ResourceDisplay: FC<ResourceDisplayProps> = ({\n cpuRequest,\n cpuLimit,\n memoryRequest,\n memoryLimit,\n containerCount,\n className,\n layout = 'inline',\n}) => {\n const items = [\n {\n icon: Cpu,\n label: 'CPU',\n value: cpuLimit ? `${cpuRequest} / ${cpuLimit}` : cpuRequest,\n color: 'text-accent-blue',\n },\n {\n icon: MemoryStick,\n label: 'Memory',\n value: memoryLimit ? `${memoryRequest} / ${memoryLimit}` : memoryRequest,\n color: 'text-accent-purple',\n },\n ...(containerCount !== undefined\n ? [\n {\n icon: Container,\n label: 'Containers',\n value: `${containerCount}`,\n color: 'text-status-warning-text',\n },\n ]\n : []),\n ];\n\n if (layout === 'grid') {\n return (\n <div className={cn('grid grid-cols-3 gap-3', className)}>\n {items.map((item) => (\n <div\n key={item.label}\n className=\"flex flex-col items-center gap-1 p-2 rounded-lg bg-
|
|
1
|
+
{"version":3,"file":"ResourceDisplay.js","names":[],"sources":["../../../src/sandbox/components/ResourceDisplay.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { Cpu, MemoryStick, Container } from 'lucide-react';\nimport { cn } from '../utils/cn';\n\ninterface ResourceDisplayProps {\n cpuRequest: string;\n cpuLimit?: string;\n memoryRequest: string;\n memoryLimit?: string;\n containerCount?: number;\n className?: string;\n layout?: 'inline' | 'grid';\n}\n\n/**\n * Compact display for sandbox resource allocation (CPU / Memory / Containers)\n */\nexport const ResourceDisplay: FC<ResourceDisplayProps> = ({\n cpuRequest,\n cpuLimit,\n memoryRequest,\n memoryLimit,\n containerCount,\n className,\n layout = 'inline',\n}) => {\n const items = [\n {\n icon: Cpu,\n label: 'CPU',\n value: cpuLimit ? `${cpuRequest} / ${cpuLimit}` : cpuRequest,\n color: 'text-accent-blue',\n },\n {\n icon: MemoryStick,\n label: 'Memory',\n value: memoryLimit ? `${memoryRequest} / ${memoryLimit}` : memoryRequest,\n color: 'text-accent-purple',\n },\n ...(containerCount !== undefined\n ? [\n {\n icon: Container,\n label: 'Containers',\n value: `${containerCount}`,\n color: 'text-status-warning-text',\n },\n ]\n : []),\n ];\n\n if (layout === 'grid') {\n return (\n <div className={cn('grid grid-cols-3 gap-3', className)}>\n {items.map((item) => (\n <div\n key={item.label}\n className=\"flex flex-col items-center gap-1 p-2 rounded-lg bg-bg-sunken/50\"\n >\n <item.icon size={16} className={item.color} />\n <span className=\"text-xs text-text-secondary\">{item.label}</span>\n <span className=\"text-sm font-semibold\">{item.value}</span>\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <div className={cn('flex items-center gap-3 text-sm', className)}>\n {items.map((item, index) => (\n <span key={item.label} className=\"inline-flex items-center gap-1\">\n <item.icon size={14} className={item.color} />\n <span className=\"font-medium\">{item.value}</span>\n {index < items.length - 1 && <span className=\"ml-2 text-text-secondary/40\">|</span>}\n </span>\n ))}\n </div>\n );\n};\n"],"mappings":";;;;AAiBA,IAAa,KAA6C,EACxD,eACA,aACA,kBACA,gBACA,mBACA,cACA,YAAS,eACL;CACJ,IAAM,IAAQ;EACZ;GACE,MAAM;GACN,OAAO;GACP,OAAO,IAAW,GAAG,EAAW,KAAK,MAAa;GAClD,OAAO;GACR;EACD;GACE,MAAM;GACN,OAAO;GACP,OAAO,IAAc,GAAG,EAAc,KAAK,MAAgB;GAC3D,OAAO;GACR;EACD,GAAI,MAAmB,KAAA,IASnB,EAAE,GARF,CACE;GACE,MAAM;GACN,OAAO;GACP,OAAO,GAAG;GACV,OAAO;GACR,CACF;EAEN;AAmBD,QAjBI,MAAW,SAEX,kBAAC,OAAD;EAAK,WAAW,EAAG,0BAA0B,EAAU;YACpD,EAAM,KAAK,MACV,kBAAC,OAAD;GAEE,WAAU;aAFZ;IAIE,kBAAC,EAAK,MAAN;KAAW,MAAM;KAAI,WAAW,EAAK;KAAS,CAAA;IAC9C,kBAAC,QAAD;KAAM,WAAU;eAA+B,EAAK;KAAa,CAAA;IACjE,kBAAC,QAAD;KAAM,WAAU;eAAyB,EAAK;KAAa,CAAA;IACvD;KANC,EAAK,MAMN,CACN;EACE,CAAA,GAKR,kBAAC,OAAD;EAAK,WAAW,EAAG,mCAAmC,EAAU;YAC7D,EAAM,KAAK,GAAM,MAChB,kBAAC,QAAD;GAAuB,WAAU;aAAjC;IACE,kBAAC,EAAK,MAAN;KAAW,MAAM;KAAI,WAAW,EAAK;KAAS,CAAA;IAC9C,kBAAC,QAAD;KAAM,WAAU;eAAe,EAAK;KAAa,CAAA;IAChD,IAAQ,EAAM,SAAS,KAAK,kBAAC,QAAD;KAAM,WAAU;eAA8B;KAAQ,CAAA;IAC9E;KAJI,EAAK,MAIT,CACP;EACE,CAAA"}
|
|
@@ -39,23 +39,23 @@ var s = class extends e {
|
|
|
39
39
|
className: "flex flex-col items-center justify-center min-h-[400px] gap-4 text-center p-6",
|
|
40
40
|
children: [
|
|
41
41
|
/* @__PURE__ */ i("div", {
|
|
42
|
-
className: "p-3 rounded-full bg-
|
|
43
|
-
children: /* @__PURE__ */ i(t, { className: "size-8 text-
|
|
42
|
+
className: "p-3 rounded-full bg-status-error-bg/10",
|
|
43
|
+
children: /* @__PURE__ */ i(t, { className: "size-8 text-status-error-text" })
|
|
44
44
|
}),
|
|
45
45
|
/* @__PURE__ */ a("div", {
|
|
46
46
|
className: "space-y-2",
|
|
47
47
|
children: [/* @__PURE__ */ i("h3", {
|
|
48
|
-
className: "text-lg font-semibold text-
|
|
48
|
+
className: "text-lg font-semibold text-text-primary",
|
|
49
49
|
children: "Failed to load page"
|
|
50
50
|
}), /* @__PURE__ */ i("p", {
|
|
51
|
-
className: "text-sm text-
|
|
51
|
+
className: "text-sm text-text-secondary max-w-md",
|
|
52
52
|
children: this.state.error?.message?.includes("Loading chunk") ? "The page chunk could not be loaded. This may be due to a network issue." : "Something went wrong while loading this page. Please try again."
|
|
53
53
|
})]
|
|
54
54
|
}),
|
|
55
55
|
/* @__PURE__ */ a("button", {
|
|
56
56
|
type: "button",
|
|
57
57
|
onClick: this.handleRetry,
|
|
58
|
-
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-
|
|
58
|
+
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors",
|
|
59
59
|
children: [/* @__PURE__ */ i(r, { className: "size-4" }), "Try Again"]
|
|
60
60
|
})
|
|
61
61
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteUtils.js","names":[],"sources":["../../../src/sandbox/components/RouteUtils.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { Loader2, AlertTriangle, RefreshCw } from 'lucide-react';\n\n/**\n * Loading fallback for lazy-loaded pages\n */\nexport function PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n );\n}\n\n/**\n * Error boundary for lazy-loaded page chunks.\n * Catches chunk-load failures and renders a retry UI instead of an infinite spinner.\n */\nexport class LazyErrorBoundary extends Component<\n { children: ReactNode },\n { hasError: boolean; error: Error | null }\n> {\n constructor(props: { children: ReactNode }) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error('[Sandbox] Lazy page load failed:', error, errorInfo);\n }\n\n handleRetry = () => {\n if (this.state.error?.name === 'ChunkLoadError') {\n window.location.reload();\n return;\n }\n this.setState({ hasError: false, error: null });\n };\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"flex flex-col items-center justify-center min-h-[400px] gap-4 text-center p-6\">\n <div className=\"p-3 rounded-full bg-
|
|
1
|
+
{"version":3,"file":"RouteUtils.js","names":[],"sources":["../../../src/sandbox/components/RouteUtils.tsx"],"sourcesContent":["import { Component, type ReactNode, type ErrorInfo } from 'react';\nimport { Loader2, AlertTriangle, RefreshCw } from 'lucide-react';\n\n/**\n * Loading fallback for lazy-loaded pages\n */\nexport function PageLoader() {\n return (\n <div className=\"flex items-center justify-center min-h-[400px]\">\n <Loader2 className=\"size-8 animate-spin text-primary\" />\n </div>\n );\n}\n\n/**\n * Error boundary for lazy-loaded page chunks.\n * Catches chunk-load failures and renders a retry UI instead of an infinite spinner.\n */\nexport class LazyErrorBoundary extends Component<\n { children: ReactNode },\n { hasError: boolean; error: Error | null }\n> {\n constructor(props: { children: ReactNode }) {\n super(props);\n this.state = { hasError: false, error: null };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { hasError: true, error };\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n console.error('[Sandbox] Lazy page load failed:', error, errorInfo);\n }\n\n handleRetry = () => {\n if (this.state.error?.name === 'ChunkLoadError') {\n window.location.reload();\n return;\n }\n this.setState({ hasError: false, error: null });\n };\n\n render() {\n if (this.state.hasError) {\n return (\n <div className=\"flex flex-col items-center justify-center min-h-[400px] gap-4 text-center p-6\">\n <div className=\"p-3 rounded-full bg-status-error-bg/10\">\n <AlertTriangle className=\"size-8 text-status-error-text\" />\n </div>\n <div className=\"space-y-2\">\n <h3 className=\"text-lg font-semibold text-text-primary\">Failed to load page</h3>\n <p className=\"text-sm text-text-secondary max-w-md\">\n {this.state.error?.message?.includes('Loading chunk')\n ? 'The page chunk could not be loaded. This may be due to a network issue.'\n : 'Something went wrong while loading this page. Please try again.'}\n </p>\n </div>\n <button\n type=\"button\"\n onClick={this.handleRetry}\n className=\"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-md bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg/90 transition-colors\"\n >\n <RefreshCw className=\"size-4\" />\n Try Again\n </button>\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;AAMA,SAAgB,IAAa;AAC3B,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD,EAAS,WAAU,oCAAqC,CAAA;EACpD,CAAA;;AAQV,IAAa,IAAb,cAAuC,EAGrC;CACA,YAAY,GAAgC;AAE1C,EADA,MAAM,EAAM,EACZ,KAAK,QAAQ;GAAE,UAAU;GAAO,OAAO;GAAM;;CAG/C,OAAO,yBAAyB,GAAc;AAC5C,SAAO;GAAE,UAAU;GAAM;GAAO;;CAGlC,kBAAkB,GAAc,GAAsB;AACpD,UAAQ,MAAM,oCAAoC,GAAO,EAAU;;CAGrE,oBAAoB;AAClB,MAAI,KAAK,MAAM,OAAO,SAAS,kBAAkB;AAC/C,UAAO,SAAS,QAAQ;AACxB;;AAEF,OAAK,SAAS;GAAE,UAAU;GAAO,OAAO;GAAM,CAAC;;CAGjD,SAAS;AA2BP,SA1BI,KAAK,MAAM,WAEX,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD,EAAe,WAAU,iCAAkC,CAAA;KACvD,CAAA;IACN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,MAAD;MAAI,WAAU;gBAA0C;MAAwB,CAAA,EAChF,kBAAC,KAAD;MAAG,WAAU;gBACV,KAAK,MAAM,OAAO,SAAS,SAAS,gBAAgB,GACjD,4EACA;MACF,CAAA,CACA;;IACN,kBAAC,UAAD;KACE,MAAK;KACL,SAAS,KAAK;KACd,WAAU;eAHZ,CAKE,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA,EAAA,YAEzB;;IACL;OAIH,KAAK,MAAM"}
|
|
@@ -60,7 +60,7 @@ function u({ sandboxId: i, workspaceId: u, pageSize: d = 50 }) {
|
|
|
60
60
|
children: v.map((t) => /* @__PURE__ */ c("li", {
|
|
61
61
|
className: "py-3",
|
|
62
62
|
children: [/* @__PURE__ */ s("div", {
|
|
63
|
-
className: "text-sm font-medium text-
|
|
63
|
+
className: "text-sm font-medium text-text-primary",
|
|
64
64
|
children: t.action
|
|
65
65
|
}), /* @__PURE__ */ c("div", {
|
|
66
66
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxActivityTab.js","names":[],"sources":["../../../src/sandbox/components/SandboxActivityTab.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\nconst RECENT_ACTIVITY = gql`\n query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {\n getRecentSandboxActivity(context: $context, limit: $limit) {\n items {\n id\n action\n sandboxName\n sandboxId\n actorId\n status\n createdAt\n }\n total\n }\n }\n`;\n\ninterface ActivityItem {\n id: string;\n action: string;\n sandboxName: string;\n sandboxId?: string | null;\n actorId: string;\n status: string;\n createdAt: string;\n}\n\ninterface Props {\n sandboxId: string;\n workspaceId: string;\n pageSize?: number;\n}\n\n/**\n * Activity / audit feed scoped to a single sandbox. Reuses the existing\n * `getRecentSandboxActivity` admin query and filters client-side by sandboxId\n * so no new backend query is needed for the v0.3.0 cycle. Server-side scoping\n * will move to a dedicated `getSandboxAuditLog(sandboxId)` query in a follow-up.\n */\nexport function SandboxActivityTab({ sandboxId, workspaceId, pageSize = 50 }: Props) {\n const { t } = useI18n();\n const client = useApolloClient();\n const [items, setItems] = useState<ActivityItem[] | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n client\n .query<{ getRecentSandboxActivity: { items: ActivityItem[] } }>({\n query: RECENT_ACTIVITY,\n variables: { context: { workspaceId }, limit: pageSize },\n fetchPolicy: 'network-only',\n })\n .then((res: { data?: { getRecentSandboxActivity?: { items?: ActivityItem[] } } }) => {\n if (cancelled) return;\n const all: ActivityItem[] = res.data?.getRecentSandboxActivity?.items ?? [];\n setItems(all.filter((entry: ActivityItem) => entry.sandboxId === sandboxId));\n })\n .catch((err: unknown) => {\n if (cancelled) return;\n setError(err instanceof Error ? err.message : String(err));\n });\n return () => {\n cancelled = true;\n };\n }, [client, sandboxId, workspaceId, pageSize]);\n\n const sorted = useMemo(\n () =>\n items\n ?.slice()\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) ?? null,\n [items]\n );\n\n if (error) {\n return (\n <p className=\"text-sm text-status-error-text\">\n {tWithFallback(t, 'sandbox.activity.loadFailed', \"Couldn't load activity.\")}\n </p>\n );\n }\n if (sorted == null) {\n return <p className=\"text-sm text-text-secondary\">…</p>;\n }\n if (sorted.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.empty', 'No activity yet.')}\n </p>\n );\n }\n\n return (\n <ul className=\"divide-y divide-border-subtle\">\n {sorted.map((entry) => (\n <li key={entry.id} className=\"py-3\">\n <div className=\"text-sm font-medium text-
|
|
1
|
+
{"version":3,"file":"SandboxActivityTab.js","names":[],"sources":["../../../src/sandbox/components/SandboxActivityTab.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\nconst RECENT_ACTIVITY = gql`\n query GetRecentSandboxActivity($context: ContextInput!, $limit: Int) {\n getRecentSandboxActivity(context: $context, limit: $limit) {\n items {\n id\n action\n sandboxName\n sandboxId\n actorId\n status\n createdAt\n }\n total\n }\n }\n`;\n\ninterface ActivityItem {\n id: string;\n action: string;\n sandboxName: string;\n sandboxId?: string | null;\n actorId: string;\n status: string;\n createdAt: string;\n}\n\ninterface Props {\n sandboxId: string;\n workspaceId: string;\n pageSize?: number;\n}\n\n/**\n * Activity / audit feed scoped to a single sandbox. Reuses the existing\n * `getRecentSandboxActivity` admin query and filters client-side by sandboxId\n * so no new backend query is needed for the v0.3.0 cycle. Server-side scoping\n * will move to a dedicated `getSandboxAuditLog(sandboxId)` query in a follow-up.\n */\nexport function SandboxActivityTab({ sandboxId, workspaceId, pageSize = 50 }: Props) {\n const { t } = useI18n();\n const client = useApolloClient();\n const [items, setItems] = useState<ActivityItem[] | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n client\n .query<{ getRecentSandboxActivity: { items: ActivityItem[] } }>({\n query: RECENT_ACTIVITY,\n variables: { context: { workspaceId }, limit: pageSize },\n fetchPolicy: 'network-only',\n })\n .then((res: { data?: { getRecentSandboxActivity?: { items?: ActivityItem[] } } }) => {\n if (cancelled) return;\n const all: ActivityItem[] = res.data?.getRecentSandboxActivity?.items ?? [];\n setItems(all.filter((entry: ActivityItem) => entry.sandboxId === sandboxId));\n })\n .catch((err: unknown) => {\n if (cancelled) return;\n setError(err instanceof Error ? err.message : String(err));\n });\n return () => {\n cancelled = true;\n };\n }, [client, sandboxId, workspaceId, pageSize]);\n\n const sorted = useMemo(\n () =>\n items\n ?.slice()\n .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) ?? null,\n [items]\n );\n\n if (error) {\n return (\n <p className=\"text-sm text-status-error-text\">\n {tWithFallback(t, 'sandbox.activity.loadFailed', \"Couldn't load activity.\")}\n </p>\n );\n }\n if (sorted == null) {\n return <p className=\"text-sm text-text-secondary\">…</p>;\n }\n if (sorted.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.empty', 'No activity yet.')}\n </p>\n );\n }\n\n return (\n <ul className=\"divide-y divide-border-subtle\">\n {sorted.map((entry) => (\n <li key={entry.id} className=\"py-3\">\n <div className=\"text-sm font-medium text-text-primary\">{entry.action}</div>\n <div className=\"mt-0.5 text-xs text-text-secondary\">\n {tWithFallback(t, 'sandbox.activity.actor', `by ${entry.actorId}`, {\n actor: entry.actorId,\n })}{' '}\n ·{' '}\n {tWithFallback(\n t,\n 'sandbox.activity.atTime',\n `at ${new Date(entry.createdAt).toLocaleString()}`,\n {\n time: new Date(entry.createdAt).toLocaleString(),\n }\n )}\n </div>\n </li>\n ))}\n </ul>\n );\n}\n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kBAAC,OAAD;IAAK,WAAU;cAAf;KACG,EAAc,GAAG,0BAA0B,MAAM,EAAM,WAAW,EACjE,OAAO,EAAM,SACd,CAAC;KAAE;KAAI;KACN;KACD,EACC,GACA,2BACA,MAAM,IAAI,KAAK,EAAM,UAAU,CAAC,gBAAgB,IAChD,EACE,MAAM,IAAI,KAAK,EAAM,UAAU,CAAC,gBAAgB,EACjD,CACF;KACG;MACH;KAhBI,EAAM,GAgBV,CACL;EACC,CAAA"}
|
|
@@ -15,7 +15,7 @@ function u({ appId: u, clientId: f, clientSecret: p }) {
|
|
|
15
15
|
className: "rounded-md border border-border-subtle bg-bg-surface p-4 text-sm",
|
|
16
16
|
children: [
|
|
17
17
|
/* @__PURE__ */ c("h3", {
|
|
18
|
-
className: "text-sm font-semibold text-
|
|
18
|
+
className: "text-sm font-semibold text-text-primary",
|
|
19
19
|
children: e(m, "sandbox.agentApp.title", "Auto-registered application")
|
|
20
20
|
}),
|
|
21
21
|
/* @__PURE__ */ c("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxAgentAppPanel.js","names":[],"sources":["../../../src/sandbox/components/SandboxAgentAppPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Copy, CheckCircle2, Eye, EyeOff } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n appId?: string | null;\n clientId?: string | null;\n /** Only available on first creation; backend never returns it again. */\n clientSecret?: string | null;\n}\n\n/**\n * Read-only panel surfacing the auto-registered DevPortal application created\n * for the in-sandbox VibeControls agent. Backend lifecycle lives in\n * `wspace-sandbox-svc/.../createSandboxAgentApp`. The clientSecret is shown\n * once, on first create — afterwards the panel hides it behind a \"rotate via\n * Developer Portal\" message.\n */\nexport function SandboxAgentAppPanel({ appId, clientId, clientSecret }: Props) {\n const { t } = useI18n();\n const [revealed, setRevealed] = useState(false);\n const [copied, setCopied] = useState<string | null>(null);\n\n if (!appId && !clientId) return null;\n\n const copy = (value: string, key: string) => {\n void navigator.clipboard.writeText(value);\n setCopied(key);\n setTimeout(() => setCopied((current) => (current === key ? null : current)), 1500);\n };\n\n return (\n <section\n aria-label={tWithFallback(t, 'sandbox.agentApp.title', 'Auto-registered application')}\n className=\"rounded-md border border-border-subtle bg-bg-surface p-4 text-sm\"\n >\n <h3 className=\"text-sm font-semibold text-
|
|
1
|
+
{"version":3,"file":"SandboxAgentAppPanel.js","names":[],"sources":["../../../src/sandbox/components/SandboxAgentAppPanel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Copy, CheckCircle2, Eye, EyeOff } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\n\ninterface Props {\n appId?: string | null;\n clientId?: string | null;\n /** Only available on first creation; backend never returns it again. */\n clientSecret?: string | null;\n}\n\n/**\n * Read-only panel surfacing the auto-registered DevPortal application created\n * for the in-sandbox VibeControls agent. Backend lifecycle lives in\n * `wspace-sandbox-svc/.../createSandboxAgentApp`. The clientSecret is shown\n * once, on first create — afterwards the panel hides it behind a \"rotate via\n * Developer Portal\" message.\n */\nexport function SandboxAgentAppPanel({ appId, clientId, clientSecret }: Props) {\n const { t } = useI18n();\n const [revealed, setRevealed] = useState(false);\n const [copied, setCopied] = useState<string | null>(null);\n\n if (!appId && !clientId) return null;\n\n const copy = (value: string, key: string) => {\n void navigator.clipboard.writeText(value);\n setCopied(key);\n setTimeout(() => setCopied((current) => (current === key ? null : current)), 1500);\n };\n\n return (\n <section\n aria-label={tWithFallback(t, 'sandbox.agentApp.title', 'Auto-registered application')}\n className=\"rounded-md border border-border-subtle bg-bg-surface p-4 text-sm\"\n >\n <h3 className=\"text-sm font-semibold text-text-primary\">\n {tWithFallback(t, 'sandbox.agentApp.title', 'Auto-registered application')}\n </h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {tWithFallback(\n t,\n 'sandbox.agentApp.description',\n 'An OAuth app was created so the in-sandbox VibeControls agent can authenticate against the platform automatically.'\n )}\n </p>\n <dl className=\"mt-3 space-y-2\">\n {appId && (\n <Row\n label={tWithFallback(t, 'sandbox.agentApp.appId', 'App ID')}\n value={appId}\n onCopy={() => copy(appId, 'app')}\n copied={copied === 'app'}\n />\n )}\n {clientId && (\n <Row\n label={tWithFallback(t, 'sandbox.agentApp.clientId', 'Client ID')}\n value={clientId}\n onCopy={() => copy(clientId, 'client')}\n copied={copied === 'client'}\n />\n )}\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-xs text-text-tertiary\">\n {tWithFallback(t, 'sandbox.agentApp.clientSecret', 'Client secret')}\n </dt>\n <dd className=\"flex items-center gap-2 font-mono text-xs\">\n {clientSecret && revealed ? (\n <>\n <span>{clientSecret}</span>\n <button\n type=\"button\"\n onClick={() => copy(clientSecret, 'secret')}\n aria-label={tWithFallback(t, 'sandbox.agentApp.copySecret', 'Copy client secret')}\n className=\"text-text-tertiary hover:text-text-secondary\"\n >\n {copied === 'secret' ? <CheckCircle2 size={12} /> : <Copy size={12} />}\n </button>\n <button\n type=\"button\"\n onClick={() => setRevealed(false)}\n className=\"text-text-tertiary hover:text-text-secondary\"\n aria-label={tWithFallback(t, 'sandbox.agentApp.hide', 'Hide')}\n >\n <EyeOff size={12} />\n </button>\n </>\n ) : clientSecret ? (\n <button\n type=\"button\"\n onClick={() => setRevealed(true)}\n className=\"inline-flex items-center gap-1 rounded-md border border-border-subtle px-2 py-0.5 text-text-secondary hover:bg-bg-sunken\"\n >\n <Eye size={12} aria-hidden=\"true\" />\n {tWithFallback(t, 'sandbox.agentApp.secret.revealOnce', 'Reveal once')}\n </button>\n ) : (\n <span className=\"text-text-tertiary\">\n {tWithFallback(\n t,\n 'sandbox.agentApp.secret.hidden',\n 'Hidden — visible only at first creation'\n )}\n </span>\n )}\n </dd>\n </div>\n </dl>\n </section>\n );\n}\n\nfunction Row({\n label,\n value,\n onCopy,\n copied,\n}: {\n label: string;\n value: string;\n onCopy: () => void;\n copied: boolean;\n}) {\n return (\n <div className=\"flex items-center justify-between gap-2\">\n <dt className=\"text-xs text-text-tertiary\">{label}</dt>\n <dd className=\"flex items-center gap-2 font-mono text-xs\">\n <span>{value}</span>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={`Copy ${label}`}\n className=\"text-text-tertiary hover:text-text-secondary\"\n >\n {copied ? <CheckCircle2 size={12} /> : <Copy size={12} />}\n </button>\n </dd>\n </div>\n );\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,EAAqB,EAAE,UAAO,aAAU,mBAAuB;CAC7E,IAAM,EAAE,SAAM,GAAS,EACjB,CAAC,GAAU,KAAe,EAAS,GAAM,EACzC,CAAC,GAAQ,KAAa,EAAwB,KAAK;AAEzD,KAAI,CAAC,KAAS,CAAC,EAAU,QAAO;CAEhC,IAAM,KAAQ,GAAe,MAAgB;AAG3C,EAFK,UAAU,UAAU,UAAU,EAAM,EACzC,EAAU,EAAI,EACd,iBAAiB,GAAW,MAAa,MAAY,IAAM,OAAO,EAAS,EAAE,KAAK;;AAGpF,QACE,kBAAC,WAAD;EACE,cAAY,EAAc,GAAG,0BAA0B,8BAA8B;EACrF,WAAU;YAFZ;GAIE,kBAAC,MAAD;IAAI,WAAU;cACX,EAAc,GAAG,0BAA0B,8BAA8B;IACvE,CAAA;GACL,kBAAC,KAAD;IAAG,WAAU;cACV,EACC,GACA,gCACA,qHACD;IACC,CAAA;GACJ,kBAAC,MAAD;IAAI,WAAU;cAAd;KACG,KACC,kBAAC,GAAD;MACE,OAAO,EAAc,GAAG,0BAA0B,SAAS;MAC3D,OAAO;MACP,cAAc,EAAK,GAAO,MAAM;MAChC,QAAQ,MAAW;MACnB,CAAA;KAEH,KACC,kBAAC,GAAD;MACE,OAAO,EAAc,GAAG,6BAA6B,YAAY;MACjE,OAAO;MACP,cAAc,EAAK,GAAU,SAAS;MACtC,QAAQ,MAAW;MACnB,CAAA;KAEJ,kBAAC,OAAD;MAAK,WAA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 function E({ sandbox: m, workspaceId: E }) {
|
|
|
77
77
|
children: /* @__PURE__ */ C("h3", {
|
|
78
78
|
className: "flex items-center gap-2 font-semibold",
|
|
79
79
|
children: [/* @__PURE__ */ S("div", {
|
|
80
|
-
className: "rounded-lg bg-primary/10 p-1.5",
|
|
80
|
+
className: "rounded-lg bg-action-primary-bg/10 p-1.5",
|
|
81
81
|
children: /* @__PURE__ */ S(v, {
|
|
82
82
|
size: 14,
|
|
83
83
|
className: "text-primary"
|
|
@@ -86,7 +86,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
86
86
|
})
|
|
87
87
|
}),
|
|
88
88
|
/* @__PURE__ */ S("p", {
|
|
89
|
-
className: "mb-3 text-sm text-
|
|
89
|
+
className: "mb-3 text-sm text-text-secondary",
|
|
90
90
|
children: A("sandbox.detail.scriptRunner.subtitle", "Run an AI-generated script in this isolated sandbox and review the output before promoting it to the real target.")
|
|
91
91
|
}),
|
|
92
92
|
!V && /* @__PURE__ */ C("div", {
|
|
@@ -101,7 +101,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
101
101
|
children: [/* @__PURE__ */ S("select", {
|
|
102
102
|
value: F,
|
|
103
103
|
onChange: (e) => I(e.target.value),
|
|
104
|
-
className: "rounded-lg border bg-
|
|
104
|
+
className: "rounded-lg border bg-bg-surface px-2 py-1 font-mono text-xs",
|
|
105
105
|
children: w.map((e) => /* @__PURE__ */ S("option", {
|
|
106
106
|
value: e,
|
|
107
107
|
children: e
|
|
@@ -110,7 +110,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
110
110
|
value: L,
|
|
111
111
|
onChange: (e) => R(e.target.value),
|
|
112
112
|
placeholder: A("sandbox.detail.scriptRunner.labelPlaceholder", "Label (optional)"),
|
|
113
|
-
className: "flex-1 rounded-lg border bg-
|
|
113
|
+
className: "flex-1 rounded-lg border bg-bg-surface px-2 py-1 text-xs"
|
|
114
114
|
})]
|
|
115
115
|
}),
|
|
116
116
|
/* @__PURE__ */ S("textarea", {
|
|
@@ -118,7 +118,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
118
118
|
onChange: (e) => P(e.target.value),
|
|
119
119
|
spellCheck: !1,
|
|
120
120
|
placeholder: A("sandbox.detail.scriptRunner.placeholder", "# Paste the AI-generated script here, then Run to test it in the sandbox"),
|
|
121
|
-
className: "h-40 w-full resize-y rounded-lg border bg-
|
|
121
|
+
className: "h-40 w-full resize-y rounded-lg border bg-bg-surface p-3 font-mono text-xs"
|
|
122
122
|
}),
|
|
123
123
|
/* @__PURE__ */ S("div", {
|
|
124
124
|
className: "flex justify-end",
|
|
@@ -132,7 +132,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
132
132
|
})
|
|
133
133
|
}),
|
|
134
134
|
K && /* @__PURE__ */ C("div", {
|
|
135
|
-
className: "flex items-center gap-2 rounded-lg bg-
|
|
135
|
+
className: "flex items-center gap-2 rounded-lg bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text",
|
|
136
136
|
children: [/* @__PURE__ */ S(y, { size: 14 }), K.message]
|
|
137
137
|
})
|
|
138
138
|
]
|
|
@@ -147,7 +147,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
147
147
|
Y.length > 0 && /* @__PURE__ */ C("div", {
|
|
148
148
|
className: "mt-4",
|
|
149
149
|
children: [/* @__PURE__ */ S("h4", {
|
|
150
|
-
className: "mb-2 text-xs font-semibold uppercase text-
|
|
150
|
+
className: "mb-2 text-xs font-semibold uppercase text-text-secondary",
|
|
151
151
|
children: A("sandbox.detail.scriptRunner.history", "Run history")
|
|
152
152
|
}), /* @__PURE__ */ S("ul", {
|
|
153
153
|
className: "divide-y rounded-lg border",
|
|
@@ -170,7 +170,7 @@ function E({ sandbox: m, workspaceId: E }) {
|
|
|
170
170
|
}),
|
|
171
171
|
n.label ? ` · ${n.label}` : "",
|
|
172
172
|
/* @__PURE__ */ S("span", {
|
|
173
|
-
className: "ml-1 text-xs text-
|
|
173
|
+
className: "ml-1 text-xs text-text-secondary",
|
|
174
174
|
children: new Date(n.createdAt).toLocaleString()
|
|
175
175
|
})
|
|
176
176
|
]
|
|
@@ -204,16 +204,16 @@ function D({ status: t, exitCode: n, tr: r }) {
|
|
|
204
204
|
className: "gap-1 bg-green-500/10 text-green-600",
|
|
205
205
|
children: [/* @__PURE__ */ S(m, { size: 12 }), r("sandbox.detail.scriptRunner.status.succeeded", "Succeeded")]
|
|
206
206
|
}) : /* @__PURE__ */ C(e, {
|
|
207
|
-
className: "gap-1 bg-
|
|
207
|
+
className: "gap-1 bg-status-error-bg/10 text-status-error-text",
|
|
208
208
|
children: [/* @__PURE__ */ S(y, { size: 12 }), t === "error" ? r("sandbox.detail.scriptRunner.status.error", "Error") : `${r("sandbox.detail.scriptRunner.status.failed", "Failed")}${n == null ? "" : ` (${n})`}`]
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
function O({ run: e, tr: t }) {
|
|
212
212
|
return /* @__PURE__ */ C("div", {
|
|
213
|
-
className: "rounded-lg border bg-
|
|
213
|
+
className: "rounded-lg border bg-bg-sunken/30 p-3",
|
|
214
214
|
children: [
|
|
215
215
|
/* @__PURE__ */ C("div", {
|
|
216
|
-
className: "mb-2 flex items-center gap-2 text-xs text-
|
|
216
|
+
className: "mb-2 flex items-center gap-2 text-xs text-text-secondary",
|
|
217
217
|
children: [/* @__PURE__ */ S(D, {
|
|
218
218
|
status: e.status,
|
|
219
219
|
exitCode: e.exitCode,
|
|
@@ -225,11 +225,11 @@ function O({ run: e, tr: t }) {
|
|
|
225
225
|
children: e.stdout
|
|
226
226
|
}),
|
|
227
227
|
e.stderr && /* @__PURE__ */ S("pre", {
|
|
228
|
-
className: "mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-
|
|
228
|
+
className: "mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-status-error-text",
|
|
229
229
|
children: e.stderr
|
|
230
230
|
}),
|
|
231
231
|
!e.stdout && !e.stderr && /* @__PURE__ */ S("p", {
|
|
232
|
-
className: "text-xs text-
|
|
232
|
+
className: "text-xs text-text-secondary",
|
|
233
233
|
children: t("sandbox.detail.scriptRunner.noOutput", "(no output)")
|
|
234
234
|
})
|
|
235
235
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxScriptRunnerPanel.js","names":[],"sources":["../../../src/sandbox/components/SandboxScriptRunnerPanel.tsx"],"sourcesContent":["import { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Terminal,\n Play,\n Loader2,\n CheckCircle2,\n XCircle,\n AlertCircle,\n ArrowUpCircle,\n ShieldCheck,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { Button, Card, CardContent, Badge } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport {\n useSandboxScriptRunsQuery,\n useRunSandboxScriptMutation,\n usePromoteSandboxScriptRunMutation,\n type SandboxScriptRunFieldsFragment,\n} from '../../generated/wspace-operations';\n\nconst INTERPRETERS = ['bash', 'sh', 'python', 'node'] as const;\n\nfunction decodeSeed(raw: string | null): string {\n if (!raw) return '';\n try {\n // Accept base64 (used by deep-links, e.g. the assistant's \"Send to Sandbox\") or plain text.\n return atob(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * SandboxScriptRunnerPanel — the sandbox-safe-execution review surface. Paste (or deep-link in via\n * `?script=<base64>`) an AI-generated script, run it inside this isolated sandbox, and review the\n * captured stdout/stderr/exit code. Each run is recorded; a run that succeeded can be promoted to the\n * real target, which stamps the sign-off onto the same record. The sandbox must be running.\n */\nexport function SandboxScriptRunnerPanel({\n sandbox,\n workspaceId,\n}: {\n sandbox: { id: string; status?: string | null };\n workspaceId: string;\n}): React.ReactElement {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => tWithFallback(t, key, fallback);\n const [searchParams, setSearchParams] = useSearchParams();\n\n const [script, setScript] = useState<string>(() => decodeSeed(searchParams.get('script')));\n const [interpreter, setInterpreter] = useState<(typeof INTERPRETERS)[number]>('bash');\n const [label, setLabel] = useState('');\n const [activeRunId, setActiveRunId] = useState<string | null>(null);\n\n const isRunning = sandbox.status === 'RUNNING';\n\n const { data, refetch } = useSandboxScriptRunsQuery({\n variables: { sandboxId: sandbox.id, context: { workspaceId } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n const [runScript, { loading: running, error: runError }] = useRunSandboxScriptMutation();\n const [promote, { loading: promoting }] = usePromoteSandboxScriptRunMutation();\n\n const runs = useMemo<SandboxScriptRunFieldsFragment[]>(\n () => data?.sandboxScriptRuns ?? [],\n [data]\n );\n const activeRun = runs.find((r) => r.id === activeRunId) ?? runs[0] ?? null;\n\n // One-shot: if we were deep-linked with a script, clear it from the URL so a refresh doesn't re-seed.\n useEffect(() => {\n if (searchParams.get('script')) {\n const next = new URLSearchParams(searchParams);\n next.delete('script');\n setSearchParams(next, { replace: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleRun = useCallback(async () => {\n if (!script.trim() || !isRunning) return;\n try {\n const res = await runScript({\n variables: {\n input: {\n sandboxId: sandbox.id,\n script,\n interpreter,\n label: label.trim() || null,\n context: { workspaceId },\n },\n },\n });\n const created = res.data?.runSandboxScript;\n if (created) setActiveRunId(created.id);\n await refetch();\n } catch {\n // surfaced via runError below\n }\n }, [script, isRunning, runScript, sandbox.id, interpreter, label, workspaceId, refetch]);\n\n const handlePromote = useCallback(\n async (runId: string) => {\n try {\n await promote({ variables: { id: runId, note: null, context: { workspaceId } } });\n await refetch();\n } catch {\n // surfaced inline on the run row via refetch\n }\n },\n [promote, workspaceId, refetch]\n );\n\n return (\n <Card>\n <CardContent className=\"p-5\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"flex items-center gap-2 font-semibold\">\n <div className=\"rounded-lg bg-primary/10 p-1.5\">\n <Terminal size={14} className=\"text-primary\" />\n </div>\n {tr('sandbox.detail.scriptRunner.title', 'Script Runner')}\n </h3>\n </div>\n <p className=\"mb-3 text-sm text-muted-foreground\">\n {tr(\n 'sandbox.detail.scriptRunner.subtitle',\n 'Run an AI-generated script in this isolated sandbox and review the output before promoting it to the real target.'\n )}\n </p>\n\n {!isRunning && (\n <div className=\"mb-3 flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-amber-600\">\n <AlertCircle size={14} />\n {tr(\n 'sandbox.detail.scriptRunner.notRunning',\n 'The sandbox must be running to execute a script.'\n )}\n </div>\n )}\n\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <select\n value={interpreter}\n onChange={(e) => setInterpreter(e.target.value as (typeof INTERPRETERS)[number])}\n className=\"rounded-lg border bg-background px-2 py-1 font-mono text-xs\"\n >\n {INTERPRETERS.map((i) => (\n <option key={i} value={i}>\n {i}\n </option>\n ))}\n </select>\n <input\n value={label}\n onChange={(e) => setLabel(e.target.value)}\n placeholder={tr('sandbox.detail.scriptRunner.labelPlaceholder', 'Label (optional)')}\n className=\"flex-1 rounded-lg border bg-background px-2 py-1 text-xs\"\n />\n </div>\n <textarea\n value={script}\n onChange={(e) => setScript(e.target.value)}\n spellCheck={false}\n placeholder={tr(\n 'sandbox.detail.scriptRunner.placeholder',\n '# Paste the AI-generated script here, then Run to test it in the sandbox'\n )}\n className=\"h-40 w-full resize-y rounded-lg border bg-background p-3 font-mono text-xs\"\n />\n <div className=\"flex justify-end\">\n <Button\n onClick={() => void handleRun()}\n disabled={!isRunning || running || !script.trim()}\n >\n {running ? <Loader2 size={14} className=\"animate-spin\" /> : <Play size={14} />}\n {tr('sandbox.detail.scriptRunner.run', 'Run in sandbox')}\n </Button>\n </div>\n {runError && (\n <div className=\"flex items-center gap-2 rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive\">\n <XCircle size={14} />\n {runError.message}\n </div>\n )}\n </div>\n\n {activeRun && (\n <div className=\"mt-4\">\n <RunOutput run={activeRun} tr={tr} />\n </div>\n )}\n\n {runs.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-xs font-semibold uppercase text-muted-foreground\">\n {tr('sandbox.detail.scriptRunner.history', 'Run history')}\n </h4>\n <ul className=\"divide-y rounded-lg border\">\n {runs.map((r) => (\n <li key={r.id} className=\"flex items-center gap-3 px-3 py-2 text-sm\">\n <RunStatusBadge status={r.status} exitCode={r.exitCode} tr={tr} />\n <button\n type=\"button\"\n onClick={() => setActiveRunId(r.id)}\n className=\"min-w-0 flex-1 truncate text-left hover:underline\"\n >\n <span className=\"font-mono text-xs\">{r.interpreter}</span>\n {r.label ? ` · ${r.label}` : ''}\n <span className=\"ml-1 text-xs text-muted-foreground\">\n {new Date(r.createdAt as unknown as string).toLocaleString()}\n </span>\n </button>\n {r.promotedAt ? (\n <Badge className=\"shrink-0 gap-1 bg-green-500/10 text-green-600\">\n <ShieldCheck size={12} />\n {tr('sandbox.detail.scriptRunner.promoted', 'Promoted')}\n </Badge>\n ) : (\n r.status === 'succeeded' && (\n <Button\n variant=\"outline\"\n onClick={() => void handlePromote(r.id)}\n disabled={promoting}\n className=\"shrink-0\"\n title={tr(\n 'sandbox.detail.scriptRunner.promoteTitle',\n 'Sign off this reviewed run for the real target'\n )}\n >\n <ArrowUpCircle size={12} />\n {tr('sandbox.detail.scriptRunner.promote', 'Promote')}\n </Button>\n )\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n\nfunction RunStatusBadge({\n status,\n exitCode,\n tr,\n}: {\n status: string;\n exitCode?: number | null;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n if (status === 'running') {\n return (\n <Badge className=\"gap-1 bg-blue-500/10 text-blue-600\">\n <Loader2 size={12} className=\"animate-spin\" />\n {tr('sandbox.detail.scriptRunner.status.running', 'Running')}\n </Badge>\n );\n }\n if (status === 'succeeded') {\n return (\n <Badge className=\"gap-1 bg-green-500/10 text-green-600\">\n <CheckCircle2 size={12} />\n {tr('sandbox.detail.scriptRunner.status.succeeded', 'Succeeded')}\n </Badge>\n );\n }\n return (\n <Badge className=\"gap-1 bg-destructive/10 text-destructive\">\n <XCircle size={12} />\n {status === 'error'\n ? tr('sandbox.detail.scriptRunner.status.error', 'Error')\n : `${tr('sandbox.detail.scriptRunner.status.failed', 'Failed')}${\n exitCode != null ? ` (${exitCode})` : ''\n }`}\n </Badge>\n );\n}\n\nfunction RunOutput({\n run,\n tr,\n}: {\n run: SandboxScriptRunFieldsFragment;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n return (\n <div className=\"rounded-lg border bg-muted/30 p-3\">\n <div className=\"mb-2 flex items-center gap-2 text-xs text-muted-foreground\">\n <RunStatusBadge status={run.status} exitCode={run.exitCode} tr={tr} />\n {run.durationMs != null && <span>{run.durationMs} ms</span>}\n </div>\n {run.stdout && (\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-words font-mono text-xs\">\n {run.stdout}\n </pre>\n )}\n {run.stderr && (\n <pre className=\"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-destructive\">\n {run.stderr}\n </pre>\n )}\n {!run.stdout && !run.stderr && (\n <p className=\"text-xs text-muted-foreground\">\n {tr('sandbox.detail.scriptRunner.noOutput', '(no output)')}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAuBA,IAAM,IAAe;CAAC;CAAQ;CAAM;CAAU;CAAO;AAErD,SAAS,EAAW,GAA4B;AAC9C,KAAI,CAAC,EAAK,QAAO;AACjB,KAAI;AAEF,SAAO,KAAK,EAAI;SACV;AACN,SAAO;;;AAUX,SAAgB,EAAyB,EACvC,YACA,kBAIqB;CACrB,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B,EAAc,GAAG,GAAK,EAAS,EAC/E,CAAC,GAAc,KAAmB,GAAiB,EAEnD,CAAC,GAAQ,KAAa,QAAuB,EAAW,EAAa,IAAI,SAAS,CAAC,CAAC,EACpF,CA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AAIX,SAAS,EAAe,EACtB,WACA,aACA,SAKqB;AAiBrB,QAhBI,MAAW,YAEX,kBAAC,GAAD;EAAO,WAAU;YAAjB,CACE,kBAAC,GAAD;GAAS,MAAM;GAAI,WAAU;GAAiB,CAAA,EAC7C,EAAG,8CAA8C,UAAU,CACtD;MAGR,MAAW,cAEX,kBAAC,GAAD;EAAO,WAAU;YAAjB,CACE,kBAAC,GAAD,EAAc,MAAM,IAAM,CAAA,EACzB,EAAG,gDAAgD,YAAY,CAC1D;MAIV,kBAAC,GAAD;EAAO,WAAU;YAAjB,CACE,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA,EACpB,MAAW,UACR,EAAG,4CAA4C,QAAQ,GACvD,GAAG,EAAG,6CAA6C,SAAS,GAC1D,KAAY,OAA0B,KAAnB,KAAK,EAAS,KAEjC;;;AAIZ,SAAS,EAAU,EACjB,QACA,SAIqB;AACrB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAgB,QAAQ,EAAI;KAAQ,UAAU,EAAI;KAAc;KAAM,CAAA,EACrE,EAAI,cAAc,QAAQ,kBAAC,QAAD,EAAA,UAAA,CAAO,EAAI,YAAW,MAAU,EAAA,CAAA,CACvD;;GACL,EAAI,UACH,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAI;IACD,CAAA;GAEP,EAAI,UACH,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAI;IACD,CAAA;GAEP,CAAC,EAAI,UAAU,CAAC,EAAI,UACnB,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,wCAAwC,cAAc;IACxD,CAAA;GAEF"}
|
|
1
|
+
{"version":3,"file":"SandboxScriptRunnerPanel.js","names":[],"sources":["../../../src/sandbox/components/SandboxScriptRunnerPanel.tsx"],"sourcesContent":["import { useState, useEffect, useCallback, useMemo } from 'react';\nimport { useSearchParams } from 'react-router-dom';\nimport {\n Terminal,\n Play,\n Loader2,\n CheckCircle2,\n XCircle,\n AlertCircle,\n ArrowUpCircle,\n ShieldCheck,\n} from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\n\nimport { Button, Card, CardContent, Badge } from './ui';\nimport { tWithFallback } from '../utils/i18n';\nimport {\n useSandboxScriptRunsQuery,\n useRunSandboxScriptMutation,\n usePromoteSandboxScriptRunMutation,\n type SandboxScriptRunFieldsFragment,\n} from '../../generated/wspace-operations';\n\nconst INTERPRETERS = ['bash', 'sh', 'python', 'node'] as const;\n\nfunction decodeSeed(raw: string | null): string {\n if (!raw) return '';\n try {\n // Accept base64 (used by deep-links, e.g. the assistant's \"Send to Sandbox\") or plain text.\n return atob(raw);\n } catch {\n return raw;\n }\n}\n\n/**\n * SandboxScriptRunnerPanel — the sandbox-safe-execution review surface. Paste (or deep-link in via\n * `?script=<base64>`) an AI-generated script, run it inside this isolated sandbox, and review the\n * captured stdout/stderr/exit code. Each run is recorded; a run that succeeded can be promoted to the\n * real target, which stamps the sign-off onto the same record. The sandbox must be running.\n */\nexport function SandboxScriptRunnerPanel({\n sandbox,\n workspaceId,\n}: {\n sandbox: { id: string; status?: string | null };\n workspaceId: string;\n}): React.ReactElement {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => tWithFallback(t, key, fallback);\n const [searchParams, setSearchParams] = useSearchParams();\n\n const [script, setScript] = useState<string>(() => decodeSeed(searchParams.get('script')));\n const [interpreter, setInterpreter] = useState<(typeof INTERPRETERS)[number]>('bash');\n const [label, setLabel] = useState('');\n const [activeRunId, setActiveRunId] = useState<string | null>(null);\n\n const isRunning = sandbox.status === 'RUNNING';\n\n const { data, refetch } = useSandboxScriptRunsQuery({\n variables: { sandboxId: sandbox.id, context: { workspaceId } },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n });\n const [runScript, { loading: running, error: runError }] = useRunSandboxScriptMutation();\n const [promote, { loading: promoting }] = usePromoteSandboxScriptRunMutation();\n\n const runs = useMemo<SandboxScriptRunFieldsFragment[]>(\n () => data?.sandboxScriptRuns ?? [],\n [data]\n );\n const activeRun = runs.find((r) => r.id === activeRunId) ?? runs[0] ?? null;\n\n // One-shot: if we were deep-linked with a script, clear it from the URL so a refresh doesn't re-seed.\n useEffect(() => {\n if (searchParams.get('script')) {\n const next = new URLSearchParams(searchParams);\n next.delete('script');\n setSearchParams(next, { replace: true });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleRun = useCallback(async () => {\n if (!script.trim() || !isRunning) return;\n try {\n const res = await runScript({\n variables: {\n input: {\n sandboxId: sandbox.id,\n script,\n interpreter,\n label: label.trim() || null,\n context: { workspaceId },\n },\n },\n });\n const created = res.data?.runSandboxScript;\n if (created) setActiveRunId(created.id);\n await refetch();\n } catch {\n // surfaced via runError below\n }\n }, [script, isRunning, runScript, sandbox.id, interpreter, label, workspaceId, refetch]);\n\n const handlePromote = useCallback(\n async (runId: string) => {\n try {\n await promote({ variables: { id: runId, note: null, context: { workspaceId } } });\n await refetch();\n } catch {\n // surfaced inline on the run row via refetch\n }\n },\n [promote, workspaceId, refetch]\n );\n\n return (\n <Card>\n <CardContent className=\"p-5\">\n <div className=\"mb-4 flex items-center justify-between\">\n <h3 className=\"flex items-center gap-2 font-semibold\">\n <div className=\"rounded-lg bg-action-primary-bg/10 p-1.5\">\n <Terminal size={14} className=\"text-primary\" />\n </div>\n {tr('sandbox.detail.scriptRunner.title', 'Script Runner')}\n </h3>\n </div>\n <p className=\"mb-3 text-sm text-text-secondary\">\n {tr(\n 'sandbox.detail.scriptRunner.subtitle',\n 'Run an AI-generated script in this isolated sandbox and review the output before promoting it to the real target.'\n )}\n </p>\n\n {!isRunning && (\n <div className=\"mb-3 flex items-center gap-2 rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-amber-600\">\n <AlertCircle size={14} />\n {tr(\n 'sandbox.detail.scriptRunner.notRunning',\n 'The sandbox must be running to execute a script.'\n )}\n </div>\n )}\n\n <div className=\"space-y-3\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <select\n value={interpreter}\n onChange={(e) => setInterpreter(e.target.value as (typeof INTERPRETERS)[number])}\n className=\"rounded-lg border bg-bg-surface px-2 py-1 font-mono text-xs\"\n >\n {INTERPRETERS.map((i) => (\n <option key={i} value={i}>\n {i}\n </option>\n ))}\n </select>\n <input\n value={label}\n onChange={(e) => setLabel(e.target.value)}\n placeholder={tr('sandbox.detail.scriptRunner.labelPlaceholder', 'Label (optional)')}\n className=\"flex-1 rounded-lg border bg-bg-surface px-2 py-1 text-xs\"\n />\n </div>\n <textarea\n value={script}\n onChange={(e) => setScript(e.target.value)}\n spellCheck={false}\n placeholder={tr(\n 'sandbox.detail.scriptRunner.placeholder',\n '# Paste the AI-generated script here, then Run to test it in the sandbox'\n )}\n className=\"h-40 w-full resize-y rounded-lg border bg-bg-surface p-3 font-mono text-xs\"\n />\n <div className=\"flex justify-end\">\n <Button\n onClick={() => void handleRun()}\n disabled={!isRunning || running || !script.trim()}\n >\n {running ? <Loader2 size={14} className=\"animate-spin\" /> : <Play size={14} />}\n {tr('sandbox.detail.scriptRunner.run', 'Run in sandbox')}\n </Button>\n </div>\n {runError && (\n <div className=\"flex items-center gap-2 rounded-lg bg-status-error-bg/10 px-3 py-2 text-sm text-status-error-text\">\n <XCircle size={14} />\n {runError.message}\n </div>\n )}\n </div>\n\n {activeRun && (\n <div className=\"mt-4\">\n <RunOutput run={activeRun} tr={tr} />\n </div>\n )}\n\n {runs.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-xs font-semibold uppercase text-text-secondary\">\n {tr('sandbox.detail.scriptRunner.history', 'Run history')}\n </h4>\n <ul className=\"divide-y rounded-lg border\">\n {runs.map((r) => (\n <li key={r.id} className=\"flex items-center gap-3 px-3 py-2 text-sm\">\n <RunStatusBadge status={r.status} exitCode={r.exitCode} tr={tr} />\n <button\n type=\"button\"\n onClick={() => setActiveRunId(r.id)}\n className=\"min-w-0 flex-1 truncate text-left hover:underline\"\n >\n <span className=\"font-mono text-xs\">{r.interpreter}</span>\n {r.label ? ` · ${r.label}` : ''}\n <span className=\"ml-1 text-xs text-text-secondary\">\n {new Date(r.createdAt as unknown as string).toLocaleString()}\n </span>\n </button>\n {r.promotedAt ? (\n <Badge className=\"shrink-0 gap-1 bg-green-500/10 text-green-600\">\n <ShieldCheck size={12} />\n {tr('sandbox.detail.scriptRunner.promoted', 'Promoted')}\n </Badge>\n ) : (\n r.status === 'succeeded' && (\n <Button\n variant=\"outline\"\n onClick={() => void handlePromote(r.id)}\n disabled={promoting}\n className=\"shrink-0\"\n title={tr(\n 'sandbox.detail.scriptRunner.promoteTitle',\n 'Sign off this reviewed run for the real target'\n )}\n >\n <ArrowUpCircle size={12} />\n {tr('sandbox.detail.scriptRunner.promote', 'Promote')}\n </Button>\n )\n )}\n </li>\n ))}\n </ul>\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n\nfunction RunStatusBadge({\n status,\n exitCode,\n tr,\n}: {\n status: string;\n exitCode?: number | null;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n if (status === 'running') {\n return (\n <Badge className=\"gap-1 bg-blue-500/10 text-blue-600\">\n <Loader2 size={12} className=\"animate-spin\" />\n {tr('sandbox.detail.scriptRunner.status.running', 'Running')}\n </Badge>\n );\n }\n if (status === 'succeeded') {\n return (\n <Badge className=\"gap-1 bg-green-500/10 text-green-600\">\n <CheckCircle2 size={12} />\n {tr('sandbox.detail.scriptRunner.status.succeeded', 'Succeeded')}\n </Badge>\n );\n }\n return (\n <Badge className=\"gap-1 bg-status-error-bg/10 text-status-error-text\">\n <XCircle size={12} />\n {status === 'error'\n ? tr('sandbox.detail.scriptRunner.status.error', 'Error')\n : `${tr('sandbox.detail.scriptRunner.status.failed', 'Failed')}${\n exitCode != null ? ` (${exitCode})` : ''\n }`}\n </Badge>\n );\n}\n\nfunction RunOutput({\n run,\n tr,\n}: {\n run: SandboxScriptRunFieldsFragment;\n tr: (k: string, f: string) => string;\n}): React.ReactElement {\n return (\n <div className=\"rounded-lg border bg-bg-sunken/30 p-3\">\n <div className=\"mb-2 flex items-center gap-2 text-xs text-text-secondary\">\n <RunStatusBadge status={run.status} exitCode={run.exitCode} tr={tr} />\n {run.durationMs != null && <span>{run.durationMs} ms</span>}\n </div>\n {run.stdout && (\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-words font-mono text-xs\">\n {run.stdout}\n </pre>\n )}\n {run.stderr && (\n <pre className=\"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-status-error-text\">\n {run.stderr}\n </pre>\n )}\n {!run.stdout && !run.stderr && (\n <p className=\"text-xs text-text-secondary\">\n {tr('sandbox.detail.scriptRunner.noOutput', '(no output)')}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAuBA,IAAM,IAAe;CAAC;CAAQ;CAAM;CAAU;CAAO;AAErD,SAAS,EAAW,GAA4B;AAC9C,KAAI,CAAC,EAAK,QAAO;AACjB,KAAI;AAEF,SAAO,KAAK,EAAI;SACV;AACN,SAAO;;;AAUX,SAAgB,EAAyB,EACvC,YACA,kBAIqB;CACrB,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B,EAAc,GAAG,GAAK,EAAS,EAC/E,CAAC,GAAc,KAAmB,GAAiB,EAEnD,CAAC,GAAQ,KAAa,QAAuB,EAAW,EAAa,IAAI,SAAS,CAAC,CAAC,EACpF,CAAC,GAAa,KAAkB,EAAwC,OAAO,EAC/E,CAAC,GAAO,KAAY,EAAS,GAAG,EAChC,CAAC,GAAa,KAAkB,EAAwB,KAAK,EAE7D,IAAY,EAAQ,WAAW,WAE/B,EAAE,SAAM,eAAY,EAA0B;EAClD,WAAW;GAAE,WAAW,EAAQ;GAAI,SAAS,EAAE,gBAAa;GAAE;EAC9D,MAAM,CAAC;EACP,aAAa;EACd,CAAC,EACI,CAAC,GAAW,EAAE,SAAS,GAAS,OAAO,OAAc,GAA6B,EAClF,CAAC,GA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AAO,WAAU;YAAjB,CACE,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA,EACpB,MAAW,UACR,EAAG,4CAA4C,QAAQ,GACvD,GAAG,EAAG,6CAA6C,SAAS,GAC1D,KAAY,OAA0B,KAAnB,KAAK,EAAS,KAEjC;;;AAIZ,SAAS,EAAU,EACjB,QACA,SAIqB;AACrB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAgB,QAAQ,EAAI;KAAQ,UAAU,EAAI;KAAc;KAAM,CAAA,EACrE,EAAI,cAAc,QAAQ,kBAAC,QAAD,EAAA,UAAA,CAAO,EAAI,YAAW,MAAU,EAAA,CAAA,CACvD;;GACL,EAAI,UACH,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAI;IACD,CAAA;GAEP,EAAI,UACH,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAI;IACD,CAAA;GAEP,CAAC,EAAI,UAAU,CAAC,EAAI,UACnB,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,wCAAwC,cAAc;IACxD,CAAA;GAEF"}
|
|
@@ -56,8 +56,8 @@ var p = {
|
|
|
56
56
|
}, m = ({ status: n, className: r, showIcon: a = !0, size: o = "sm" }) => {
|
|
57
57
|
let { t: s } = u(), c = p[n] || {
|
|
58
58
|
label: n,
|
|
59
|
-
color: "text-
|
|
60
|
-
bg: "bg-
|
|
59
|
+
color: "text-text-secondary",
|
|
60
|
+
bg: "bg-bg-sunken border-border-subtle",
|
|
61
61
|
icon: i
|
|
62
62
|
}, l = c.icon, m = n === "PROVISIONING" || n === "STOPPING", h = {
|
|
63
63
|
PENDING: t(s, "sandbox.status.pending", "Pending"),
|