@tgoliveira/outpost 1.1.0 → 1.2.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/AGENTS.md +22 -0
- package/dist/adapters/drizzle/index.cjs +57 -0
- package/dist/adapters/drizzle/index.cjs.map +1 -1
- package/dist/adapters/drizzle/index.d.cts +165 -3
- package/dist/adapters/drizzle/index.d.ts +165 -3
- package/dist/adapters/drizzle/index.js +57 -2
- package/dist/adapters/drizzle/index.js.map +1 -1
- package/dist/admin/index.cjs +641 -0
- package/dist/admin/index.cjs.map +1 -0
- package/dist/admin/index.d.cts +119 -0
- package/dist/admin/index.d.ts +119 -0
- package/dist/admin/index.js +638 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/config-override-repository-BHIGX3DJ.d.cts +14 -0
- package/dist/config-override-repository-BHIGX3DJ.d.ts +14 -0
- package/dist/http/index.d.cts +3 -3
- package/dist/http/index.d.ts +3 -3
- package/dist/{index-Dmt-aLH2.d.cts → index-BO0GiZmP.d.cts} +1 -1
- package/dist/{index-CVUvaJms.d.ts → index-c6caPsUG.d.ts} +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/modules/ui/index.cjs +942 -0
- package/dist/modules/ui/index.cjs.map +1 -0
- package/dist/modules/ui/index.d.cts +17 -0
- package/dist/modules/ui/index.d.ts +17 -0
- package/dist/modules/ui/index.js +885 -0
- package/dist/modules/ui/index.js.map +1 -0
- package/dist/modules/ui/layouts/page-shell.cjs +58 -0
- package/dist/modules/ui/layouts/page-shell.cjs.map +1 -0
- package/dist/modules/ui/layouts/page-shell.d.cts +13 -0
- package/dist/modules/ui/layouts/page-shell.d.ts +13 -0
- package/dist/modules/ui/layouts/page-shell.js +32 -0
- package/dist/modules/ui/layouts/page-shell.js.map +1 -0
- package/dist/modules/ui/lib/cn.cjs +33 -0
- package/dist/modules/ui/lib/cn.cjs.map +1 -0
- package/dist/modules/ui/lib/cn.d.cts +3 -0
- package/dist/modules/ui/lib/cn.d.ts +3 -0
- package/dist/modules/ui/lib/cn.js +8 -0
- package/dist/modules/ui/lib/cn.js.map +1 -0
- package/dist/modules/ui/lib/main-content.cjs +31 -0
- package/dist/modules/ui/lib/main-content.cjs.map +1 -0
- package/dist/modules/ui/lib/main-content.d.cts +3 -0
- package/dist/modules/ui/lib/main-content.d.ts +3 -0
- package/dist/modules/ui/lib/main-content.js +6 -0
- package/dist/modules/ui/lib/main-content.js.map +1 -0
- package/dist/modules/ui/outpost-ui-provider.cjs +52 -0
- package/dist/modules/ui/outpost-ui-provider.cjs.map +1 -0
- package/dist/modules/ui/outpost-ui-provider.d.cts +15 -0
- package/dist/modules/ui/outpost-ui-provider.d.ts +15 -0
- package/dist/modules/ui/outpost-ui-provider.js +27 -0
- package/dist/modules/ui/outpost-ui-provider.js.map +1 -0
- package/dist/modules/ui/pages/admin/admin-config-page.cjs +429 -0
- package/dist/modules/ui/pages/admin/admin-config-page.cjs.map +1 -0
- package/dist/modules/ui/pages/admin/admin-config-page.d.cts +8 -0
- package/dist/modules/ui/pages/admin/admin-config-page.d.ts +8 -0
- package/dist/modules/ui/pages/admin/admin-config-page.js +395 -0
- package/dist/modules/ui/pages/admin/admin-config-page.js.map +1 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.cjs +344 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.cjs.map +1 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.d.cts +8 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.d.ts +8 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.js +310 -0
- package/dist/modules/ui/pages/admin/admin-observability-page.js.map +1 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.cjs +160 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.cjs.map +1 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.d.cts +9 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.d.ts +9 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.js +126 -0
- package/dist/modules/ui/pages/admin/admin-panel-page.js.map +1 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.cjs +565 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.cjs.map +1 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.d.cts +8 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.d.ts +8 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.js +531 -0
- package/dist/modules/ui/pages/admin/admin-queue-page.js.map +1 -0
- package/dist/modules/ui/pages/index.cjs +909 -0
- package/dist/modules/ui/pages/index.cjs.map +1 -0
- package/dist/modules/ui/pages/index.d.cts +6 -0
- package/dist/modules/ui/pages/index.d.ts +6 -0
- package/dist/modules/ui/pages/index.js +869 -0
- package/dist/modules/ui/pages/index.js.map +1 -0
- package/dist/modules/ui/pages/types.cjs +38 -0
- package/dist/modules/ui/pages/types.cjs.map +1 -0
- package/dist/modules/ui/pages/types.d.cts +9 -0
- package/dist/modules/ui/pages/types.d.ts +9 -0
- package/dist/modules/ui/pages/types.js +12 -0
- package/dist/modules/ui/pages/types.js.map +1 -0
- package/dist/modules/ui/pages/use-page-ui.cjs +55 -0
- package/dist/modules/ui/pages/use-page-ui.cjs.map +1 -0
- package/dist/modules/ui/pages/use-page-ui.d.cts +6 -0
- package/dist/modules/ui/pages/use-page-ui.d.ts +6 -0
- package/dist/modules/ui/pages/use-page-ui.js +29 -0
- package/dist/modules/ui/pages/use-page-ui.js.map +1 -0
- package/dist/modules/ui/primitives/alert.cjs +63 -0
- package/dist/modules/ui/primitives/alert.cjs.map +1 -0
- package/dist/modules/ui/primitives/alert.d.cts +10 -0
- package/dist/modules/ui/primitives/alert.d.ts +10 -0
- package/dist/modules/ui/primitives/alert.js +36 -0
- package/dist/modules/ui/primitives/alert.js.map +1 -0
- package/dist/modules/ui/primitives/badge.cjs +60 -0
- package/dist/modules/ui/primitives/badge.cjs.map +1 -0
- package/dist/modules/ui/primitives/badge.d.cts +9 -0
- package/dist/modules/ui/primitives/badge.d.ts +9 -0
- package/dist/modules/ui/primitives/badge.js +33 -0
- package/dist/modules/ui/primitives/badge.js.map +1 -0
- package/dist/modules/ui/primitives/button.cjs +61 -0
- package/dist/modules/ui/primitives/button.cjs.map +1 -0
- package/dist/modules/ui/primitives/button.d.cts +9 -0
- package/dist/modules/ui/primitives/button.d.ts +9 -0
- package/dist/modules/ui/primitives/button.js +37 -0
- package/dist/modules/ui/primitives/button.js.map +1 -0
- package/dist/modules/ui/primitives/card.cjs +71 -0
- package/dist/modules/ui/primitives/card.cjs.map +1 -0
- package/dist/modules/ui/primitives/card.d.cts +11 -0
- package/dist/modules/ui/primitives/card.d.ts +11 -0
- package/dist/modules/ui/primitives/card.js +41 -0
- package/dist/modules/ui/primitives/card.js.map +1 -0
- package/dist/modules/ui/primitives/empty-state.cjs +37 -0
- package/dist/modules/ui/primitives/empty-state.cjs.map +1 -0
- package/dist/modules/ui/primitives/empty-state.d.cts +9 -0
- package/dist/modules/ui/primitives/empty-state.d.ts +9 -0
- package/dist/modules/ui/primitives/empty-state.js +12 -0
- package/dist/modules/ui/primitives/empty-state.js.map +1 -0
- package/dist/modules/ui/primitives/input.cjs +55 -0
- package/dist/modules/ui/primitives/input.cjs.map +1 -0
- package/dist/modules/ui/primitives/input.d.cts +6 -0
- package/dist/modules/ui/primitives/input.d.ts +6 -0
- package/dist/modules/ui/primitives/input.js +30 -0
- package/dist/modules/ui/primitives/input.js.map +1 -0
- package/dist/modules/ui/primitives/loading-state.cjs +55 -0
- package/dist/modules/ui/primitives/loading-state.cjs.map +1 -0
- package/dist/modules/ui/primitives/loading-state.d.cts +8 -0
- package/dist/modules/ui/primitives/loading-state.d.ts +8 -0
- package/dist/modules/ui/primitives/loading-state.js +30 -0
- package/dist/modules/ui/primitives/loading-state.js.map +1 -0
- package/dist/modules/ui/primitives/page-header.cjs +40 -0
- package/dist/modules/ui/primitives/page-header.cjs.map +1 -0
- package/dist/modules/ui/primitives/page-header.d.cts +10 -0
- package/dist/modules/ui/primitives/page-header.d.ts +10 -0
- package/dist/modules/ui/primitives/page-header.js +15 -0
- package/dist/modules/ui/primitives/page-header.js.map +1 -0
- package/dist/{outpost-client-ymTJISpu.d.ts → outpost-client-BItbgqIo.d.ts} +2 -2
- package/dist/{outpost-client-yUijE00q.d.cts → outpost-client-BlVf4gjo.d.cts} +2 -2
- package/dist/react/client.cjs +14 -0
- package/dist/react/client.cjs.map +1 -0
- package/dist/react/client.d.cts +5 -0
- package/dist/react/client.d.ts +5 -0
- package/dist/react/client.js +11 -0
- package/dist/react/client.js.map +1 -0
- package/dist/react/index.cjs +943 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +17 -0
- package/dist/react/index.d.ts +17 -0
- package/dist/react/index.js +887 -0
- package/dist/react/index.js.map +1 -0
- package/dist/{repositories-DhUe8f2R.d.cts → repositories-CHIOFGn3.d.cts} +2 -0
- package/dist/{repositories-Bck6wJNS.d.ts → repositories-WyhvxzyY.d.ts} +2 -0
- package/dist/testing/index.cjs +41 -0
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +13 -3
- package/dist/testing/index.d.ts +13 -3
- package/dist/testing/index.js +41 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/workers/index.d.cts +2 -2
- package/dist/workers/index.d.ts +2 -2
- package/package.json +45 -3
- package/styles.css +4 -0
|
@@ -0,0 +1,942 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/modules/ui/index.ts
|
|
31
|
+
var ui_exports = {};
|
|
32
|
+
__export(ui_exports, {
|
|
33
|
+
AdminConfigPage: () => AdminConfigPage,
|
|
34
|
+
AdminObservabilityPage: () => AdminObservabilityPage,
|
|
35
|
+
AdminPanelPage: () => AdminPanelPage,
|
|
36
|
+
AdminQueuePage: () => AdminQueuePage,
|
|
37
|
+
Alert: () => Alert,
|
|
38
|
+
Badge: () => Badge,
|
|
39
|
+
Button: () => Button,
|
|
40
|
+
Card: () => Card,
|
|
41
|
+
CardDescription: () => CardDescription,
|
|
42
|
+
CardHeader: () => CardHeader,
|
|
43
|
+
CardTitle: () => CardTitle,
|
|
44
|
+
DEFAULT_OUTPOST_PATHS: () => DEFAULT_OUTPOST_PATHS,
|
|
45
|
+
EmptyState: () => EmptyState,
|
|
46
|
+
Input: () => Input,
|
|
47
|
+
LoadingState: () => LoadingState,
|
|
48
|
+
OutpostUIProvider: () => OutpostUIProvider,
|
|
49
|
+
PageHeader: () => PageHeader,
|
|
50
|
+
PageShell: () => PageShell,
|
|
51
|
+
resolveOutpostPaths: () => resolveOutpostPaths,
|
|
52
|
+
useOutpostUi: () => useOutpostUi,
|
|
53
|
+
useUiPaths: () => useUiPaths
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(ui_exports);
|
|
56
|
+
|
|
57
|
+
// src/modules/ui/outpost-ui-provider.tsx
|
|
58
|
+
var import_react = require("react");
|
|
59
|
+
|
|
60
|
+
// src/modules/ui/pages/types.ts
|
|
61
|
+
var DEFAULT_OUTPOST_PATHS = {
|
|
62
|
+
adminPanel: "/admin"
|
|
63
|
+
};
|
|
64
|
+
function resolveOutpostPaths(overrides) {
|
|
65
|
+
return { ...DEFAULT_OUTPOST_PATHS, ...overrides };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/modules/ui/outpost-ui-provider.tsx
|
|
69
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
70
|
+
var OutpostUiContext = (0, import_react.createContext)(null);
|
|
71
|
+
function OutpostUIProvider({ children, paths }) {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OutpostUiContext.Provider, { value: { paths: resolveOutpostPaths(paths) }, children });
|
|
73
|
+
}
|
|
74
|
+
function useOutpostUi() {
|
|
75
|
+
return (0, import_react.useContext)(OutpostUiContext);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// src/modules/ui/lib/cn.ts
|
|
79
|
+
function cn(...classes) {
|
|
80
|
+
return classes.filter(Boolean).join(" ");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/modules/ui/lib/main-content.ts
|
|
84
|
+
var MAIN_CONTENT_ID = "outpost-main-content";
|
|
85
|
+
|
|
86
|
+
// src/modules/ui/layouts/page-shell.tsx
|
|
87
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
|
+
var widthClass = {
|
|
89
|
+
narrow: "max-w-md",
|
|
90
|
+
medium: "max-w-xl",
|
|
91
|
+
wide: "max-w-6xl"
|
|
92
|
+
};
|
|
93
|
+
function PageShell({ children, width = "wide", className }) {
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
95
|
+
"main",
|
|
96
|
+
{
|
|
97
|
+
id: MAIN_CONTENT_ID,
|
|
98
|
+
tabIndex: -1,
|
|
99
|
+
className: cn("mx-auto px-4 py-8 md:py-10", widthClass[width], className),
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/modules/ui/primitives/button.tsx
|
|
106
|
+
var import_react2 = require("react");
|
|
107
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
108
|
+
var Button = (0, import_react2.forwardRef)(function Button2({ variant = "primary", className, children, ...props }, ref) {
|
|
109
|
+
const variants = {
|
|
110
|
+
primary: "bg-[var(--primary)] text-white hover:bg-[var(--primary-hover)]",
|
|
111
|
+
secondary: "border border-[var(--border)] bg-[var(--card)] text-[var(--foreground)] hover:bg-[var(--card-muted)]",
|
|
112
|
+
danger: "bg-[var(--danger)] text-white hover:bg-red-800"
|
|
113
|
+
};
|
|
114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
115
|
+
"button",
|
|
116
|
+
{
|
|
117
|
+
ref,
|
|
118
|
+
className: cn(
|
|
119
|
+
"min-h-11 rounded-[var(--radius)] px-4 py-2.5 text-sm font-medium transition-colors",
|
|
120
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
121
|
+
variants[variant],
|
|
122
|
+
className
|
|
123
|
+
),
|
|
124
|
+
...props,
|
|
125
|
+
children
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// src/modules/ui/primitives/alert.tsx
|
|
131
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
132
|
+
var variantStyles = {
|
|
133
|
+
info: "border-[var(--info-muted)] bg-[var(--info-muted)] text-[var(--info)]",
|
|
134
|
+
success: "border-[var(--success-muted)] bg-[var(--success-muted)] text-[var(--success)]",
|
|
135
|
+
warning: "border-[var(--warning-muted)] bg-[var(--warning-muted)] text-[var(--warning)]",
|
|
136
|
+
danger: "border-[var(--danger-muted)] bg-[var(--danger-muted)] text-[var(--danger)]",
|
|
137
|
+
muted: "border-[var(--border)] bg-[var(--card-muted)] text-[var(--muted)]"
|
|
138
|
+
};
|
|
139
|
+
function Alert({ variant = "muted", title, className, children, ...props }) {
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
role: "status",
|
|
144
|
+
className: cn(
|
|
145
|
+
"rounded-[var(--radius)] border px-4 py-3 text-sm leading-relaxed",
|
|
146
|
+
variantStyles[variant],
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
...props,
|
|
150
|
+
children: [
|
|
151
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "mb-1 font-medium", children: title }),
|
|
152
|
+
children
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/modules/ui/primitives/badge.tsx
|
|
159
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
160
|
+
var styles = {
|
|
161
|
+
default: "bg-[var(--accent-muted)] text-[var(--foreground)]",
|
|
162
|
+
success: "bg-[var(--success-muted)] text-[var(--success)]",
|
|
163
|
+
info: "bg-[var(--info-muted)] text-[var(--info)]",
|
|
164
|
+
danger: "bg-[var(--danger-muted)] text-[var(--danger)]",
|
|
165
|
+
muted: "bg-[var(--card-muted)] text-[var(--muted)]",
|
|
166
|
+
warning: "bg-[var(--warning-muted)] text-[var(--warning)]"
|
|
167
|
+
};
|
|
168
|
+
function Badge({ variant = "default", className, children, ...props }) {
|
|
169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
className: cn(
|
|
173
|
+
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",
|
|
174
|
+
styles[variant],
|
|
175
|
+
className
|
|
176
|
+
),
|
|
177
|
+
...props,
|
|
178
|
+
children
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/modules/ui/primitives/card.tsx
|
|
184
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
185
|
+
function Card({ className, muted, children, ...props }) {
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
className: cn(
|
|
190
|
+
"rounded-[var(--radius)] border border-[var(--border)] p-5 shadow-[var(--shadow-sm)]",
|
|
191
|
+
muted ? "bg-[var(--card-muted)]" : "bg-[var(--card)]",
|
|
192
|
+
className
|
|
193
|
+
),
|
|
194
|
+
...props,
|
|
195
|
+
children
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
function CardHeader({ className, children, ...props }) {
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("mb-4 space-y-1", className), ...props, children });
|
|
201
|
+
}
|
|
202
|
+
function CardTitle({ className, children, ...props }) {
|
|
203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: cn("text-lg font-medium text-[var(--foreground)]", className), ...props, children });
|
|
204
|
+
}
|
|
205
|
+
function CardDescription({
|
|
206
|
+
className,
|
|
207
|
+
children,
|
|
208
|
+
...props
|
|
209
|
+
}) {
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: cn("text-sm leading-relaxed text-[var(--muted)]", className), ...props, children });
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/modules/ui/primitives/page-header.tsx
|
|
214
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
215
|
+
function PageHeader({ title, description, action }) {
|
|
216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-8 flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h1", { className: "text-2xl font-semibold tracking-tight text-[var(--foreground)]", children: title }),
|
|
219
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "max-w-prose text-sm leading-relaxed text-[var(--muted)]", children: description })
|
|
220
|
+
] }),
|
|
221
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "shrink-0", children: action })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// src/modules/ui/primitives/loading-state.tsx
|
|
226
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
227
|
+
function LoadingState({ label = "Loading" }) {
|
|
228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
229
|
+
"div",
|
|
230
|
+
{
|
|
231
|
+
className: "flex flex-col items-center justify-center gap-3 py-16 text-center",
|
|
232
|
+
role: "status",
|
|
233
|
+
"aria-live": "polite",
|
|
234
|
+
"aria-busy": "true",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: "h-8 w-8 animate-pulse rounded-full border-2 border-[var(--border)] border-t-[var(--primary)]",
|
|
240
|
+
"aria-hidden": "true"
|
|
241
|
+
}
|
|
242
|
+
),
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "text-sm text-[var(--muted)]", children: [
|
|
244
|
+
label,
|
|
245
|
+
"\u2026"
|
|
246
|
+
] })
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/modules/ui/primitives/empty-state.tsx
|
|
253
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
254
|
+
function EmptyState({ title, description }) {
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "py-8 text-center", children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-medium text-[var(--foreground)]", children: title }),
|
|
257
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mt-1 text-sm text-[var(--muted)]", children: description })
|
|
258
|
+
] });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// src/modules/ui/primitives/input.tsx
|
|
262
|
+
var import_react3 = require("react");
|
|
263
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
264
|
+
var Input = (0, import_react3.forwardRef)(
|
|
265
|
+
function Input2({ className, ...props }, ref) {
|
|
266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
267
|
+
"input",
|
|
268
|
+
{
|
|
269
|
+
ref,
|
|
270
|
+
className: cn(
|
|
271
|
+
"w-full rounded-[var(--radius)] border border-[var(--border)] bg-[var(--card)] px-3 py-2 text-sm text-[var(--foreground)]",
|
|
272
|
+
"placeholder:text-[var(--muted)] focus:outline-none focus:ring-2 focus:ring-[var(--primary)]",
|
|
273
|
+
className
|
|
274
|
+
),
|
|
275
|
+
...props
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
// src/modules/ui/pages/admin/admin-panel-page.tsx
|
|
282
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
283
|
+
|
|
284
|
+
// src/modules/ui/pages/use-page-ui.ts
|
|
285
|
+
function useUiPaths(overrides) {
|
|
286
|
+
const ui = useOutpostUi();
|
|
287
|
+
return resolveOutpostPaths({ ...ui?.paths, ...overrides });
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// src/modules/ui/pages/admin/admin-panel-page.tsx
|
|
291
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
292
|
+
var SECTIONS = [
|
|
293
|
+
{
|
|
294
|
+
key: "adminQueue",
|
|
295
|
+
label: "Email Queue",
|
|
296
|
+
description: "Inspect queued messages and run the send worker manually.",
|
|
297
|
+
suffix: "/queue"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
key: "adminConfig",
|
|
301
|
+
label: "Configuration",
|
|
302
|
+
description: "View and override vault/env settings. Admin overrides win over env.local.",
|
|
303
|
+
suffix: "/config"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
key: "adminObservability",
|
|
307
|
+
label: "Observability",
|
|
308
|
+
description: "Queue depth, worker activity, and OpenTelemetry metric catalog.",
|
|
309
|
+
suffix: "/observability"
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
function AdminPanelPage({ paths }) {
|
|
313
|
+
const resolved = useUiPaths(paths);
|
|
314
|
+
const base = resolved.adminPanel;
|
|
315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(PageShell, { width: "wide", children: [
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "mb-8", children: [
|
|
317
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { className: "text-2xl font-semibold text-[var(--foreground)]", children: "Outpost Admin" }),
|
|
318
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "mt-1 text-sm text-[var(--muted)]", children: "Operate the transactional email outbox \u2014 queue, configuration, and observability." })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3", children: SECTIONS.map((section) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_link.default, { href: `${base}${section.suffix}`, className: "block", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Card, { className: "h-full cursor-pointer transition-shadow hover:shadow-md", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CardHeader, { children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardTitle, { className: "text-base", children: section.label }),
|
|
322
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CardDescription, { className: "text-sm", children: section.description })
|
|
323
|
+
] }) }) }, section.key)) })
|
|
324
|
+
] });
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// src/modules/ui/pages/admin/admin-queue-page.tsx
|
|
328
|
+
var import_react4 = require("react");
|
|
329
|
+
var import_link2 = __toESM(require("next/link"), 1);
|
|
330
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
331
|
+
var PIPELINE_CONFIG_KEYS = [
|
|
332
|
+
"domainValidation.syntax",
|
|
333
|
+
"domainValidation.mx",
|
|
334
|
+
"sanitize.maxSubjectBytes",
|
|
335
|
+
"sanitize.maxBodyBytes",
|
|
336
|
+
"sanitize.maxRecipientBytes",
|
|
337
|
+
"sanitize.maxHeaderValueBytes"
|
|
338
|
+
];
|
|
339
|
+
function stateBadge(state) {
|
|
340
|
+
if (state === "queued") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "info", children: "queued" });
|
|
341
|
+
if (state === "sending") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "warning", children: "sending" });
|
|
342
|
+
if (state === "failed") return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "danger", children: "failed" });
|
|
343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "muted", children: state });
|
|
344
|
+
}
|
|
345
|
+
function formatDate(d) {
|
|
346
|
+
if (!d) return "\u2014";
|
|
347
|
+
return new Date(d).toLocaleString();
|
|
348
|
+
}
|
|
349
|
+
function formatBytes(n) {
|
|
350
|
+
if (typeof n !== "number" || Number.isNaN(n)) return String(n ?? "\u2014");
|
|
351
|
+
if (n >= 1e6) return `${(n / 1e6).toFixed(1)} MB`;
|
|
352
|
+
if (n >= 1e3) return `${(n / 1e3).toFixed(1)} KB`;
|
|
353
|
+
return `${n} B`;
|
|
354
|
+
}
|
|
355
|
+
function configLabel(key) {
|
|
356
|
+
const labels = {
|
|
357
|
+
"domainValidation.syntax": "Email syntax check",
|
|
358
|
+
"domainValidation.mx": "MX record check (dispatch)",
|
|
359
|
+
"sanitize.maxSubjectBytes": "Max subject size",
|
|
360
|
+
"sanitize.maxBodyBytes": "Max body size",
|
|
361
|
+
"sanitize.maxRecipientBytes": "Max recipient size",
|
|
362
|
+
"sanitize.maxHeaderValueBytes": "Max header value size"
|
|
363
|
+
};
|
|
364
|
+
return labels[key] ?? key;
|
|
365
|
+
}
|
|
366
|
+
function PipelineConfigCard({
|
|
367
|
+
apiBase,
|
|
368
|
+
configPath
|
|
369
|
+
}) {
|
|
370
|
+
const [keys, setKeys] = (0, import_react4.useState)([]);
|
|
371
|
+
const [isLoading, setIsLoading] = (0, import_react4.useState)(true);
|
|
372
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
373
|
+
(0, import_react4.useEffect)(() => {
|
|
374
|
+
let cancelled = false;
|
|
375
|
+
(async () => {
|
|
376
|
+
setIsLoading(true);
|
|
377
|
+
setError("");
|
|
378
|
+
try {
|
|
379
|
+
const res = await fetch(`${apiBase}/admin/config`);
|
|
380
|
+
if (!res.ok) throw new Error("Failed to load");
|
|
381
|
+
const data = await res.json();
|
|
382
|
+
if (!cancelled) setKeys(data.keys ?? []);
|
|
383
|
+
} catch {
|
|
384
|
+
if (!cancelled) setError("Could not load pipeline settings.");
|
|
385
|
+
} finally {
|
|
386
|
+
if (!cancelled) setIsLoading(false);
|
|
387
|
+
}
|
|
388
|
+
})();
|
|
389
|
+
return () => {
|
|
390
|
+
cancelled = true;
|
|
391
|
+
};
|
|
392
|
+
}, [apiBase]);
|
|
393
|
+
const pipeline = PIPELINE_CONFIG_KEYS.map((key) => {
|
|
394
|
+
const row = keys.find((k) => k.key === key);
|
|
395
|
+
return { key, source: row?.source ?? "default", value: row?.value };
|
|
396
|
+
});
|
|
397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { children: [
|
|
398
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardHeader, { children: [
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardTitle, { children: "Outbound pipeline (effective config)" }),
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardDescription, { children: [
|
|
401
|
+
"Sanitization runs at enqueue and again before dispatch. Domain syntax is checked at enqueue; MX (when enabled) runs in the send worker.",
|
|
402
|
+
" ",
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_link2.default, { href: configPath, className: "underline hover:text-[var(--foreground)]", children: "Edit in Config" })
|
|
404
|
+
] })
|
|
405
|
+
] }),
|
|
406
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "danger", children: error }) }) : isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingState, { label: "Loading pipeline settings" }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "overflow-x-auto px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: "w-full text-sm", children: [
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "border-b border-[var(--border)] text-left text-[var(--muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { children: [
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "pb-2 font-medium", children: "Check / limit" }),
|
|
409
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "pb-2 font-medium", children: "Effective value" }),
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "pb-2 font-medium", children: "Source" })
|
|
411
|
+
] }) }),
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: pipeline.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "py-2 pr-4", children: configLabel(row.key) }),
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "py-2 pr-4 font-mono text-xs", children: row.key.startsWith("domainValidation.") ? row.value === true ? "enabled" : row.value === false ? "disabled" : String(row.value ?? "\u2014") : row.key.startsWith("sanitize.") ? formatBytes(row.value) : String(row.value ?? "\u2014") }),
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "py-2", children: row.source === "admin" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "info", children: "admin" }) : row.source === "env" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "default", children: "env" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "muted", children: "default" }) })
|
|
416
|
+
] }, row.key)) })
|
|
417
|
+
] }) })
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
function AuditTrailPanel({
|
|
421
|
+
apiBase,
|
|
422
|
+
messageId,
|
|
423
|
+
subject,
|
|
424
|
+
onClose
|
|
425
|
+
}) {
|
|
426
|
+
const [events, setEvents] = (0, import_react4.useState)([]);
|
|
427
|
+
const [isLoading, setIsLoading] = (0, import_react4.useState)(true);
|
|
428
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
429
|
+
(0, import_react4.useEffect)(() => {
|
|
430
|
+
let cancelled = false;
|
|
431
|
+
(async () => {
|
|
432
|
+
setIsLoading(true);
|
|
433
|
+
setError("");
|
|
434
|
+
try {
|
|
435
|
+
const res = await fetch(
|
|
436
|
+
`${apiBase}/admin/audit?messageId=${encodeURIComponent(messageId)}`
|
|
437
|
+
);
|
|
438
|
+
if (!res.ok) throw new Error("Failed to load");
|
|
439
|
+
const data = await res.json();
|
|
440
|
+
if (!cancelled) setEvents(data.events ?? []);
|
|
441
|
+
} catch {
|
|
442
|
+
if (!cancelled) setError("Failed to load audit trail.");
|
|
443
|
+
} finally {
|
|
444
|
+
if (!cancelled) setIsLoading(false);
|
|
445
|
+
}
|
|
446
|
+
})();
|
|
447
|
+
return () => {
|
|
448
|
+
cancelled = true;
|
|
449
|
+
};
|
|
450
|
+
}, [apiBase, messageId]);
|
|
451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
452
|
+
"div",
|
|
453
|
+
{
|
|
454
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
455
|
+
role: "dialog",
|
|
456
|
+
"aria-modal": "true",
|
|
457
|
+
"aria-labelledby": "audit-trail-title",
|
|
458
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { className: "max-h-[85vh] w-full max-w-lg overflow-hidden shadow-lg", children: [
|
|
459
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardHeader, { children: [
|
|
460
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardTitle, { id: "audit-trail-title", children: "Audit trail" }),
|
|
461
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardDescription, { children: [
|
|
462
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-medium text-[var(--foreground)]", children: subject }),
|
|
463
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mt-1 block font-mono text-xs", children: messageId })
|
|
464
|
+
] })
|
|
465
|
+
] }),
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "max-h-[50vh] overflow-y-auto px-6 pb-4", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingState, { label: "Loading audit events" }) : error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "danger", children: error }) : events.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EmptyState, { title: "No events", description: "No audit entries for this message yet." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ol", { className: "space-y-3 border-l border-[var(--border)] pl-4", children: events.map((ev) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "relative text-sm", children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "absolute -left-[calc(0.5rem+5px)] top-1.5 h-2 w-2 rounded-full bg-[var(--border)]" }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { variant: "default", children: ev.eventType }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-xs text-[var(--muted)]", children: formatDate(ev.at) })
|
|
471
|
+
] }),
|
|
472
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "mt-1 text-xs text-[var(--muted)]", children: [
|
|
473
|
+
"actor: ",
|
|
474
|
+
ev.actor
|
|
475
|
+
] }),
|
|
476
|
+
ev.detail && Object.keys(ev.detail).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("pre", { className: "mt-1 overflow-x-auto rounded bg-[var(--card-muted)] p-2 font-mono text-xs", children: JSON.stringify(ev.detail, null, 2) })
|
|
477
|
+
] }, ev.id)) }) }),
|
|
478
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex justify-end border-t border-[var(--border)] px-6 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "secondary", onClick: onClose, children: "Close" }) })
|
|
479
|
+
] })
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
function MessageTable({
|
|
484
|
+
title,
|
|
485
|
+
description,
|
|
486
|
+
rows,
|
|
487
|
+
onViewAudit
|
|
488
|
+
}) {
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { className: "overflow-hidden", children: [
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CardHeader, { children: [
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardTitle, { children: title }),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardDescription, { children: description })
|
|
493
|
+
] }),
|
|
494
|
+
rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "px-6 pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EmptyState, { title: "No messages", description: "Nothing in this bucket right now." }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: "w-full text-sm", children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "State" }),
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Subject" }),
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Provider" }),
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Attempts" }),
|
|
500
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Last error" }),
|
|
501
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Next attempt" }),
|
|
502
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Created" }),
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Audit" })
|
|
504
|
+
] }) }),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: stateBadge(row.state) }),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("td", { className: "px-4 py-3", children: [
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-medium", children: row.subject }),
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-mono text-xs text-[var(--muted)]", children: row.id })
|
|
510
|
+
] }),
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: row.provider }),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: row.attempts }),
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "max-w-[200px] px-4 py-3", children: row.lastError ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
514
|
+
"span",
|
|
515
|
+
{
|
|
516
|
+
className: "line-clamp-2 text-xs text-[var(--danger)]",
|
|
517
|
+
title: row.lastError,
|
|
518
|
+
children: row.lastError
|
|
519
|
+
}
|
|
520
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[var(--muted)]", children: "\u2014" }) }),
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: formatDate(row.nextAttemptAt) }),
|
|
522
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: formatDate(row.createdAt) }),
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "secondary", onClick: () => onViewAudit(row), children: "View" }) })
|
|
524
|
+
] }, row.id)) })
|
|
525
|
+
] }) })
|
|
526
|
+
] });
|
|
527
|
+
}
|
|
528
|
+
function AdminQueuePage({ apiBase = "/api/outpost" }) {
|
|
529
|
+
const resolved = useUiPaths();
|
|
530
|
+
const configPath = `${resolved.adminPanel}/config`;
|
|
531
|
+
const [data, setData] = (0, import_react4.useState)(null);
|
|
532
|
+
const [isLoading, setIsLoading] = (0, import_react4.useState)(true);
|
|
533
|
+
const [isRunningWorker, setIsRunningWorker] = (0, import_react4.useState)(false);
|
|
534
|
+
const [error, setError] = (0, import_react4.useState)("");
|
|
535
|
+
const [workerResult, setWorkerResult] = (0, import_react4.useState)("");
|
|
536
|
+
const [auditMessage, setAuditMessage] = (0, import_react4.useState)(null);
|
|
537
|
+
const load = (0, import_react4.useCallback)(async () => {
|
|
538
|
+
setIsLoading(true);
|
|
539
|
+
setError("");
|
|
540
|
+
try {
|
|
541
|
+
const res = await fetch(`${apiBase}/admin/queue`);
|
|
542
|
+
if (!res.ok) throw new Error("Failed to load");
|
|
543
|
+
setData(await res.json());
|
|
544
|
+
} catch {
|
|
545
|
+
setError("Failed to load the email queue. Please try again.");
|
|
546
|
+
} finally {
|
|
547
|
+
setIsLoading(false);
|
|
548
|
+
}
|
|
549
|
+
}, [apiBase]);
|
|
550
|
+
(0, import_react4.useEffect)(() => {
|
|
551
|
+
void load();
|
|
552
|
+
}, [load]);
|
|
553
|
+
async function runWorker() {
|
|
554
|
+
setIsRunningWorker(true);
|
|
555
|
+
setError("");
|
|
556
|
+
setWorkerResult("");
|
|
557
|
+
try {
|
|
558
|
+
const res = await fetch(`${apiBase}/admin/worker/send`, { method: "POST" });
|
|
559
|
+
if (!res.ok) throw new Error("Worker run failed");
|
|
560
|
+
const report = await res.json();
|
|
561
|
+
setWorkerResult(`Worker finished: claimed ${report.claimed ?? 0} message(s).`);
|
|
562
|
+
await load();
|
|
563
|
+
} catch {
|
|
564
|
+
setError("Failed to run the send worker. Please try again.");
|
|
565
|
+
} finally {
|
|
566
|
+
setIsRunningWorker(false);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(PageShell, { width: "wide", children: [
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_link2.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "mx-2", children: "/" }),
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[var(--foreground)]", children: "Email Queue" })
|
|
574
|
+
] }),
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
576
|
+
PageHeader,
|
|
577
|
+
{
|
|
578
|
+
title: "Email Queue",
|
|
579
|
+
description: "Messages waiting to be sent. Run the send worker to process the next batch.",
|
|
580
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-2", children: [
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: isLoading ? "Loading\u2026" : "Refresh" }),
|
|
582
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "primary", onClick: runWorker, disabled: isRunningWorker, children: isRunningWorker ? "Running\u2026" : "Run send worker" })
|
|
583
|
+
] })
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
|
|
587
|
+
workerResult && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Alert, { variant: "success", className: "mb-4", children: workerResult }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "mb-6", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PipelineConfigCard, { apiBase, configPath }) }),
|
|
589
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LoadingState, { label: "Loading queue" }) : data ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "space-y-6", children: [
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Queued" }),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.queued ?? 0 })
|
|
594
|
+
] }),
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Sending" }),
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.sending ?? 0 })
|
|
598
|
+
] }),
|
|
599
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Card, { muted: true, children: [
|
|
600
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "Failed (DLQ)" }),
|
|
601
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.counts.failed ?? 0 })
|
|
602
|
+
] })
|
|
603
|
+
] }),
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
605
|
+
MessageTable,
|
|
606
|
+
{
|
|
607
|
+
title: "Queued",
|
|
608
|
+
description: "Persisted and waiting for the send worker.",
|
|
609
|
+
rows: data.queued,
|
|
610
|
+
onViewAudit: setAuditMessage
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
614
|
+
MessageTable,
|
|
615
|
+
{
|
|
616
|
+
title: "Sending",
|
|
617
|
+
description: "Claimed by a worker; will be reclaimed if the lease expires.",
|
|
618
|
+
rows: data.sending,
|
|
619
|
+
onViewAudit: setAuditMessage
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
623
|
+
MessageTable,
|
|
624
|
+
{
|
|
625
|
+
title: "Failed",
|
|
626
|
+
description: "Dead-lettered after retries exhausted. Last error often reflects sanitization, domain, or provider failure.",
|
|
627
|
+
rows: data.failed,
|
|
628
|
+
onViewAudit: setAuditMessage
|
|
629
|
+
}
|
|
630
|
+
)
|
|
631
|
+
] }) : null,
|
|
632
|
+
auditMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
633
|
+
AuditTrailPanel,
|
|
634
|
+
{
|
|
635
|
+
apiBase,
|
|
636
|
+
messageId: auditMessage.id,
|
|
637
|
+
subject: auditMessage.subject,
|
|
638
|
+
onClose: () => setAuditMessage(null)
|
|
639
|
+
}
|
|
640
|
+
)
|
|
641
|
+
] });
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/modules/ui/pages/admin/admin-config-page.tsx
|
|
645
|
+
var import_react5 = require("react");
|
|
646
|
+
var import_link3 = __toESM(require("next/link"), 1);
|
|
647
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
648
|
+
function sourceBadge(source) {
|
|
649
|
+
if (source === "admin") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "info", children: "admin" });
|
|
650
|
+
if (source === "env") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "default", children: "env" });
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Badge, { variant: "muted", children: "default" });
|
|
652
|
+
}
|
|
653
|
+
function valueDisplay(value, secret) {
|
|
654
|
+
if (value === void 0 || value === null) return "\u2014";
|
|
655
|
+
if (secret && typeof value === "string") return value;
|
|
656
|
+
return String(value);
|
|
657
|
+
}
|
|
658
|
+
function AdminConfigPage({ apiBase = "/api/outpost" }) {
|
|
659
|
+
const resolved = useUiPaths();
|
|
660
|
+
const [configKeys, setConfigKeys] = (0, import_react5.useState)([]);
|
|
661
|
+
const [isLoading, setIsLoading] = (0, import_react5.useState)(true);
|
|
662
|
+
const [error, setError] = (0, import_react5.useState)("");
|
|
663
|
+
const [editingKey, setEditingKey] = (0, import_react5.useState)(null);
|
|
664
|
+
const [editValue, setEditValue] = (0, import_react5.useState)("");
|
|
665
|
+
const [saving, setSaving] = (0, import_react5.useState)(false);
|
|
666
|
+
const load = (0, import_react5.useCallback)(async () => {
|
|
667
|
+
setIsLoading(true);
|
|
668
|
+
setError("");
|
|
669
|
+
try {
|
|
670
|
+
const res = await fetch(`${apiBase}/admin/config`);
|
|
671
|
+
if (!res.ok) throw new Error("Failed to load");
|
|
672
|
+
const data = await res.json();
|
|
673
|
+
setConfigKeys(data.keys ?? []);
|
|
674
|
+
} catch {
|
|
675
|
+
setError("Failed to load configuration.");
|
|
676
|
+
} finally {
|
|
677
|
+
setIsLoading(false);
|
|
678
|
+
}
|
|
679
|
+
}, [apiBase]);
|
|
680
|
+
(0, import_react5.useEffect)(() => {
|
|
681
|
+
void load();
|
|
682
|
+
}, [load]);
|
|
683
|
+
function startEdit(ck) {
|
|
684
|
+
setEditingKey(ck.key);
|
|
685
|
+
setEditValue(ck.secret ? "" : valueDisplay(ck.value));
|
|
686
|
+
}
|
|
687
|
+
function parseEditValue(raw) {
|
|
688
|
+
if (raw === "true") return true;
|
|
689
|
+
if (raw === "false") return false;
|
|
690
|
+
const n = Number(raw);
|
|
691
|
+
if (!Number.isNaN(n) && raw.trim() !== "") return n;
|
|
692
|
+
return raw;
|
|
693
|
+
}
|
|
694
|
+
async function saveEdit(key) {
|
|
695
|
+
setSaving(true);
|
|
696
|
+
setError("");
|
|
697
|
+
try {
|
|
698
|
+
const res = await fetch(`${apiBase}/admin/config`, {
|
|
699
|
+
method: "POST",
|
|
700
|
+
headers: { "Content-Type": "application/json" },
|
|
701
|
+
body: JSON.stringify({ key, value: parseEditValue(editValue) })
|
|
702
|
+
});
|
|
703
|
+
if (!res.ok) {
|
|
704
|
+
const data = await res.json().catch(() => ({}));
|
|
705
|
+
throw new Error(data.error ?? "Save failed");
|
|
706
|
+
}
|
|
707
|
+
setEditingKey(null);
|
|
708
|
+
await load();
|
|
709
|
+
} catch (e) {
|
|
710
|
+
setError(e instanceof Error ? e.message : "Failed to save.");
|
|
711
|
+
} finally {
|
|
712
|
+
setSaving(false);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
async function resetOverride(key) {
|
|
716
|
+
setSaving(true);
|
|
717
|
+
try {
|
|
718
|
+
await fetch(`${apiBase}/admin/config`, {
|
|
719
|
+
method: "DELETE",
|
|
720
|
+
headers: { "Content-Type": "application/json" },
|
|
721
|
+
body: JSON.stringify({ key })
|
|
722
|
+
});
|
|
723
|
+
await load();
|
|
724
|
+
} catch {
|
|
725
|
+
setError("Failed to reset override.");
|
|
726
|
+
} finally {
|
|
727
|
+
setSaving(false);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(PageShell, { width: "wide", children: [
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_link3.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "mx-2", children: "/" }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-[var(--foreground)]", children: "Configuration" })
|
|
735
|
+
] }),
|
|
736
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
737
|
+
PageHeader,
|
|
738
|
+
{
|
|
739
|
+
title: "Configuration",
|
|
740
|
+
description: "Priority: admin override \u2192 env.local \u2192 package default. Secrets are masked in the UI.",
|
|
741
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: "Refresh" })
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
|
|
745
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingState, { label: "Loading config" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Card, { className: "overflow-hidden", children: [
|
|
746
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(CardHeader, { children: [
|
|
747
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardTitle, { children: "Vault & environment settings" }),
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CardDescription, { children: "Keys mirror `.env.example` and `createOutpost` options. Admin overrides persist in the database." })
|
|
749
|
+
] }),
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "w-full text-sm", children: [
|
|
751
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { children: [
|
|
752
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Key" }),
|
|
753
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Source" }),
|
|
754
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Value" }),
|
|
755
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "px-4 py-2" })
|
|
756
|
+
] }) }),
|
|
757
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: configKeys.map((ck) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3 font-mono text-xs", children: ck.key }),
|
|
759
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3", children: sourceBadge(ck.source) }),
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3", children: editingKey === ck.key ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
761
|
+
Input,
|
|
762
|
+
{
|
|
763
|
+
className: "h-7 text-xs",
|
|
764
|
+
type: ck.secret ? "password" : "text",
|
|
765
|
+
placeholder: ck.secret ? "Enter new value" : void 0,
|
|
766
|
+
value: editValue,
|
|
767
|
+
onChange: (e) => setEditValue(e.target.value),
|
|
768
|
+
onKeyDown: (e) => {
|
|
769
|
+
if (e.key === "Enter") void saveEdit(ck.key);
|
|
770
|
+
if (e.key === "Escape") setEditingKey(null);
|
|
771
|
+
},
|
|
772
|
+
autoFocus: true
|
|
773
|
+
}
|
|
774
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "font-mono text-xs", children: valueDisplay(ck.value, ck.secret) }) }),
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "px-4 py-3 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex items-center justify-end gap-2", children: editingKey === ck.key ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
777
|
+
Button,
|
|
778
|
+
{
|
|
779
|
+
variant: "primary",
|
|
780
|
+
className: "text-xs",
|
|
781
|
+
disabled: saving,
|
|
782
|
+
onClick: () => saveEdit(ck.key),
|
|
783
|
+
children: saving ? "Saving\u2026" : "Save"
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
787
|
+
Button,
|
|
788
|
+
{
|
|
789
|
+
variant: "secondary",
|
|
790
|
+
className: "text-xs",
|
|
791
|
+
onClick: () => setEditingKey(null),
|
|
792
|
+
children: "Cancel"
|
|
793
|
+
}
|
|
794
|
+
)
|
|
795
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Button, { variant: "secondary", className: "text-xs", onClick: () => startEdit(ck), children: "Edit" }),
|
|
797
|
+
ck.source === "admin" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
798
|
+
Button,
|
|
799
|
+
{
|
|
800
|
+
variant: "danger",
|
|
801
|
+
className: "text-xs",
|
|
802
|
+
disabled: saving,
|
|
803
|
+
onClick: () => resetOverride(ck.key),
|
|
804
|
+
children: "Reset"
|
|
805
|
+
}
|
|
806
|
+
)
|
|
807
|
+
] }) }) })
|
|
808
|
+
] }, ck.key)) })
|
|
809
|
+
] }) })
|
|
810
|
+
] })
|
|
811
|
+
] });
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/modules/ui/pages/admin/admin-observability-page.tsx
|
|
815
|
+
var import_react6 = require("react");
|
|
816
|
+
var import_link4 = __toESM(require("next/link"), 1);
|
|
817
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
818
|
+
function AdminObservabilityPage({ apiBase = "/api/outpost" }) {
|
|
819
|
+
const resolved = useUiPaths();
|
|
820
|
+
const [data, setData] = (0, import_react6.useState)(null);
|
|
821
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(true);
|
|
822
|
+
const [error, setError] = (0, import_react6.useState)("");
|
|
823
|
+
const load = (0, import_react6.useCallback)(async () => {
|
|
824
|
+
setIsLoading(true);
|
|
825
|
+
setError("");
|
|
826
|
+
try {
|
|
827
|
+
const res = await fetch(`${apiBase}/admin/observability`);
|
|
828
|
+
if (!res.ok) throw new Error("Failed to load");
|
|
829
|
+
setData(await res.json());
|
|
830
|
+
} catch {
|
|
831
|
+
setError("Failed to load observability data.");
|
|
832
|
+
} finally {
|
|
833
|
+
setIsLoading(false);
|
|
834
|
+
}
|
|
835
|
+
}, [apiBase]);
|
|
836
|
+
(0, import_react6.useEffect)(() => {
|
|
837
|
+
void load();
|
|
838
|
+
}, [load]);
|
|
839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(PageShell, { width: "wide", children: [
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mb-4 text-sm text-[var(--muted)]", children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_link4.default, { href: resolved.adminPanel, className: "hover:underline", children: "Admin" }),
|
|
842
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mx-2", children: "/" }),
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[var(--foreground)]", children: "Observability" })
|
|
844
|
+
] }),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
846
|
+
PageHeader,
|
|
847
|
+
{
|
|
848
|
+
title: "Observability",
|
|
849
|
+
description: "Operational snapshot from the outbox. Export OpenTelemetry metrics to your collector for dashboards.",
|
|
850
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "secondary", onClick: load, disabled: isLoading, children: isLoading ? "Loading\u2026" : "Refresh" })
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Alert, { variant: "danger", className: "mb-4", children: error }),
|
|
854
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LoadingState, { label: "Loading observability" }) : data ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-6", children: [
|
|
855
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [
|
|
856
|
+
Object.entries(data.countsByState).map(([state, count]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { muted: true, children: [
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: state }),
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: count })
|
|
859
|
+
] }, state)),
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { muted: true, children: [
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs uppercase tracking-wide text-[var(--muted)]", children: "suppressions" }),
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "mt-1 text-2xl font-semibold", children: data.suppressionCount })
|
|
863
|
+
] })
|
|
864
|
+
] }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { children: [
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CardHeader, { children: [
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardTitle, { children: "Last send worker run" }),
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardDescription, { children: 'Updated when an operator clicks "Run send worker" on the queue page or a cron invokes the worker.' })
|
|
869
|
+
] }),
|
|
870
|
+
data.lastWorkerRun ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3 text-sm", children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "At" }),
|
|
873
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: new Date(data.lastWorkerRun.at).toLocaleString() })
|
|
874
|
+
] }),
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
876
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Claimed" }),
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.claimed })
|
|
878
|
+
] }),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
880
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Sent" }),
|
|
881
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.sent })
|
|
882
|
+
] }),
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
884
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Retried" }),
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.retried })
|
|
886
|
+
] }),
|
|
887
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Rate limited" }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.rateLimited })
|
|
890
|
+
] }),
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-[var(--muted)]", children: "Failed (DLQ)" }),
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: data.lastWorkerRun.failed })
|
|
894
|
+
] })
|
|
895
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-sm text-[var(--muted)]", children: "No worker run recorded yet." })
|
|
896
|
+
] }),
|
|
897
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Card, { className: "overflow-hidden", children: [
|
|
898
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(CardHeader, { children: [
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardTitle, { children: "OpenTelemetry metrics" }),
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CardDescription, { children: "Emitted when `OtelTelemetry` is wired. Point your SDK exporter at these names." })
|
|
901
|
+
] }),
|
|
902
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "w-full text-sm", children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: "border-b border-[var(--border)] bg-[var(--card-muted)]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { children: [
|
|
904
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Name" }),
|
|
905
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Type" }),
|
|
906
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { className: "px-4 py-2 text-left font-medium text-[var(--muted)]", children: "Description" })
|
|
907
|
+
] }) }),
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: "divide-y divide-[var(--border)]", children: data.metrics.map((m) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { className: "hover:bg-[var(--card-muted)]", children: [
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3 font-mono text-xs", children: m.name }),
|
|
910
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Badge, { variant: m.type === "gauge" ? "info" : "default", children: m.type }) }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: "px-4 py-3 text-[var(--muted)]", children: m.description })
|
|
912
|
+
] }, m.name)) })
|
|
913
|
+
] }) })
|
|
914
|
+
] })
|
|
915
|
+
] }) : null
|
|
916
|
+
] });
|
|
917
|
+
}
|
|
918
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
919
|
+
0 && (module.exports = {
|
|
920
|
+
AdminConfigPage,
|
|
921
|
+
AdminObservabilityPage,
|
|
922
|
+
AdminPanelPage,
|
|
923
|
+
AdminQueuePage,
|
|
924
|
+
Alert,
|
|
925
|
+
Badge,
|
|
926
|
+
Button,
|
|
927
|
+
Card,
|
|
928
|
+
CardDescription,
|
|
929
|
+
CardHeader,
|
|
930
|
+
CardTitle,
|
|
931
|
+
DEFAULT_OUTPOST_PATHS,
|
|
932
|
+
EmptyState,
|
|
933
|
+
Input,
|
|
934
|
+
LoadingState,
|
|
935
|
+
OutpostUIProvider,
|
|
936
|
+
PageHeader,
|
|
937
|
+
PageShell,
|
|
938
|
+
resolveOutpostPaths,
|
|
939
|
+
useOutpostUi,
|
|
940
|
+
useUiPaths
|
|
941
|
+
});
|
|
942
|
+
//# sourceMappingURL=index.cjs.map
|