@burdenoff/microfe-sandbox 2026.1013.2 → 2026.1101.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/generated/global-types.d.ts +5428 -1640
- package/dist/generated/global-types.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +16 -24
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +2 -8
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +113929 -40483
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js.map +1 -1
- package/dist/sandbox/components/ContainerImagePicker.d.ts.map +1 -1
- package/dist/sandbox/components/ExportSandboxesDialog.d.ts.map +1 -1
- package/dist/sandbox/components/ExportSandboxesDialog.js +99 -79
- package/dist/sandbox/components/ExportSandboxesDialog.js.map +1 -1
- package/dist/sandbox/components/SandboxTypeSelector.d.ts.map +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.d.ts.map +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.js +468 -468
- package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -1
- package/dist/sandbox/utils/imageRegistry.d.ts +12 -3
- package/dist/sandbox/utils/imageRegistry.d.ts.map +1 -1
- package/dist/sandbox/utils/imageRegistry.js +6 -6
- package/dist/sandbox/utils/imageRegistry.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerImagePicker.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ContainerImagePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContainerImagePicker.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ContainerImagePicker.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AAElD,UAAU,KAAK;IACb,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,YAAY,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3E,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,+BA4EzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportSandboxesDialog.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExportSandboxesDialog.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"names":[],"mappings":"AAwFA,UAAU,KAAK;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,+BA0K1E"}
|
|
@@ -1,126 +1,146 @@
|
|
|
1
1
|
import { Button as e, Checkbox as t, Dialog as n, DialogContent as r, DialogDescription as i, DialogFooter as a, DialogHeader as o, DialogTitle as s } from "./ui.js";
|
|
2
2
|
import { tWithFallback as c } from "../utils/i18n.js";
|
|
3
3
|
import { useSandboxEvents as l } from "../utils/sandboxEvents.js";
|
|
4
|
-
import {
|
|
5
|
-
import { gql as
|
|
6
|
-
import { useMutation as
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { Fragment as
|
|
4
|
+
import { useState as u } from "react";
|
|
5
|
+
import { gql as d } from "@apollo/client";
|
|
6
|
+
import { useMutation as f, useSubscription as p } from "@apollo/client/react";
|
|
7
|
+
import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
8
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
9
9
|
//#region src/sandbox/components/ExportSandboxesDialog.tsx
|
|
10
|
-
var
|
|
11
|
-
mutation ExportSandboxes($input:
|
|
12
|
-
|
|
10
|
+
var v = d`
|
|
11
|
+
mutation ExportSandboxes($context: ContextInput, $input: CreateExportJobInput!) {
|
|
12
|
+
createExportJob(context: $context, input: $input) {
|
|
13
13
|
id
|
|
14
|
-
workspaceId
|
|
15
14
|
status
|
|
16
15
|
format
|
|
17
16
|
downloadUrl
|
|
18
|
-
expiresAt
|
|
19
17
|
errorMessage
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
|
-
`,
|
|
23
|
-
subscription
|
|
24
|
-
|
|
20
|
+
`, y = d`
|
|
21
|
+
subscription OnExportJobProgress($jobId: ID!) {
|
|
22
|
+
exportJobProgress(jobId: $jobId) {
|
|
25
23
|
id
|
|
26
24
|
status
|
|
27
25
|
format
|
|
28
|
-
rowCount
|
|
29
26
|
downloadUrl
|
|
30
|
-
expiresAt
|
|
31
27
|
errorMessage
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
`;
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
function b(e) {
|
|
32
|
+
return e === "COMPLETED" ? "READY" : e === "FAILED" || e === "CANCELLED" || e === "EXPIRED" || e === "DELETED" ? "FAILED" : "PENDING";
|
|
33
|
+
}
|
|
34
|
+
function x(e) {
|
|
35
|
+
return {
|
|
36
|
+
id: e.id,
|
|
37
|
+
status: b(e.status),
|
|
38
|
+
format: e.format === "CSV" ? "CSV" : "JSON",
|
|
39
|
+
downloadUrl: e.downloadUrl,
|
|
40
|
+
errorMessage: e.errorMessage
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function S({ workspaceId: d, open: b, onClose: S }) {
|
|
44
|
+
let { t: C } = m(), w = l(), [T, E] = u("CSV"), [D, O] = u(!1), [k, A] = u(null), [j, M] = u(null), [N, P] = u(null), [F, { loading: I }] = f(v);
|
|
45
|
+
p(y, {
|
|
46
|
+
variables: { jobId: k ?? "" },
|
|
47
|
+
skip: k === null,
|
|
43
48
|
onData: ({ data: e }) => {
|
|
44
|
-
let t = e.data?.
|
|
45
|
-
t &&
|
|
49
|
+
let t = e.data?.exportJobProgress;
|
|
50
|
+
t && M(x(t));
|
|
46
51
|
}
|
|
47
52
|
});
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
let L = async () => {
|
|
54
|
+
P(null);
|
|
55
|
+
try {
|
|
56
|
+
let { data: e } = await F({ variables: {
|
|
57
|
+
context: { workspaceId: d },
|
|
58
|
+
input: {
|
|
59
|
+
name: `sandbox-export-${Date.now()}`,
|
|
60
|
+
entityTypes: D ? ["sandbox_environments", "sandbox_usage_events"] : ["sandbox_environments"],
|
|
61
|
+
format: T
|
|
62
|
+
}
|
|
63
|
+
} });
|
|
64
|
+
e?.createExportJob && (A(e.createExportJob.id), M(x(e.createExportJob)), w.sandboxExportRequested({
|
|
65
|
+
jobId: e.createExportJob.id,
|
|
66
|
+
format: T
|
|
67
|
+
}));
|
|
68
|
+
} catch (e) {
|
|
69
|
+
P(e instanceof Error ? e.message : "unknown");
|
|
70
|
+
}
|
|
71
|
+
}, R = c(C, "sandbox.exportDialog.title", "Export sandboxes"), z = c(C, "sandbox.exportDialog.description", "Generate a downloadable snapshot of the sandboxes matching your current filters.");
|
|
72
|
+
return /* @__PURE__ */ g(n, {
|
|
73
|
+
open: b,
|
|
62
74
|
onOpenChange: (e) => {
|
|
63
75
|
e || S();
|
|
64
76
|
},
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
"aria-label":
|
|
77
|
+
children: /* @__PURE__ */ _(r, {
|
|
78
|
+
"aria-label": R,
|
|
67
79
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
80
|
+
/* @__PURE__ */ _(o, { children: [/* @__PURE__ */ g(s, { children: R }), /* @__PURE__ */ g(i, { children: z })] }),
|
|
81
|
+
j ? /* @__PURE__ */ g("div", {
|
|
70
82
|
className: "space-y-3 text-sm text-text-secondary",
|
|
71
|
-
children:
|
|
83
|
+
children: j.status === "READY" && j.downloadUrl ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("p", {
|
|
72
84
|
className: "text-status-success-text font-medium",
|
|
73
85
|
children: c(C, "sandbox.exportDialog.ready", "Export ready")
|
|
74
|
-
}), /* @__PURE__ */
|
|
75
|
-
href:
|
|
86
|
+
}), /* @__PURE__ */ g("a", {
|
|
87
|
+
href: j.downloadUrl,
|
|
76
88
|
target: "_blank",
|
|
77
89
|
rel: "noopener noreferrer",
|
|
78
90
|
className: "inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors",
|
|
79
91
|
children: c(C, "sandbox.exportDialog.download", "Download")
|
|
80
|
-
})] }) :
|
|
92
|
+
})] }) : j.status === "FAILED" ? /* @__PURE__ */ g("p", {
|
|
81
93
|
className: "text-status-danger-text",
|
|
82
94
|
role: "alert",
|
|
83
|
-
children: c(C, "sandbox.exportDialog.failed", `Export failed: ${
|
|
84
|
-
}) : /* @__PURE__ */
|
|
95
|
+
children: c(C, "sandbox.exportDialog.failed", `Export failed: ${j.errorMessage}`, { error: j.errorMessage ?? "unknown" })
|
|
96
|
+
}) : /* @__PURE__ */ g("p", {
|
|
85
97
|
className: "text-status-info-text",
|
|
86
98
|
children: c(C, "sandbox.exportDialog.preparing", "Preparing export…")
|
|
87
99
|
})
|
|
88
|
-
}) : /* @__PURE__ */
|
|
100
|
+
}) : /* @__PURE__ */ _("div", {
|
|
89
101
|
className: "space-y-4",
|
|
90
|
-
children: [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
})
|
|
113
|
-
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ _("fieldset", { children: [/* @__PURE__ */ g("legend", {
|
|
104
|
+
className: "text-sm font-medium text-text-primary",
|
|
105
|
+
children: c(C, "sandbox.exportDialog.format.label", "Format")
|
|
106
|
+
}), /* @__PURE__ */ g("div", {
|
|
107
|
+
className: "mt-2 flex gap-4",
|
|
108
|
+
children: ["CSV", "JSON"].map((e) => /* @__PURE__ */ _("label", {
|
|
109
|
+
className: "inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer",
|
|
110
|
+
children: [/* @__PURE__ */ g("input", {
|
|
111
|
+
type: "radio",
|
|
112
|
+
name: "format",
|
|
113
|
+
checked: T === e,
|
|
114
|
+
onChange: () => E(e),
|
|
115
|
+
"aria-label": e,
|
|
116
|
+
className: "accent-primary"
|
|
117
|
+
}), e]
|
|
118
|
+
}, e))
|
|
119
|
+
})] }),
|
|
120
|
+
N ? /* @__PURE__ */ g("p", {
|
|
121
|
+
className: "text-status-danger-text",
|
|
122
|
+
role: "alert",
|
|
123
|
+
children: c(C, "sandbox.exportDialog.startFailed", `Could not start the export: ${N}`, { error: N })
|
|
124
|
+
}) : null,
|
|
125
|
+
/* @__PURE__ */ _("label", {
|
|
126
|
+
className: "flex items-center gap-2 text-sm text-text-primary cursor-pointer",
|
|
127
|
+
children: [/* @__PURE__ */ g(t, {
|
|
128
|
+
checked: D,
|
|
129
|
+
onCheckedChange: (e) => O(e === !0),
|
|
130
|
+
"aria-label": c(C, "sandbox.exportDialog.includeUsage", "Include usage events")
|
|
131
|
+
}), /* @__PURE__ */ g("span", { children: c(C, "sandbox.exportDialog.includeUsage", "Include usage events") })]
|
|
132
|
+
})
|
|
133
|
+
]
|
|
114
134
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
135
|
+
/* @__PURE__ */ _(a, { children: [/* @__PURE__ */ g(e, {
|
|
116
136
|
type: "button",
|
|
117
137
|
variant: "outline",
|
|
118
138
|
onClick: S,
|
|
119
139
|
children: c(C, "sandbox.exportDialog.cancel", "Cancel")
|
|
120
|
-
}), !
|
|
140
|
+
}), !j && /* @__PURE__ */ g(e, {
|
|
121
141
|
type: "button",
|
|
122
|
-
onClick:
|
|
123
|
-
disabled:
|
|
142
|
+
onClick: L,
|
|
143
|
+
disabled: I,
|
|
124
144
|
children: c(C, "sandbox.exportDialog.submit", "Export")
|
|
125
145
|
})] })
|
|
126
146
|
]
|
|
@@ -128,6 +148,6 @@ function x({ workspaceId: f, open: x, onClose: S }) {
|
|
|
128
148
|
});
|
|
129
149
|
}
|
|
130
150
|
//#endregion
|
|
131
|
-
export {
|
|
151
|
+
export { S as ExportSandboxesDialog };
|
|
132
152
|
|
|
133
153
|
//# sourceMappingURL=ExportSandboxesDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from './ui';\n\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($input: ExportSandboxesInput!) {\n exportSandboxes(input: $input) {\n id\n workspaceId\n status\n format\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnSandboxExportJobChanged($workspaceId: ID!, $jobId: ID!) {\n onSandboxExportJobChanged(workspaceId: $workspaceId, jobId: $jobId) {\n id\n status\n format\n rowCount\n downloadUrl\n expiresAt\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\ntype Job = {\n id: string;\n status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED';\n format: ExportFormat;\n rowCount?: number | null;\n downloadUrl?: string | null;\n expiresAt?: string | null;\n errorMessage?: string | null;\n};\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n // Job id is only read inside the subscription callback (not the render),\n // so keep it in a ref to avoid an unused-state re-render per status tick.\n const jobIdRef = useRef<string | null>(null);\n const [jobIdActive, setJobIdActive] = useState(false);\n const [job, setJob] = useState<Job | null>(null);\n\n const [trigger, { loading }] = useMutation<{ exportSandboxes: Job }>(EXPORT_MUTATION);\n\n useSubscription<{ onSandboxExportJobChanged: Job }>(EXPORT_SUBSCRIPTION, {\n variables: { workspaceId, jobId: jobIdRef.current! },\n skip: !jobIdActive,\n onData: ({ data }: { data: { data?: { onSandboxExportJobChanged?: Job } | null } }) => {\n const next = data.data?.onSandboxExportJobChanged;\n if (next) setJob(next);\n },\n });\n\n const start = async () => {\n const { data } = await trigger({\n variables: {\n input: { workspaceId, format, includeUsageEvents: includeUsage, context: { workspaceId } },\n },\n });\n if (data?.exportSandboxes) {\n jobIdRef.current = data.exportSandboxes.id;\n setJobIdActive(true);\n setJob(data.exportSandboxes);\n events.sandboxExportRequested({ jobId: data.exportSandboxes.id, format });\n }\n };\n\n const heading = tWithFallback(t, 'sandbox.exportDialog.title', 'Export sandboxes');\n const description = tWithFallback(\n t,\n 'sandbox.exportDialog.description',\n 'Generate a downloadable snapshot of the sandboxes matching your current filters.'\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent aria-label={heading}>\n <DialogHeader>\n <DialogTitle>{heading}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {job ? (\n <div className=\"space-y-3 text-sm text-text-secondary\">\n {job.status === 'COMPLETED' && job.downloadUrl ? (\n <>\n <p className=\"text-status-success-text font-medium\">\n {tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}\n </p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.failed',\n `Export failed: ${job.errorMessage}`,\n {\n error: job.errorMessage ?? 'unknown',\n }\n )}\n </p>\n ) : (\n <p className=\"text-status-info-text\">\n {tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}\n </p>\n )}\n </div>\n ) : (\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-4\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label\n key={f}\n className=\"inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n className=\"accent-primary\"\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n <label className=\"flex items-center gap-2 text-sm text-text-primary cursor-pointer\">\n <Checkbox\n checked={includeUsage}\n onCheckedChange={(checked: boolean | 'indeterminate') =>\n setIncludeUsage(checked === true)\n }\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n <span>\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </span>\n </label>\n </div>\n )}\n\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </Button>\n {!job && (\n <Button type=\"button\" onClick={start} disabled={loading}>\n {tWithFallback(t, 'sandbox.exportDialog.submit', 'Export')}\n </Button>\n )}\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAM,IAAkB,CAAG;;;;;;;;;;;;GAcrB,IAAsB,CAAG;;;;;;;;;;;;;AA+B/B,SAAgB,EAAsB,EAAE,gBAAa,SAAM,cAAkB;CAC3E,IAAM,EAAE,SAAM,GAAS,EACjB,IAAS,GAAkB,EAC3B,CAAC,GAAQ,KAAa,EAAuB,MAAM,EACnD,CAAC,GAAc,KAAmB,EAAS,GAAM,EAGjD,IAAW,EAAsB,KAAK,EACtC,CAAC,GAAa,KAAkB,EAAS,GAAM,EAC/C,CAAC,GAAK,KAAU,EAAqB,KAAK,EAE1C,CAAC,GAAS,EAAE,gBAAa,EAAsC,EAAgB;AAErF,GAAoD,GAAqB;EACvE,WAAW;GAAE;GAAa,OAAO,EAAS;GAAU;EACpD,MAAM,CAAC;EACP,SAAS,EAAE,cAA4E;GACrF,IAAM,IAAO,EAAK,MAAM;AACxB,GAAI,KAAM,EAAO,EAAK;;EAEzB,CAAC;CAEF,IAAM,IAAQ,YAAY;EACxB,IAAM,EAAE,YAAS,MAAM,EAAQ,EAC7B,WAAW,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AAc,GAAG,qCAAqC,SAAS;MACzD,CAAA,EACT,kBAAC,OAAD;MAAK,WAAU;gBACX,CAAC,OAAO,OAAO,CAAW,KAAK,MAC/B,kBAAC,SAAD;OAEE,WAAU;iBAFZ,CAIE,kBAAC,SAAD;QACE,MAAK;QACL,MAAK;QACL,SAAS,MAAW;QACpB,gBAAgB,EAAU,EAAE;QAC5B,cAAY;QACZ,WAAU;QACV,CAAA,EACD,EACK;SAZD,EAYC,CACR;MACE,CAAA,CACG,EAAA,CAAA,EACX,kBAAC,SAAD;MAAO,WAAU;gBAAjB,CACE,kBAAC,GAAD;OACE,SAAS;OACT,kBAAkB,MAChB,EAAgB,MAAY,GAAK;OAEnC,cAAY,EACV,GACA,qCACA,uBACD;OACD,CAAA,EACF,kBAAC,QAAD,EAAA,UACG,EAAc,GAAG,qCAAqC,uBAAuB,EACzE,CAAA,CACD;QACJ;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,SAAS;eAC9C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAS;KAAO,UAAU;eAC7C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA"}
|
|
1
|
+
{"version":3,"file":"ExportSandboxesDialog.js","names":[],"sources":["../../../src/sandbox/components/ExportSandboxesDialog.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useSubscription } from '@apollo/client/react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useSandboxEvents } from '../utils/sandboxEvents';\nimport {\n Button,\n Checkbox,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from './ui';\n\n/**\n * The sandbox export is delegated to wspace-export-svc (BOFF-5318): the\n * dialog drives the canonical `createExportJob` mutation and tracks it with\n * the export service's `exportJobProgress` subscription. `sandbox_environments`\n * is the entity config the export service pages over the sandbox data with;\n * the usage-events checkbox adds `sandbox_usage_events`.\n */\nconst EXPORT_MUTATION = gql`\n mutation ExportSandboxes($context: ContextInput, $input: CreateExportJobInput!) {\n createExportJob(context: $context, input: $input) {\n id\n status\n format\n downloadUrl\n errorMessage\n }\n }\n`;\n\nconst EXPORT_SUBSCRIPTION = gql`\n subscription OnExportJobProgress($jobId: ID!) {\n exportJobProgress(jobId: $jobId) {\n id\n status\n format\n downloadUrl\n errorMessage\n }\n }\n`;\n\ntype ExportFormat = 'CSV' | 'JSON';\n\n/**\n * The export service's job status, projected onto what the dialog can render.\n * `COMPLETED` is ready (real presigned download URL); `FAILED` and the\n * terminal non-success states are failures; everything else is still running.\n */\ntype Job = {\n id: string;\n status: 'PENDING' | 'READY' | 'FAILED';\n format: ExportFormat;\n downloadUrl?: string | null;\n errorMessage?: string | null;\n};\n\nfunction projectStatus(status: string): Job['status'] {\n if (status === 'COMPLETED') return 'READY';\n if (status === 'FAILED' || status === 'CANCELLED' || status === 'EXPIRED' || status === 'DELETED')\n return 'FAILED';\n return 'PENDING';\n}\n\ntype RawJob = {\n id: string;\n status: string;\n format: string;\n downloadUrl?: string | null;\n errorMessage?: string | null;\n};\n\nfunction toJob(raw: RawJob): Job {\n return {\n id: raw.id,\n status: projectStatus(raw.status),\n format: raw.format === 'CSV' ? 'CSV' : 'JSON',\n downloadUrl: raw.downloadUrl,\n errorMessage: raw.errorMessage,\n };\n}\n\ninterface Props {\n workspaceId: string;\n open: boolean;\n onClose: () => void;\n}\n\nexport function ExportSandboxesDialog({ workspaceId, open, onClose }: Props) {\n const { t } = useI18n();\n const events = useSandboxEvents();\n const [format, setFormat] = useState<ExportFormat>('CSV');\n const [includeUsage, setIncludeUsage] = useState(false);\n const [jobId, setJobId] = useState<string | null>(null);\n const [job, setJob] = useState<Job | null>(null);\n const [startError, setStartError] = useState<string | null>(null);\n\n const [trigger, { loading }] = useMutation<\n { createExportJob: RawJob },\n { context: object; input: object }\n >(EXPORT_MUTATION);\n\n useSubscription<{ exportJobProgress: RawJob }>(EXPORT_SUBSCRIPTION, {\n variables: { jobId: jobId ?? '' },\n skip: jobId === null,\n onData: ({ data }: { data: { data?: { exportJobProgress?: RawJob } | null } }) => {\n const next = data.data?.exportJobProgress;\n if (next) setJob(toJob(next));\n },\n });\n\n const start = async () => {\n setStartError(null);\n try {\n const { data } = await trigger({\n variables: {\n context: { workspaceId },\n input: {\n name: `sandbox-export-${Date.now()}`,\n entityTypes: includeUsage\n ? ['sandbox_environments', 'sandbox_usage_events']\n : ['sandbox_environments'],\n format,\n },\n },\n });\n if (data?.createExportJob) {\n setJobId(data.createExportJob.id);\n setJob(toJob(data.createExportJob));\n events.sandboxExportRequested({ jobId: data.createExportJob.id, format });\n }\n } catch (err) {\n // The mutation can fail quota gates or auth without Apollo surfacing it\n // — show the failure in the dialog instead of leaving a dead button.\n setStartError(err instanceof Error ? err.message : 'unknown');\n }\n };\n\n const heading = tWithFallback(t, 'sandbox.exportDialog.title', 'Export sandboxes');\n const description = tWithFallback(\n t,\n 'sandbox.exportDialog.description',\n 'Generate a downloadable snapshot of the sandboxes matching your current filters.'\n );\n\n return (\n <Dialog\n open={open}\n onOpenChange={(next) => {\n if (!next) onClose();\n }}\n >\n <DialogContent aria-label={heading}>\n <DialogHeader>\n <DialogTitle>{heading}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {job ? (\n <div className=\"space-y-3 text-sm text-text-secondary\">\n {job.status === 'READY' && job.downloadUrl ? (\n <>\n <p className=\"text-status-success-text font-medium\">\n {tWithFallback(t, 'sandbox.exportDialog.ready', 'Export ready')}\n </p>\n <a\n href={job.downloadUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center rounded-md bg-status-info-bg-subtle px-3 py-1.5 text-status-info-text hover:bg-status-info-bg-default hover:text-status-info-text-inverse transition-colors\"\n >\n {tWithFallback(t, 'sandbox.exportDialog.download', 'Download')}\n </a>\n </>\n ) : job.status === 'FAILED' ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.failed',\n `Export failed: ${job.errorMessage}`,\n {\n error: job.errorMessage ?? 'unknown',\n }\n )}\n </p>\n ) : (\n <p className=\"text-status-info-text\">\n {tWithFallback(t, 'sandbox.exportDialog.preparing', 'Preparing export…')}\n </p>\n )}\n </div>\n ) : (\n <div className=\"space-y-4\">\n <fieldset>\n <legend className=\"text-sm font-medium text-text-primary\">\n {tWithFallback(t, 'sandbox.exportDialog.format.label', 'Format')}\n </legend>\n <div className=\"mt-2 flex gap-4\">\n {(['CSV', 'JSON'] as const).map((f) => (\n <label\n key={f}\n className=\"inline-flex items-center gap-1.5 text-sm text-text-primary cursor-pointer\"\n >\n <input\n type=\"radio\"\n name=\"format\"\n checked={format === f}\n onChange={() => setFormat(f)}\n aria-label={f}\n className=\"accent-primary\"\n />\n {f}\n </label>\n ))}\n </div>\n </fieldset>\n {startError ? (\n <p className=\"text-status-danger-text\" role=\"alert\">\n {tWithFallback(\n t,\n 'sandbox.exportDialog.startFailed',\n `Could not start the export: ${startError}`,\n { error: startError }\n )}\n </p>\n ) : null}\n <label className=\"flex items-center gap-2 text-sm text-text-primary cursor-pointer\">\n <Checkbox\n checked={includeUsage}\n onCheckedChange={(checked: boolean | 'indeterminate') =>\n setIncludeUsage(checked === true)\n }\n aria-label={tWithFallback(\n t,\n 'sandbox.exportDialog.includeUsage',\n 'Include usage events'\n )}\n />\n <span>\n {tWithFallback(t, 'sandbox.exportDialog.includeUsage', 'Include usage events')}\n </span>\n </label>\n </div>\n )}\n\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tWithFallback(t, 'sandbox.exportDialog.cancel', 'Cancel')}\n </Button>\n {!job && (\n <Button type=\"button\" onClick={start} disabled={loading}>\n {tWith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;OACzD,CAAA,EACT,kBAAC,OAAD;OAAK,WAAU;iBACX,CAAC,OAAO,OAAO,CAAW,KAAK,MAC/B,kBAAC,SAAD;QAEE,WAAU;kBAFZ,CAIE,kBAAC,SAAD;SACE,MAAK;SACL,MAAK;SACL,SAAS,MAAW;SACpB,gBAAgB,EAAU,EAAE;SAC5B,cAAY;SACZ,WAAU;SACV,CAAA,EACD,EACK;UAZD,EAYC,CACR;OACE,CAAA,CACG,EAAA,CAAA;MACV,IACC,kBAAC,KAAD;OAAG,WAAU;OAA0B,MAAK;iBACzC,EACC,GACA,oCACA,+BAA+B,KAC/B,EAAE,OAAO,GAAY,CACtB;OACC,CAAA,GACF;MACJ,kBAAC,SAAD;OAAO,WAAU;iBAAjB,CACE,kBAAC,GAAD;QACE,SAAS;QACT,kBAAkB,MAChB,EAAgB,MAAY,GAAK;QAEnC,cAAY,EACV,GACA,qCACA,uBACD;QACD,CAAA,EACF,kBAAC,QAAD,EAAA,UACG,EAAc,GAAG,qCAAqC,uBAAuB,EACzE,CAAA,CACD;;MACJ;;IAGR,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,SAAS;eAC9C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,EACR,CAAC,KACA,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAS;KAAO,UAAU;eAC7C,EAAc,GAAG,+BAA+B,SAAS;KACnD,CAAA,CAEE,EAAA,CAAA;IACD;;EACT,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxTypeSelector.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/SandboxTypeSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SandboxTypeSelector.d.ts","sourceRoot":"","sources":["../../../src/sandbox/components/SandboxTypeSelector.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,+EAA+E;IAC/E,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,EAiClD,CAAC;AAEF,UAAU,wBAAwB;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IACtC;2DACuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,QAAQ,EACR,gBAAgB,GACjB,EAAE,wBAAwB,+BA+E1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxCreatePage.d.ts","sourceRoot":"","sources":["../../../src/sandbox/pages/SandboxCreatePage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SandboxCreatePage.d.ts","sourceRoot":"","sources":["../../../src/sandbox/pages/SandboxCreatePage.tsx"],"names":[],"mappings":"AAqKA,wBAAgB,iBAAiB,gCA0iDhC"}
|