@burdenoff/microfe-sandbox 2026.624.1 → 2026.624.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sandbox/components/CountdownTimer.js +2 -2
- package/dist/sandbox/components/CountdownTimer.js.map +1 -1
- package/dist/sandbox/components/ExtendTTLModal.js +57 -64
- package/dist/sandbox/components/ExtendTTLModal.js.map +1 -1
- package/dist/sandbox/components/PageLayout.js +1 -1
- package/dist/sandbox/components/PageLayout.js.map +1 -1
- package/dist/sandbox/components/ResourceDisplay.js +2 -2
- package/dist/sandbox/components/ResourceDisplay.js.map +1 -1
- package/dist/sandbox/pages/AdminTemplatesPage.js +90 -72
- package/dist/sandbox/pages/AdminTemplatesPage.js.map +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.js +1 -1
- package/dist/sandbox/pages/SandboxCreatePage.js.map +1 -1
- package/dist/sandbox/pages/SandboxListPage.js +209 -193
- package/dist/sandbox/pages/SandboxListPage.js.map +1 -1
- package/dist/sandbox/pages/TemplateDetailPage.js +1 -1
- package/dist/sandbox/pages/TemplateDetailPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ function l({ expiresAt: l, onExpired: u, onExtend: d, compact: f = !1 }) {
|
|
|
16
16
|
role: "timer",
|
|
17
17
|
"aria-live": "polite",
|
|
18
18
|
"aria-label": w,
|
|
19
|
-
className: `inline-flex items-center gap-1 text-sm font-mono ${x}`,
|
|
19
|
+
className: `inline-flex items-center gap-1 text-sm font-mono tabular-nums ${x}`,
|
|
20
20
|
children: [/* @__PURE__ */ s(a, {
|
|
21
21
|
"aria-hidden": "true",
|
|
22
22
|
className: "size-3.5"
|
|
@@ -34,7 +34,7 @@ function l({ expiresAt: l, onExpired: u, onExtend: d, compact: f = !1 }) {
|
|
|
34
34
|
/* @__PURE__ */ c("div", {
|
|
35
35
|
className: "flex flex-col",
|
|
36
36
|
children: [/* @__PURE__ */ s("span", {
|
|
37
|
-
className: `text-lg font-mono font-semibold ${x}`,
|
|
37
|
+
className: `text-lg font-mono font-semibold tabular-nums ${x}`,
|
|
38
38
|
children: b
|
|
39
39
|
}), /* @__PURE__ */ s("span", {
|
|
40
40
|
className: "text-xs text-text-secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport { Timer, Plus, AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useRemainingSeconds } from '../hooks/useRemainingSeconds';\n\ninterface CountdownTimerProps {\n expiresAt: string;\n onExpired?: () => void;\n onExtend?: () => void;\n compact?: boolean;\n}\n\nexport function CountdownTimer({\n expiresAt,\n onExpired,\n onExtend,\n compact = false,\n}: CountdownTimerProps) {\n const remainingSeconds = useRemainingSeconds(expiresAt, onExpired);\n const { t } = useI18n();\n\n // Browser notification at 60 seconds remaining, once per expiresAt window.\n // Ref-based flag avoids a render cycle and tracks the active expiresAt directly.\n const alertedForRef = useRef<string | null>(null);\n if (\n alertedForRef.current !== expiresAt &&\n remainingSeconds <= 60 &&\n remainingSeconds > 0 &&\n typeof window !== 'undefined' &&\n 'Notification' in window &&\n Notification.permission === 'granted'\n ) {\n alertedForRef.current = expiresAt;\n new Notification(tWithFallback(t, 'sandbox.timer.alertTitle', 'Sandbox expiring'), {\n body: tWithFallback(\n t,\n 'sandbox.timer.alertBody',\n 'Your sandbox will be destroyed in less than 1 minute. Extend it to continue working.'\n ),\n icon: '/favicon.ico',\n });\n }\n\n const hours = Math.floor(remainingSeconds / 3600);\n const minutes = Math.floor((remainingSeconds % 3600) / 60);\n const seconds = remainingSeconds % 60;\n const fmt = (n: number) => String(n).padStart(2, '0');\n const timeString =\n hours > 0 ? `${fmt(hours)}:${fmt(minutes)}:${fmt(seconds)}` : `${fmt(minutes)}:${fmt(seconds)}`;\n\n const color = (() => {\n if (remainingSeconds <= 0) return 'text-text-secondary';\n if (remainingSeconds <= 30) return 'text-status-error-text animate-pulse';\n if (remainingSeconds <= 60) return 'text-status-error-text';\n if (remainingSeconds <= 300) return 'text-status-warning-text';\n return 'text-status-success-text';\n })();\n\n const bg = (() => {\n if (remainingSeconds <= 0) return 'bg-bg-sunken border-border-subtle';\n if (remainingSeconds <= 60) return 'bg-status-error-bg-subtle border-border-default';\n if (remainingSeconds <= 300) return 'bg-status-warning-bg-subtle border-border-default';\n return 'bg-status-success-bg-subtle border-border-default';\n })();\n\n const remainingMinutes = Math.max(1, Math.ceil(remainingSeconds / 60));\n const accessibleLabel =\n remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.remaining', `${remainingMinutes} minutes remaining`, {\n count: remainingMinutes,\n });\n\n if (compact) {\n return (\n <span\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`inline-flex items-center gap-1 text-sm font-mono ${color}`}\n >\n <Timer aria-hidden=\"true\" className=\"size-3.5\" />\n {timeString}\n </span>\n );\n }\n\n return (\n <div\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`flex items-center gap-3 rounded-lg border px-4 py-2 ${bg}`}\n >\n <Timer aria-hidden=\"true\" className={`size-5 ${color}`} />\n <div className=\"flex flex-col\">\n <span className={`text-lg font-mono font-semibold ${color}`}>{timeString}</span>\n <span className=\"text-xs text-text-secondary\">\n {remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.label', 'Time remaining')}\n </span>\n </div>\n\n {remainingSeconds <= 60 && remainingSeconds > 0 && (\n <div className=\"flex items-center gap-1 text-xs text-status-error-text font-medium\">\n <AlertTriangle aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.expiringSoon', 'Expiring soon')}\n </div>\n )}\n\n {onExtend && remainingSeconds > 0 && (\n <button\n type=\"button\"\n onClick={onExtend}\n aria-label={tWithFallback(t, 'sandbox.timer.extend', 'Extend sandbox duration')}\n className=\"ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors\"\n >\n <Plus aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.extend', 'Extend')}\n </button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,EAAe,EAC7B,cACA,cACA,aACA,aAAU,MACY;CACtB,IAAM,IAAmB,EAAoB,GAAW,EAAU,EAC5D,EAAE,SAAM,GAAS,EAIjB,IAAgB,EAAsB,KAAK;AACjD,CACE,EAAc,YAAY,KAC1B,KAAoB,MACpB,IAAmB,KACnB,OAAO,SAAW,OAClB,kBAAkB,UAClB,aAAa,eAAe,cAE5B,EAAc,UAAU,GACxB,IAAI,aAAa,EAAc,GAAG,4BAA4B,mBAAmB,EAAE;EACjF,MAAM,EACJ,GACA,2BACA,uFACD;EACD,MAAM;EACP,CAAC;CAGJ,IAAM,IAAQ,KAAK,MAAM,IAAmB,KAAK,EAC3C,IAAU,KAAK,MAAO,IAAmB,OAAQ,GAAG,EACpD,IAAU,IAAmB,IAC7B,KAAO,MAAc,OAAO,EAAE,CAAC,SAAS,GAAG,IAAI,EAC/C,IACJ,IAAQ,IAAI,GAAG,EAAI,EAAM,CAAC,GAAG,EAAI,EAAQ,CAAC,GAAG,EAAI,EAAQ,KAAK,GAAG,EAAI,EAAQ,CAAC,GAAG,EAAI,EAAQ,IAEzF,IACA,KAAoB,IAAU,wBAC9B,KAAoB,KAAW,yCAC/B,KAAoB,KAAW,2BAC/B,KAAoB,MAAY,6BAC7B,4BAGH,IACA,KAAoB,IAAU,sCAC9B,KAAoB,KAAW,oDAC/B,KAAoB,MAAY,sDAC7B,qDAGH,IAAmB,KAAK,IAAI,GAAG,KAAK,KAAK,IAAmB,GAAG,CAAC,EAChE,IACJ,KAAoB,IAChB,EAAc,GAAG,yBAAyB,UAAU,GACpD,EAAc,GAAG,2BAA2B,GAAG,EAAiB,qBAAqB,EACnF,OAAO,GACR,CAAC;AAgBR,QAdI,IAEA,kBAAC,QAAD;EACE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"CountdownTimer.js","names":[],"sources":["../../../src/sandbox/components/CountdownTimer.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport { Timer, Plus, AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { tWithFallback } from '../utils/i18n';\nimport { useRemainingSeconds } from '../hooks/useRemainingSeconds';\n\ninterface CountdownTimerProps {\n expiresAt: string;\n onExpired?: () => void;\n onExtend?: () => void;\n compact?: boolean;\n}\n\nexport function CountdownTimer({\n expiresAt,\n onExpired,\n onExtend,\n compact = false,\n}: CountdownTimerProps) {\n const remainingSeconds = useRemainingSeconds(expiresAt, onExpired);\n const { t } = useI18n();\n\n // Browser notification at 60 seconds remaining, once per expiresAt window.\n // Ref-based flag avoids a render cycle and tracks the active expiresAt directly.\n const alertedForRef = useRef<string | null>(null);\n if (\n alertedForRef.current !== expiresAt &&\n remainingSeconds <= 60 &&\n remainingSeconds > 0 &&\n typeof window !== 'undefined' &&\n 'Notification' in window &&\n Notification.permission === 'granted'\n ) {\n alertedForRef.current = expiresAt;\n new Notification(tWithFallback(t, 'sandbox.timer.alertTitle', 'Sandbox expiring'), {\n body: tWithFallback(\n t,\n 'sandbox.timer.alertBody',\n 'Your sandbox will be destroyed in less than 1 minute. Extend it to continue working.'\n ),\n icon: '/favicon.ico',\n });\n }\n\n const hours = Math.floor(remainingSeconds / 3600);\n const minutes = Math.floor((remainingSeconds % 3600) / 60);\n const seconds = remainingSeconds % 60;\n const fmt = (n: number) => String(n).padStart(2, '0');\n const timeString =\n hours > 0 ? `${fmt(hours)}:${fmt(minutes)}:${fmt(seconds)}` : `${fmt(minutes)}:${fmt(seconds)}`;\n\n const color = (() => {\n if (remainingSeconds <= 0) return 'text-text-secondary';\n if (remainingSeconds <= 30) return 'text-status-error-text animate-pulse';\n if (remainingSeconds <= 60) return 'text-status-error-text';\n if (remainingSeconds <= 300) return 'text-status-warning-text';\n return 'text-status-success-text';\n })();\n\n const bg = (() => {\n if (remainingSeconds <= 0) return 'bg-bg-sunken border-border-subtle';\n if (remainingSeconds <= 60) return 'bg-status-error-bg-subtle border-border-default';\n if (remainingSeconds <= 300) return 'bg-status-warning-bg-subtle border-border-default';\n return 'bg-status-success-bg-subtle border-border-default';\n })();\n\n const remainingMinutes = Math.max(1, Math.ceil(remainingSeconds / 60));\n const accessibleLabel =\n remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.remaining', `${remainingMinutes} minutes remaining`, {\n count: remainingMinutes,\n });\n\n if (compact) {\n return (\n <span\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`inline-flex items-center gap-1 text-sm font-mono tabular-nums ${color}`}\n >\n <Timer aria-hidden=\"true\" className=\"size-3.5\" />\n {timeString}\n </span>\n );\n }\n\n return (\n <div\n role=\"timer\"\n aria-live=\"polite\"\n aria-label={accessibleLabel}\n className={`flex items-center gap-3 rounded-lg border px-4 py-2 ${bg}`}\n >\n <Timer aria-hidden=\"true\" className={`size-5 ${color}`} />\n <div className=\"flex flex-col\">\n <span className={`text-lg font-mono font-semibold tabular-nums ${color}`}>{timeString}</span>\n <span className=\"text-xs text-text-secondary\">\n {remainingSeconds <= 0\n ? tWithFallback(t, 'sandbox.timer.expired', 'Expired')\n : tWithFallback(t, 'sandbox.timer.label', 'Time remaining')}\n </span>\n </div>\n\n {remainingSeconds <= 60 && remainingSeconds > 0 && (\n <div className=\"flex items-center gap-1 text-xs text-status-error-text font-medium\">\n <AlertTriangle aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.expiringSoon', 'Expiring soon')}\n </div>\n )}\n\n {onExtend && remainingSeconds > 0 && (\n <button\n type=\"button\"\n onClick={onExtend}\n aria-label={tWithFallback(t, 'sandbox.timer.extend', 'Extend sandbox duration')}\n className=\"ml-auto flex items-center gap-1 rounded-md bg-bg-surface px-3 py-1.5 text-sm font-medium text-text-secondary shadow-sm border border-border-subtle hover:bg-bg-sunken transition-colors\"\n >\n <Plus aria-hidden=\"true\" className=\"size-3.5\" />\n {tWithFallback(t, 'sandbox.timer.extend', 'Extend')}\n </button>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgB,EAAe,EAC7B,cACA,cACA,aACA,aAAU,MACY;CACtB,IAAM,IAAmB,EAAoB,GAAW,EAAU,EAC5D,EAAE,SAAM,GAAS,EAIjB,IAAgB,EAAsB,KAAK;AACjD,CACE,EAAc,YAAY,KAC1B,KAAoB,MACpB,IAAmB,KACnB,OAAO,SAAW,OAClB,kBAAkB,UAClB,aAAa,eAAe,cAE5B,EAAc,UAAU,GACxB,IAAI,aAAa,EAAc,GAAG,4BAA4B,mBAAmB,EAAE;EACjF,MAAM,EACJ,GACA,2BACA,uFACD;EACD,MAAM;EACP,CAAC;CAGJ,IAAM,IAAQ,KAAK,MAAM,IAAmB,KAAK,EAC3C,IAAU,KAAK,MAAO,IAAmB,OAAQ,GAAG,EACpD,IAAU,IAAmB,IAC7B,KAAO,MAAc,OAAO,EAAE,CAAC,SAAS,GAAG,IAAI,EAC/C,IACJ,IAAQ,IAAI,GAAG,EAAI,EAAM,CAAC,GAAG,EAAI,EAAQ,CAAC,GAAG,EAAI,EAAQ,KAAK,GAAG,EAAI,EAAQ,CAAC,GAAG,EAAI,EAAQ,IAEzF,IACA,KAAoB,IAAU,wBAC9B,KAAoB,KAAW,yCAC/B,KAAoB,KAAW,2BAC/B,KAAoB,MAAY,6BAC7B,4BAGH,IACA,KAAoB,IAAU,sCAC9B,KAAoB,KAAW,oDAC/B,KAAoB,MAAY,sDAC7B,qDAGH,IAAmB,KAAK,IAAI,GAAG,KAAK,KAAK,IAAmB,GAAG,CAAC,EAChE,IACJ,KAAoB,IAChB,EAAc,GAAG,yBAAyB,UAAU,GACpD,EAAc,GAAG,2BAA2B,GAAG,EAAiB,qBAAqB,EACnF,OAAO,GACR,CAAC;AAgBR,QAdI,IAEA,kBAAC,QAAD;EACE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,WAAW,iEAAiE;YAJ9E,CAME,kBAAC,GAAD;GAAO,eAAY;GAAO,WAAU;GAAa,CAAA,EAChD,EACI;MAKT,kBAAC,OAAD;EACE,MAAK;EACL,aAAU;EACV,cAAY;EACZ,WAAW,uDAAuD;YAJpE;GAME,kBAAC,GAAD;IAAO,eAAY;IAAO,WAAW,UAAU;IAAW,CAAA;GAC1D,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,QAAD;KAAM,WAAW,gDAAgD;eAAU;KAAkB,CAAA,EAC7F,kBAAC,QAAD;KAAM,WAAU;eACb,KAAoB,IACjB,EAAc,GAAG,yBAAyB,UAAU,GACpD,EAAc,GAAG,uBAAuB,iBAAiB;KACxD,CAAA,CACH;;GAEL,KAAoB,MAAM,IAAmB,KAC5C,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAa,CAAA,EACxD,EAAc,GAAG,8BAA8B,gBAAgB,CAC5D;;GAGP,KAAY,IAAmB,KAC9B,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,cAAY,EAAc,GAAG,wBAAwB,0BAA0B;IAC/E,WAAU;cAJZ,CAME,kBAAC,GAAD;KAAM,eAAY;KAAO,WAAU;KAAa,CAAA,EAC/C,EAAc,GAAG,wBAAwB,SAAS,CAC5C;;GAEP"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Button as e } from "./ui.js";
|
|
2
2
|
import { useState as t } from "react";
|
|
3
|
-
import { Clock as n
|
|
4
|
-
import { jsx as
|
|
3
|
+
import { Clock as n } from "lucide-react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { ResponsiveDialog as a, ResponsiveDialogContent as o, ResponsiveDialogFooter as s, ResponsiveDialogHeader as c, ResponsiveDialogTitle as l } from "@burdenoff/fe-libs/ui";
|
|
5
6
|
//#region src/sandbox/components/ExtendTTLModal.tsx
|
|
6
|
-
var
|
|
7
|
+
var u = [
|
|
7
8
|
{
|
|
8
9
|
label: "15 minutes",
|
|
9
10
|
seconds: 900
|
|
@@ -21,95 +22,87 @@ var o = [
|
|
|
21
22
|
seconds: 7200
|
|
22
23
|
}
|
|
23
24
|
];
|
|
24
|
-
function
|
|
25
|
-
let [
|
|
26
|
-
if (!
|
|
27
|
-
let
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
function d({ isOpen: d, onClose: f, onExtend: p, currentExpiresAt: m, isLoading: h }) {
|
|
26
|
+
let [g, _] = t(null), [v, y] = t("");
|
|
27
|
+
if (!d) return null;
|
|
28
|
+
let b = new Date(m).getTime() - Date.now(), x = Math.max(0, Math.floor(b / 6e4));
|
|
29
|
+
return /* @__PURE__ */ r(a, {
|
|
30
|
+
open: d,
|
|
31
|
+
onOpenChange: (e) => {
|
|
32
|
+
e || f();
|
|
33
|
+
},
|
|
34
|
+
children: /* @__PURE__ */ i(o, {
|
|
35
|
+
className: "max-w-md",
|
|
32
36
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
className: "flex items-center
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
className: "text-lg font-semibold",
|
|
39
|
-
children: "Extend Sandbox Duration"
|
|
40
|
-
})]
|
|
41
|
-
}), /* @__PURE__ */ i("button", {
|
|
42
|
-
type: "button",
|
|
43
|
-
onClick: c,
|
|
44
|
-
"aria-label": "Close dialog",
|
|
45
|
-
className: "text-text-tertiary hover:text-text-secondary",
|
|
46
|
-
children: /* @__PURE__ */ i(r, { className: "size-5" })
|
|
47
|
-
})]
|
|
48
|
-
}),
|
|
49
|
-
/* @__PURE__ */ a("p", {
|
|
37
|
+
/* @__PURE__ */ r(c, { children: /* @__PURE__ */ i(l, {
|
|
38
|
+
className: "flex items-center gap-2",
|
|
39
|
+
children: [/* @__PURE__ */ r(n, { className: "size-5 text-accent-blue" }), "Extend Sandbox Duration"]
|
|
40
|
+
}) }),
|
|
41
|
+
/* @__PURE__ */ i("p", {
|
|
50
42
|
className: "text-sm text-text-secondary mb-4",
|
|
51
|
-
children: [
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
children: [
|
|
44
|
+
"Current remaining time:",
|
|
45
|
+
" ",
|
|
46
|
+
/* @__PURE__ */ i("span", {
|
|
47
|
+
className: "font-medium tabular-nums",
|
|
48
|
+
children: [x, " minutes"]
|
|
49
|
+
})
|
|
50
|
+
]
|
|
55
51
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ r("div", {
|
|
57
53
|
className: "space-y-2 mb-4",
|
|
58
|
-
children:
|
|
54
|
+
children: u.map((e, t) => /* @__PURE__ */ i("button", {
|
|
59
55
|
type: "button",
|
|
60
56
|
onClick: () => {
|
|
61
|
-
|
|
57
|
+
_(t), y("");
|
|
62
58
|
},
|
|
63
|
-
className: `w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${
|
|
59
|
+
className: `w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${g === t ? "border-primary bg-status-info-bg-subtle text-status-info-text" : "border-border-subtle hover:bg-bg-sunken text-text-secondary"}`,
|
|
64
60
|
children: ["+ ", e.label]
|
|
65
61
|
}, e.seconds))
|
|
66
62
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
className: "mb-
|
|
69
|
-
children: [/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ i("div", {
|
|
64
|
+
className: "mb-2",
|
|
65
|
+
children: [/* @__PURE__ */ r("label", {
|
|
70
66
|
htmlFor: "extend-ttl-custom-minutes",
|
|
71
67
|
className: "block text-sm font-medium text-text-secondary mb-1",
|
|
72
68
|
children: "Custom duration (minutes)"
|
|
73
|
-
}), /* @__PURE__ */
|
|
69
|
+
}), /* @__PURE__ */ r("input", {
|
|
74
70
|
id: "extend-ttl-custom-minutes",
|
|
75
71
|
type: "number",
|
|
76
72
|
min: "1",
|
|
77
73
|
max: "1440",
|
|
78
|
-
value:
|
|
74
|
+
value: v,
|
|
79
75
|
onChange: (e) => {
|
|
80
|
-
|
|
76
|
+
y(e.target.value), _(null);
|
|
81
77
|
},
|
|
82
78
|
placeholder: "Enter minutes",
|
|
83
79
|
"aria-label": "Custom duration in minutes",
|
|
84
80
|
className: "w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"
|
|
85
81
|
})]
|
|
86
82
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
children: d ? "Extending..." : "Extend"
|
|
106
|
-
})]
|
|
107
|
-
})
|
|
83
|
+
/* @__PURE__ */ i(s, { children: [/* @__PURE__ */ r(e, {
|
|
84
|
+
variant: "outline",
|
|
85
|
+
onClick: f,
|
|
86
|
+
className: "flex-1",
|
|
87
|
+
children: "Cancel"
|
|
88
|
+
}), /* @__PURE__ */ r(e, {
|
|
89
|
+
onClick: () => {
|
|
90
|
+
let e;
|
|
91
|
+
if (g !== null) e = u[g].seconds;
|
|
92
|
+
else if (v) {
|
|
93
|
+
if (e = parseInt(v, 10) * 60, isNaN(e) || e <= 0) return;
|
|
94
|
+
} else return;
|
|
95
|
+
p(e);
|
|
96
|
+
},
|
|
97
|
+
disabled: h || g === null && !v,
|
|
98
|
+
className: "flex-1",
|
|
99
|
+
children: h ? "Extending..." : "Extend"
|
|
100
|
+
})] })
|
|
108
101
|
]
|
|
109
102
|
})
|
|
110
103
|
});
|
|
111
104
|
}
|
|
112
105
|
//#endregion
|
|
113
|
-
export {
|
|
106
|
+
export { d as ExtendTTLModal };
|
|
114
107
|
|
|
115
108
|
//# sourceMappingURL=ExtendTTLModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock
|
|
1
|
+
{"version":3,"file":"ExtendTTLModal.js","names":[],"sources":["../../../src/sandbox/components/ExtendTTLModal.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Clock } from 'lucide-react';\nimport {\n ResponsiveDialog,\n ResponsiveDialogContent,\n ResponsiveDialogHeader,\n ResponsiveDialogTitle,\n ResponsiveDialogFooter,\n} from '@burdenoff/fe-libs/ui';\nimport { Button } from './ui';\n\ninterface ExtendTTLModalProps {\n isOpen: boolean;\n onClose: () => void;\n onExtend: (additionalSeconds: number) => void;\n currentExpiresAt: string;\n isLoading?: boolean;\n}\n\nconst PRESET_DURATIONS = [\n { label: '15 minutes', seconds: 15 * 60 },\n { label: '30 minutes', seconds: 30 * 60 },\n { label: '1 hour', seconds: 60 * 60 },\n { label: '2 hours', seconds: 2 * 60 * 60 },\n];\n\nexport function ExtendTTLModal({\n isOpen,\n onClose,\n onExtend,\n currentExpiresAt,\n isLoading,\n}: ExtendTTLModalProps) {\n const [selectedPreset, setSelectedPreset] = useState<number | null>(null);\n const [customMinutes, setCustomMinutes] = useState('');\n\n if (!isOpen) return null;\n\n const remainingMs = new Date(currentExpiresAt).getTime() - Date.now();\n const remainingMinutes = Math.max(0, Math.floor(remainingMs / 60000));\n\n const handleExtend = () => {\n let seconds: number;\n if (selectedPreset !== null) {\n seconds = PRESET_DURATIONS[selectedPreset].seconds;\n } else if (customMinutes) {\n seconds = parseInt(customMinutes, 10) * 60;\n if (isNaN(seconds) || seconds <= 0) return;\n } else {\n return;\n }\n onExtend(seconds);\n };\n\n return (\n <ResponsiveDialog\n open={isOpen}\n onOpenChange={(open) => {\n if (!open) onClose();\n }}\n >\n <ResponsiveDialogContent className=\"max-w-md\">\n <ResponsiveDialogHeader>\n <ResponsiveDialogTitle className=\"flex items-center gap-2\">\n <Clock className=\"size-5 text-accent-blue\" />\n Extend Sandbox Duration\n </ResponsiveDialogTitle>\n </ResponsiveDialogHeader>\n\n <p className=\"text-sm text-text-secondary mb-4\">\n Current remaining time:{' '}\n <span className=\"font-medium tabular-nums\">{remainingMinutes} minutes</span>\n </p>\n\n <div className=\"space-y-2 mb-4\">\n {PRESET_DURATIONS.map((preset, i) => (\n <button\n key={preset.seconds}\n type=\"button\"\n onClick={() => {\n setSelectedPreset(i);\n setCustomMinutes('');\n }}\n className={`w-full rounded-lg border px-4 py-2.5 text-left text-sm font-medium transition-colors ${\n selectedPreset === i\n ? 'border-primary bg-status-info-bg-subtle text-status-info-text'\n : 'border-border-subtle hover:bg-bg-sunken text-text-secondary'\n }`}\n >\n + {preset.label}\n </button>\n ))}\n </div>\n\n <div className=\"mb-2\">\n <label\n htmlFor=\"extend-ttl-custom-minutes\"\n className=\"block text-sm font-medium text-text-secondary mb-1\"\n >\n Custom duration (minutes)\n </label>\n <input\n id=\"extend-ttl-custom-minutes\"\n type=\"number\"\n min=\"1\"\n max=\"1440\"\n value={customMinutes}\n onChange={(e) => {\n setCustomMinutes(e.target.value);\n setSelectedPreset(null);\n }}\n placeholder=\"Enter minutes\"\n aria-label=\"Custom duration in minutes\"\n className=\"w-full rounded-lg border border-border-subtle px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary\"\n />\n </div>\n\n <ResponsiveDialogFooter>\n <Button variant=\"outline\" onClick={onClose} className=\"flex-1\">\n Cancel\n </Button>\n <Button\n onClick={handleExtend}\n disabled={isLoading || (selectedPreset === null && !customMinutes)}\n className=\"flex-1\"\n >\n {isLoading ? 'Extending...' : 'Extend'}\n </Button>\n </ResponsiveDialogFooter>\n </ResponsiveDialogContent>\n </ResponsiveDialog>\n );\n}\n"],"mappings":";;;;;;AAmBA,IAAM,IAAmB;CACvB;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAc,SAAS;EAAS;CACzC;EAAE,OAAO;EAAU,SAAS;EAAS;CACrC;EAAE,OAAO;EAAW,SAAS;EAAa;CAC3C;AAED,SAAgB,EAAe,EAC7B,WACA,YACA,aACA,qBACA,gBACsB;CACtB,IAAM,CAAC,GAAgB,KAAqB,EAAwB,KAAK,EACnE,CAAC,GAAe,KAAoB,EAAS,GAAG;AAEtD,KAAI,CAAC,EAAQ,QAAO;CAEpB,IAAM,IAAc,IAAI,KAAK,EAAiB,CAAC,SAAS,GAAG,KAAK,KAAK,EAC/D,IAAmB,KAAK,IAAI,GAAG,KAAK,MAAM,IAAc,IAAM,CAAC;AAerE,QACE,kBAAC,GAAD;EACE,MAAM;EACN,eAAe,MAAS;AACtB,GAAK,KAAM,GAAS;;YAGtB,kBAAC,GAAD;GAAyB,WAAU;aAAnC;IACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;KAAuB,WAAU;eAAjC,CACE,kBAAC,GAAD,EAAO,WAAU,2BAA4B,CAAA,EAAA,0BAEvB;QACD,CAAA;IAEzB,kBAAC,KAAD;KAAG,WAAU;eAAb;MAAgD;MACtB;MACxB,kBAAC,QAAD;OAAM,WAAU;iBAAhB,CAA4C,GAAiB,WAAe;;MAC1E;;IAEJ,kBAAC,OAAD;KAAK,WAAU;eACZ,EAAiB,KAAK,GAAQ,MAC7B,kBAAC,UAAD;MAEE,MAAK;MACL,eAAe;AAEb,OADA,EAAkB,EAAE,EACpB,EAAiB,GAAG;;MAEtB,WAAW,wFACT,MAAmB,IACf,kEACA;gBAVR,CAYC,MACI,EAAO,MACH;QAbF,EAAO,QAaL,CACT;KACE,CAAA;IAEN,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,SAAD;MACE,SAAQ;MACR,WAAU;gBACX;MAEO,CAAA,EACR,kBAAC,SAAD;MACE,IAAG;MACH,MAAK;MACL,KAAI;MACJ,KAAI;MACJ,OAAO;MACP,WAAW,MAAM;AAEf,OADA,EAAiB,EAAE,OAAO,MAAM,EAChC,EAAkB,KAAK;;MAEzB,aAAY;MACZ,cAAW;MACX,WAAU;MACV,CAAA,CACE;;IAEN,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD;KAAQ,SAAQ;KAAU,SAAS;KAAS,WAAU;eAAS;KAEtD,CAAA,EACT,kBAAC,GAAD;KACE,eAjFiB;MACzB,IAAI;AACJ,UAAI,MAAmB,KACrB,KAAU,EAAiB,GAAgB;eAClC,GAET;WADA,IAAU,SAAS,GAAe,GAAG,GAAG,IACpC,MAAM,EAAQ,IAAI,KAAW,EAAG;YAEpC;AAEF,QAAS,EAAQ;;KAwET,UAAU,KAAc,MAAmB,QAAQ,CAAC;KACpD,WAAU;eAET,IAAY,iBAAiB;KACvB,CAAA,CACc,EAAA,CAAA;IACD;;EACT,CAAA"}
|
|
@@ -13,7 +13,7 @@ var i = {
|
|
|
13
13
|
};
|
|
14
14
|
function a({ children: r, title: a, subtitle: o, icon: s, headerActions: c, headerContent: l, maxWidth: u = "xl", showHeader: d = !0, className: f, contentClassName: p }) {
|
|
15
15
|
return /* @__PURE__ */ t("div", {
|
|
16
|
-
className: e("min-h-screen w-full bg-bg-surface text-text-primary", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-
|
|
16
|
+
className: e("min-h-screen w-full bg-bg-surface text-text-primary", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-200", f),
|
|
17
17
|
children: /* @__PURE__ */ n("div", {
|
|
18
18
|
className: e("mx-auto w-full", i[u], p),
|
|
19
19
|
children: [d && (a || c) && /* @__PURE__ */ n("header", {
|
|
@@ -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-
|
|
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-200',\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"}
|
|
@@ -37,7 +37,7 @@ var o = ({ cpuRequest: o, cpuLimit: s, memoryRequest: c, memoryLimit: l, contain
|
|
|
37
37
|
children: e.label
|
|
38
38
|
}),
|
|
39
39
|
/* @__PURE__ */ i("span", {
|
|
40
|
-
className: "text-sm font-semibold",
|
|
40
|
+
className: "text-sm font-semibold tabular-nums",
|
|
41
41
|
children: e.value
|
|
42
42
|
})
|
|
43
43
|
]
|
|
@@ -52,7 +52,7 @@ var o = ({ cpuRequest: o, cpuLimit: s, memoryRequest: c, memoryLimit: l, contain
|
|
|
52
52
|
className: e.color
|
|
53
53
|
}),
|
|
54
54
|
/* @__PURE__ */ i("span", {
|
|
55
|
-
className: "font-medium",
|
|
55
|
+
className: "font-medium tabular-nums",
|
|
56
56
|
children: e.value
|
|
57
57
|
}),
|
|
58
58
|
t < p.length - 1 && /* @__PURE__ */ i("span", {
|
|
@@ -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-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;
|
|
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 tabular-nums\">{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 tabular-nums\">{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;eAAsC,EAAK;KAAa,CAAA;IACpE;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;eAA4B,EAAK;KAAa,CAAA;IAC7D,IAAQ,EAAM,SAAS,KAAK,kBAAC,QAAD;KAAM,WAAU;eAA8B;KAAQ,CAAA;IAC9E;KAJI,EAAK,MAIT,CACP;EACE,CAAA"}
|
|
@@ -6,150 +6,168 @@ import { SandboxTypeIcon as s } from "../components/SandboxTypeIcon.js";
|
|
|
6
6
|
import { EmptyState as c, PageLayout as l } from "../components/PageLayout.js";
|
|
7
7
|
import { useDeleteSandboxTemplateMutation as u, useListSandboxTemplatesQuery as d } from "../../generated/wspace-operations.js";
|
|
8
8
|
import { formatTTL as f } from "../utils/formatters.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { useState as p } from "react";
|
|
10
|
+
import { Container as m, LayoutTemplate as h, Loader2 as g, Pencil as _, Plus as v, Star as y, Trash2 as b } from "lucide-react";
|
|
11
|
+
import { useI18n as x } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
12
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
13
|
+
import { AlertDialog as w, AlertDialogAction as T, AlertDialogCancel as E, AlertDialogContent as D, AlertDialogDescription as O, AlertDialogFooter as k, AlertDialogHeader as A, AlertDialogTitle as j } from "@burdenoff/fe-libs/ui";
|
|
12
14
|
//#region src/sandbox/pages/AdminTemplatesPage.tsx
|
|
13
|
-
function
|
|
14
|
-
let { basePath:
|
|
15
|
-
variables: { context: { workspaceId:
|
|
16
|
-
skip: !
|
|
17
|
-
}), [
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
15
|
+
function M() {
|
|
16
|
+
let { basePath: M = "/", navigate: N, workspaceId: P } = e(), { t: F } = x(), { data: I, loading: L, refetch: R } = d({
|
|
17
|
+
variables: { context: { workspaceId: P } },
|
|
18
|
+
skip: !P
|
|
19
|
+
}), [z] = u(), B = I?.listSandboxTemplates?.items ?? [], [V, H] = p(null), U = () => {
|
|
20
|
+
N?.(t(M, "templates/new"));
|
|
21
|
+
}, W = (e) => {
|
|
22
|
+
N?.(t(M, `templates/${e}`));
|
|
23
|
+
}, G = async (e) => {
|
|
24
|
+
H(null);
|
|
25
|
+
try {
|
|
26
|
+
await z({ variables: {
|
|
27
|
+
context: { workspaceId: P },
|
|
28
|
+
id: e
|
|
29
|
+
} }), await R();
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error("[Sandbox] Failed to delete template:", e), window.alert(o(F, "sandbox.adminTemplates.actions.delete.error", "Failed to delete template. Please try again."));
|
|
32
|
+
}
|
|
21
33
|
};
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
title: o(
|
|
24
|
-
subtitle: o(
|
|
25
|
-
icon: /* @__PURE__ */
|
|
26
|
-
headerActions: /* @__PURE__ */
|
|
27
|
-
onClick:
|
|
34
|
+
return /* @__PURE__ */ C(l, {
|
|
35
|
+
title: o(F, "sandbox.adminTemplates.title", "Templates"),
|
|
36
|
+
subtitle: o(F, "sandbox.adminTemplates.subtitle", "Manage sandbox templates - create, edit, and configure predefined configurations"),
|
|
37
|
+
icon: /* @__PURE__ */ S(h, { size: 24 }),
|
|
38
|
+
headerActions: /* @__PURE__ */ C(r, {
|
|
39
|
+
onClick: U,
|
|
28
40
|
size: "lg",
|
|
29
|
-
children: [/* @__PURE__ */
|
|
41
|
+
children: [/* @__PURE__ */ S(v, { size: 18 }), o(F, "sandbox.adminTemplates.actions.create", "Create Template")]
|
|
30
42
|
}),
|
|
31
|
-
headerContent: /* @__PURE__ */
|
|
43
|
+
headerContent: /* @__PURE__ */ S(n, {
|
|
32
44
|
variant: "secondary",
|
|
33
|
-
children: o(
|
|
45
|
+
children: o(F, "sandbox.adminTemplates.header.count", "{count} templates", { count: B.length })
|
|
34
46
|
}),
|
|
35
|
-
children:
|
|
47
|
+
children: [L ? /* @__PURE__ */ S("div", {
|
|
36
48
|
className: "flex items-center justify-center min-h-[200px]",
|
|
37
|
-
children: /* @__PURE__ */
|
|
38
|
-
}) :
|
|
49
|
+
children: /* @__PURE__ */ S(g, { className: "size-8 animate-spin text-primary" })
|
|
50
|
+
}) : B.length > 0 ? /* @__PURE__ */ S("div", {
|
|
39
51
|
className: "grid grid-cols-1 md:grid-cols-2 gap-4",
|
|
40
|
-
children:
|
|
52
|
+
children: B.map((e, t) => /* @__PURE__ */ S(i, {
|
|
41
53
|
className: "group hover:shadow-md hover:border-primary/30 transition-all duration-200 animate-in fade-in-0 slide-in-from-bottom-2",
|
|
42
54
|
style: { animationDelay: `${t * 50}ms` },
|
|
43
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ C(a, {
|
|
44
56
|
className: "p-5",
|
|
45
57
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ C("div", {
|
|
47
59
|
className: "flex items-start justify-between mb-3",
|
|
48
|
-
children: [/* @__PURE__ */
|
|
60
|
+
children: [/* @__PURE__ */ C("div", {
|
|
49
61
|
className: "flex items-center gap-3",
|
|
50
|
-
children: [/* @__PURE__ */
|
|
62
|
+
children: [/* @__PURE__ */ S("div", {
|
|
51
63
|
className: "p-2 rounded-lg bg-bg-sunken/50",
|
|
52
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ S(s, {
|
|
53
65
|
type: e.template,
|
|
54
66
|
size: 20
|
|
55
67
|
})
|
|
56
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ C("div", { children: [/* @__PURE__ */ C("div", {
|
|
57
69
|
className: "flex items-center gap-2",
|
|
58
|
-
children: [/* @__PURE__ */
|
|
70
|
+
children: [/* @__PURE__ */ S("h3", {
|
|
59
71
|
className: "font-semibold",
|
|
60
72
|
children: e.name
|
|
61
|
-
}), e.isDefault && /* @__PURE__ */
|
|
73
|
+
}), e.isDefault && /* @__PURE__ */ C(n, {
|
|
62
74
|
variant: "default",
|
|
63
75
|
className: "gap-1 text-xs bg-status-warning-bg-subtle text-status-warning-text border-border-default",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
76
|
+
children: [/* @__PURE__ */ S(y, { size: 10 }), o(F, "sandbox.adminTemplates.badges.default", "Default")]
|
|
65
77
|
})]
|
|
66
|
-
}), /* @__PURE__ */
|
|
78
|
+
}), /* @__PURE__ */ S(s, {
|
|
67
79
|
type: e.template,
|
|
68
80
|
size: 12,
|
|
69
81
|
showLabel: !0,
|
|
70
82
|
className: "mt-0.5"
|
|
71
83
|
})] })]
|
|
72
|
-
}), /* @__PURE__ */
|
|
84
|
+
}), /* @__PURE__ */ C("div", {
|
|
73
85
|
className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
74
|
-
children: [/* @__PURE__ */
|
|
86
|
+
children: [/* @__PURE__ */ S(r, {
|
|
75
87
|
variant: "ghost",
|
|
76
88
|
size: "icon",
|
|
77
|
-
onClick: () =>
|
|
78
|
-
"aria-label": o(
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
}), /* @__PURE__ */
|
|
89
|
+
onClick: () => W(e.id),
|
|
90
|
+
"aria-label": o(F, "sandbox.adminTemplates.actions.edit.ariaLabel", "Edit template"),
|
|
91
|
+
children: /* @__PURE__ */ S(_, { size: 14 })
|
|
92
|
+
}), /* @__PURE__ */ S(r, {
|
|
81
93
|
variant: "ghost",
|
|
82
94
|
size: "icon",
|
|
83
95
|
className: "text-status-error-text hover:text-status-error-text",
|
|
84
|
-
onClick:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} catch (e) {
|
|
91
|
-
console.error("[Sandbox] Failed to delete template:", e), window.alert(o(E, "sandbox.adminTemplates.actions.delete.error", "Failed to delete template. Please try again."));
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"aria-label": o(E, "sandbox.adminTemplates.actions.delete.ariaLabel", "Delete template"),
|
|
95
|
-
children: /* @__PURE__ */ x(y, { size: 14 })
|
|
96
|
+
onClick: () => H({
|
|
97
|
+
id: e.id,
|
|
98
|
+
name: e.name
|
|
99
|
+
}),
|
|
100
|
+
"aria-label": o(F, "sandbox.adminTemplates.actions.delete.ariaLabel", "Delete template"),
|
|
101
|
+
children: /* @__PURE__ */ S(b, { size: 14 })
|
|
96
102
|
})]
|
|
97
103
|
})]
|
|
98
104
|
}),
|
|
99
|
-
e.description && /* @__PURE__ */
|
|
105
|
+
e.description && /* @__PURE__ */ S("p", {
|
|
100
106
|
className: "text-sm text-text-secondary mb-3 line-clamp-2",
|
|
101
107
|
children: e.description
|
|
102
108
|
}),
|
|
103
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ C("div", {
|
|
104
110
|
className: "flex flex-wrap items-center gap-2",
|
|
105
111
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ C(n, {
|
|
107
113
|
variant: "outline",
|
|
108
114
|
className: "text-xs gap-1",
|
|
109
115
|
children: [e.resources?.cpuRequest ?? "?", " CPU"]
|
|
110
116
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ C(n, {
|
|
112
118
|
variant: "outline",
|
|
113
119
|
className: "text-xs gap-1",
|
|
114
120
|
children: [e.resources?.memoryRequest ?? "?", " mem"]
|
|
115
121
|
}),
|
|
116
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ C(n, {
|
|
117
123
|
variant: "outline",
|
|
118
124
|
className: "text-xs gap-1",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
125
|
+
children: [/* @__PURE__ */ S(m, { size: 10 }), o(F, "sandbox.adminTemplates.meta.containers", "{count} containers", { count: e.containers?.length ?? 0 })]
|
|
120
126
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ C(n, {
|
|
122
128
|
variant: "outline",
|
|
123
129
|
className: "text-xs gap-1",
|
|
124
130
|
children: [f(e.ttlSeconds), " TTL"]
|
|
125
131
|
}),
|
|
126
|
-
e.storage?.mode && e.storage.mode !== "NONE" && /* @__PURE__ */
|
|
132
|
+
e.storage?.mode && e.storage.mode !== "NONE" && /* @__PURE__ */ C(n, {
|
|
127
133
|
variant: "outline",
|
|
128
134
|
className: "text-xs gap-1",
|
|
129
|
-
children: [e.storage.mode === "EPHEMERAL" ? o(
|
|
135
|
+
children: [e.storage.mode === "EPHEMERAL" ? o(F, "sandbox.adminTemplates.storage.ephemeral", "Ephemeral") : o(F, "sandbox.adminTemplates.storage.persistent", "Persistent"), e.storage.sizeGi ? ` ${e.storage.sizeGi}Gi` : ""]
|
|
130
136
|
}),
|
|
131
|
-
(e.allowedImages?.length ?? 0) > 0 && /* @__PURE__ */
|
|
137
|
+
(e.allowedImages?.length ?? 0) > 0 && /* @__PURE__ */ S(n, {
|
|
132
138
|
variant: "outline",
|
|
133
139
|
className: "text-xs gap-1",
|
|
134
|
-
children: o(
|
|
140
|
+
children: o(F, "sandbox.adminTemplates.meta.allowedImages", "{count} allowed images", { count: e.allowedImages.length })
|
|
135
141
|
})
|
|
136
142
|
]
|
|
137
143
|
})
|
|
138
144
|
]
|
|
139
145
|
})
|
|
140
146
|
}, e.id))
|
|
141
|
-
}) : /* @__PURE__ */
|
|
142
|
-
icon: /* @__PURE__ */
|
|
143
|
-
title: o(
|
|
144
|
-
description: o(
|
|
145
|
-
action: /* @__PURE__ */
|
|
146
|
-
onClick:
|
|
147
|
-
children: [/* @__PURE__ */
|
|
147
|
+
}) : /* @__PURE__ */ S(c, {
|
|
148
|
+
icon: /* @__PURE__ */ S(h, { size: 48 }),
|
|
149
|
+
title: o(F, "sandbox.adminTemplates.empty.title", "No templates yet"),
|
|
150
|
+
description: o(F, "sandbox.adminTemplates.empty.description", "Create templates for commonly used sandbox configurations to speed up provisioning."),
|
|
151
|
+
action: /* @__PURE__ */ C(r, {
|
|
152
|
+
onClick: U,
|
|
153
|
+
children: [/* @__PURE__ */ S(v, { size: 16 }), o(F, "sandbox.adminTemplates.empty.action", "Create First Template")]
|
|
148
154
|
})
|
|
149
|
-
})
|
|
155
|
+
}), /* @__PURE__ */ S(w, {
|
|
156
|
+
open: V !== null,
|
|
157
|
+
onOpenChange: (e) => {
|
|
158
|
+
e || H(null);
|
|
159
|
+
},
|
|
160
|
+
children: /* @__PURE__ */ C(D, { children: [/* @__PURE__ */ C(A, { children: [/* @__PURE__ */ S(j, { children: o(F, "sandbox.adminTemplates.actions.delete.ariaLabel", "Delete template") }), /* @__PURE__ */ S(O, { children: o(F, "sandbox.adminTemplates.actions.delete.confirm", "Delete template \"{name}\"? This cannot be undone.", { name: V?.name ?? "" }) })] }), /* @__PURE__ */ C(k, { children: [/* @__PURE__ */ S(E, { children: "Cancel" }), /* @__PURE__ */ S(T, {
|
|
161
|
+
className: "bg-status-error-bg text-status-error-text hover:bg-status-error-bg/90",
|
|
162
|
+
onClick: () => {
|
|
163
|
+
V && G(V.id);
|
|
164
|
+
},
|
|
165
|
+
children: "Delete"
|
|
166
|
+
})] })] })
|
|
167
|
+
})]
|
|
150
168
|
});
|
|
151
169
|
}
|
|
152
170
|
//#endregion
|
|
153
|
-
export {
|
|
171
|
+
export { M as AdminTemplatesPage };
|
|
154
172
|
|
|
155
173
|
//# sourceMappingURL=AdminTemplatesPage.js.map
|