dsh-agent-control-center 0.3.1 → 0.4.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/CHANGELOG.md +44 -0
- package/README.md +6 -4
- package/README.zh.md +6 -4
- package/client.js +1100 -2
- package/docs/01-CONTRACT.md +1 -1
- package/docs/05-ACCEPTANCE-EVIDENCE.md +38 -0
- package/docs/07-GUIDE.md +1 -1
- package/docs/09-ARCHITECTURE.md +2 -2
- package/docs/12-PLUGIN-HEALTH.md +49 -0
- package/index.js +4 -1
- package/lib/core/index.js +15 -1
- package/lib/core/store.js +5 -1
- package/lib/modules/j-instruction.js +162 -2
- package/lib/modules/l-health.js +862 -0
- package/package.json +1 -1
- package/scripts/verify.mjs +1 -0
- package/src/client/i18n/health.js +260 -0
- package/src/client/pages/health.js +832 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
/* Health page (module L) — one read-only, evidence-first health check.
|
|
2
|
+
*
|
|
3
|
+
* Page order, top to bottom:
|
|
4
|
+
* 1. Read-only policy notice: this page never writes a plugin or config.
|
|
5
|
+
* 2. Verdict card: worst-severity notice plus four status cells from
|
|
6
|
+
* `health.summary()` (plugins, settings namespaces, section conflicts,
|
|
7
|
+
* compatibility).
|
|
8
|
+
* 3. Plugin inventory: `health.plugins()` rows and its anomalies, with the
|
|
9
|
+
* action each anomaly calls for.
|
|
10
|
+
* 4. Settings namespaces: `health.settings()` metadata only, the redaction
|
|
11
|
+
* badge and this plugin's own declared/enabled row.
|
|
12
|
+
* 5. Section static scan: `health.sections()` counts, sections, duplicate-id
|
|
13
|
+
* conflicts and the mandatory limitation note.
|
|
14
|
+
* 6. Compatibility: `health.compat()` level, version, read-only flag and
|
|
15
|
+
* reasons.
|
|
16
|
+
*
|
|
17
|
+
* Each block loads, fails and reloads on its own: a missing host method shows
|
|
18
|
+
* the reason plus the next step, never a fabricated value. Layout is vertical
|
|
19
|
+
* rhythm only — the host settings column already scrolls. */
|
|
20
|
+
(function healthPage() {
|
|
21
|
+
const PAGE_STYLE = { display: 'flex', flexDirection: 'column', gap: '12px', padding: '8px 0' }
|
|
22
|
+
const STACK_STYLE = { display: 'flex', flexDirection: 'column', gap: '8px' }
|
|
23
|
+
const COLUMN_STYLE = { display: 'flex', flexDirection: 'column', gap: '2px' }
|
|
24
|
+
const SMALL_STYLE = { fontSize: '11px' }
|
|
25
|
+
const BREAK_STYLE = { wordBreak: 'break-word' }
|
|
26
|
+
const EMPTY_VALUE = '—'
|
|
27
|
+
|
|
28
|
+
const SEVERITY_TONE = { ok: 'success', warn: 'warn', error: 'danger', info: 'info' }
|
|
29
|
+
const COMPAT_TONE = { full: 'success', degraded: 'warn', unknown: 'warn', unsupported: 'danger' }
|
|
30
|
+
/** Anomaly kind → shared tone; `unaddressable` rows are usable, only uneditable. */
|
|
31
|
+
const ANOMALY_TONE = { 'duplicate-module': 'warn', unaddressable: 'warn' }
|
|
32
|
+
/** Summary section id → navigation copy. */
|
|
33
|
+
const BLOCK_KEYS = {
|
|
34
|
+
plugins: 'health.block.plugins',
|
|
35
|
+
settings: 'health.block.settings',
|
|
36
|
+
sections: 'health.block.sections',
|
|
37
|
+
compat: 'health.block.compat',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @param {unknown} value @returns {string} */
|
|
41
|
+
function textOf(value) {
|
|
42
|
+
return value === null || value === undefined ? '' : String(value).trim()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @param {unknown} value @returns {boolean} */
|
|
46
|
+
function isRecord(value) {
|
|
47
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @param {unknown} value @returns {string} a formatted count, or — when the host had no number */
|
|
51
|
+
function countText(value) {
|
|
52
|
+
return typeof value === 'number' && Number.isFinite(value) ? ACC.fmt.num(value) : EMPTY_VALUE
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @param {string} severity @param {Function} t @returns {string} */
|
|
56
|
+
function severityLabel(severity, t) {
|
|
57
|
+
if (severity === 'ok') return t('health.severity.ok')
|
|
58
|
+
if (severity === 'warn') return t('health.severity.warn')
|
|
59
|
+
if (severity === 'error') return t('health.severity.error')
|
|
60
|
+
return t('health.severity.info')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** @param {string} id @param {Function} t @returns {string} */
|
|
64
|
+
function blockLabel(id, t) {
|
|
65
|
+
const key = BLOCK_KEYS[id]
|
|
66
|
+
return key === undefined ? textOf(id) || EMPTY_VALUE : t(key)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Host free text for a note. In Chinese it is shown as-is; in English a mapped
|
|
71
|
+
* translation wins, then ASCII host text is shown verbatim and CJK host text
|
|
72
|
+
* falls back to the translated key so the English UI never prints Chinese.
|
|
73
|
+
* @param {string} key @param {unknown} raw @param {Function} t @returns {string}
|
|
74
|
+
*/
|
|
75
|
+
function noteText(key, raw, t) {
|
|
76
|
+
const value = textOf(raw)
|
|
77
|
+
if (value.length === 0) return t(key)
|
|
78
|
+
if (ACC.l10n !== undefined && ACC.l10n !== null && typeof ACC.l10n.hostOr === 'function') {
|
|
79
|
+
return ACC.l10n.hostOr(key, value, t(key))
|
|
80
|
+
}
|
|
81
|
+
return value
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
85
|
+
function anomalyKindLabel(kind, t) {
|
|
86
|
+
if (kind === 'duplicate-module') return t('health.anomalyKind.duplicate-module')
|
|
87
|
+
if (kind === 'unaddressable') return t('health.anomalyKind.unaddressable')
|
|
88
|
+
return t('health.anomalyKindUnknown')
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
92
|
+
function anomalyAction(kind, t) {
|
|
93
|
+
if (kind === 'duplicate-module') return t('health.anomalyAction.duplicate-module')
|
|
94
|
+
if (kind === 'unaddressable') return t('health.anomalyAction.unaddressable')
|
|
95
|
+
return t('health.anomalyActionGeneric')
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** @param {string} kind @param {Function} t @returns {string} */
|
|
99
|
+
function conflictKindLabel(kind, t) {
|
|
100
|
+
return kind === 'duplicate-id' ? t('health.conflictKind.duplicate-id') : t('health.conflictKindUnknown')
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* One truthy/falsey/absent own-row flag as a badge. An absent flag is data the
|
|
105
|
+
* host did not provide, so it renders as — instead of a guessed state.
|
|
106
|
+
* @param {unknown} value @param {Function} t @param {string} trueKey @param {string} falseKey
|
|
107
|
+
* @returns {unknown}
|
|
108
|
+
*/
|
|
109
|
+
function ownBadge(value, t, trueKey, falseKey) {
|
|
110
|
+
if (value === true) return h(C.Badge, { tone: 'success' }, t(trueKey))
|
|
111
|
+
if (value === false) return h(C.Badge, { tone: 'warn' }, t(falseKey))
|
|
112
|
+
return h('span', { className: 'acc-muted' }, EMPTY_VALUE)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Failure or `{available:false}` answer: the host reason, an optional hint and
|
|
117
|
+
* the next step are all visible. A hint that is missing gets the generic next
|
|
118
|
+
* step, so the block never ends without an action.
|
|
119
|
+
* @param {{ t: Function, title?: string, reason?: unknown, code?: unknown, hint?: unknown, onRetry?: Function, extra?: unknown }} props
|
|
120
|
+
*/
|
|
121
|
+
function FailurePanel(props) {
|
|
122
|
+
const t = props.t
|
|
123
|
+
const reason = textOf(props.reason)
|
|
124
|
+
const hint = textOf(props.hint)
|
|
125
|
+
return h(
|
|
126
|
+
'div',
|
|
127
|
+
{ style: STACK_STYLE },
|
|
128
|
+
h(C.ErrorBox, {
|
|
129
|
+
error: {
|
|
130
|
+
code: textOf(props.code) || 'unavailable',
|
|
131
|
+
message: reason.length > 0 ? reason : t('health.reasonMissing'),
|
|
132
|
+
hint: hint.length > 0 ? hint : undefined,
|
|
133
|
+
},
|
|
134
|
+
label: props.title || t('health.unavailable'),
|
|
135
|
+
onRetry: props.onRetry,
|
|
136
|
+
}),
|
|
137
|
+
hint.length === 0 ? h(C.Notice, { tone: 'info' }, t('health.unavailableNextStep')) : null,
|
|
138
|
+
props.extra === undefined ? null : props.extra,
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Loader for a block whose host-side module is missing: it answers the
|
|
144
|
+
* documented `{available:false, reason, hint}` record without posting a
|
|
145
|
+
* request the host cannot serve (an old host would answer 404 for every
|
|
146
|
+
* health method, which also shows up as a browser resource error).
|
|
147
|
+
* @param {{ reason?: unknown, hint?: unknown }} gate
|
|
148
|
+
* @returns {() => Promise<Record<string, unknown>>}
|
|
149
|
+
*/
|
|
150
|
+
function gatedLoader(gate) {
|
|
151
|
+
return () => Promise.resolve({ available: false, reason: textOf(gate.reason), hint: textOf(gate.hint) })
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Three-state body: loading, error/unavailable, or the block's own rendering.
|
|
156
|
+
* @param {{ t: Function, state: any, extra?: (data: any) => unknown, render: (data: any) => unknown }} props
|
|
157
|
+
*/
|
|
158
|
+
function BlockContent(props) {
|
|
159
|
+
const t = props.t
|
|
160
|
+
const state = props.state
|
|
161
|
+
if (state.status === 'loading') return h(C.Loading, { label: t('health.loading') })
|
|
162
|
+
if (state.status === 'error') {
|
|
163
|
+
const error = state.error !== null && typeof state.error === 'object' ? state.error : {}
|
|
164
|
+
return h(FailurePanel, {
|
|
165
|
+
t,
|
|
166
|
+
title: t('health.blockFailed'),
|
|
167
|
+
reason: error.message,
|
|
168
|
+
code: error.code || error.name,
|
|
169
|
+
hint: error.hint,
|
|
170
|
+
onRetry: state.reload,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
const data = isRecord(state.data) ? state.data : {}
|
|
174
|
+
if (data.available === false) {
|
|
175
|
+
return h(FailurePanel, {
|
|
176
|
+
t,
|
|
177
|
+
title: t('health.unavailable'),
|
|
178
|
+
reason: data.reason,
|
|
179
|
+
code: 'unavailable',
|
|
180
|
+
hint: data.hint,
|
|
181
|
+
onRetry: state.reload,
|
|
182
|
+
extra: props.extra === undefined ? undefined : props.extra(data),
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
return props.render(data)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Card shell: a title, a subtitle and the block's own refresh control. The
|
|
190
|
+
* refresh buttons get one unique accessible name each.
|
|
191
|
+
* @param {{ t: Function, title: unknown, subtitle?: unknown, loading: boolean, onRefresh: Function, refreshLabel: string, children?: unknown }} props
|
|
192
|
+
*/
|
|
193
|
+
function BlockCard(props) {
|
|
194
|
+
const t = props.t
|
|
195
|
+
return h(
|
|
196
|
+
C.Card,
|
|
197
|
+
{
|
|
198
|
+
title: props.title,
|
|
199
|
+
subtitle: props.subtitle,
|
|
200
|
+
actions: h(
|
|
201
|
+
C.Btn,
|
|
202
|
+
{
|
|
203
|
+
tone: 'ghost',
|
|
204
|
+
icon: 'retry',
|
|
205
|
+
onClick: props.onRefresh,
|
|
206
|
+
disabled: props.loading === true,
|
|
207
|
+
ariaLabel: props.refreshLabel,
|
|
208
|
+
title: props.refreshLabel,
|
|
209
|
+
},
|
|
210
|
+
props.loading === true ? t('health.refreshing') : t('health.refresh'),
|
|
211
|
+
),
|
|
212
|
+
},
|
|
213
|
+
props.children,
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** @param {{ label: unknown, value: unknown, hint?: unknown }} props */
|
|
218
|
+
function StatusTile(props) {
|
|
219
|
+
return h(
|
|
220
|
+
'div',
|
|
221
|
+
{ className: 'acc-card acc-stat', style: { cursor: 'default' } },
|
|
222
|
+
h('span', { className: 'acc-stat-label' }, props.label),
|
|
223
|
+
h('span', { className: 'acc-stat-value' }, props.value),
|
|
224
|
+
props.hint === undefined || props.hint === null
|
|
225
|
+
? null
|
|
226
|
+
: h('span', { className: 'acc-stat-label', style: SMALL_STYLE }, props.hint),
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* The mandatory limitation note of the section scan (and the settings source
|
|
232
|
+
* note); the host text is used when it is shown as-is.
|
|
233
|
+
* @param {{ t: Function, text: unknown }} props
|
|
234
|
+
*/
|
|
235
|
+
function NoteLine(props) {
|
|
236
|
+
return h(
|
|
237
|
+
'div',
|
|
238
|
+
{ className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } },
|
|
239
|
+
`${props.t('health.noteLabel')}: ${String(props.text)}`,
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Worst-severity verdict: its severity owns the tone of this notice.
|
|
245
|
+
* @param {{ t: Function, worst: any }} props
|
|
246
|
+
*/
|
|
247
|
+
function VerdictNotice(props) {
|
|
248
|
+
const t = props.t
|
|
249
|
+
const worst = isRecord(props.worst) ? props.worst : null
|
|
250
|
+
if (worst === null) return h(C.Notice, { tone: 'warn' }, t('health.summaryMissingWorst'))
|
|
251
|
+
const severity = worst.severity === 'ok' || worst.severity === 'warn' || worst.severity === 'error' ? worst.severity : 'info'
|
|
252
|
+
const tone = SEVERITY_TONE[severity] || 'info'
|
|
253
|
+
if (severity === 'ok' || textOf(worst.id) === 'none') {
|
|
254
|
+
return h(C.Notice, { tone }, h('span', null, h('strong', null, t('health.worst')), `: ${t('health.worstNone')}`))
|
|
255
|
+
}
|
|
256
|
+
return h(
|
|
257
|
+
C.Notice,
|
|
258
|
+
{ tone },
|
|
259
|
+
h(
|
|
260
|
+
'div',
|
|
261
|
+
{ style: COLUMN_STYLE },
|
|
262
|
+
h('span', null, h('strong', null, t('health.worst')), `: ${blockLabel(textOf(worst.id), t)} · ${severityLabel(severity, t)}`),
|
|
263
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.worstHint')),
|
|
264
|
+
),
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** @param {{ t: Function, data: any }} props */
|
|
269
|
+
function SummaryBody(props) {
|
|
270
|
+
const t = props.t
|
|
271
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
272
|
+
const plugins = isRecord(data.plugins) ? data.plugins : {}
|
|
273
|
+
const settings = isRecord(data.settings) ? data.settings : {}
|
|
274
|
+
const sections = isRecord(data.sections) ? data.sections : {}
|
|
275
|
+
const compat = isRecord(data.compat) ? data.compat : {}
|
|
276
|
+
const anomalies = plugins.anomalies
|
|
277
|
+
const namespaces = settings.namespaces
|
|
278
|
+
const conflicts = sections.conflicts
|
|
279
|
+
const compatLevel = textOf(compat.level)
|
|
280
|
+
const readOnly = compat.readOnly
|
|
281
|
+
const redactionVerified = settings.redactionVerified === true
|
|
282
|
+
const generatedAt = textOf(data.generatedAt)
|
|
283
|
+
const partial = [plugins.total, anomalies, namespaces, conflicts, sections.count, compat.level].some(
|
|
284
|
+
(value) => value === null || value === undefined,
|
|
285
|
+
)
|
|
286
|
+
return h(
|
|
287
|
+
'div',
|
|
288
|
+
{ style: STACK_STYLE },
|
|
289
|
+
h(VerdictNotice, { t, worst: data.worst }),
|
|
290
|
+
h(
|
|
291
|
+
'div',
|
|
292
|
+
{ className: 'acc-stat-grid', role: 'group', 'aria-label': t('health.tilesAria') },
|
|
293
|
+
h(StatusTile, {
|
|
294
|
+
label: t('health.tile.plugins'),
|
|
295
|
+
value: countText(plugins.total),
|
|
296
|
+
hint:
|
|
297
|
+
typeof anomalies === 'number' && anomalies > 0
|
|
298
|
+
? h(C.Badge, { tone: 'warn', title: t('health.tileAnomalies', { count: anomalies }) }, t('health.tileAnomalies', { count: anomalies }))
|
|
299
|
+
: typeof anomalies === 'number'
|
|
300
|
+
? t('health.tileNoAnomalies')
|
|
301
|
+
: t('common.unknown'),
|
|
302
|
+
}),
|
|
303
|
+
h(StatusTile, {
|
|
304
|
+
label: t('health.tile.settings'),
|
|
305
|
+
value: countText(namespaces),
|
|
306
|
+
hint: h(
|
|
307
|
+
C.Badge,
|
|
308
|
+
{
|
|
309
|
+
tone: redactionVerified ? 'success' : 'danger',
|
|
310
|
+
title: t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
311
|
+
},
|
|
312
|
+
t(redactionVerified ? 'health.redacted' : 'health.notRedacted'),
|
|
313
|
+
),
|
|
314
|
+
}),
|
|
315
|
+
h(StatusTile, {
|
|
316
|
+
label: t('health.tile.sections'),
|
|
317
|
+
value: countText(conflicts),
|
|
318
|
+
hint: typeof sections.count === 'number' ? t('health.tileSectionsCount', { count: sections.count }) : t('common.unknown'),
|
|
319
|
+
}),
|
|
320
|
+
h(StatusTile, {
|
|
321
|
+
label: t('health.tile.compat'),
|
|
322
|
+
value: compatLevel.length > 0 ? compatLevel : EMPTY_VALUE,
|
|
323
|
+
hint:
|
|
324
|
+
readOnly === true
|
|
325
|
+
? h(C.Badge, { tone: 'warn' }, t('health.readOnlyYes'))
|
|
326
|
+
: readOnly === false
|
|
327
|
+
? h(C.Badge, { tone: 'success' }, t('health.readOnlyNo'))
|
|
328
|
+
: t('common.unknown'),
|
|
329
|
+
}),
|
|
330
|
+
),
|
|
331
|
+
partial ? h(C.Notice, { tone: 'warn' }, t('health.summaryPartial')) : null,
|
|
332
|
+
generatedAt.length > 0
|
|
333
|
+
? h('div', { className: 'acc-muted', style: SMALL_STYLE }, t('health.generatedAt', { time: ACC.fmt.dateTime(generatedAt) }))
|
|
334
|
+
: null,
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** @param {{ t: Function }} props */
|
|
339
|
+
function SummaryCard(props) {
|
|
340
|
+
const t = props.t
|
|
341
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
342
|
+
const blocked = gate.available === false
|
|
343
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.summary', {}, context), [])
|
|
344
|
+
return h(
|
|
345
|
+
BlockCard,
|
|
346
|
+
{
|
|
347
|
+
t,
|
|
348
|
+
title: t('health.summaryTitle'),
|
|
349
|
+
subtitle: t('health.summarySubtitle'),
|
|
350
|
+
loading: state.status === 'loading',
|
|
351
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
352
|
+
refreshLabel: t('health.refresh.summary'),
|
|
353
|
+
},
|
|
354
|
+
h(BlockContent, { t, state, render: (data) => h(SummaryBody, { t, data }) }),
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/** @param {{ t: Function, anomaly: any }} props */
|
|
359
|
+
function AnomalyNotice(props) {
|
|
360
|
+
const t = props.t
|
|
361
|
+
const anomaly = isRecord(props.anomaly) ? props.anomaly : {}
|
|
362
|
+
const kind = textOf(anomaly.kind)
|
|
363
|
+
const detail = textOf(anomaly.detail)
|
|
364
|
+
return h(
|
|
365
|
+
C.Notice,
|
|
366
|
+
{ tone: ANOMALY_TONE[kind] || 'warn' },
|
|
367
|
+
h(
|
|
368
|
+
'div',
|
|
369
|
+
{ style: { ...COLUMN_STYLE, gap: '3px' } },
|
|
370
|
+
h('span', null, h('strong', null, `${t('health.anomalyKindLabel')}: ${anomalyKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`)),
|
|
371
|
+
detail.length > 0 ? h('div', { style: BREAK_STYLE }, detail) : null,
|
|
372
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.anomalySuggestion')}: ${anomalyAction(kind, t)}`),
|
|
373
|
+
),
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
378
|
+
function PluginsBody(props) {
|
|
379
|
+
const t = props.t
|
|
380
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
381
|
+
const items = Array.isArray(data.items) ? data.items : []
|
|
382
|
+
const anomalies = Array.isArray(data.anomalies) ? data.anomalies : []
|
|
383
|
+
const source = textOf(data.source)
|
|
384
|
+
return h(
|
|
385
|
+
'div',
|
|
386
|
+
{ style: STACK_STYLE },
|
|
387
|
+
h(
|
|
388
|
+
'div',
|
|
389
|
+
{ className: 'acc-row' },
|
|
390
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.source')}:`),
|
|
391
|
+
h(C.Mono, { text: source.length > 0 ? source : EMPTY_VALUE }),
|
|
392
|
+
),
|
|
393
|
+
items.length === 0
|
|
394
|
+
? h(C.Empty, {
|
|
395
|
+
title: t('health.pluginsEmpty'),
|
|
396
|
+
hint: t('health.pluginsEmptyHint'),
|
|
397
|
+
icon: 'inbox',
|
|
398
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
399
|
+
})
|
|
400
|
+
: h(C.Table, {
|
|
401
|
+
columns: [
|
|
402
|
+
{ key: 'entryId', label: t('health.pluginsColumnEntry'), truncate: true },
|
|
403
|
+
{ key: 'moduleName', label: t('health.pluginsColumnModule'), truncate: true },
|
|
404
|
+
{ key: 'patchId', label: t('health.pluginsColumnPatch'), truncate: true },
|
|
405
|
+
{ key: 'readOnlyReason', label: t('health.pluginsColumnReadOnly'), truncate: true },
|
|
406
|
+
],
|
|
407
|
+
rows: items,
|
|
408
|
+
empty: null,
|
|
409
|
+
}),
|
|
410
|
+
h(
|
|
411
|
+
'div',
|
|
412
|
+
{ style: STACK_STYLE },
|
|
413
|
+
h('div', { className: 'acc-section-title' }, t('health.anomaliesTitle')),
|
|
414
|
+
anomalies.length === 0
|
|
415
|
+
? h(
|
|
416
|
+
C.Notice,
|
|
417
|
+
{ tone: 'success' },
|
|
418
|
+
h(
|
|
419
|
+
'div',
|
|
420
|
+
{ style: COLUMN_STYLE },
|
|
421
|
+
h('span', null, t('health.anomaliesNone')),
|
|
422
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.anomaliesNoneHint')),
|
|
423
|
+
),
|
|
424
|
+
)
|
|
425
|
+
: anomalies.map((anomaly, index) => h(AnomalyNotice, { key: `anomaly-${index}`, t, anomaly })),
|
|
426
|
+
),
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** @param {{ t: Function }} props */
|
|
431
|
+
function PluginsCard(props) {
|
|
432
|
+
const t = props.t
|
|
433
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
434
|
+
const blocked = gate.available === false
|
|
435
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.plugins', {}, context), [])
|
|
436
|
+
return h(
|
|
437
|
+
BlockCard,
|
|
438
|
+
{
|
|
439
|
+
t,
|
|
440
|
+
title: t('health.pluginsTitle'),
|
|
441
|
+
subtitle: t('health.pluginsSubtitle'),
|
|
442
|
+
loading: state.status === 'loading',
|
|
443
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
444
|
+
refreshLabel: t('health.refresh.plugins'),
|
|
445
|
+
},
|
|
446
|
+
h(BlockContent, {
|
|
447
|
+
t,
|
|
448
|
+
state,
|
|
449
|
+
render: (data) => h(PluginsBody, { t, data, onRetry: state.reload }),
|
|
450
|
+
}),
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
455
|
+
function SettingsBody(props) {
|
|
456
|
+
const t = props.t
|
|
457
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
458
|
+
const namespaces = Array.isArray(data.namespaces) ? data.namespaces : []
|
|
459
|
+
const own = isRecord(data.own) ? data.own : {}
|
|
460
|
+
const redactionVerified = data.redactionVerified === true
|
|
461
|
+
const note = noteText('health.settingsNote', data.note, t)
|
|
462
|
+
return h(
|
|
463
|
+
'div',
|
|
464
|
+
{ style: STACK_STYLE },
|
|
465
|
+
h(
|
|
466
|
+
'div',
|
|
467
|
+
{ className: 'acc-row', style: { alignItems: 'flex-start' } },
|
|
468
|
+
h(
|
|
469
|
+
C.Badge,
|
|
470
|
+
{
|
|
471
|
+
tone: redactionVerified ? 'success' : 'danger',
|
|
472
|
+
title: t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
473
|
+
},
|
|
474
|
+
t(redactionVerified ? 'health.settingsRedactionOk' : 'health.settingsRedactionFail'),
|
|
475
|
+
),
|
|
476
|
+
h(
|
|
477
|
+
'span',
|
|
478
|
+
{ className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } },
|
|
479
|
+
t(redactionVerified ? 'health.settingsRedactionOkHint' : 'health.settingsRedactionFailHint'),
|
|
480
|
+
),
|
|
481
|
+
),
|
|
482
|
+
h(
|
|
483
|
+
'div',
|
|
484
|
+
{ className: 'acc-row' },
|
|
485
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.settingsOwn')}:`),
|
|
486
|
+
h(C.Mono, { text: textOf(own.ns) || EMPTY_VALUE }),
|
|
487
|
+
ownBadge(own.declared, t, 'health.settingsDeclared', 'health.settingsNotDeclared'),
|
|
488
|
+
ownBadge(own.enabled, t, 'health.settingsEnabled', 'health.settingsDisabled'),
|
|
489
|
+
),
|
|
490
|
+
namespaces.length === 0
|
|
491
|
+
? h(C.Empty, {
|
|
492
|
+
title: t('health.settingsEmpty'),
|
|
493
|
+
hint: t('health.settingsEmptyHint'),
|
|
494
|
+
icon: 'inbox',
|
|
495
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
496
|
+
})
|
|
497
|
+
: h(C.Table, {
|
|
498
|
+
columns: [
|
|
499
|
+
{ key: 'ns', label: t('health.settingsColumnNs'), truncate: true },
|
|
500
|
+
{ key: 'revision', label: t('health.settingsColumnRevision'), align: 'right' },
|
|
501
|
+
{
|
|
502
|
+
key: 'autoGenerate',
|
|
503
|
+
label: t('health.settingsColumnAutoGenerate'),
|
|
504
|
+
render: (row) =>
|
|
505
|
+
h(C.Badge, { tone: row.autoGenerate === true ? 'info' : 'neutral' }, row.autoGenerate === true ? t('health.yes') : t('health.no')),
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
key: 'secretKeys',
|
|
509
|
+
label: t('health.settingsColumnSecretKeys'),
|
|
510
|
+
render: (row) => {
|
|
511
|
+
const list = Array.isArray(row.secretKeys) ? row.secretKeys : []
|
|
512
|
+
return h(
|
|
513
|
+
'span',
|
|
514
|
+
{
|
|
515
|
+
className: list.length === 0 ? 'acc-muted' : undefined,
|
|
516
|
+
title: list.length > 0 ? list.map((entry) => textOf(entry)).join(', ') : undefined,
|
|
517
|
+
},
|
|
518
|
+
t('health.secretKeyCount', { count: list.length }),
|
|
519
|
+
)
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
],
|
|
523
|
+
rows: namespaces,
|
|
524
|
+
empty: null,
|
|
525
|
+
}),
|
|
526
|
+
h(NoteLine, { t, text: note }),
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/** @param {{ t: Function }} props */
|
|
531
|
+
function SettingsCard(props) {
|
|
532
|
+
const t = props.t
|
|
533
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
534
|
+
const blocked = gate.available === false
|
|
535
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.settings', {}, context), [])
|
|
536
|
+
return h(
|
|
537
|
+
BlockCard,
|
|
538
|
+
{
|
|
539
|
+
t,
|
|
540
|
+
title: t('health.settingsTitle'),
|
|
541
|
+
subtitle: t('health.settingsSubtitle'),
|
|
542
|
+
loading: state.status === 'loading',
|
|
543
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
544
|
+
refreshLabel: t('health.refresh.settings'),
|
|
545
|
+
},
|
|
546
|
+
h(BlockContent, {
|
|
547
|
+
t,
|
|
548
|
+
state,
|
|
549
|
+
extra: (data) => h(NoteLine, { t, text: noteText('health.settingsNote', isRecord(data) ? data.note : undefined, t) }),
|
|
550
|
+
render: (data) => h(SettingsBody, { t, data, onRetry: state.reload }),
|
|
551
|
+
}),
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/** @param {{ t: Function, conflict: any }} props */
|
|
556
|
+
function ConflictNotice(props) {
|
|
557
|
+
const t = props.t
|
|
558
|
+
const conflict = isRecord(props.conflict) ? props.conflict : {}
|
|
559
|
+
const kind = textOf(conflict.kind)
|
|
560
|
+
const id = textOf(conflict.id)
|
|
561
|
+
const owners = Array.isArray(conflict.owners) ? conflict.owners.map((owner) => textOf(owner)).filter((owner) => owner.length > 0) : []
|
|
562
|
+
const suggestion = textOf(conflict.suggestion)
|
|
563
|
+
return h(
|
|
564
|
+
C.Notice,
|
|
565
|
+
{ tone: 'warn' },
|
|
566
|
+
h(
|
|
567
|
+
'div',
|
|
568
|
+
{ style: { ...COLUMN_STYLE, gap: '3px' } },
|
|
569
|
+
h('span', null, h('strong', null, `${t('health.conflictKindLabel')}: ${conflictKindLabel(kind, t)}${kind.length > 0 ? ` · ${kind}` : ''}`), id.length > 0 ? ` · ${id}` : ''),
|
|
570
|
+
owners.length > 0
|
|
571
|
+
? h('span', { className: 'acc-muted', style: SMALL_STYLE }, `${t('health.conflictOwners')}: ${owners.join(', ')}`)
|
|
572
|
+
: null,
|
|
573
|
+
h(
|
|
574
|
+
'span',
|
|
575
|
+
{ style: { ...BREAK_STYLE, fontSize: '11px' } },
|
|
576
|
+
`${t('health.conflictSuggestion')}: ${suggestion.length > 0 ? suggestion : t('health.conflictSuggestionFallback')}`,
|
|
577
|
+
),
|
|
578
|
+
),
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** @param {{ t: Function, data: any, onRetry?: Function }} props */
|
|
583
|
+
function SectionsBody(props) {
|
|
584
|
+
const t = props.t
|
|
585
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
586
|
+
const scanned = isRecord(data.scanned) ? data.scanned : {}
|
|
587
|
+
const sections = Array.isArray(data.sections) ? data.sections : []
|
|
588
|
+
const conflicts = Array.isArray(data.conflicts) ? data.conflicts : []
|
|
589
|
+
const method = textOf(data.method)
|
|
590
|
+
const note = noteText('health.sectionsNote', data.note, t)
|
|
591
|
+
const scannedText = t('health.sectionsScanned', { packages: countText(scanned.packages), files: countText(scanned.files) })
|
|
592
|
+
return h(
|
|
593
|
+
'div',
|
|
594
|
+
{ style: STACK_STYLE },
|
|
595
|
+
h(
|
|
596
|
+
C.Notice,
|
|
597
|
+
{ tone: 'info' },
|
|
598
|
+
h(
|
|
599
|
+
'div',
|
|
600
|
+
{ style: COLUMN_STYLE },
|
|
601
|
+
h('span', null, method.length > 0 ? `${scannedText} · ${method}` : scannedText),
|
|
602
|
+
h('span', { className: 'acc-muted', style: { ...SMALL_STYLE, ...BREAK_STYLE } }, `${t('health.noteLabel')}: ${note}`),
|
|
603
|
+
),
|
|
604
|
+
),
|
|
605
|
+
sections.length === 0
|
|
606
|
+
? h(C.Empty, {
|
|
607
|
+
title: t('health.sectionsEmpty'),
|
|
608
|
+
hint: t('health.sectionsEmptyHint'),
|
|
609
|
+
icon: 'diagnostics',
|
|
610
|
+
action: props.onRetry ? h(C.Btn, { onClick: props.onRetry }, t('common.retry')) : null,
|
|
611
|
+
})
|
|
612
|
+
: h(C.Table, {
|
|
613
|
+
columns: [
|
|
614
|
+
{ key: 'id', label: t('health.sectionsColumnId'), truncate: true },
|
|
615
|
+
{ key: 'owner', label: t('health.sectionsColumnOwner'), truncate: true },
|
|
616
|
+
{ key: 'file', label: t('health.sectionsColumnFile'), truncate: true },
|
|
617
|
+
],
|
|
618
|
+
rows: sections,
|
|
619
|
+
empty: null,
|
|
620
|
+
}),
|
|
621
|
+
h(
|
|
622
|
+
'div',
|
|
623
|
+
{ style: STACK_STYLE },
|
|
624
|
+
h('div', { className: 'acc-section-title' }, t('health.conflictsTitle')),
|
|
625
|
+
conflicts.length === 0
|
|
626
|
+
? h(
|
|
627
|
+
C.Notice,
|
|
628
|
+
{ tone: 'success' },
|
|
629
|
+
h(
|
|
630
|
+
'div',
|
|
631
|
+
{ style: COLUMN_STYLE },
|
|
632
|
+
h('span', null, t('health.conflictsNone')),
|
|
633
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.conflictsNoneHint')),
|
|
634
|
+
),
|
|
635
|
+
)
|
|
636
|
+
: conflicts.map((conflict, index) => h(ConflictNotice, { key: `conflict-${index}`, t, conflict })),
|
|
637
|
+
),
|
|
638
|
+
)
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/** @param {{ t: Function }} props */
|
|
642
|
+
function SectionsCard(props) {
|
|
643
|
+
const t = props.t
|
|
644
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
645
|
+
const blocked = gate.available === false
|
|
646
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.sections', {}, context), [])
|
|
647
|
+
return h(
|
|
648
|
+
BlockCard,
|
|
649
|
+
{
|
|
650
|
+
t,
|
|
651
|
+
title: t('health.sectionsTitle'),
|
|
652
|
+
subtitle: t('health.sectionsSubtitle'),
|
|
653
|
+
loading: state.status === 'loading',
|
|
654
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
655
|
+
refreshLabel: t('health.refresh.sections'),
|
|
656
|
+
},
|
|
657
|
+
h(BlockContent, {
|
|
658
|
+
t,
|
|
659
|
+
state,
|
|
660
|
+
extra: (data) => h(NoteLine, { t, text: noteText('health.sectionsNote', isRecord(data) ? data.note : undefined, t) }),
|
|
661
|
+
render: (data) => h(SectionsBody, { t, data, onRetry: state.reload }),
|
|
662
|
+
}),
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/** @param {{ t: Function, reason: any }} props */
|
|
667
|
+
function CompatReasonRow(props) {
|
|
668
|
+
const t = props.t
|
|
669
|
+
const reason = isRecord(props.reason) ? props.reason : {}
|
|
670
|
+
const severity = reason.severity === 'error' || reason.severity === 'warn' ? reason.severity : 'info'
|
|
671
|
+
const code = textOf(reason.code)
|
|
672
|
+
const text = textOf(reason.text)
|
|
673
|
+
return h(
|
|
674
|
+
C.Notice,
|
|
675
|
+
{ tone: SEVERITY_TONE[severity] || 'info' },
|
|
676
|
+
h(
|
|
677
|
+
'div',
|
|
678
|
+
{ style: { ...COLUMN_STYLE, gap: '2px' } },
|
|
679
|
+
h(
|
|
680
|
+
'span',
|
|
681
|
+
null,
|
|
682
|
+
h(C.Badge, { tone: SEVERITY_TONE[severity] || 'info' }, severityLabel(severity, t)),
|
|
683
|
+
code.length > 0 ? h('span', { style: { marginInlineStart: '6px' } }, h(C.Mono, { text: code })) : null,
|
|
684
|
+
),
|
|
685
|
+
text.length > 0 ? h('span', { style: { ...BREAK_STYLE, fontSize: '11px' } }, text) : null,
|
|
686
|
+
),
|
|
687
|
+
)
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/** @param {{ t: Function, data: any }} props */
|
|
691
|
+
function CompatBody(props) {
|
|
692
|
+
const t = props.t
|
|
693
|
+
const data = isRecord(props.data) ? props.data : {}
|
|
694
|
+
const level = textOf(data.level)
|
|
695
|
+
const version = textOf(data.version)
|
|
696
|
+
const readOnly = data.readOnly
|
|
697
|
+
const reasons = Array.isArray(data.reasons) ? data.reasons : []
|
|
698
|
+
return h(
|
|
699
|
+
'div',
|
|
700
|
+
{ style: STACK_STYLE },
|
|
701
|
+
h(C.KeyValues, {
|
|
702
|
+
items: [
|
|
703
|
+
{
|
|
704
|
+
label: t('health.compatLevel'),
|
|
705
|
+
value: level.length > 0 ? h(C.Badge, { tone: COMPAT_TONE[level] || 'neutral' }, level) : EMPTY_VALUE,
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
label: t('health.compatVersion'),
|
|
709
|
+
value: version.length > 0 ? h(C.Mono, { text: version }) : h('span', { className: 'acc-muted' }, t('common.unknown')),
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
label: t('health.compatReadOnly'),
|
|
713
|
+
value:
|
|
714
|
+
readOnly === true
|
|
715
|
+
? h(C.Badge, { tone: 'warn' }, t('health.readOnlyYes'))
|
|
716
|
+
: readOnly === false
|
|
717
|
+
? h(C.Badge, { tone: 'success' }, t('health.readOnlyNo'))
|
|
718
|
+
: EMPTY_VALUE,
|
|
719
|
+
},
|
|
720
|
+
],
|
|
721
|
+
}),
|
|
722
|
+
h(
|
|
723
|
+
'div',
|
|
724
|
+
{ style: STACK_STYLE },
|
|
725
|
+
h('div', { className: 'acc-section-title' }, t('health.compatReasons')),
|
|
726
|
+
reasons.length === 0
|
|
727
|
+
? h(
|
|
728
|
+
C.Notice,
|
|
729
|
+
{ tone: 'info' },
|
|
730
|
+
h(
|
|
731
|
+
'div',
|
|
732
|
+
{ style: COLUMN_STYLE },
|
|
733
|
+
h('span', null, t('health.compatReasonsNone')),
|
|
734
|
+
h('span', { className: 'acc-muted', style: SMALL_STYLE }, t('health.compatReasonsNoneHint')),
|
|
735
|
+
),
|
|
736
|
+
)
|
|
737
|
+
: reasons.map((reason, index) => h(CompatReasonRow, { key: `reason-${index}`, t, reason })),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/** @param {{ t: Function }} props */
|
|
743
|
+
function CompatCard(props) {
|
|
744
|
+
const t = props.t
|
|
745
|
+
const gate = isRecord(props.gate) ? props.gate : {}
|
|
746
|
+
const blocked = gate.available === false
|
|
747
|
+
const state = ACC.useAsync(blocked ? gatedLoader(gate) : (context) => ACC.api('health.compat', {}, context), [])
|
|
748
|
+
return h(
|
|
749
|
+
BlockCard,
|
|
750
|
+
{
|
|
751
|
+
t,
|
|
752
|
+
title: t('health.compatTitle'),
|
|
753
|
+
subtitle: t('health.compatSubtitle'),
|
|
754
|
+
loading: state.status === 'loading',
|
|
755
|
+
onRefresh: blocked ? props.onGateRefresh : state.reload,
|
|
756
|
+
refreshLabel: t('health.refresh.compat'),
|
|
757
|
+
},
|
|
758
|
+
h(BlockContent, { t, state, render: (data) => h(CompatBody, { t, data }) }),
|
|
759
|
+
)
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Page shell. The plugin's own health endpoint is probed once to learn which
|
|
764
|
+
* modules the running host actually loaded: a host that predates the health
|
|
765
|
+
* module then shows the documented unavailable answer instead of posting five
|
|
766
|
+
* requests it cannot serve.
|
|
767
|
+
* @param {{ t: Function }} props
|
|
768
|
+
*/
|
|
769
|
+
function HealthPage(props) {
|
|
770
|
+
const t = props.t
|
|
771
|
+
const gate = ACC.useAsync((context) => ACC.health(context), [])
|
|
772
|
+
const notice = h(C.Notice, { tone: 'info' }, t('health.readOnlyNotice'))
|
|
773
|
+
if (gate.status === 'loading') {
|
|
774
|
+
return h('div', { style: PAGE_STYLE, 'data-acc-page': 'health' }, notice, h(C.Loading, { label: t('health.loading') }))
|
|
775
|
+
}
|
|
776
|
+
if (gate.status === 'error') {
|
|
777
|
+
const error = isRecord(gate.error) ? gate.error : {}
|
|
778
|
+
return h(
|
|
779
|
+
'div',
|
|
780
|
+
{ style: PAGE_STYLE, 'data-acc-page': 'health' },
|
|
781
|
+
notice,
|
|
782
|
+
h(
|
|
783
|
+
BlockCard,
|
|
784
|
+
{
|
|
785
|
+
t,
|
|
786
|
+
title: t('health.hostHealthTitle'),
|
|
787
|
+
loading: false,
|
|
788
|
+
onRefresh: gate.reload,
|
|
789
|
+
refreshLabel: t('health.refresh.host'),
|
|
790
|
+
},
|
|
791
|
+
h(FailurePanel, {
|
|
792
|
+
t,
|
|
793
|
+
title: t('health.blockFailed'),
|
|
794
|
+
reason: error.message,
|
|
795
|
+
code: error.code || error.name,
|
|
796
|
+
hint: error.hint,
|
|
797
|
+
onRetry: gate.reload,
|
|
798
|
+
}),
|
|
799
|
+
),
|
|
800
|
+
)
|
|
801
|
+
}
|
|
802
|
+
const host = isRecord(gate.data) ? gate.data : {}
|
|
803
|
+
const modules = Array.isArray(host.modules) ? host.modules : []
|
|
804
|
+
const module = modules.find((entry) => isRecord(entry) && entry.id === 'health')
|
|
805
|
+
const gateView =
|
|
806
|
+
module === undefined
|
|
807
|
+
? { available: false, reason: t('health.moduleMissingReason'), hint: t('health.moduleMissingHint') }
|
|
808
|
+
: module.state === 'BLOCKED'
|
|
809
|
+
? { available: false, reason: textOf(module.detail) || t('health.moduleBlockedReason'), hint: t('health.moduleBlockedHint') }
|
|
810
|
+
: { available: true }
|
|
811
|
+
return h(
|
|
812
|
+
'div',
|
|
813
|
+
{ style: PAGE_STYLE, 'data-acc-page': 'health' },
|
|
814
|
+
notice,
|
|
815
|
+
h(SummaryCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
816
|
+
h(PluginsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
817
|
+
h(SettingsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
818
|
+
h(SectionsCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
819
|
+
h(CompatCard, { t, gate: gateView, onGateRefresh: gate.reload }),
|
|
820
|
+
)
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
ACC.registerPage({
|
|
824
|
+
id: 'health',
|
|
825
|
+
titleKey: 'nav.health',
|
|
826
|
+
descriptionKey: 'nav.desc.health',
|
|
827
|
+
icon: 'diagnostics',
|
|
828
|
+
order: 75,
|
|
829
|
+
group: 'maintain',
|
|
830
|
+
render: (props) => h(HealthPage, props),
|
|
831
|
+
})
|
|
832
|
+
})()
|