@fonderie/vue-admin-screens 0.1.0
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 +21 -0
- package/README.md +38 -0
- package/dist/index.cjs +627 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +169 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.js +593 -0
- package/dist/index.js.map +1 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fonderie, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @fonderie/vue-admin-screens
|
|
2
|
+
|
|
3
|
+
The admin shell for Vue — the `/wp-admin` of a Fonderie app, over
|
|
4
|
+
[`@fonderie/admin`](../admin). Navigation follows the operator's questions;
|
|
5
|
+
each page is a screen you can also mount on its own.
|
|
6
|
+
|
|
7
|
+
Status: **experimental** (0.x).
|
|
8
|
+
|
|
9
|
+
| Group | Page | Answers |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Today | Attention | what needs me today — empty is green |
|
|
12
|
+
| System | Modules · Configuration · Doctor · Routes | what did I deploy · is it configured · is it working · what is exposed |
|
|
13
|
+
| Settings | Config & secrets | the `@fonderie/config` admin screens, as a sub-page |
|
|
14
|
+
| Messaging | Templates | the `@fonderie/courier` admin screens, as a sub-page |
|
|
15
|
+
| Activity | Admin log · Access | who did what · who can be here |
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { AdminClient, ConfigAdminClient, CourierAdminClient } from '@fonderie/client';
|
|
19
|
+
import { AdminShell } from '@fonderie/vue-admin-screens';
|
|
20
|
+
|
|
21
|
+
const base = { baseUrl: 'https://api.example.com', adminToken, actor: 'louis' };
|
|
22
|
+
const client = new AdminClient(base);
|
|
23
|
+
// prefix: the composed surface under /_admin — one token for everything.
|
|
24
|
+
const configClient = new ConfigAdminClient({ ...base, prefix: '/_admin' });
|
|
25
|
+
const courierClient = new CourierAdminClient({ ...base, prefix: '/_admin' });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
h(AdminShell, { client, configClient, courierClient })
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Pass `page` and listen to `navigate` to own the URL (one route per page);
|
|
33
|
+
omit `page` and the shell keeps it itself. Settings and Messaging appear only
|
|
34
|
+
when their client is given.
|
|
35
|
+
|
|
36
|
+
Nothing here stores the token: the app constructs the clients and decides
|
|
37
|
+
where the token lives. Every request through the shell lands in the admin
|
|
38
|
+
log, including the ones the token refuses.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AdminLogScreen: () => AdminLogScreen,
|
|
24
|
+
AdminShell: () => AdminShell,
|
|
25
|
+
AttentionScreen: () => AttentionScreen,
|
|
26
|
+
ConfigScreen: () => ConfigScreen,
|
|
27
|
+
DoctorScreen: () => DoctorScreen,
|
|
28
|
+
ModulesScreen: () => ModulesScreen,
|
|
29
|
+
RoutesScreen: () => RoutesScreen,
|
|
30
|
+
TokensScreen: () => TokensScreen
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
|
|
34
|
+
// src/screens/AdminShell.ts
|
|
35
|
+
var import_vue_config_admin_screens = require("@fonderie/vue-config-admin-screens");
|
|
36
|
+
var import_vue_courier_admin_screens = require("@fonderie/vue-courier-admin-screens");
|
|
37
|
+
var import_vue9 = require("vue");
|
|
38
|
+
|
|
39
|
+
// src/styles.ts
|
|
40
|
+
var styles = {
|
|
41
|
+
shell: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
minHeight: "100vh",
|
|
44
|
+
fontFamily: "system-ui, sans-serif",
|
|
45
|
+
color: "#111"
|
|
46
|
+
},
|
|
47
|
+
nav: { width: "220px", borderRight: "1px solid #eee", padding: "16px", flexShrink: 0 },
|
|
48
|
+
navGroup: {
|
|
49
|
+
fontSize: "11px",
|
|
50
|
+
textTransform: "uppercase",
|
|
51
|
+
letterSpacing: "0.6px",
|
|
52
|
+
color: "#888",
|
|
53
|
+
margin: "16px 0 6px"
|
|
54
|
+
},
|
|
55
|
+
navItem: {
|
|
56
|
+
display: "block",
|
|
57
|
+
width: "100%",
|
|
58
|
+
textAlign: "left",
|
|
59
|
+
background: "none",
|
|
60
|
+
border: "none",
|
|
61
|
+
borderRadius: "6px",
|
|
62
|
+
padding: "6px 8px",
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
fontSize: "14px",
|
|
65
|
+
color: "#111"
|
|
66
|
+
},
|
|
67
|
+
navItemActive: { background: "#f3f4f6", fontWeight: 600 },
|
|
68
|
+
main: { flex: 1, padding: "24px", maxWidth: "960px" },
|
|
69
|
+
container: { padding: "24px", maxWidth: "960px" },
|
|
70
|
+
title: { fontSize: "20px", fontWeight: 700, marginTop: 0, marginBottom: "12px" },
|
|
71
|
+
subtitle: { fontSize: "15px", fontWeight: 600, marginTop: "24px", marginBottom: "8px" },
|
|
72
|
+
status: { padding: "12px", color: "#666" },
|
|
73
|
+
error: { color: "#e11d48", marginBottom: "12px", fontSize: "14px" },
|
|
74
|
+
ok: { color: "#15803d", fontWeight: 600 },
|
|
75
|
+
bad: { color: "#e11d48", fontWeight: 600 },
|
|
76
|
+
advice: { color: "#b45309" },
|
|
77
|
+
muted: { color: "#666", fontSize: "13px" },
|
|
78
|
+
mono: { fontFamily: "ui-monospace, monospace", fontSize: "13px" },
|
|
79
|
+
table: { width: "100%", borderCollapse: "collapse", fontSize: "14px" },
|
|
80
|
+
th: {
|
|
81
|
+
textAlign: "left",
|
|
82
|
+
borderBottom: "1px solid #ddd",
|
|
83
|
+
padding: "6px 8px",
|
|
84
|
+
fontWeight: 600,
|
|
85
|
+
color: "#444"
|
|
86
|
+
},
|
|
87
|
+
td: { borderBottom: "1px solid #eee", padding: "6px 8px", verticalAlign: "top" },
|
|
88
|
+
list: { listStyle: "none", padding: 0, margin: 0 },
|
|
89
|
+
row: { borderBottom: "1px solid #eee", padding: "8px 0" },
|
|
90
|
+
badge: {
|
|
91
|
+
display: "inline-block",
|
|
92
|
+
borderRadius: "999px",
|
|
93
|
+
padding: "1px 8px",
|
|
94
|
+
fontSize: "12px",
|
|
95
|
+
background: "#f3f4f6"
|
|
96
|
+
},
|
|
97
|
+
button: {
|
|
98
|
+
background: "none",
|
|
99
|
+
border: "1px solid #ddd",
|
|
100
|
+
borderRadius: "8px",
|
|
101
|
+
padding: "4px 10px",
|
|
102
|
+
cursor: "pointer",
|
|
103
|
+
fontSize: "13px"
|
|
104
|
+
},
|
|
105
|
+
toolbar: { display: "flex", gap: "8px", alignItems: "center", marginBottom: "12px" }
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/screens/AdminLogScreen.ts
|
|
109
|
+
var import_vue_admin = require("@fonderie/vue-admin");
|
|
110
|
+
var import_vue2 = require("vue");
|
|
111
|
+
|
|
112
|
+
// src/screens/common.ts
|
|
113
|
+
var import_vue = require("vue");
|
|
114
|
+
function page(title, state, content, toolbar = [], options = {}) {
|
|
115
|
+
const body = state.isLoading.value ? (0, import_vue.h)("p", { style: styles.status }, options.loadingText ?? "Loading\u2026") : state.error.value ? (0, import_vue.h)(
|
|
116
|
+
"p",
|
|
117
|
+
{ style: styles.error, role: "alert" },
|
|
118
|
+
(options.errorText ?? ((e) => e.explanation))(state.error.value)
|
|
119
|
+
) : content();
|
|
120
|
+
return (0, import_vue.h)("div", { style: styles.container }, [
|
|
121
|
+
(0, import_vue.h)("div", { style: styles.toolbar }, [
|
|
122
|
+
(0, import_vue.h)("h1", { style: { ...styles.title, marginBottom: 0 } }, title),
|
|
123
|
+
...toolbar
|
|
124
|
+
]),
|
|
125
|
+
body
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
function table(headers, rows) {
|
|
129
|
+
return (0, import_vue.h)("table", { style: styles.table }, [
|
|
130
|
+
(0, import_vue.h)("thead", [
|
|
131
|
+
(0, import_vue.h)(
|
|
132
|
+
"tr",
|
|
133
|
+
headers.map((t) => (0, import_vue.h)("th", { style: styles.th }, t))
|
|
134
|
+
)
|
|
135
|
+
]),
|
|
136
|
+
(0, import_vue.h)("tbody", rows)
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
var td = (children, extra = {}) => (0, import_vue.h)("td", { style: { ...styles.td, ...extra } }, children);
|
|
140
|
+
var refreshButton = (label, disabled, onClick) => (0, import_vue.h)("button", { type: "button", style: styles.button, disabled, onClick }, label);
|
|
141
|
+
|
|
142
|
+
// src/screens/AdminLogScreen.ts
|
|
143
|
+
var AdminLogScreen = (0, import_vue2.defineComponent)({
|
|
144
|
+
name: "FonderieAdminLogScreen",
|
|
145
|
+
props: {
|
|
146
|
+
client: { type: Object, required: true },
|
|
147
|
+
pageSize: { type: Number, default: 50 }
|
|
148
|
+
},
|
|
149
|
+
setup(props) {
|
|
150
|
+
const { entries, hasMore, isLoading, error, refresh, loadMore } = (0, import_vue_admin.useAdminLog)(props.client, {
|
|
151
|
+
limit: props.pageSize
|
|
152
|
+
});
|
|
153
|
+
return () => (0, import_vue2.h)("div", { style: styles.container }, [
|
|
154
|
+
(0, import_vue2.h)("div", { style: styles.toolbar }, [
|
|
155
|
+
(0, import_vue2.h)("h1", { style: { ...styles.title, marginBottom: 0 } }, "Admin log"),
|
|
156
|
+
refreshButton("Refresh", isLoading.value, () => void refresh())
|
|
157
|
+
]),
|
|
158
|
+
error.value ? (0, import_vue2.h)(
|
|
159
|
+
"p",
|
|
160
|
+
{ style: styles.error, role: "alert" },
|
|
161
|
+
error.value.status === 404 ? "The admin log is off \u2014 give AdminModule a store." : error.value.explanation
|
|
162
|
+
) : [
|
|
163
|
+
table(
|
|
164
|
+
["When", "Actor", "Request", "Status", "Module"],
|
|
165
|
+
entries.value.map(
|
|
166
|
+
(e) => (0, import_vue2.h)("tr", { key: e.id }, [
|
|
167
|
+
td(new Date(e.at).toLocaleString(), styles.muted),
|
|
168
|
+
td(e.actor),
|
|
169
|
+
td(`${e.method} ${e.path}`, styles.mono),
|
|
170
|
+
td([
|
|
171
|
+
(0, import_vue2.h)(
|
|
172
|
+
"span",
|
|
173
|
+
{ style: e.status >= 400 ? styles.bad : styles.ok },
|
|
174
|
+
String(e.status)
|
|
175
|
+
),
|
|
176
|
+
" ",
|
|
177
|
+
(0, import_vue2.h)("span", { style: styles.muted }, `${e.durationMs} ms`)
|
|
178
|
+
]),
|
|
179
|
+
td(e.module, styles.muted)
|
|
180
|
+
])
|
|
181
|
+
)
|
|
182
|
+
),
|
|
183
|
+
isLoading.value ? (0, import_vue2.h)("p", { style: styles.status }, "Loading\u2026") : null,
|
|
184
|
+
hasMore.value && !isLoading.value ? (0, import_vue2.h)(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
type: "button",
|
|
188
|
+
style: { ...styles.button, marginTop: "12px" },
|
|
189
|
+
onClick: () => void loadMore()
|
|
190
|
+
},
|
|
191
|
+
"Load more"
|
|
192
|
+
) : null
|
|
193
|
+
]
|
|
194
|
+
]);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// src/screens/AttentionScreen.ts
|
|
199
|
+
var import_vue_admin2 = require("@fonderie/vue-admin");
|
|
200
|
+
var import_vue3 = require("vue");
|
|
201
|
+
var AttentionScreen = (0, import_vue3.defineComponent)({
|
|
202
|
+
name: "FonderieAttentionScreen",
|
|
203
|
+
props: { client: { type: Object, required: true } },
|
|
204
|
+
setup(props) {
|
|
205
|
+
const { attention, isLoading, error, refresh } = (0, import_vue_admin2.useAttention)(props.client);
|
|
206
|
+
return () => page(
|
|
207
|
+
"Attention",
|
|
208
|
+
{ isLoading, error },
|
|
209
|
+
() => {
|
|
210
|
+
const a = attention.value;
|
|
211
|
+
if (!a) return null;
|
|
212
|
+
if (a.items.length === 0)
|
|
213
|
+
return (0, import_vue3.h)(
|
|
214
|
+
"p",
|
|
215
|
+
{ style: styles.ok },
|
|
216
|
+
`Nothing needs you. Checked ${new Date(a.generatedAt).toLocaleString()}.`
|
|
217
|
+
);
|
|
218
|
+
return (0, import_vue3.h)(
|
|
219
|
+
"ul",
|
|
220
|
+
{ style: styles.list },
|
|
221
|
+
a.items.map(
|
|
222
|
+
(item) => (0, import_vue3.h)("li", { key: `${item.source}:${item.message}`, style: styles.row }, [
|
|
223
|
+
(0, import_vue3.h)(
|
|
224
|
+
"span",
|
|
225
|
+
{ style: item.severity === "error" ? styles.bad : styles.advice },
|
|
226
|
+
item.severity
|
|
227
|
+
),
|
|
228
|
+
" ",
|
|
229
|
+
(0, import_vue3.h)("span", { style: styles.mono }, item.source),
|
|
230
|
+
` \u2014 ${item.message}`
|
|
231
|
+
])
|
|
232
|
+
)
|
|
233
|
+
);
|
|
234
|
+
},
|
|
235
|
+
[refreshButton("Refresh", isLoading.value, () => void refresh())],
|
|
236
|
+
{ loadingText: "Running the checks\u2026" }
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// src/screens/ConfigScreen.ts
|
|
242
|
+
var import_vue_admin3 = require("@fonderie/vue-admin");
|
|
243
|
+
var import_vue4 = require("vue");
|
|
244
|
+
var ConfigScreen = (0, import_vue4.defineComponent)({
|
|
245
|
+
name: "FonderieConfigScreen",
|
|
246
|
+
props: { client: { type: Object, required: true } },
|
|
247
|
+
setup(props) {
|
|
248
|
+
const { report, isLoading, error } = (0, import_vue_admin3.useAdminConfig)(props.client);
|
|
249
|
+
return () => page("Configuration", { isLoading, error }, () => {
|
|
250
|
+
const r = report.value;
|
|
251
|
+
if (!r) return null;
|
|
252
|
+
return [
|
|
253
|
+
(0, import_vue4.h)("h2", { style: styles.subtitle }, "Readiness"),
|
|
254
|
+
(0, import_vue4.h)(
|
|
255
|
+
"ul",
|
|
256
|
+
{ style: styles.list },
|
|
257
|
+
r.modules.map(
|
|
258
|
+
(m) => (0, import_vue4.h)("li", { key: m.name, style: styles.row }, [
|
|
259
|
+
(0, import_vue4.h)("span", { style: styles.mono }, m.name),
|
|
260
|
+
" ",
|
|
261
|
+
...m.problems.length === 0 ? [(0, import_vue4.h)("span", { style: styles.ok }, "ok")] : m.problems.map(
|
|
262
|
+
(p) => (0, import_vue4.h)(
|
|
263
|
+
"div",
|
|
264
|
+
{
|
|
265
|
+
key: p.message,
|
|
266
|
+
style: p.severity === "error" ? styles.bad : styles.advice
|
|
267
|
+
},
|
|
268
|
+
p.message
|
|
269
|
+
)
|
|
270
|
+
)
|
|
271
|
+
])
|
|
272
|
+
)
|
|
273
|
+
),
|
|
274
|
+
(0, import_vue4.h)("h2", { style: styles.subtitle }, "Environment"),
|
|
275
|
+
r.env.length === 0 ? (0, import_vue4.h)("p", { style: styles.muted }, "No variables declared \u2014 pass `env` to AdminModule.") : (0, import_vue4.h)(
|
|
276
|
+
"ul",
|
|
277
|
+
{ style: styles.list },
|
|
278
|
+
r.env.map(
|
|
279
|
+
(e) => (0, import_vue4.h)("li", { key: e.name, style: styles.row }, [
|
|
280
|
+
(0, import_vue4.h)("span", { style: styles.mono }, e.name),
|
|
281
|
+
" ",
|
|
282
|
+
(0, import_vue4.h)("span", { style: e.set ? styles.ok : styles.bad }, e.set ? "set" : "missing")
|
|
283
|
+
])
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
];
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
// src/screens/DoctorScreen.ts
|
|
292
|
+
var import_vue_admin4 = require("@fonderie/vue-admin");
|
|
293
|
+
var import_vue5 = require("vue");
|
|
294
|
+
var DoctorScreen = (0, import_vue5.defineComponent)({
|
|
295
|
+
name: "FonderieDoctorScreen",
|
|
296
|
+
props: { client: { type: Object, required: true } },
|
|
297
|
+
setup(props) {
|
|
298
|
+
const { report, isLoading, error, refresh } = (0, import_vue_admin4.useDoctor)(props.client);
|
|
299
|
+
return () => page(
|
|
300
|
+
"Doctor",
|
|
301
|
+
{ isLoading, error },
|
|
302
|
+
() => {
|
|
303
|
+
const r = report.value;
|
|
304
|
+
if (!r) return null;
|
|
305
|
+
return (0, import_vue5.h)(
|
|
306
|
+
"ul",
|
|
307
|
+
{ style: styles.list },
|
|
308
|
+
r.checks.map(
|
|
309
|
+
(c) => (0, import_vue5.h)("li", { key: c.name, style: styles.row }, [
|
|
310
|
+
(0, import_vue5.h)(
|
|
311
|
+
"span",
|
|
312
|
+
{ style: c.skipped ? styles.muted : c.ok ? styles.ok : styles.bad },
|
|
313
|
+
c.skipped ? "skipped" : c.ok ? "ok" : "failed"
|
|
314
|
+
),
|
|
315
|
+
" ",
|
|
316
|
+
(0, import_vue5.h)("span", { style: styles.mono }, c.name),
|
|
317
|
+
" ",
|
|
318
|
+
(0, import_vue5.h)("span", { style: styles.muted }, `${c.module} \xB7 ${c.durationMs} ms`),
|
|
319
|
+
c.skipped ? (0, import_vue5.h)("div", { style: styles.muted }, c.skipped) : null,
|
|
320
|
+
...c.findings.map(
|
|
321
|
+
(f) => (0, import_vue5.h)("div", { key: f, style: c.ok ? styles.advice : styles.bad }, f)
|
|
322
|
+
)
|
|
323
|
+
])
|
|
324
|
+
)
|
|
325
|
+
);
|
|
326
|
+
},
|
|
327
|
+
[
|
|
328
|
+
refreshButton("Run again", isLoading.value, () => void refresh()),
|
|
329
|
+
report.value && !isLoading.value ? (0, import_vue5.h)(
|
|
330
|
+
"span",
|
|
331
|
+
{ style: report.value.ok ? styles.ok : styles.bad },
|
|
332
|
+
report.value.ok ? "all checks pass" : "a check failed"
|
|
333
|
+
) : (0, import_vue5.h)("span")
|
|
334
|
+
],
|
|
335
|
+
{ loadingText: "Running the checks\u2026" }
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
// src/screens/ModulesScreen.ts
|
|
341
|
+
var import_vue_admin5 = require("@fonderie/vue-admin");
|
|
342
|
+
var import_vue6 = require("vue");
|
|
343
|
+
var ModulesScreen = (0, import_vue6.defineComponent)({
|
|
344
|
+
name: "FonderieModulesScreen",
|
|
345
|
+
props: { client: { type: Object, required: true } },
|
|
346
|
+
setup(props) {
|
|
347
|
+
const { manifest, isLoading, error } = (0, import_vue_admin5.useManifest)(props.client);
|
|
348
|
+
return () => page("Modules", { isLoading, error }, () => {
|
|
349
|
+
const m = manifest.value;
|
|
350
|
+
if (!m) return null;
|
|
351
|
+
return [
|
|
352
|
+
(0, import_vue6.h)(
|
|
353
|
+
"p",
|
|
354
|
+
{ style: styles.muted },
|
|
355
|
+
`${m.env} \xB7 admin ${m.admin.version} \xB7 admin log ${m.admin.log ? "on" : "off"} \xB7 ${m.routes.length} routes`
|
|
356
|
+
),
|
|
357
|
+
table(
|
|
358
|
+
["Module", "Version", "Readiness", "Describes admin"],
|
|
359
|
+
m.modules.map(
|
|
360
|
+
(mod) => (0, import_vue6.h)("tr", { key: mod.name }, [
|
|
361
|
+
td(mod.name, styles.mono),
|
|
362
|
+
td(mod.version ?? (0, import_vue6.h)("span", { style: styles.muted }, "not reported")),
|
|
363
|
+
td([
|
|
364
|
+
(0, import_vue6.h)(
|
|
365
|
+
"span",
|
|
366
|
+
{ style: mod.readiness.ok ? styles.ok : styles.bad },
|
|
367
|
+
mod.readiness.ok ? "ok" : "error"
|
|
368
|
+
),
|
|
369
|
+
...mod.readiness.problems.map(
|
|
370
|
+
(p) => (0, import_vue6.h)(
|
|
371
|
+
"div",
|
|
372
|
+
{
|
|
373
|
+
key: p.message,
|
|
374
|
+
style: p.severity === "error" ? styles.bad : styles.advice
|
|
375
|
+
},
|
|
376
|
+
p.message
|
|
377
|
+
)
|
|
378
|
+
)
|
|
379
|
+
]),
|
|
380
|
+
td(mod.describesAdmin ? "yes" : (0, import_vue6.h)("span", { style: styles.muted }, "no"))
|
|
381
|
+
])
|
|
382
|
+
)
|
|
383
|
+
)
|
|
384
|
+
];
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
// src/screens/RoutesScreen.ts
|
|
390
|
+
var import_vue_admin6 = require("@fonderie/vue-admin");
|
|
391
|
+
var import_vue7 = require("vue");
|
|
392
|
+
var RoutesScreen = (0, import_vue7.defineComponent)({
|
|
393
|
+
name: "FonderieRoutesScreen",
|
|
394
|
+
props: { client: { type: Object, required: true } },
|
|
395
|
+
setup(props) {
|
|
396
|
+
const { report, isLoading, error } = (0, import_vue_admin6.useAdminRoutes)(props.client);
|
|
397
|
+
return () => page(
|
|
398
|
+
"Routes",
|
|
399
|
+
{ isLoading, error },
|
|
400
|
+
() => table(
|
|
401
|
+
["Method", "Path", "Guard", "Module"],
|
|
402
|
+
(report.value?.routes ?? []).map(
|
|
403
|
+
(r) => (0, import_vue7.h)("tr", { key: `${r.method} ${r.path}` }, [
|
|
404
|
+
td(r.method, styles.mono),
|
|
405
|
+
td(r.path, styles.mono),
|
|
406
|
+
td((0, import_vue7.h)("span", { style: styles.badge }, r.guard)),
|
|
407
|
+
td(r.module ?? "application", styles.muted)
|
|
408
|
+
])
|
|
409
|
+
)
|
|
410
|
+
)
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
// src/screens/TokensScreen.ts
|
|
416
|
+
var import_vue_admin7 = require("@fonderie/vue-admin");
|
|
417
|
+
var import_vue8 = require("vue");
|
|
418
|
+
var TokensScreen = (0, import_vue8.defineComponent)({
|
|
419
|
+
name: "FonderieTokensScreen",
|
|
420
|
+
props: { client: { type: Object, required: true } },
|
|
421
|
+
setup(props) {
|
|
422
|
+
const { report, isLoading, error } = (0, import_vue_admin7.useAdminTokens)(props.client);
|
|
423
|
+
return () => page("Access", { isLoading, error }, () => {
|
|
424
|
+
const r = report.value;
|
|
425
|
+
if (!r) return null;
|
|
426
|
+
return [
|
|
427
|
+
(0, import_vue8.h)("h2", { style: styles.subtitle }, "Admin token"),
|
|
428
|
+
(0, import_vue8.h)("p", [
|
|
429
|
+
(0, import_vue8.h)(
|
|
430
|
+
"span",
|
|
431
|
+
{ style: r.admin.ok ? styles.ok : styles.bad },
|
|
432
|
+
r.admin.ok ? "strong" : "weak"
|
|
433
|
+
),
|
|
434
|
+
...r.admin.problems.map(
|
|
435
|
+
(p) => (0, import_vue8.h)("div", { key: p.message, style: styles.bad }, p.message)
|
|
436
|
+
)
|
|
437
|
+
]),
|
|
438
|
+
(0, import_vue8.h)("h2", { style: styles.subtitle }, "Legacy per-brick tokens"),
|
|
439
|
+
r.legacy.length === 0 ? (0, import_vue8.h)(
|
|
440
|
+
"p",
|
|
441
|
+
{ style: styles.muted },
|
|
442
|
+
"None \u2014 every brick's admin surface goes through this token."
|
|
443
|
+
) : (0, import_vue8.h)(
|
|
444
|
+
"ul",
|
|
445
|
+
{ style: styles.list },
|
|
446
|
+
r.legacy.map(
|
|
447
|
+
(l) => (0, import_vue8.h)("li", { key: l.module, style: styles.row }, [
|
|
448
|
+
(0, import_vue8.h)("span", { style: styles.mono }, l.module),
|
|
449
|
+
" ",
|
|
450
|
+
(0, import_vue8.h)(
|
|
451
|
+
"span",
|
|
452
|
+
{ style: styles.muted },
|
|
453
|
+
"still registers its standalone routes with its own token (deprecated)"
|
|
454
|
+
)
|
|
455
|
+
])
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
];
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
// src/screens/AdminShell.ts
|
|
464
|
+
var NAV = [
|
|
465
|
+
{ group: "Today", items: [{ page: "attention", label: "Attention" }] },
|
|
466
|
+
{
|
|
467
|
+
group: "System",
|
|
468
|
+
items: [
|
|
469
|
+
{ page: "modules", label: "Modules" },
|
|
470
|
+
{ page: "config", label: "Configuration" },
|
|
471
|
+
{ page: "doctor", label: "Doctor" },
|
|
472
|
+
{ page: "routes", label: "Routes" }
|
|
473
|
+
]
|
|
474
|
+
},
|
|
475
|
+
{ group: "Settings", items: [{ page: "settings", label: "Config & secrets", needs: "config" }] },
|
|
476
|
+
{ group: "Messaging", items: [{ page: "templates", label: "Templates", needs: "courier" }] },
|
|
477
|
+
{
|
|
478
|
+
group: "Activity",
|
|
479
|
+
items: [
|
|
480
|
+
{ page: "log", label: "Admin log" },
|
|
481
|
+
{ page: "tokens", label: "Access" }
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
];
|
|
485
|
+
var AdminShell = (0, import_vue9.defineComponent)({
|
|
486
|
+
name: "FonderieAdminShell",
|
|
487
|
+
props: {
|
|
488
|
+
client: { type: Object, required: true },
|
|
489
|
+
// Given ⇒ the Settings and Messaging pages appear. Construct them with
|
|
490
|
+
// `prefix: '/_admin'` to go through the one token.
|
|
491
|
+
configClient: { type: Object, default: void 0 },
|
|
492
|
+
courierClient: { type: Object, default: void 0 },
|
|
493
|
+
environment: { type: String, default: void 0 },
|
|
494
|
+
// Controlled navigation: pass `page` and listen to `navigate` to own the
|
|
495
|
+
// URL. Omit `page` and the shell keeps it itself.
|
|
496
|
+
page: { type: String, default: void 0 }
|
|
497
|
+
},
|
|
498
|
+
emits: { navigate: (_page) => true },
|
|
499
|
+
setup(props, { emit }) {
|
|
500
|
+
const own = (0, import_vue9.ref)("attention");
|
|
501
|
+
const current = (0, import_vue9.computed)(() => props.page ?? own.value);
|
|
502
|
+
const editing = (0, import_vue9.ref)(null);
|
|
503
|
+
const go = (p) => {
|
|
504
|
+
editing.value = null;
|
|
505
|
+
emit("navigate", p);
|
|
506
|
+
if (props.page === void 0) own.value = p;
|
|
507
|
+
};
|
|
508
|
+
const back = () => (0, import_vue9.h)(
|
|
509
|
+
"button",
|
|
510
|
+
{ type: "button", style: styles.button, onClick: () => editing.value = null },
|
|
511
|
+
"\u2190 Back"
|
|
512
|
+
);
|
|
513
|
+
const body = () => {
|
|
514
|
+
const c = props.client;
|
|
515
|
+
switch (current.value) {
|
|
516
|
+
case "attention":
|
|
517
|
+
return (0, import_vue9.h)(AttentionScreen, { client: c });
|
|
518
|
+
case "modules":
|
|
519
|
+
return (0, import_vue9.h)(ModulesScreen, { client: c });
|
|
520
|
+
case "doctor":
|
|
521
|
+
return (0, import_vue9.h)(DoctorScreen, { client: c });
|
|
522
|
+
case "config":
|
|
523
|
+
return (0, import_vue9.h)(ConfigScreen, { client: c });
|
|
524
|
+
case "routes":
|
|
525
|
+
return (0, import_vue9.h)(RoutesScreen, { client: c });
|
|
526
|
+
case "tokens":
|
|
527
|
+
return (0, import_vue9.h)(TokensScreen, { client: c });
|
|
528
|
+
case "log":
|
|
529
|
+
return (0, import_vue9.h)(AdminLogScreen, { client: c });
|
|
530
|
+
case "settings": {
|
|
531
|
+
const cc = props.configClient;
|
|
532
|
+
if (!cc)
|
|
533
|
+
return (0, import_vue9.h)(
|
|
534
|
+
"p",
|
|
535
|
+
{ style: styles.status },
|
|
536
|
+
"Pass a ConfigAdminClient to manage config and secrets here."
|
|
537
|
+
);
|
|
538
|
+
const e = editing.value;
|
|
539
|
+
if (e && e.kind !== "template")
|
|
540
|
+
return [
|
|
541
|
+
back(),
|
|
542
|
+
(0, import_vue9.h)(import_vue_config_admin_screens.ConfigEditorScreen, {
|
|
543
|
+
client: cc,
|
|
544
|
+
kind: e.kind,
|
|
545
|
+
configKey: e.key,
|
|
546
|
+
...props.environment !== void 0 ? { environment: props.environment } : {},
|
|
547
|
+
onSaved: () => editing.value = null
|
|
548
|
+
})
|
|
549
|
+
];
|
|
550
|
+
return (0, import_vue9.h)(import_vue_config_admin_screens.ConfigListScreen, {
|
|
551
|
+
client: cc,
|
|
552
|
+
...props.environment !== void 0 ? { environment: props.environment } : {},
|
|
553
|
+
"onSelect-config": (key) => editing.value = { kind: "config", key },
|
|
554
|
+
"onSelect-secret": (key) => editing.value = { kind: "secret", key }
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
case "templates": {
|
|
558
|
+
const kc = props.courierClient;
|
|
559
|
+
if (!kc)
|
|
560
|
+
return (0, import_vue9.h)(
|
|
561
|
+
"p",
|
|
562
|
+
{ style: styles.status },
|
|
563
|
+
"Pass a CourierAdminClient to manage templates here."
|
|
564
|
+
);
|
|
565
|
+
const e = editing.value;
|
|
566
|
+
if (e?.kind === "template")
|
|
567
|
+
return [
|
|
568
|
+
back(),
|
|
569
|
+
(0, import_vue9.h)(import_vue_courier_admin_screens.TemplateEditorScreen, {
|
|
570
|
+
client: kc,
|
|
571
|
+
type: e.type,
|
|
572
|
+
onSaved: () => editing.value = null
|
|
573
|
+
})
|
|
574
|
+
];
|
|
575
|
+
return (0, import_vue9.h)(import_vue_courier_admin_screens.TemplateListScreen, {
|
|
576
|
+
client: kc,
|
|
577
|
+
"onSelect-template": (t) => editing.value = { kind: "template", type: t.type }
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
return () => (0, import_vue9.h)("div", { style: styles.shell }, [
|
|
583
|
+
(0, import_vue9.h)(
|
|
584
|
+
"nav",
|
|
585
|
+
{ style: styles.nav, "aria-label": "Admin" },
|
|
586
|
+
NAV.map((g) => {
|
|
587
|
+
const items = g.items.filter(
|
|
588
|
+
(i) => !i.needs || (i.needs === "config" ? props.configClient : props.courierClient)
|
|
589
|
+
);
|
|
590
|
+
if (items.length === 0) return null;
|
|
591
|
+
return (0, import_vue9.h)("div", { key: g.group }, [
|
|
592
|
+
(0, import_vue9.h)("div", { style: styles.navGroup }, g.group),
|
|
593
|
+
...items.map(
|
|
594
|
+
(i) => (0, import_vue9.h)(
|
|
595
|
+
"button",
|
|
596
|
+
{
|
|
597
|
+
key: i.page,
|
|
598
|
+
type: "button",
|
|
599
|
+
style: {
|
|
600
|
+
...styles.navItem,
|
|
601
|
+
...current.value === i.page ? styles.navItemActive : {}
|
|
602
|
+
},
|
|
603
|
+
"aria-current": current.value === i.page ? "page" : void 0,
|
|
604
|
+
onClick: () => go(i.page)
|
|
605
|
+
},
|
|
606
|
+
i.label
|
|
607
|
+
)
|
|
608
|
+
)
|
|
609
|
+
]);
|
|
610
|
+
})
|
|
611
|
+
),
|
|
612
|
+
(0, import_vue9.h)("main", { style: styles.main }, body())
|
|
613
|
+
]);
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
617
|
+
0 && (module.exports = {
|
|
618
|
+
AdminLogScreen,
|
|
619
|
+
AdminShell,
|
|
620
|
+
AttentionScreen,
|
|
621
|
+
ConfigScreen,
|
|
622
|
+
DoctorScreen,
|
|
623
|
+
ModulesScreen,
|
|
624
|
+
RoutesScreen,
|
|
625
|
+
TokensScreen
|
|
626
|
+
});
|
|
627
|
+
//# sourceMappingURL=index.cjs.map
|