@lunora/studio 0.0.0 → 1.0.0-alpha.2
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/LICENSE.md +105 -0
- package/README.md +123 -9
- package/__assets__/package-og.svg +14 -0
- package/dist/index.d.ts +1402 -0
- package/dist/index.js +41 -0
- package/dist/mount.d.ts +21 -0
- package/dist/mount.js +26 -0
- package/dist/packem_shared/ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js +45 -0
- package/dist/packem_shared/ApiDocsPanel-DpRjJhG5.js +842 -0
- package/dist/packem_shared/ApiReferencePanel-DMIUp-kK.js +229 -0
- package/dist/packem_shared/ApiTab-DURGU15e.js +251 -0
- package/dist/packem_shared/AuditPanel-BC59Nhst.js +212 -0
- package/dist/packem_shared/CommandPalette-Dx_CoB9i.js +373 -0
- package/dist/packem_shared/ConfirmButton-WQVUoGFb.js +59 -0
- package/dist/packem_shared/ConnectionBadge-Bxagrip8.js +111 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +50 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +89 -0
- package/dist/packem_shared/DataBrowser-Coz6jJE6.js +4542 -0
- package/dist/packem_shared/DataFilters-FNquMaiu.js +249 -0
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +66 -0
- package/dist/packem_shared/ExportImportPanel-WO34fJxy.js +193 -0
- package/dist/packem_shared/FileBrowser-Zcr-Qgxo.js +2932 -0
- package/dist/packem_shared/FunctionRunner-j0Rd5m9t.js +343 -0
- package/dist/packem_shared/FunctionStatsPanel-DboBl-XL.js +432 -0
- package/dist/packem_shared/GlobalDataBrowser-9MhPEfgN.js +318 -0
- package/dist/packem_shared/HealthPanel-DOIgbUtx.js +640 -0
- package/dist/packem_shared/HomePanel-bdOCNA-p.js +1273 -0
- package/dist/packem_shared/InsightsPanel-DaZPnSgt.js +423 -0
- package/dist/packem_shared/LogsPanel-CWdqAGpQ.js +839 -0
- package/dist/packem_shared/MailPanel-D_EGtDnS.js +447 -0
- package/dist/packem_shared/MetricsPanel-E4Gv6wTO.js +1625 -0
- package/dist/packem_shared/MigrationsPanel-DQdPY9io.js +246 -0
- package/dist/packem_shared/OpenRpcReferencePanel-j2p3HB0s.js +191 -0
- package/dist/packem_shared/PitrPanel-BbBkQR6t.js +252 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +3 -0
- package/dist/packem_shared/ScheduledJobs-Ok1CYYwI.js +159 -0
- package/dist/packem_shared/SchemaViewer-D8XGnp-X.js +2512 -0
- package/dist/packem_shared/SecurityAdvisorPanel-Cdm2IxLW.js +79 -0
- package/dist/packem_shared/SettingsPanel-D3WF2mBU.js +176 -0
- package/dist/packem_shared/ShardInput-DNCsT1KW.js +107 -0
- package/dist/packem_shared/SqlEditorPanel-BuQ7f2Hs.js +13 -0
- package/dist/packem_shared/Studio-D36od9Oz.js +33 -0
- package/dist/packem_shared/StudioApp-dvywkJ8I.js +383 -0
- package/dist/packem_shared/StudioI18nProvider-Dcajsznk.js +48 -0
- package/dist/packem_shared/TableEditor-DIVDk3vT.js +371 -0
- package/dist/packem_shared/advisor-view-DBlzJi6C.js +159 -0
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +108 -0
- package/dist/packem_shared/app.d-CCmwDEVs.d.ts +300 -0
- package/dist/packem_shared/badge-B2PKA1-5.js +49 -0
- package/dist/packem_shared/bar-chart-CzJAgqkp.js +3245 -0
- package/dist/packem_shared/button-BhsN2uZH.js +49 -0
- package/dist/packem_shared/card-DURq3ElK.js +175 -0
- package/dist/packem_shared/cf-links-BZfRdxSE.js +8 -0
- package/dist/packem_shared/checkbox-UNkzAxl-.js +63 -0
- package/dist/packem_shared/createStudioI18n-CgvlmDkN.js +27 -0
- package/dist/packem_shared/data-grid-CCh2Couo.js +183 -0
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +280 -0
- package/dist/packem_shared/empty-state-DY_oe0k6.js +98 -0
- package/dist/packem_shared/grid-features-DTjG6Sex.js +840 -0
- package/dist/packem_shared/input-XH4r1Pt1.js +53 -0
- package/dist/packem_shared/internal-BBZYexre.js +68 -0
- package/dist/packem_shared/label-D8ykjn5J.js +46 -0
- package/dist/packem_shared/live-status-bPff1O7Y.js +44 -0
- package/dist/packem_shared/reference-view-BCKIoai7.js +2180 -0
- package/dist/packem_shared/shard-history-DyebH1R5.js +38 -0
- package/dist/packem_shared/sparkline-10dG-_f0.js +93 -0
- package/dist/packem_shared/sql-editor-panel-CW2y2x9h.js +2562 -0
- package/dist/packem_shared/storage-tier-CL98eOvn.js +85 -0
- package/dist/packem_shared/studio-BDVd7rIV.js +10303 -0
- package/dist/packem_shared/table-_RzNvy3R.js +246 -0
- package/dist/packem_shared/table-list-sidebar-aZHLq70w.js +832 -0
- package/dist/packem_shared/textarea-D3gaCU_-.js +46 -0
- package/dist/packem_shared/use-live-admin-D1h1Fzsd.js +73 -0
- package/dist/packem_shared/use-live-shard-seed-B74RYcOy.js +76 -0
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +32 -0
- package/dist/packem_shared/utils-B05Dmz_H.js +8 -0
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +10 -0
- package/dist/standalone/studio.js +356 -0
- package/dist/styles.css +2 -0
- package/package.json +77 -17
- package/src/theme.css +59 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { useLunora } from '@lunora/react';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { ConfirmButton } from './ConfirmButton-WQVUoGFb.js';
|
|
4
|
+
import { C as Card, a as CardContent } from './card-DURq3ElK.js';
|
|
5
|
+
import { E as EmptyState } from './empty-state-DY_oe0k6.js';
|
|
6
|
+
import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-_RzNvy3R.js';
|
|
7
|
+
import { useAutoRefresh } from './DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
|
|
8
|
+
import { useT } from './createStudioI18n-CgvlmDkN.js';
|
|
9
|
+
import { f as fireAndForget, e as errorMessage, d as formatTimestamp } from './internal-BBZYexre.js';
|
|
10
|
+
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
11
|
+
|
|
12
|
+
const formatScheduledFor = (value) => Number.isFinite(value) ? formatTimestamp(value, "—") : "—";
|
|
13
|
+
const ScheduledJobs = ({
|
|
14
|
+
cancelJob,
|
|
15
|
+
loadJobs
|
|
16
|
+
} = {}) => {
|
|
17
|
+
const client = useLunora();
|
|
18
|
+
const t = useT();
|
|
19
|
+
const [jobs, setJobs] = useState(null);
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const load = loadJobs ?? (() => client.listScheduledJobs());
|
|
22
|
+
const cancelImpl = useMemo(() => {
|
|
23
|
+
if (cancelJob !== void 0) {
|
|
24
|
+
return cancelJob;
|
|
25
|
+
}
|
|
26
|
+
return loadJobs === void 0 ? (id) => client.cancelScheduledJob(id) : void 0;
|
|
27
|
+
}, [cancelJob, client, loadJobs]);
|
|
28
|
+
const refresh = async () => {
|
|
29
|
+
setError(null);
|
|
30
|
+
try {
|
|
31
|
+
const records = await load();
|
|
32
|
+
setJobs(records.toSorted((a, b) => a.scheduledFor - b.scheduledFor));
|
|
33
|
+
} catch (error_) {
|
|
34
|
+
setJobs(null);
|
|
35
|
+
setError(errorMessage(error_));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
fireAndForget(refresh());
|
|
40
|
+
}, []);
|
|
41
|
+
const livePush = loadJobs === void 0;
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!livePush) {
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
return client.subscribeScheduledJobs((records) => {
|
|
47
|
+
setError(null);
|
|
48
|
+
setJobs(records.toSorted((a, b) => a.scheduledFor - b.scheduledFor));
|
|
49
|
+
});
|
|
50
|
+
}, [livePush, client]);
|
|
51
|
+
useAutoRefresh(() => {
|
|
52
|
+
fireAndForget(refresh());
|
|
53
|
+
}, !livePush);
|
|
54
|
+
const cancel = async (id) => {
|
|
55
|
+
if (cancelImpl === void 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setError(null);
|
|
59
|
+
try {
|
|
60
|
+
await cancelImpl(id);
|
|
61
|
+
if (!livePush) {
|
|
62
|
+
await refresh();
|
|
63
|
+
}
|
|
64
|
+
} catch (error_) {
|
|
65
|
+
setError(errorMessage(error_));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
69
|
+
className: "flex flex-col gap-3",
|
|
70
|
+
"data-testid": "lunora-scheduled-jobs",
|
|
71
|
+
children: [error !== null && /* @__PURE__ */ jsxDEV("p", {
|
|
72
|
+
className: "text-sm text-destructive",
|
|
73
|
+
"data-testid": "sj-error",
|
|
74
|
+
role: "alert",
|
|
75
|
+
children: error
|
|
76
|
+
}, void 0, false), jobs !== null && jobs.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
77
|
+
description: t("Jobs queued with runAfter / runAt will appear here."),
|
|
78
|
+
icon: /* @__PURE__ */ jsxDEV("svg", {
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
strokeLinejoin: "round",
|
|
84
|
+
strokeWidth: 1.6,
|
|
85
|
+
viewBox: "0 0 24 24",
|
|
86
|
+
children: [/* @__PURE__ */ jsxDEV("circle", {
|
|
87
|
+
cx: "12",
|
|
88
|
+
cy: "12",
|
|
89
|
+
r: "9"
|
|
90
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV("path", {
|
|
91
|
+
d: "M12 7.5V12l4 2"
|
|
92
|
+
}, void 0, false)]
|
|
93
|
+
}, void 0, true),
|
|
94
|
+
testId: "sj-empty",
|
|
95
|
+
title: t("No scheduled jobs.")
|
|
96
|
+
}, void 0, false), jobs !== null && jobs.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
|
|
97
|
+
className: "overflow-hidden py-0",
|
|
98
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
99
|
+
className: "px-0",
|
|
100
|
+
children: /* @__PURE__ */ jsxDEV(Table, {
|
|
101
|
+
"data-testid": "sj-table",
|
|
102
|
+
children: [/* @__PURE__ */ jsxDEV(TableHeader, {
|
|
103
|
+
children: /* @__PURE__ */ jsxDEV(TableRow, {
|
|
104
|
+
children: [/* @__PURE__ */ jsxDEV(TableHead, {
|
|
105
|
+
children: t("function")
|
|
106
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
107
|
+
children: t("scheduled for")
|
|
108
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
109
|
+
children: t("pool")
|
|
110
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
111
|
+
children: t("attempts")
|
|
112
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
113
|
+
children: t("shard")
|
|
114
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
115
|
+
children: t("id")
|
|
116
|
+
}, void 0, false), cancelImpl !== void 0 && /* @__PURE__ */ jsxDEV(TableHead, {
|
|
117
|
+
"aria-label": t("Actions")
|
|
118
|
+
}, void 0, false)]
|
|
119
|
+
}, void 0, true)
|
|
120
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
|
|
121
|
+
children: jobs.map((job) => /* @__PURE__ */ jsxDEV(TableRow, {
|
|
122
|
+
"data-testid": `sj-row-${job.id}`,
|
|
123
|
+
children: [/* @__PURE__ */ jsxDEV(TableCell, {
|
|
124
|
+
className: "font-mono text-xs",
|
|
125
|
+
children: job.functionPath
|
|
126
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
127
|
+
className: "text-muted-foreground tabular-nums",
|
|
128
|
+
children: formatScheduledFor(job.scheduledFor)
|
|
129
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
130
|
+
className: "font-mono text-xs",
|
|
131
|
+
children: job.pool ?? ""
|
|
132
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
133
|
+
className: "tabular-nums",
|
|
134
|
+
children: job.attempts ?? 0
|
|
135
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
136
|
+
children: job.shardKey ?? ""
|
|
137
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
138
|
+
className: "font-mono text-xs",
|
|
139
|
+
children: job.id
|
|
140
|
+
}, void 0, false), cancelImpl !== void 0 && /* @__PURE__ */ jsxDEV(TableCell, {
|
|
141
|
+
className: "text-right",
|
|
142
|
+
children: /* @__PURE__ */ jsxDEV(ConfirmButton, {
|
|
143
|
+
confirmLabel: t("Cancel job?"),
|
|
144
|
+
onConfirm: () => {
|
|
145
|
+
fireAndForget(cancel(job.id));
|
|
146
|
+
},
|
|
147
|
+
testId: `sj-cancel-${job.id}`,
|
|
148
|
+
children: t("Cancel")
|
|
149
|
+
}, void 0, false)
|
|
150
|
+
}, void 0, false)]
|
|
151
|
+
}, job.id, true))
|
|
152
|
+
}, void 0, false)]
|
|
153
|
+
}, void 0, true)
|
|
154
|
+
}, void 0, false)
|
|
155
|
+
}, void 0, false)]
|
|
156
|
+
}, void 0, true);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export { ScheduledJobs };
|