@micelio/strapi-plugin-core 0.1.0 → 0.2.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/README.md +5 -3
- package/dist/admin/MicelioLayout-Bmu5xCw9.js +1023 -0
- package/dist/admin/MicelioLayout-DMMsKnMo.mjs +1021 -0
- package/dist/admin/PreviewHeaderAction-BaduMvYy.mjs +61 -0
- package/dist/admin/PreviewHeaderAction-CGHycv4I.js +61 -0
- package/dist/admin/{en-D-T8z3qh.js → en-BDVuq0fN.js} +37 -1
- package/dist/admin/{en-C2O-S2ym.mjs → en-Bahc6y6N.mjs} +37 -1
- package/dist/admin/{es-RV0vkOHh.js → es-DStBGkm7.js} +37 -1
- package/dist/admin/{es-CQ2tv9N8.mjs → es-nUHBIoZG.mjs} +37 -1
- package/dist/admin/{index-D3TGbaQ7.js → index-D_Dbvo2F.js} +8 -2
- package/dist/admin/{index-CiSujTES.mjs → index-Dwr15ZsB.mjs} +8 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/permissions-BAI0qDr9.js +24 -0
- package/dist/admin/permissions-CYirM30e.mjs +25 -0
- package/dist/admin/src/components/EyeIcon.d.ts +8 -0
- package/dist/admin/src/components/PreviewFrame.d.ts +47 -0
- package/dist/admin/src/components/PreviewHeaderAction.d.ts +28 -0
- package/dist/admin/src/hooks/useEntry.d.ts +31 -0
- package/dist/admin/src/hooks/usePreviewSource.d.ts +31 -0
- package/dist/admin/src/pages/MicelioLayout.d.ts +2 -1
- package/dist/admin/src/pages/PreviewPage.d.ts +2 -0
- package/dist/admin/src/permissions.d.ts +5 -0
- package/dist/admin/src/translations/en.json.d.ts +37 -1
- package/dist/admin/src/utils/fetchError.d.ts +2 -0
- package/dist/admin/src/utils/previewAction.d.ts +22 -0
- package/dist/admin/src/utils/previewPane.d.ts +59 -0
- package/dist/server/index.js +796 -105
- package/dist/server/index.mjs +796 -105
- package/dist/server/src/constants/preview.d.ts +2 -0
- package/dist/server/src/constants/taxonomy.d.ts +13 -0
- package/dist/server/src/content-types/category/schema.json.d.ts +78 -0
- package/dist/server/src/content-types/index.d.ts +125 -2
- package/dist/server/src/content-types/preview-credential/schema.json.d.ts +7 -6
- package/dist/server/src/content-types/tag/schema.json.d.ts +46 -0
- package/dist/server/src/controllers/index.d.ts +6 -0
- package/dist/server/src/editorial/transitions.d.ts +5 -2
- package/dist/server/src/index.d.ts +140 -2
- package/dist/server/src/migrations/rename-legacy-uids.d.ts +26 -0
- package/dist/server/src/migrations/site-backfill.d.ts +13 -0
- package/dist/server/src/preview/credentials.d.ts +7 -5
- package/dist/server/src/preview/draft-query.d.ts +62 -0
- package/dist/server/src/preview/revocation.d.ts +9 -1
- package/dist/server/src/preview/shortcut.d.ts +24 -0
- package/dist/server/src/routes/index.d.ts +2 -0
- package/dist/server/src/routes/taxonomy.d.ts +12 -0
- package/dist/server/src/services/index.d.ts +6 -0
- package/dist/server/src/services/preview.d.ts +25 -6
- package/dist/server/src/site-scope/documents.d.ts +13 -3
- package/dist/server/src/types/hooks.d.ts +5 -4
- package/dist/server/src/types/preview.d.ts +35 -10
- package/package.json +4 -3
- package/dist/admin/MicelioLayout-3sKGPS_0.mjs +0 -443
- package/dist/admin/MicelioLayout-DXzRS4l3.js +0 -443
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const designSystem = require("@strapi/design-system");
|
|
5
|
-
const admin = require("@strapi/strapi/admin");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const reactIntl = require("react-intl");
|
|
8
|
-
const reactRouterDom = require("react-router-dom");
|
|
9
|
-
const en = require("./en-D-T8z3qh.js");
|
|
10
|
-
const index = require("./index-D3TGbaQ7.js");
|
|
11
|
-
function useAdminPages() {
|
|
12
|
-
const client = admin.useFetchClient();
|
|
13
|
-
const clientRef = react.useRef(client);
|
|
14
|
-
clientRef.current = client;
|
|
15
|
-
const [state, setState] = react.useState({ pages: [], hasFailed: false, isLoading: true });
|
|
16
|
-
react.useEffect(() => {
|
|
17
|
-
let isCurrent = true;
|
|
18
|
-
void (async () => {
|
|
19
|
-
try {
|
|
20
|
-
const response = await clientRef.current.get(
|
|
21
|
-
"/micelio/admin-pages"
|
|
22
|
-
);
|
|
23
|
-
if (isCurrent) setState({ pages: response.data.data, hasFailed: false, isLoading: false });
|
|
24
|
-
} catch {
|
|
25
|
-
if (isCurrent) setState({ pages: [], hasFailed: true, isLoading: false });
|
|
26
|
-
}
|
|
27
|
-
})();
|
|
28
|
-
return () => {
|
|
29
|
-
isCurrent = false;
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
return state;
|
|
33
|
-
}
|
|
34
|
-
function hasMessage(id) {
|
|
35
|
-
return Object.hasOwn(en.default, id);
|
|
36
|
-
}
|
|
37
|
-
function useMessages() {
|
|
38
|
-
const { formatMessage, formatDate } = reactIntl.useIntl();
|
|
39
|
-
return {
|
|
40
|
-
t: (id, values) => formatMessage(
|
|
41
|
-
{ id: index.getTranslation(id), defaultMessage: en.default[id] ?? id },
|
|
42
|
-
values
|
|
43
|
-
),
|
|
44
|
-
// Seconds included: a run again within the same minute must read as new.
|
|
45
|
-
date: (iso) => formatDate(iso, { dateStyle: "medium", timeStyle: "medium" })
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const STATUS_READ_PERMISSION = { action: "plugin::micelio.status.read", subject: null };
|
|
49
|
-
const NAV_GROUPS = ["overview", "content", "site", "about"];
|
|
50
|
-
const CORE_NAV_ITEMS = [
|
|
51
|
-
{ id: "status", group: "overview", to: "", permission: STATUS_READ_PERMISSION },
|
|
52
|
-
{ id: "about", group: "about", to: "about" }
|
|
53
|
-
];
|
|
54
|
-
function visibleNavItems(items, permissions) {
|
|
55
|
-
return items.filter(
|
|
56
|
-
(item) => !item.permission || permissions.some(({ action }) => action === item.permission?.action)
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
function localised(text, locale) {
|
|
60
|
-
const language = locale.split("-")[0] ?? "en";
|
|
61
|
-
const found = language === "es" ? text.es : void 0;
|
|
62
|
-
return found && found.trim() !== "" ? found : text.en;
|
|
63
|
-
}
|
|
64
|
-
function AboutPage() {
|
|
65
|
-
const { t } = useMessages();
|
|
66
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
|
|
67
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: t("about.title") }),
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Header, { title: t("about.title"), subtitle: t("about.subtitle") }),
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: t("about.body") }) })
|
|
70
|
-
] });
|
|
71
|
-
}
|
|
72
|
-
function useHostCheckRun(initial) {
|
|
73
|
-
const client = admin.useFetchClient();
|
|
74
|
-
const clientRef = react.useRef(client);
|
|
75
|
-
clientRef.current = client;
|
|
76
|
-
const [report, setReport] = react.useState(initial);
|
|
77
|
-
const [isRunning, setIsRunning] = react.useState(false);
|
|
78
|
-
const [hasFailed, setHasFailed] = react.useState(false);
|
|
79
|
-
const run = react.useCallback(async () => {
|
|
80
|
-
setIsRunning(true);
|
|
81
|
-
setHasFailed(false);
|
|
82
|
-
try {
|
|
83
|
-
const response = await clientRef.current.post(
|
|
84
|
-
"/micelio/status/host-check"
|
|
85
|
-
);
|
|
86
|
-
setReport(response.data.data);
|
|
87
|
-
return response.data.data;
|
|
88
|
-
} catch {
|
|
89
|
-
setHasFailed(true);
|
|
90
|
-
return null;
|
|
91
|
-
} finally {
|
|
92
|
-
setIsRunning(false);
|
|
93
|
-
}
|
|
94
|
-
}, []);
|
|
95
|
-
return { report, isRunning, hasFailed, run };
|
|
96
|
-
}
|
|
97
|
-
function useStatus() {
|
|
98
|
-
const client = admin.useFetchClient();
|
|
99
|
-
const clientRef = react.useRef(client);
|
|
100
|
-
clientRef.current = client;
|
|
101
|
-
const [resource, setResource] = react.useState({ kind: "loading" });
|
|
102
|
-
const [count, setCount] = react.useState(0);
|
|
103
|
-
react.useEffect(() => {
|
|
104
|
-
let isCurrent = true;
|
|
105
|
-
void (async () => {
|
|
106
|
-
try {
|
|
107
|
-
const response = await clientRef.current.get("/micelio/status");
|
|
108
|
-
if (isCurrent) setResource({ kind: "ready", data: response.data.data });
|
|
109
|
-
} catch {
|
|
110
|
-
if (isCurrent) setResource({ kind: "error" });
|
|
111
|
-
}
|
|
112
|
-
})();
|
|
113
|
-
return () => {
|
|
114
|
-
isCurrent = false;
|
|
115
|
-
};
|
|
116
|
-
}, [count]);
|
|
117
|
-
const reload = react.useCallback(() => {
|
|
118
|
-
setResource({ kind: "loading" });
|
|
119
|
-
setCount((value) => value + 1);
|
|
120
|
-
}, []);
|
|
121
|
-
const refresh = react.useCallback(async () => {
|
|
122
|
-
try {
|
|
123
|
-
const response = await clientRef.current.get("/micelio/status");
|
|
124
|
-
setResource({ kind: "ready", data: response.data.data });
|
|
125
|
-
} catch {
|
|
126
|
-
}
|
|
127
|
-
}, []);
|
|
128
|
-
return { resource, reload, refresh };
|
|
129
|
-
}
|
|
130
|
-
function checkText(result, part, isKnown) {
|
|
131
|
-
const fallback = part === "title" ? result.title : result.fix;
|
|
132
|
-
if (fallback === void 0) return null;
|
|
133
|
-
const messageId = `status.hostCheck.check.${result.id}.${part}`;
|
|
134
|
-
return isKnown(messageId) ? { messageId } : { text: fallback };
|
|
135
|
-
}
|
|
136
|
-
function diagnosticsText(report) {
|
|
137
|
-
const lines = [`Micelio ${report.plugin.version} (core release line ${report.plugin.coreLine})`];
|
|
138
|
-
if (report.hostCheck) {
|
|
139
|
-
const failed = report.hostCheck.results.filter(({ status }) => status === "fail").length;
|
|
140
|
-
lines.push(`Host check: ${report.hostCheck.ok ? "ok" : "fails"} (${failed} failed)`);
|
|
141
|
-
} else {
|
|
142
|
-
lines.push("Host check: not run");
|
|
143
|
-
}
|
|
144
|
-
for (const [id, result] of Object.entries(report.plugins)) lines.push(pluginLine(id, result));
|
|
145
|
-
return lines.join("\n");
|
|
146
|
-
}
|
|
147
|
-
function pluginLine(id, result) {
|
|
148
|
-
if (result.ranAt === null) return `${id}: checks not run`;
|
|
149
|
-
const count = (status) => result.checks.filter((check) => check.status === status).length;
|
|
150
|
-
return `${id}: ${count("ok")} ok, ${count("warn")} warn, ${count("fail")} fail`;
|
|
151
|
-
}
|
|
152
|
-
const TONES = {
|
|
153
|
-
success: { backgroundColor: "success100", textColor: "success700" },
|
|
154
|
-
danger: { backgroundColor: "danger100", textColor: "danger700" },
|
|
155
|
-
// warning700 on warning100 is 4.0:1, below the 4.5:1 of WCAG AA.
|
|
156
|
-
warning: { backgroundColor: "warning100", textColor: "neutral800" },
|
|
157
|
-
neutral: { backgroundColor: "neutral150", textColor: "neutral700" }
|
|
158
|
-
};
|
|
159
|
-
const CHECK_TONES = {
|
|
160
|
-
pass: "success",
|
|
161
|
-
fail: "danger",
|
|
162
|
-
skip: "neutral"
|
|
163
|
-
};
|
|
164
|
-
function StatusPage() {
|
|
165
|
-
const { t } = useMessages();
|
|
166
|
-
return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: [STATUS_READ_PERMISSION], children: /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: t("status.title") }),
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Header, { title: t("status.title"), subtitle: t("status.subtitle") }),
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(StatusContent, {}) })
|
|
170
|
-
] }) });
|
|
171
|
-
}
|
|
172
|
-
function StatusContent() {
|
|
173
|
-
const { t } = useMessages();
|
|
174
|
-
const { resource, reload, refresh } = useStatus();
|
|
175
|
-
if (resource.kind === "loading") return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, { children: t("status.loading") });
|
|
176
|
-
if (resource.kind === "error") {
|
|
177
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Section, { title: t("status.error.title"), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
|
|
178
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("status.error") }),
|
|
179
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", size: "S", onClick: reload, children: t("status.retry") })
|
|
180
|
-
] }) });
|
|
181
|
-
}
|
|
182
|
-
const report = resource.data;
|
|
183
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
184
|
-
/* @__PURE__ */ jsxRuntime.jsx(PluginSection, { report }),
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.jsx(HostCheckSection, { initial: report.hostCheck, onRan: refresh }),
|
|
186
|
-
/* @__PURE__ */ jsxRuntime.jsx(PluginChecksSections, { report }),
|
|
187
|
-
/* @__PURE__ */ jsxRuntime.jsx(FrontendsSection, { frontends: report.frontends }),
|
|
188
|
-
/* @__PURE__ */ jsxRuntime.jsx(SitesSection, { sites: report.sites }),
|
|
189
|
-
/* @__PURE__ */ jsxRuntime.jsx(DiagnosticsButton, { report })
|
|
190
|
-
] });
|
|
191
|
-
}
|
|
192
|
-
function Section({ title, children }) {
|
|
193
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "section", background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
194
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h2", children: title }),
|
|
195
|
-
children
|
|
196
|
-
] }) });
|
|
197
|
-
}
|
|
198
|
-
function StatusBadge({ tone, children }) {
|
|
199
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...TONES[tone], children });
|
|
200
|
-
}
|
|
201
|
-
function Fact({ label, value }) {
|
|
202
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
203
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", tag: "dt", children: label }),
|
|
204
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "dd", children: value })
|
|
205
|
-
] });
|
|
206
|
-
}
|
|
207
|
-
function PluginSection({ report }) {
|
|
208
|
-
const { t } = useMessages();
|
|
209
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Section, { title: t("status.plugin.title"), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { tag: "dl", gap: 8, wrap: "wrap", alignItems: "flex-start", children: [
|
|
210
|
-
/* @__PURE__ */ jsxRuntime.jsx(Fact, { label: t("status.plugin.version"), value: report.plugin.version }),
|
|
211
|
-
/* @__PURE__ */ jsxRuntime.jsx(Fact, { label: t("status.plugin.coreLine"), value: report.plugin.coreLine }),
|
|
212
|
-
/* @__PURE__ */ jsxRuntime.jsx(Fact, { label: t("status.blocks.count"), value: report.blocks.count }),
|
|
213
|
-
/* @__PURE__ */ jsxRuntime.jsx(Fact, { label: t("status.sites.count"), value: report.sites.length })
|
|
214
|
-
] }) });
|
|
215
|
-
}
|
|
216
|
-
function HostCheckSection({
|
|
217
|
-
initial,
|
|
218
|
-
onRan
|
|
219
|
-
}) {
|
|
220
|
-
const { t, date } = useMessages();
|
|
221
|
-
const { notifyStatus, notifyAlert } = designSystem.useNotifyAT();
|
|
222
|
-
const { report, isRunning, hasFailed, run } = useHostCheckRun(initial);
|
|
223
|
-
const say = (text) => "messageId" in text ? t(text.messageId) : text.text;
|
|
224
|
-
const verdict = (current) => `${t(current.ok ? "status.hostCheck.ok" : "status.hostCheck.failed")} ${t(
|
|
225
|
-
"status.hostCheck.checkedAt",
|
|
226
|
-
{ date: date(current.checkedAt), environment: current.environment }
|
|
227
|
-
)}`;
|
|
228
|
-
const runAgain = async () => {
|
|
229
|
-
const answer = await run();
|
|
230
|
-
if (answer) await onRan();
|
|
231
|
-
if (answer) notifyStatus(verdict(answer));
|
|
232
|
-
else notifyAlert(t("status.hostCheck.runFailed"));
|
|
233
|
-
};
|
|
234
|
-
const header = /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, wrap: "wrap", justifyContent: "space-between", alignItems: "center", children: [
|
|
235
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: report ? void 0 : "neutral600", children: report ? verdict(report) : t("status.hostCheck.notRun") }),
|
|
236
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", size: "S", loading: isRunning, onClick: runAgain, children: t(isRunning ? "status.hostCheck.running" : "status.hostCheck.runAgain") })
|
|
237
|
-
] });
|
|
238
|
-
const failure = hasFailed ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger700", children: t("status.hostCheck.runFailed") }) : null;
|
|
239
|
-
if (!report) {
|
|
240
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Section, { title: t("status.hostCheck.title"), children: [
|
|
241
|
-
header,
|
|
242
|
-
failure
|
|
243
|
-
] });
|
|
244
|
-
}
|
|
245
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Section, { title: t("status.hostCheck.title"), children: [
|
|
246
|
-
header,
|
|
247
|
-
failure,
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 3, rowCount: report.results.length + 1, children: [
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
250
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.hostCheck.column.check") }) }),
|
|
251
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.hostCheck.column.status") }) }),
|
|
252
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.hostCheck.column.found") }) })
|
|
253
|
-
] }) }),
|
|
254
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: report.results.map((result) => {
|
|
255
|
-
const title = checkText(result, "title", hasMessage);
|
|
256
|
-
const fix = result.status === "fail" ? checkText(result, "fix", hasMessage) : null;
|
|
257
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
258
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
259
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: title ? say(title) : result.id }),
|
|
260
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
|
|
261
|
-
result.required ? "status.hostCheck.required" : "status.hostCheck.optional"
|
|
262
|
-
) })
|
|
263
|
-
] }) }),
|
|
264
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { tone: CHECK_TONES[result.status], children: t(`status.hostCheck.status.${result.status}`) }) }),
|
|
265
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
266
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: result.detail }),
|
|
267
|
-
fix ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral800", children: [
|
|
268
|
-
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
269
|
-
t("status.hostCheck.fix"),
|
|
270
|
-
":"
|
|
271
|
-
] }),
|
|
272
|
-
" ",
|
|
273
|
-
say(fix)
|
|
274
|
-
] }) : null
|
|
275
|
-
] }) })
|
|
276
|
-
] }, result.id);
|
|
277
|
-
}) })
|
|
278
|
-
] }),
|
|
279
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("status.hostCheck.rerun") })
|
|
280
|
-
] });
|
|
281
|
-
}
|
|
282
|
-
function FrontendsSection({ frontends }) {
|
|
283
|
-
const { t } = useMessages();
|
|
284
|
-
if (frontends.length === 0) {
|
|
285
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Section, { title: t("status.frontends.title"), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("status.frontends.none") }) });
|
|
286
|
-
}
|
|
287
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Section, { title: t("status.frontends.title"), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: frontends.length + 1, children: [
|
|
288
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
289
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.frontends.column.origin") }) }),
|
|
290
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.frontends.column.sites") }) }),
|
|
291
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.frontends.column.health") }) }),
|
|
292
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.frontends.column.version") }) })
|
|
293
|
-
] }) }),
|
|
294
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: frontends.map((frontend) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
295
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: frontend.origin }) }),
|
|
296
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: frontend.sites.join(", ") }) }),
|
|
297
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
298
|
-
/* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { tone: frontend.health === "reachable" ? "success" : "neutral", children: t(`status.frontends.health.${frontend.health}`) }),
|
|
299
|
-
frontend.health === "unavailable" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("status.frontends.unavailable") }) : null
|
|
300
|
-
] }) }),
|
|
301
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: frontend.version ?? t("status.frontends.noVersion") }) })
|
|
302
|
-
] }, frontend.origin)) })
|
|
303
|
-
] }) });
|
|
304
|
-
}
|
|
305
|
-
function SitesSection({ sites }) {
|
|
306
|
-
const { t } = useMessages();
|
|
307
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Section, { title: t("status.sites.title"), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: sites.length + 1, children: [
|
|
308
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
309
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.sites.column.name") }) }),
|
|
310
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.sites.column.slug") }) }),
|
|
311
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.sites.column.hosts") }) }),
|
|
312
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.sites.column.url") }) })
|
|
313
|
-
] }) }),
|
|
314
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: sites.map((site) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
315
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
316
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: site.name }),
|
|
317
|
-
site.isDefault ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: t("status.sites.default") }) : null
|
|
318
|
-
] }) }),
|
|
319
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: site.slug }) }),
|
|
320
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: site.hosts.length > 0 ? site.hosts.join(", ") : t("status.sites.noHosts") }) }),
|
|
321
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: site.origin ?? t("status.sites.noUrl") }) })
|
|
322
|
-
] }, site.documentId)) })
|
|
323
|
-
] }) });
|
|
324
|
-
}
|
|
325
|
-
const PLUGIN_TONES = {
|
|
326
|
-
ok: "success",
|
|
327
|
-
warn: "warning",
|
|
328
|
-
fail: "danger"
|
|
329
|
-
};
|
|
330
|
-
function PluginChecksSections({ report }) {
|
|
331
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Object.entries(report.plugins).map(([id, result]) => /* @__PURE__ */ jsxRuntime.jsx(PluginChecksCard, { result, sites: report.sites }, id)) });
|
|
332
|
-
}
|
|
333
|
-
function PluginChecksCard({ result, sites }) {
|
|
334
|
-
const { t, date } = useMessages();
|
|
335
|
-
const { locale } = reactIntl.useIntl();
|
|
336
|
-
const slugOf = (documentId) => sites.find((site) => site.documentId === documentId)?.slug ?? documentId;
|
|
337
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Section, { title: localised(result.label, locale), children: [
|
|
338
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: result.ranAt === null ? t("status.plugins.notRun") : t("status.plugins.ranAt", { date: date(result.ranAt) }) }),
|
|
339
|
-
result.ranAt !== null && result.checks.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("status.plugins.empty") }) : null,
|
|
340
|
-
result.checks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: result.checks.length + 1, children: [
|
|
341
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
342
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.plugins.column.site") }) }),
|
|
343
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.plugins.column.check") }) }),
|
|
344
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.plugins.column.status") }) }),
|
|
345
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("status.plugins.column.found") }) })
|
|
346
|
-
] }) }),
|
|
347
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: result.checks.map((check) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
348
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: slugOf(check.site) }) }),
|
|
349
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: localised(check.title, locale) }) }),
|
|
350
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { tone: PLUGIN_TONES[check.status], children: t(`status.plugins.status.${check.status}`) }) }),
|
|
351
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
352
|
-
check.detail ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: localised(check.detail, locale) }) : null,
|
|
353
|
-
check.fix ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral800", children: [
|
|
354
|
-
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
355
|
-
t("status.plugins.fix"),
|
|
356
|
-
":"
|
|
357
|
-
] }),
|
|
358
|
-
" ",
|
|
359
|
-
localised(check.fix, locale)
|
|
360
|
-
] }) : null
|
|
361
|
-
] }) })
|
|
362
|
-
] }, `${check.site}:${check.id}`)) })
|
|
363
|
-
] }) : null
|
|
364
|
-
] });
|
|
365
|
-
}
|
|
366
|
-
function DiagnosticsButton({ report }) {
|
|
367
|
-
const { t } = useMessages();
|
|
368
|
-
const { notifyStatus, notifyAlert } = designSystem.useNotifyAT();
|
|
369
|
-
const copy = async () => {
|
|
370
|
-
try {
|
|
371
|
-
await navigator.clipboard.writeText(diagnosticsText(report));
|
|
372
|
-
notifyStatus(t("status.diagnostics.copied"));
|
|
373
|
-
} catch {
|
|
374
|
-
notifyAlert(t("status.diagnostics.failed"));
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", size: "S", onClick: copy, children: t("status.diagnostics.copy") }) });
|
|
378
|
-
}
|
|
379
|
-
function MicelioLayout() {
|
|
380
|
-
const { t } = useMessages();
|
|
381
|
-
const { locale } = reactIntl.useIntl();
|
|
382
|
-
const { pages, hasFailed, isLoading } = useAdminPages();
|
|
383
|
-
const isLoadingPermissions = admin.useAuth("MicelioLayout", (state) => state.isLoading);
|
|
384
|
-
const permissions = admin.useAuth("MicelioLayout", (state) => state.permissions);
|
|
385
|
-
const canReadStatus = permissions.some(({ action }) => action === STATUS_READ_PERMISSION.action);
|
|
386
|
-
const coreItems = visibleNavItems(CORE_NAV_ITEMS, permissions);
|
|
387
|
-
const linksOf = (group) => [
|
|
388
|
-
...coreItems.filter((item) => item.group === group).map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
389
|
-
admin.SubNav.Link,
|
|
390
|
-
{
|
|
391
|
-
to: item.to ? `/plugins/${index.PLUGIN_ID}/${item.to}` : `/plugins/${index.PLUGIN_ID}`,
|
|
392
|
-
end: !item.to,
|
|
393
|
-
label: t(`nav.${item.id}`)
|
|
394
|
-
},
|
|
395
|
-
item.id
|
|
396
|
-
)),
|
|
397
|
-
...pages.filter((page) => page.group === group).map((page) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
398
|
-
admin.SubNav.Link,
|
|
399
|
-
{
|
|
400
|
-
to: `/plugins/${index.PLUGIN_ID}/${page.to}`,
|
|
401
|
-
label: localised(page.label, locale)
|
|
402
|
-
},
|
|
403
|
-
page.id
|
|
404
|
-
))
|
|
405
|
-
];
|
|
406
|
-
if (isLoadingPermissions) return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, {});
|
|
407
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
408
|
-
admin.Layouts.Root,
|
|
409
|
-
{
|
|
410
|
-
sideNav: /* @__PURE__ */ jsxRuntime.jsxs(admin.SubNav.Main, { "aria-label": t("nav.label"), children: [
|
|
411
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Header, { label: t("nav.title") }),
|
|
412
|
-
/* @__PURE__ */ jsxRuntime.jsxs(admin.SubNav.Sections, { children: [
|
|
413
|
-
NAV_GROUPS.map((group) => ({ group, links: linksOf(group) })).filter(({ links }) => links.length > 0).map(({ group, links }) => /* @__PURE__ */ jsxRuntime.jsx(admin.SubNav.Section, { label: t(`nav.group.${group}`), children: links }, group)),
|
|
414
|
-
hasFailed ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("nav.error") }) : null
|
|
415
|
-
] })
|
|
416
|
-
] }),
|
|
417
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
418
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: canReadStatus ? /* @__PURE__ */ jsxRuntime.jsx(StatusPage, {}) : /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Navigate, { to: "about", replace: true }) }),
|
|
419
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "about", element: /* @__PURE__ */ jsxRuntime.jsx(AboutPage, {}) }),
|
|
420
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(ExtensionPage, { pages, isLoading }) })
|
|
421
|
-
] })
|
|
422
|
-
}
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
function ExtensionPage({ pages, isLoading }) {
|
|
426
|
-
const { t } = useMessages();
|
|
427
|
-
const path = reactRouterDom.useParams()["*"] ?? "";
|
|
428
|
-
const page = pages.find((candidate) => candidate.to === path);
|
|
429
|
-
const Component = react.useMemo(() => {
|
|
430
|
-
const loader = page ? index.pageLoaderOf(page.id) : void 0;
|
|
431
|
-
return loader ? react.lazy(loader) : null;
|
|
432
|
-
}, [page]);
|
|
433
|
-
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, {});
|
|
434
|
-
if (!Component) {
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
|
|
436
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: t("page.unavailable.title") }),
|
|
437
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Header, { title: t("page.unavailable.title") }),
|
|
438
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: t("page.unavailable") }) })
|
|
439
|
-
] });
|
|
440
|
-
}
|
|
441
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(Component, {}) });
|
|
442
|
-
}
|
|
443
|
-
exports.default = MicelioLayout;
|