@webx-ui/module-audit 0.4.7 → 0.5.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/dist/index.js CHANGED
@@ -1,4129 +1,20 @@
1
- import { defineComponent as ae, computed as F, openBlock as t, createBlock as i, unref as e, withCtx as a, createVNode as f, createElementVNode as P, toDisplayString as s, createElementBlock as v, createCommentVNode as $, createTextVNode as c, Fragment as R, renderList as q, ref as W, onMounted as ye, renderSlot as rt, watch as de, normalizeClass as Se, useModel as et, mergeModels as Pe, withModifiers as dt, onBeforeUnmount as tt, createSlots as at } from "vue";
2
- import { useAdmin as oe, useTranslate as Y, useErrorText as ue, WxListScreen as ct, WxDate as $e, useDates as pt, WxScreen as gt } from "@webx-ui/module-admin";
3
- import { WxTooltip as Ae, WxLink as Oe, WxBadge as G, WxText as I, WxSkeleton as me, WxButton as X, WxTable as ke, WxSelect as pe, toast as Q, WxIcon as Le, WxDialog as st, WxFormItem as Ee, WxInput as nt, WxTextarea as ht, WxSegmented as je, WxPopover as qe, WxCard as ce, WxAlert as ve, WxProgress as Me, WxEmpty as De, WxStatistic as Re, WxDrawer as vt, WxTabs as ft, WxImage as _t, WxCheckboxGroup as mt, confirm as yt, WxActionBar as kt } from "@webx-ui/core";
4
- import { useRouter as we, useRoute as lt } from "vue-router";
5
- function it(h, u) {
6
- let r, d;
7
- try {
8
- r = new URL(h), d = new URL(u, h);
9
- } catch {
10
- return [];
11
- }
12
- const n = [];
13
- if (r.protocol === "http:" && d.protocol === "https:") n.push("https");
14
- else if (r.protocol !== d.protocol) return [];
15
- const o = (w) => w.replace(/^www\./, "");
16
- if (r.host !== d.host) {
17
- if (o(r.host) !== o(d.host)) return [];
18
- n.push("www");
19
- }
20
- const _ = (w) => w.replace(/\/+$/, "");
21
- if (r.pathname !== d.pathname) {
22
- if (_(r.pathname) !== _(d.pathname)) return [];
23
- n.push("slash");
24
- }
25
- return r.search !== d.search || r.hash !== d.hash ? [] : n;
26
- }
27
- const Ve = 14;
28
- function wt(h) {
29
- return h.length <= Ve * 2 ? [h, ""] : [h.slice(0, -Ve), h.slice(-Ve)];
30
- }
31
- function bt(h) {
32
- const u = Number(h);
33
- return u >= 500 || u === 0 ? "danger" : u >= 400 ? "warning" : u === 301 || u === 308 ? "info" : u >= 300 ? "warning" : "success";
34
- }
35
- const xt = [
36
- 200,
37
- 201,
38
- 204,
39
- 206,
40
- 301,
41
- 302,
42
- 303,
43
- 304,
44
- 307,
45
- 308,
46
- 400,
47
- 401,
48
- 403,
49
- 404,
50
- 405,
51
- 406,
52
- 408,
53
- 410,
54
- 415,
55
- 429,
56
- 451,
57
- 500,
58
- 502,
59
- 503,
60
- 504
61
- ];
62
- function $t(h) {
63
- return h ? xt.includes(h) ? `code-${h}` : h >= 100 && h < 600 ? `code-${Math.floor(h / 100)}xx` : "code-none" : "code-none";
64
- }
65
- const zt = { class: "wx-audit-address__head" }, St = {
66
- key: 0,
67
- class: "wx-audit-address__tail"
68
- }, At = { class: "wx-audit-address__full" }, Ct = /* @__PURE__ */ ae({
69
- __name: "AuditAddress",
70
- props: {
71
- href: {},
72
- type: {},
73
- strong: { type: Boolean }
74
- },
75
- setup(h) {
76
- const u = h, r = F(() => wt(u.href));
77
- return (d, n) => (t(), i(e(Ae), { "max-width": 560 }, {
78
- content: a(() => [
79
- P("span", At, s(u.href), 1)
80
- ]),
81
- default: a(() => [
82
- f(e(Oe), {
83
- href: u.href,
84
- target: "_blank",
85
- type: u.type,
86
- weight: u.strong ? "medium" : void 0,
87
- class: "wx-audit-address"
88
- }, {
89
- default: a(() => [
90
- P("span", zt, s(r.value[0]), 1),
91
- r.value[1] ? (t(), v("span", St, s(r.value[1]), 1)) : $("", !0)
92
- ]),
93
- _: 1
94
- }, 8, ["href", "type", "weight"])
95
- ]),
96
- _: 1
97
- }));
98
- }
99
- }), ne = (h, u) => {
100
- const r = h.__vccOpts || h;
101
- for (const [d, n] of u)
102
- r[d] = n;
103
- return r;
104
- }, fe = /* @__PURE__ */ ne(Ct, [["__scopeId", "data-v-38aa24fb"]]), Pt = {
105
- module: {
106
- title: "Audit"
107
- },
108
- page: {
109
- overview: "Overview",
110
- issues: "Findings",
111
- settings: "Settings",
112
- run: "Run the audit",
113
- scope: "Scope",
114
- "scope-full": "Full",
115
- "scope-full-help": "Everything the audit can check.",
116
- "scope-quick": "Quick",
117
- "scope-quick-help": "The config, the host and the database — takes seconds.",
118
- start: "Start",
119
- started: "The audit has started.",
120
- cancel: "Cancel the run",
121
- never: "No audit has been run yet.",
122
- "never-help": "Run the first one to see how the site looks to a visitor and to a search engine.",
123
- health: "Health",
124
- errors: "Errors",
125
- warnings: "Warnings",
126
- notices: "Notices",
127
- new: "New",
128
- fixed: "Fixed",
129
- "health-pages": "Pages without errors: :clean of :pages",
130
- "health-site": "Errors of the whole site: :count",
131
- "health-warnings": "Checks with warnings: :count",
132
- "health-help": "The share of pages without errors, minus 10 points for each error of the whole site and 2 for each check with warnings — the warnings take 20 at most.",
133
- "last-run": "Last run",
134
- "base-url": "Address",
135
- "status-queued": "Waiting in the queue",
136
- "status-running": "Running",
137
- "status-done": "Done",
138
- "status-failed": "Failed",
139
- "status-cancelled": "Cancelled",
140
- "stage-probes": "Config and host",
141
- "stage-database": "Database",
142
- "stage-crawl": "Pages",
143
- "stage-analyse": "Analysis",
144
- "last-failed": "The last run did not finish: :error",
145
- "by-group": "By group",
146
- "group-config": "Configuration",
147
- "group-host": "Host and addresses",
148
- "group-hosts": "Outgoing addresses",
149
- "group-other": "Other",
150
- sources: "Content searched",
151
- "sources-missing": "Installed, but not searched:",
152
- "sources-help": "Besides crawling the site, the audit reads the text modules keep in the database — drafts, hidden records and fields the template never prints — and looks there for absolute addresses, such as links to a development stand. Green: modules that hand their text over. Orange: modules installed here that do not yet. Their published pages are still crawled, but their drafts and hidden fields are not searched, and a fix button cannot reach them.",
153
- "sources-help-label": "What this means",
154
- "sync-queue": "The queue runs jobs inside the request (sync), so the panel cannot start a run. Run php artisan webx:audit:run from the terminal or cron.",
155
- "already-running": "An audit is already running.",
156
- check: "Check",
157
- count: "Found",
158
- severity: "Severity",
159
- "severity-error": "Error",
160
- "severity-warning": "Warning",
161
- "severity-notice": "Notice",
162
- "any-severity": "Any severity",
163
- "any-group": "Any group",
164
- "any-state": "New and persisting",
165
- "state-new": "New",
166
- "state-persisting": "Persisting",
167
- address: "Address",
168
- empty: "Nothing found.",
169
- clean: "The last run found nothing.",
170
- found: "What was found",
171
- why: "Why it matters",
172
- fix: "How to fix it",
173
- explain: "What this check means",
174
- "open-editor": "Open in the editor",
175
- "fix-button": "Fix",
176
- "fix-apply": "Apply",
177
- "fix-applied": "Done. Run the audit again to see the finding go.",
178
- "fix-none": "Nothing left to change: no fix can close this finding now.",
179
- "fix-pressed": "Fixed — waiting for the next run",
180
- "fix-changes": "Changes",
181
- "fix-before": "Now",
182
- "fix-after": "After",
183
- yes: "Yes",
184
- no: "No",
185
- missing: "Missing",
186
- pages: "Pages",
187
- "pages-progress": "Pages crawled: :crawled of at most :limit",
188
- "resources-progress": "Pictures, styles, scripts and external links checked: :checked of :total",
189
- "pages-none": "No full run has crawled the site yet. Start a full audit to see every page.",
190
- "pages-run": "Full run of :date",
191
- "group-indexing": "Indexing",
192
- "group-redirects": "Redirects",
193
- "group-page": "Page",
194
- "group-content": "Content and speed",
195
- "group-links": "Links",
196
- "group-images": "Pictures",
197
- "group-a11y": "Accessibility",
198
- "group-structure": "Structure",
199
- columns: "Columns",
200
- export: "Export CSV",
201
- "search-url": "Search by address",
202
- "any-status": "Any answer",
203
- "status-none": "No answer",
204
- "any-indexable": "Indexable or not",
205
- "indexable-yes": "Indexable",
206
- "indexable-no": "Not indexable",
207
- "any-check": "With any findings or none",
208
- "add-filter": "Add a filter",
209
- "remove-filter": "Remove the filter",
210
- "op-contains": "contains",
211
- "op-eq": "is",
212
- "op-empty": "is empty",
213
- "op-filled": "is not empty",
214
- "op-gt": "more than",
215
- "op-lt": "less than",
216
- "op-yes": "yes",
217
- "op-no": "no",
218
- value: "Value",
219
- "field-url": "Address",
220
- "field-status": "Code",
221
- "field-final_status": "Final code",
222
- "field-redirect_to": "Redirects to",
223
- "field-source": "Found through",
224
- "field-depth": "Depth",
225
- "field-indexable": "Indexable",
226
- "field-issues": "Findings",
227
- "field-title": "Title",
228
- "field-description": "Description",
229
- "field-h1": "H1",
230
- "field-canonical": "Canonical",
231
- "field-robots_meta": "Meta robots",
232
- "field-x_robots_tag": "X-Robots-Tag",
233
- "field-lang": "Language",
234
- "field-content_type": "Content type",
235
- "field-bytes": "Size, bytes",
236
- "field-ttfb_ms": "First byte, ms",
237
- "field-total_ms": "Answer, ms",
238
- "field-compression": "Compression",
239
- "field-word_count": "Words",
240
- "field-links_in": "Links in",
241
- "field-links_out_internal": "Internal links out",
242
- "field-links_out_external": "External links out",
243
- "field-images": "Pictures",
244
- "field-images_without_alt": "Pictures without alt",
245
- "field-in_sitemap": "In the sitemap",
246
- "field-in_registry": "In the registry",
247
- "field-blocked_by_robots": "Closed in robots.txt",
248
- "source-home": "Home page",
249
- "source-sitemap": "Sitemap",
250
- "source-registry": "Address registry",
251
- "source-link": "Link",
252
- "card-overview": "Overview",
253
- "card-issues": "Problems",
254
- "card-incoming": "Incoming",
255
- "card-outgoing": "Outgoing",
256
- "card-images": "Pictures",
257
- "card-css": "CSS",
258
- "card-js": "JS",
259
- "card-microdata": "Structured data",
260
- "card-headings": "Headings",
261
- "no-headings": "The page has no headings.",
262
- "headings-recheck": "The list of headings appears once the page is checked again.",
263
- "heading-empty": "Empty heading",
264
- "headings-hints": "Not the usual order",
265
- "headings-fine": "The headings go in the usual order: one H1 first, each level one step below the one above.",
266
- "headings-no-h1": "There is no H1. A page needs one main heading — search engines and screen readers start from it.",
267
- "headings-many-h1": "More than one H1 — keep one, make the rest H2. H1 headings: :count",
268
- "headings-h1-not-first": "The page starts with :level, not H1: the main heading should come before the rest.",
269
- "headings-skipped": "Levels are skipped — go down one step at a time: after H2 comes H3, not H4. Places: :count",
270
- "headings-empty": "Headings with no text — fill them in or make them ordinary text. Empty: :count",
271
- "heading-missing": ":level is missing after :after",
272
- "headings-summary-ok": "In order, headings: :count",
273
- "headings-summary-bad": "Out of order, headings: :count",
274
- "headings-open": "Open the map",
275
- response: "Response",
276
- headers: "Headers",
277
- markup: "Markup",
278
- "open-page": "Open the page",
279
- "no-issues": "No problems on this page.",
280
- "no-links": "No links.",
281
- kind: "Kind",
282
- anchor: "Anchor",
283
- host: "Host",
284
- size: "Size",
285
- cache: "Cache",
286
- alt: "Alt",
287
- "not-checked": "Not checked",
288
- "no-resources": "Nothing of this kind on the page.",
289
- "no-json-ld": "The page has no structured data.",
290
- "jsonld-block": "Block :number",
291
- "jsonld-error": "Does not parse:",
292
- "jsonld-required": "Required fields missing:",
293
- "jsonld-recommended": "Recommended fields missing:",
294
- "jsonld-complete": "Every field search engines ask for is there.",
295
- "host-own": "Own",
296
- "host-own_mirror": "Other mirror",
297
- "host-dev": "Stand",
298
- "host-external": "External",
299
- error: "Error",
300
- "source-list": "Recheck list",
301
- hosts: "Outgoing",
302
- runs: "Runs",
303
- "scope-urls": "Recheck",
304
- "urls-foreign": "None of these addresses is on the audited site.",
305
- "state-hidden": "Hidden",
306
- hide: "Hide",
307
- "hide-title": "Hide this finding",
308
- "hide-help": "Hidden findings stop counting, in this run and in every later one. Nothing is deleted: the hidden list shows them again.",
309
- "hide-pattern": "Addresses",
310
- "hide-pattern-help": "This address, or a mask of them: * is a stretch without a slash, ** one with slashes (/search/**). Empty hides every finding of the check.",
311
- "hide-reason": "Why it is all right",
312
- "hide-count": "Findings of the last run it would hide: :count",
313
- "hidden-done": "Hidden.",
314
- "hidden-reason": "Hidden: :reason",
315
- "hidden-by": "Hidden by :who: :reason",
316
- unhide: "Show again",
317
- unhidden: "Shown again.",
318
- recheck: "Recheck",
319
- "recheck-running": "Rechecking the page…",
320
- "recheck-fixed": "Fixed since the last full run: :count",
321
- "recheck-new": "New since the last full run: :count",
322
- "recheck-compare": "Compare the runs",
323
- "export-page": "Export",
324
- "runs-empty": "No runs yet.",
325
- "run-id": "Run",
326
- status: "Status",
327
- "started-at": "Started",
328
- "started-by": "Started by",
329
- "by-schedule": "Schedule",
330
- "by-mcp": "Agent",
331
- "by-console": "Console",
332
- "by-person": "Administrator",
333
- compare: "Compare",
334
- "compare-help": "Pick two runs: what the later one found that the earlier did not, what both found, and what is gone.",
335
- clear: "Clear audit data",
336
- "clear-title": "Clear all audit data?",
337
- "clear-text": "Every run is deleted with everything it found: findings, crawled pages, snapshots, links and the history to compare against. This cannot be undone. Hiding rules and settings stay.",
338
- "clear-confirm": "Delete everything",
339
- "clear-cancel": "Keep",
340
- cleared: "Audit data cleared.",
341
- "clear-running": "An audit is running: cancel it or wait for it to finish, then clear.",
342
- "compare-from": "Earlier run",
343
- "compare-to": "Later run",
344
- "compare-none": "Both runs found the same.",
345
- "compare-scopes": "The runs differ in scope: only the checks the later run ran can count as fixed.",
346
- "kind-new": "New",
347
- "kind-persisting": "Persisting",
348
- "kind-fixed": "Fixed",
349
- "hosts-empty": "No run has seen a link or an address in the database yet.",
350
- "search-host": "Search by host",
351
- "any-class": "Any class",
352
- links: "Links",
353
- fields: "Fields in the database",
354
- broken: "Broken",
355
- "first-seen": "First seen",
356
- "host-pages": "On pages",
357
- "host-fields": "In the database",
358
- record: "Record",
359
- field: "Field",
360
- unpublished: "Not published",
361
- save: "Save",
362
- saved: "Saved.",
363
- dismiss: "Cancel",
364
- "view-full": "View full size",
365
- "view-pages": "By page",
366
- "view-links": "By link",
367
- "leads-to": "Leads to",
368
- "change-slash": "Slash only",
369
- "change-www": "www",
370
- "change-https": "http → https",
371
- "link-pages": "Pages: :count",
372
- "link-show-all": "Show all",
373
- "link-collapse": "Collapse",
374
- "attrs-opener": "Opens in a new tab without noopener. Current browsers add it themselves; older ones let the opened page control this one.",
375
- "section-answer": "Server answer",
376
- "section-crawl": "Crawl",
377
- "section-head": "Markup",
378
- "section-sharing": "Preview and structured data",
379
- "code-none": "No answer — the server did not respond in time or the connection failed (DNS, certificate, refused). Open the address in a browser.",
380
- "code-200": "200 OK — the page opens normally.",
381
- "code-201": "201 Created — the server created something; a link should not lead here.",
382
- "code-204": "204 No Content — answered, but with an empty page.",
383
- "code-206": "206 Partial Content — a part of the file was sent, as video and downloads do.",
384
- "code-301": "301 Moved Permanently — the address has moved for good. Update the link to where it leads.",
385
- "code-302": "302 Found — a temporary redirect. The target may change again; search engines keep the old address.",
386
- "code-303": "303 See Other — sent elsewhere after a form or an action; a link should point at the result.",
387
- "code-304": "304 Not Modified — the browser's copy is still current.",
388
- "code-307": "307 Temporary Redirect — like 302: temporary, the old address stays the main one.",
389
- "code-308": "308 Permanent Redirect — like 301: moved for good. Update the link.",
390
- "code-400": "400 Bad Request — the server did not understand the request; often a broken address.",
391
- "code-401": "401 Unauthorized — sign-in needed. Visitors without an account cannot open it.",
392
- "code-403": "403 Forbidden — the server refused. Many sites answer robots this way: if it opens in a browser, the link is fine.",
393
- "code-404": "404 Not Found — the page is gone. Fix or remove the link.",
394
- "code-405": "405 Method Not Allowed — the address exists but does not answer this kind of request.",
395
- "code-406": "406 Not Acceptable — the server would not answer in a form the robot asked for; check in a browser.",
396
- "code-408": "408 Request Timeout — the server gave up waiting. Usually passes; recheck later.",
397
- "code-410": "410 Gone — removed on purpose and not coming back. Remove the link.",
398
- "code-415": "415 Unsupported Media Type — the server refused the format of the request.",
399
- "code-429": "429 Too Many Requests — the server asked the robot to slow down. Not a broken page.",
400
- "code-451": "451 Unavailable For Legal Reasons — blocked by law in the server's region.",
401
- "code-500": "500 Internal Server Error — the site behind the link broke. Recheck later; if it stays, the link is dead.",
402
- "code-502": "502 Bad Gateway — the server behind a proxy did not answer. Usually temporary.",
403
- "code-503": "503 Service Unavailable — overloaded or under maintenance. Usually temporary.",
404
- "code-504": "504 Gateway Timeout — the server behind a proxy answered too slowly. Usually temporary.",
405
- "code-1xx": "An interim answer — the request is still being handled.",
406
- "code-2xx": "A success — the address answered.",
407
- "code-3xx": "A redirect — the address sends elsewhere. Better to link straight to where it leads.",
408
- "code-4xx": "A client error — the address cannot be opened as it is: missing, closed or refused.",
409
- "code-5xx": "A server error — the site behind the link failed. Often temporary; recheck later."
410
- }
411
- }, Ge = /* @__PURE__ */ new WeakSet();
412
- function se() {
413
- try {
414
- const { i18n: h } = oe();
415
- Ge.has(h) || (h.defaults("webx-audit", Pt), Ge.add(h));
416
- } catch {
417
- }
418
- }
419
- const Ot = {
420
- key: 0,
421
- class: "wx-audit-attrs"
422
- }, Wt = /* @__PURE__ */ ae({
423
- __name: "AuditLinkAttrs",
424
- props: {
425
- rel: {},
426
- target: {}
427
- },
428
- setup(h) {
429
- const u = h;
430
- se();
431
- const r = Y("webx-audit"), d = F(() => (u.rel ?? "").split(/\s+/).filter(Boolean)), n = F(
432
- () => u.target?.toLowerCase() === "_blank" && !d.value.some((o) => o === "noopener" || o === "noreferrer")
433
- );
434
- return (o, _) => u.target || d.value.length ? (t(), v("span", Ot, [
435
- u.target && n.value ? (t(), i(e(Ae), {
436
- key: 0,
437
- content: e(r)("page.attrs-opener"),
438
- "max-width": 320
439
- }, {
440
- default: a(() => [
441
- f(e(G), {
442
- type: "warning",
443
- variant: "outline",
444
- size: "sm"
445
- }, {
446
- default: a(() => [
447
- c(s(u.target), 1)
448
- ]),
449
- _: 1
450
- })
451
- ]),
452
- _: 1
453
- }, 8, ["content"])) : u.target ? (t(), i(e(G), {
454
- key: 1,
455
- variant: "outline",
456
- size: "sm"
457
- }, {
458
- default: a(() => [
459
- c(s(u.target), 1)
460
- ]),
461
- _: 1
462
- })) : $("", !0),
463
- (t(!0), v(R, null, q(d.value, (w) => (t(), i(e(G), {
464
- key: w,
465
- variant: "outline",
466
- size: "sm"
467
- }, {
468
- default: a(() => [
469
- c(s(w), 1)
470
- ]),
471
- _: 2
472
- }, 1024))), 128))
473
- ])) : $("", !0);
474
- }
475
- }), ze = /* @__PURE__ */ ne(Wt, [["__scopeId", "data-v-ab753c1e"]]);
476
- function Ke(h) {
477
- const u = {
478
- search: h.search || void 0,
479
- status: h.status || void 0,
480
- indexable: h.indexable === null || h.indexable === void 0 ? void 0 : h.indexable ? 1 : 0,
481
- check: h.check || void 0,
482
- sort: h.sort || void 0,
483
- page: h.page,
484
- per_page: h.per_page
485
- };
486
- for (const r of h.filters ?? [])
487
- u[`f[${r.field}]`] = r.value === void 0 || r.value === "" ? r.op : `${r.op}:${r.value}`;
488
- return u;
489
- }
490
- function re(h) {
491
- const u = `${h.apiPath}/audit`, r = (n) => n.data, d = (n) => ({
492
- check: n.check || void 0,
493
- severity: n.severity || void 0,
494
- group: n.group || void 0,
495
- state: n.state || void 0,
496
- page: n.page,
497
- per_page: n.per_page
498
- });
499
- return {
500
- latest: () => h.http.get(`${u}/runs/latest`).then(r),
501
- run: (n) => h.http.get(`${u}/runs/${n}`).then(r),
502
- runs: (n = {}) => h.http.get(`${u}/runs`, { query: n }).then((o) => ({ ...o.meta, data: o.data })),
503
- start: (n, o) => h.http.post(`${u}/runs`, n === "urls" ? { scope: n, urls: o } : { scope: n }).then(r),
504
- cancel: (n) => h.http.post(`${u}/runs/${n}/cancel`, {}).then(r),
505
- clear: () => h.http.delete(`${u}/runs`).then((n) => n.data.runs),
506
- checks: (n, o = {}) => h.http.get(`${u}/runs/${n}/checks`, { query: d(o) }).then(r),
507
- issues: (n, o = {}) => h.http.get(`${u}/runs/${n}/issues`, { query: d(o) }).then((_) => ({ ..._.meta, data: _.data })),
508
- pages: (n, o = {}) => h.http.get(`${u}/runs/${n}/pages`, { query: Ke(o) }).then((_) => ({ ..._.meta, data: _.data })),
509
- pagesFile: (n, o, _) => {
510
- const w = new URLSearchParams();
511
- for (const [b, y] of Object.entries({
512
- ...Ke(o),
513
- page: void 0,
514
- per_page: void 0
515
- }))
516
- y !== void 0 && w.set(b, String(y));
517
- return w.set("columns", _.join(",")), `${u}/runs/${n}/pages/export?${w.toString()}`;
518
- },
519
- page: (n, o) => h.http.get(`${u}/runs/${n}/pages/${o}`).then(r),
520
- links: (n, o, _ = {}) => h.http.get(`${u}/runs/${n}/pages/${o}/links`, { query: _ }).then((w) => ({ ...w.meta, data: w.data })),
521
- resources: (n, o, _) => h.http.get(`${u}/runs/${n}/pages/${o}/resources`, { query: _ }).then((w) => ({ ...w.meta, data: w.data })),
522
- fixes: (n, o) => h.http.get(`${u}/runs/${n}/issues/${o}/fixes`).then(r),
523
- fix: (n, o, _, w = !1) => h.http.post(`${u}/runs/${n}/issues/${o}/fixes/${encodeURIComponent(_)}`, {
524
- dry_run: w
525
- }).then(r),
526
- pageFile: (n, o) => `${u}/runs/${n}/pages/${o}/export`,
527
- compare: (n, o) => h.http.get(`${u}/runs/compare`, { query: { to: n, from: o ?? void 0 } }).then(r),
528
- compareIssues: (n) => h.http.get(`${u}/runs/compare/issues`, {
529
- query: { ...n, from: n.from ?? void 0, check: n.check || void 0 }
530
- }).then((o) => ({ ...o.meta, data: o.data })),
531
- hosts: (n = {}) => h.http.get(`${u}/hosts`, {
532
- query: {
533
- class: n.class || void 0,
534
- search: n.search || void 0,
535
- host: n.host || void 0
536
- }
537
- }).then(r),
538
- ignores: () => h.http.get(`${u}/ignores`).then(r),
539
- hide: (n) => h.http.post(`${u}/ignores`, n).then(r),
540
- hidePreview: (n) => h.http.post(`${u}/ignores`, { ...n, dry_run: !0 }).then((o) => o.data.hidden),
541
- unhide: (n) => h.http.delete(`${u}/ignores/${n}`).then(() => {
542
- }),
543
- settings: () => h.http.get(`${u}/settings`).then((n) => n.data.values),
544
- saveSettings: (n) => h.http.put(`${u}/settings`, { values: n }).then((o) => o.data.values)
545
- };
546
- }
547
- const _e = /* @__PURE__ */ ae({
548
- __name: "AuditStatus",
549
- props: {
550
- code: {},
551
- size: { default: "sm" }
552
- },
553
- setup(h) {
554
- const u = h;
555
- se();
556
- const r = Y("webx-audit"), d = F(() => u.code ? String(u.code) : r("page.status-none"));
557
- return (n, o) => (t(), i(e(Ae), {
558
- content: e(r)(`page.${e($t)(u.code)}`),
559
- "max-width": 360
560
- }, {
561
- default: a(() => [
562
- f(e(G), {
563
- type: e(bt)(u.code ?? 0),
564
- size: u.size
565
- }, {
566
- default: a(() => [
567
- c(s(d.value), 1)
568
- ]),
569
- _: 1
570
- }, 8, ["type", "size"])
571
- ]),
572
- _: 1
573
- }, 8, ["content"]));
574
- }
575
- }), It = { class: "wx-audit-places" }, Ut = {
576
- key: 0,
577
- class: "wx-audit-places__group"
578
- }, Tt = { class: "wx-audit-places__head" }, Nt = { class: "wx-audit-places__pages" }, Rt = {
579
- key: 1,
580
- class: "wx-audit-places__group"
581
- }, Vt = { class: "wx-audit-places__card" }, Ft = { class: "wx-audit-places__record" }, Je = 5, Ht = /* @__PURE__ */ ae({
582
- __name: "AuditHostPlaces",
583
- props: {
584
- host: {}
585
- },
586
- setup(h) {
587
- const u = h, r = re(oe());
588
- se();
589
- const d = Y("webx-audit"), n = ue(), o = we(), _ = W(null), w = W(null), b = (O) => O != null && (O >= 400 || O === 0), y = W(/* @__PURE__ */ new Set());
590
- function m(O) {
591
- return `${O.kind} ${O.url}`;
592
- }
593
- function z(O) {
594
- return y.value.has(m(O)) ? O.places : O.places.slice(0, Je);
595
- }
596
- function C(O) {
597
- const l = new Set(y.value);
598
- l.delete(m(O)) || l.add(m(O)), y.value = l;
599
- }
600
- return ye(async () => {
601
- try {
602
- _.value = await r.hosts({ host: u.host });
603
- } catch (O) {
604
- w.value = n(O);
605
- }
606
- }), (O, l) => (t(), v("div", It, [
607
- w.value ? (t(), i(e(I), {
608
- key: 0,
609
- size: "sm",
610
- tone: "danger"
611
- }, {
612
- default: a(() => [
613
- c(s(w.value), 1)
614
- ]),
615
- _: 1
616
- })) : _.value ? (t(), v(R, { key: 2 }, [
617
- _.value.targets?.length ? (t(), v("section", Ut, [
618
- f(e(I), {
619
- size: "sm",
620
- weight: "semibold"
621
- }, {
622
- default: a(() => [
623
- c(s(e(d)("page.host-pages")), 1)
624
- ]),
625
- _: 1
626
- }),
627
- (t(!0), v(R, null, q(_.value.targets, (k) => (t(), v("div", {
628
- key: m(k),
629
- class: "wx-audit-places__card"
630
- }, [
631
- P("div", Tt, [
632
- f(e(G), {
633
- type: "default",
634
- size: "sm",
635
- class: "wx-audit-places__fixed"
636
- }, {
637
- default: a(() => [
638
- c(s(k.kind), 1)
639
- ]),
640
- _: 2
641
- }, 1024),
642
- f(fe, {
643
- href: k.url,
644
- strong: ""
645
- }, null, 8, ["href"]),
646
- k.kind === "a" && !k.mixed ? (t(), i(ze, {
647
- key: 0,
648
- rel: k.rel,
649
- target: k.target,
650
- class: "wx-audit-places__fixed"
651
- }, null, 8, ["rel", "target"])) : $("", !0),
652
- b(k.status) ? (t(), i(_e, {
653
- key: 1,
654
- code: k.status,
655
- class: "wx-audit-places__fixed"
656
- }, null, 8, ["code"])) : $("", !0),
657
- f(e(I), {
658
- size: "sm",
659
- tone: "muted",
660
- class: "wx-audit-places__count"
661
- }, {
662
- default: a(() => [
663
- c(s(e(d)("page.link-pages", { count: k.pages })), 1)
664
- ]),
665
- _: 2
666
- }, 1024)
667
- ]),
668
- P("ul", Nt, [
669
- (t(!0), v(R, null, q(z(k), (g, U) => (t(), v("li", { key: U }, [
670
- f(fe, {
671
- href: g.page
672
- }, null, 8, ["href"]),
673
- g.anchor ? (t(), i(e(I), {
674
- key: 0,
675
- size: "sm",
676
- tone: "muted",
677
- class: "wx-audit-places__anchor"
678
- }, {
679
- default: a(() => [
680
- c("«" + s(g.anchor) + "»", 1)
681
- ]),
682
- _: 2
683
- }, 1024)) : $("", !0),
684
- k.kind === "a" && k.mixed ? (t(), i(ze, {
685
- key: 1,
686
- rel: g.rel,
687
- target: g.target,
688
- class: "wx-audit-places__fixed"
689
- }, null, 8, ["rel", "target"])) : $("", !0)
690
- ]))), 128))
691
- ]),
692
- k.places.length > Je ? (t(), i(e(X), {
693
- key: 0,
694
- size: "sm",
695
- variant: "text",
696
- class: "wx-audit-places__more",
697
- onClick: (g) => C(k)
698
- }, {
699
- default: a(() => [
700
- c(s(y.value.has(m(k)) ? e(d)("page.link-collapse") : e(d)("page.link-show-all")), 1)
701
- ]),
702
- _: 2
703
- }, 1032, ["onClick"])) : $("", !0)
704
- ]))), 128))
705
- ])) : $("", !0),
706
- _.value.fields?.length ? (t(), v("section", Rt, [
707
- f(e(I), {
708
- size: "sm",
709
- weight: "semibold"
710
- }, {
711
- default: a(() => [
712
- c(s(e(d)("page.host-fields")), 1)
713
- ]),
714
- _: 1
715
- }),
716
- P("div", Vt, [
717
- (t(!0), v(R, null, q(_.value.fields, (k, g) => (t(), v("div", {
718
- key: g,
719
- class: "wx-audit-places__field"
720
- }, [
721
- P("div", Ft, [
722
- f(e(I), { size: "sm" }, {
723
- default: a(() => [
724
- c(s(k.record_label), 1)
725
- ]),
726
- _: 2
727
- }, 1024),
728
- f(e(I), {
729
- size: "sm",
730
- tone: "muted"
731
- }, {
732
- default: a(() => [
733
- c(s(k.source) + " · " + s(k.field) + s(k.locale ? ` · ${k.locale}` : ""), 1)
734
- ]),
735
- _: 2
736
- }, 1024),
737
- k.published ? $("", !0) : (t(), i(e(G), {
738
- key: 0,
739
- size: "sm"
740
- }, {
741
- default: a(() => [
742
- c(s(e(d)("page.unpublished")), 1)
743
- ]),
744
- _: 1
745
- }))
746
- ]),
747
- f(fe, {
748
- href: k.url
749
- }, null, 8, ["href"]),
750
- k.edit_url ? (t(), i(e(X), {
751
- key: 0,
752
- size: "sm",
753
- variant: "text",
754
- icon: "edit",
755
- class: "wx-audit-places__fixed",
756
- onClick: (U) => e(o).push(k.edit_url)
757
- }, {
758
- default: a(() => [
759
- c(s(e(d)("page.open-editor")), 1)
760
- ]),
761
- _: 1
762
- }, 8, ["onClick"])) : $("", !0)
763
- ]))), 128))
764
- ])
765
- ])) : $("", !0)
766
- ], 64)) : (t(), i(e(me), {
767
- key: 1,
768
- rows: 2
769
- }))
770
- ]));
771
- }
772
- }), Lt = /* @__PURE__ */ ne(Ht, [["__scopeId", "data-v-42fbbd09"]]), be = /* @__PURE__ */ ae({
773
- __name: "AuditLayout",
774
- props: {
775
- base: {},
776
- current: {},
777
- card: { type: Boolean, default: !0 },
778
- actions: { default: () => [] }
779
- },
780
- setup(h) {
781
- const u = h, r = oe(), d = we(), n = lt();
782
- se();
783
- const o = Y("webx-audit"), _ = F(
784
- () => r.state.manifest?.modules.find((m) => m.id === "audit")?.title ?? o("module.title")
785
- ), w = F(() => [
786
- { value: "overview", label: o("page.overview") },
787
- { value: "issues", label: o("page.issues") },
788
- { value: "pages", label: o("page.pages") },
789
- { value: "hosts", label: o("page.hosts") },
790
- { value: "runs", label: o("page.runs") }
791
- ]), b = F(
792
- () => u.current === "settings" ? u.actions : [
793
- ...u.actions,
794
- {
795
- key: "settings",
796
- label: o("page.settings"),
797
- icon: "settings",
798
- run: () => {
799
- d.push(`${u.base}/settings`);
800
- }
801
- }
802
- ]
803
- ), y = F({
804
- /*
805
- * The settings belong to no tab, but the tabs need a value of theirs — given one they do not
806
- * have, they correct it to the first and lead away at once. So «Overview» stays lit, and the
807
- * settings page has a «Back» of its own beside «Save».
808
- */
809
- get: () => u.current === "settings" ? "overview" : u.current,
810
- set: (m) => {
811
- const z = m === "overview" ? u.base : `${u.base}/${String(m)}`;
812
- z !== n.path && d.push(z);
813
- }
814
- });
815
- return (m, z) => (t(), i(e(ct), {
816
- view: y.value,
817
- "onUpdate:view": z[0] || (z[0] = (C) => y.value = C),
818
- title: _.value,
819
- views: w.value,
820
- actions: b.value,
821
- card: u.card
822
- }, {
823
- default: a(() => [
824
- rt(m.$slots, "default")
825
- ]),
826
- _: 3
827
- }, 8, ["view", "title", "views", "actions", "card"]));
828
- }
829
- }), jt = { class: "wx-audit-hosts__host" }, qt = /* @__PURE__ */ ae({
830
- __name: "AuditHostsPage",
831
- props: {
832
- base: {}
833
- },
834
- setup(h) {
835
- const u = h, r = re(oe());
836
- se();
837
- const d = Y("webx-audit"), n = Y("webx-admin"), o = ue(), _ = W(null), w = W(!1), b = W(""), y = W(null), m = W([]), z = {
838
- dev: "danger",
839
- own_mirror: "warning",
840
- external: "info",
841
- own: "success"
842
- }, C = F(() => [
843
- { key: "host", label: d("page.host"), minWidth: 220 },
844
- { key: "links", label: d("page.links"), width: 90, align: "right" },
845
- { key: "pages", label: d("page.pages"), width: 90, align: "right", hideBelow: 560 },
846
- { key: "broken", label: d("page.broken"), width: 100, align: "right", hideBelow: 640 },
847
- { key: "fields", label: d("page.fields"), width: 120, align: "right" },
848
- { key: "first_seen", label: d("page.first-seen"), minWidth: 140, hideBelow: 760 }
849
- ]), O = F(
850
- () => Object.keys(z).map((g) => ({
851
- value: g,
852
- label: `${d(`page.host-${g}`)}${_.value?.classes[g] ? ` · ${_.value.classes[g]}` : ""}`
853
- }))
854
- );
855
- function l(g) {
856
- return typeof g == "string" && g in z ? g : null;
857
- }
858
- async function k() {
859
- w.value = !0;
860
- try {
861
- _.value = await r.hosts({ class: y.value, search: b.value }), m.value = [];
862
- } catch (g) {
863
- Q.danger(o(g));
864
- } finally {
865
- w.value = !1;
866
- }
867
- }
868
- return de([y, b], () => {
869
- k();
870
- }), ye(k), (g, U) => (t(), i(be, {
871
- base: u.base,
872
- current: "hosts"
873
- }, {
874
- default: a(() => [
875
- f(e(ke), {
876
- expanded: m.value,
877
- "onUpdate:expanded": U[1] || (U[1] = (S) => m.value = S),
878
- search: b.value,
879
- "onUpdate:search": U[2] || (U[2] = (S) => b.value = S),
880
- data: _.value?.hosts ?? [],
881
- columns: C.value,
882
- "row-key": "host",
883
- expandable: "",
884
- flush: "",
885
- searchable: "",
886
- "search-placeholder": e(d)("page.search-host"),
887
- loading: w.value,
888
- "filters-count": y.value ? 1 : 0,
889
- "filters-label": e(n)("filters.title"),
890
- "row-class": (S) => S.class === "dev" ? "is-stand" : void 0,
891
- "empty-text": e(d)("page.hosts-empty")
892
- }, {
893
- filters: a(() => [
894
- f(e(pe), {
895
- "model-value": y.value,
896
- options: O.value,
897
- placeholder: e(d)("page.any-class"),
898
- clearable: "",
899
- "onUpdate:modelValue": U[0] || (U[0] = (S) => y.value = l(S))
900
- }, null, 8, ["model-value", "options", "placeholder"])
901
- ]),
902
- "cell-host": a(({ row: S }) => [
903
- P("span", jt, [
904
- f(e(G), {
905
- type: z[S.class],
906
- size: "sm"
907
- }, {
908
- default: a(() => [
909
- c(s(e(d)(`page.host-${S.class}`)), 1)
910
- ]),
911
- _: 2
912
- }, 1032, ["type"]),
913
- f(e(I), {
914
- size: "sm",
915
- tone: S.class === "dev" ? "danger" : void 0,
916
- weight: "medium"
917
- }, {
918
- default: a(() => [
919
- c(s(S.host), 1)
920
- ]),
921
- _: 2
922
- }, 1032, ["tone"])
923
- ])
924
- ]),
925
- "cell-broken": a(({ row: S }) => [
926
- f(e(I), {
927
- size: "sm",
928
- tone: S.broken ? "danger" : "muted"
929
- }, {
930
- default: a(() => [
931
- c(s(S.broken), 1)
932
- ]),
933
- _: 2
934
- }, 1032, ["tone"])
935
- ]),
936
- "cell-fields": a(({ row: S }) => [
937
- f(e(I), {
938
- size: "sm",
939
- tone: S.fields && S.class === "dev" ? "danger" : void 0
940
- }, {
941
- default: a(() => [
942
- c(s(S.fields), 1)
943
- ]),
944
- _: 2
945
- }, 1032, ["tone"])
946
- ]),
947
- "cell-first_seen": a(({ row: S }) => [
948
- S.first_seen ? (t(), i(e($e), {
949
- key: 0,
950
- value: S.first_seen
951
- }, null, 8, ["value"])) : $("", !0)
952
- ]),
953
- expanded: a(({ row: S }) => [
954
- f(Lt, {
955
- host: S.host
956
- }, null, 8, ["host"])
957
- ]),
958
- _: 1
959
- }, 8, ["expanded", "search", "data", "columns", "search-placeholder", "loading", "filters-count", "filters-label", "row-class", "empty-text"])
960
- ]),
961
- _: 1
962
- }, 8, ["base"]));
963
- }
964
- }), Bt = /* @__PURE__ */ ne(qt, [["__scopeId", "data-v-44b7e64a"]]), Et = { class: "wx-audit-details" }, Mt = {
965
- key: 1,
966
- class: "wx-audit-details__scroll"
967
- }, Dt = { class: "wx-audit-details__table" }, Gt = {
968
- key: 0,
969
- class: "wx-audit-details__to"
970
- }, Kt = {
971
- key: 7,
972
- class: "wx-audit-details__code"
973
- }, Jt = /* @__PURE__ */ ae({
974
- __name: "AuditDetails",
975
- props: {
976
- details: {},
977
- counted: { type: Boolean }
978
- },
979
- setup(h) {
980
- const u = h, r = we();
981
- se();
982
- const d = Y("webx-audit"), n = F(() => u.details.table?.columns ?? []), o = F(
983
- () => n.value.some((C) => C.key === "url" && C.type === "url") && n.value.some((C) => C.key === "location" && C.type === "url")
984
- );
985
- function _(C) {
986
- return o.value && C.key === "url";
987
- }
988
- function w(C) {
989
- return o.value && C.key === "location";
990
- }
991
- function b(C, O) {
992
- return C[O.key];
993
- }
994
- function y(C) {
995
- return C == null ? "" : d(C ? "page.yes" : "page.no");
996
- }
997
- function m(C) {
998
- return C == null ? "" : String(C);
999
- }
1000
- function z(C) {
1001
- return it(m(C.url), m(C.location));
1002
- }
1003
- return (C, O) => (t(), v("div", Et, [
1004
- u.details.summary && !u.counted ? (t(), i(e(I), {
1005
- key: 0,
1006
- size: "sm"
1007
- }, {
1008
- default: a(() => [
1009
- c(s(u.details.summary), 1)
1010
- ]),
1011
- _: 1
1012
- })) : $("", !0),
1013
- u.details.table && u.details.table.rows.length ? (t(), v("div", Mt, [
1014
- P("table", Dt, [
1015
- P("colgroup", null, [
1016
- (t(!0), v(R, null, q(n.value, (l) => (t(), v("col", {
1017
- key: l.key,
1018
- class: Se([
1019
- `wx-audit-details__col--${l.type}`,
1020
- `wx-audit-details__col--${l.key}`
1021
- ])
1022
- }, null, 2))), 128))
1023
- ]),
1024
- P("thead", null, [
1025
- P("tr", null, [
1026
- (t(!0), v(R, null, q(n.value, (l) => (t(), v("th", {
1027
- key: l.key
1028
- }, s(l.label), 1))), 128))
1029
- ])
1030
- ]),
1031
- P("tbody", null, [
1032
- (t(!0), v(R, null, q(u.details.table.rows, (l, k) => (t(), v("tr", { key: k }, [
1033
- (t(!0), v(R, null, q(n.value, (g) => (t(), v("td", {
1034
- key: g.key
1035
- }, [
1036
- w(g) && m(b(l, g)) ? (t(), v("span", Gt, [
1037
- f(e(Le), {
1038
- name: "arrow-right",
1039
- size: "1em",
1040
- class: "wx-audit-details__arrow",
1041
- label: e(d)("page.leads-to")
1042
- }, null, 8, ["label"]),
1043
- f(fe, {
1044
- href: m(b(l, g)),
1045
- strong: ""
1046
- }, null, 8, ["href"]),
1047
- (t(!0), v(R, null, q(z(l), (U) => (t(), i(e(G), {
1048
- key: U,
1049
- type: "default",
1050
- size: "sm",
1051
- class: "wx-audit-details__change"
1052
- }, {
1053
- default: a(() => [
1054
- c(s(e(d)(`page.change-${U}`)), 1)
1055
- ]),
1056
- _: 2
1057
- }, 1024))), 128))
1058
- ])) : g.type === "url" && m(b(l, g)) ? (t(), i(fe, {
1059
- key: 1,
1060
- href: m(b(l, g)),
1061
- type: _(g) ? "muted" : void 0
1062
- }, null, 8, ["href", "type"])) : g.type === "status" && b(l, g) !== null ? (t(), i(_e, {
1063
- key: 2,
1064
- code: Number(b(l, g))
1065
- }, null, 8, ["code"])) : g.type === "attrs" ? (t(), i(ze, {
1066
- key: 3,
1067
- rel: m(l.rel),
1068
- target: m(l.target)
1069
- }, null, 8, ["rel", "target"])) : g.type === "bool" ? (t(), v(R, { key: 4 }, [
1070
- c(s(y(b(l, g))), 1)
1071
- ], 64)) : g.type === "missing" && !m(b(l, g)) ? (t(), i(e(I), {
1072
- key: 5,
1073
- size: "sm",
1074
- tone: "danger"
1075
- }, {
1076
- default: a(() => [
1077
- c(s(e(d)("page.missing")), 1)
1078
- ]),
1079
- _: 1
1080
- })) : g.type === "edit" && m(b(l, g)) ? (t(), i(e(X), {
1081
- key: 6,
1082
- size: "sm",
1083
- variant: "text",
1084
- icon: "edit",
1085
- onClick: (U) => e(r).push(m(b(l, g)))
1086
- }, {
1087
- default: a(() => [
1088
- c(s(e(d)("page.open-editor")), 1)
1089
- ]),
1090
- _: 1
1091
- }, 8, ["onClick"])) : g.type === "code" ? (t(), v("code", Kt, s(m(b(l, g))), 1)) : (t(), v(R, { key: 8 }, [
1092
- c(s(m(b(l, g))), 1)
1093
- ], 64))
1094
- ]))), 128))
1095
- ]))), 128))
1096
- ])
1097
- ])
1098
- ])) : $("", !0)
1099
- ]));
1100
- }
1101
- }), Be = /* @__PURE__ */ ne(Jt, [["__scopeId", "data-v-8f3d8146"]]), Xt = { class: "wx-audit-fix" }, Qt = { class: "wx-audit-fix__changes" }, Yt = {
1102
- key: 0,
1103
- class: "wx-audit-fix__field"
1104
- }, Zt = { class: "wx-audit-fix__value" }, ea = {
1105
- key: 0,
1106
- class: "wx-audit-fix__count"
1107
- }, ta = { class: "wx-audit-fix__value" }, aa = { class: "wx-audit-fix__actions" }, sa = /* @__PURE__ */ ae({
1108
- __name: "AuditFixDialog",
1109
- props: /* @__PURE__ */ Pe({
1110
- run: {},
1111
- issue: {}
1112
- }, {
1113
- open: { type: Boolean, default: !1 },
1114
- openModifiers: {}
1115
- }),
1116
- emits: /* @__PURE__ */ Pe(["fixed"], ["update:open"]),
1117
- setup(h, { emit: u }) {
1118
- const r = h, d = u, n = et(h, "open"), o = re(oe());
1119
- se();
1120
- const _ = Y("webx-audit"), w = ue(), b = we(), y = W(null), m = W(null), z = W(null);
1121
- async function C() {
1122
- y.value = null, m.value = null;
1123
- try {
1124
- y.value = await o.fixes(r.run, r.issue.id);
1125
- } catch (k) {
1126
- m.value = w(k);
1127
- }
1128
- }
1129
- async function O(k) {
1130
- z.value = k.id;
1131
- try {
1132
- await o.fix(r.run, r.issue.id, k.id), Q.success(_("page.fix-applied")), d("fixed", k.id), n.value = !1;
1133
- } catch (g) {
1134
- Q.danger(w(g));
1135
- } finally {
1136
- z.value = null;
1137
- }
1138
- }
1139
- function l(k) {
1140
- n.value = !1, b.push(k);
1141
- }
1142
- return de(
1143
- [n, () => r.issue.id],
1144
- ([k]) => {
1145
- k && C();
1146
- },
1147
- { immediate: !0 }
1148
- ), (k, g) => (t(), i(e(st), {
1149
- open: n.value,
1150
- "onUpdate:open": g[0] || (g[0] = (U) => n.value = U),
1151
- title: e(_)("page.fix-button"),
1152
- width: 640
1153
- }, {
1154
- default: a(() => [
1155
- P("div", Xt, [
1156
- m.value ? (t(), i(e(I), {
1157
- key: 0,
1158
- size: "sm",
1159
- tone: "danger"
1160
- }, {
1161
- default: a(() => [
1162
- c(s(m.value), 1)
1163
- ]),
1164
- _: 1
1165
- })) : y.value ? y.value.length === 0 ? (t(), i(e(I), {
1166
- key: 2,
1167
- size: "sm",
1168
- tone: "muted"
1169
- }, {
1170
- default: a(() => [
1171
- c(s(e(_)("page.fix-none")), 1)
1172
- ]),
1173
- _: 1
1174
- })) : $("", !0) : (t(), i(e(me), {
1175
- key: 1,
1176
- rows: 3
1177
- })),
1178
- (t(!0), v(R, null, q(y.value ?? [], (U) => (t(), v("section", {
1179
- key: U.id,
1180
- class: "wx-audit-fix__offer"
1181
- }, [
1182
- f(e(I), { weight: "semibold" }, {
1183
- default: a(() => [
1184
- c(s(U.title), 1)
1185
- ]),
1186
- _: 2
1187
- }, 1024),
1188
- U.description ? (t(), i(e(I), {
1189
- key: 0,
1190
- size: "sm",
1191
- tone: "muted"
1192
- }, {
1193
- default: a(() => [
1194
- c(s(U.description), 1)
1195
- ]),
1196
- _: 2
1197
- }, 1024)) : $("", !0),
1198
- P("table", Qt, [
1199
- P("thead", null, [
1200
- P("tr", null, [
1201
- P("th", null, s(e(_)("page.fix-changes")), 1),
1202
- P("th", null, s(e(_)("page.fix-before")), 1),
1203
- P("th", null, s(e(_)("page.fix-after")), 1),
1204
- g[1] || (g[1] = P("th", null, null, -1))
1205
- ])
1206
- ]),
1207
- P("tbody", null, [
1208
- (t(!0), v(R, null, q(U.changes, (S, J) => (t(), v("tr", { key: J }, [
1209
- P("td", null, [
1210
- P("div", null, s(S.label), 1),
1211
- S.field ? (t(), v("div", Yt, s(S.field), 1)) : $("", !0)
1212
- ]),
1213
- P("td", Zt, [
1214
- c(s(S.before ?? "") + " ", 1),
1215
- S.count ? (t(), v("span", ea, "× " + s(S.count), 1)) : $("", !0)
1216
- ]),
1217
- P("td", ta, s(S.after ?? ""), 1),
1218
- P("td", null, [
1219
- S.edit_url ? (t(), i(e(X), {
1220
- key: 0,
1221
- size: "sm",
1222
- variant: "text",
1223
- icon: "edit",
1224
- "aria-label": e(_)("page.open-editor"),
1225
- onClick: (ee) => l(S.edit_url)
1226
- }, null, 8, ["aria-label", "onClick"])) : $("", !0)
1227
- ])
1228
- ]))), 128))
1229
- ])
1230
- ]),
1231
- U.note ? (t(), i(e(I), {
1232
- key: 1,
1233
- size: "sm",
1234
- tone: "muted"
1235
- }, {
1236
- default: a(() => [
1237
- c(s(U.note), 1)
1238
- ]),
1239
- _: 2
1240
- }, 1024)) : $("", !0),
1241
- P("div", aa, [
1242
- f(e(X), {
1243
- type: "primary",
1244
- size: "sm",
1245
- loading: z.value === U.id,
1246
- disabled: z.value !== null,
1247
- onClick: (S) => O(U)
1248
- }, {
1249
- default: a(() => [
1250
- c(s(e(_)("page.fix-apply")), 1)
1251
- ]),
1252
- _: 1
1253
- }, 8, ["loading", "disabled", "onClick"])
1254
- ])
1255
- ]))), 128))
1256
- ])
1257
- ]),
1258
- _: 1
1259
- }, 8, ["open", "title"]));
1260
- }
1261
- }), na = /* @__PURE__ */ ne(sa, [["__scopeId", "data-v-28525af3"]]), la = { class: "wx-audit-hide" }, ia = /* @__PURE__ */ ae({
1262
- __name: "AuditHideDialog",
1263
- props: /* @__PURE__ */ Pe({
1264
- issue: {},
1265
- title: {}
1266
- }, {
1267
- open: { type: Boolean, default: !1 },
1268
- openModifiers: {}
1269
- }),
1270
- emits: /* @__PURE__ */ Pe(["hidden"], ["update:open"]),
1271
- setup(h, { emit: u }) {
1272
- const r = h, d = u, n = et(h, "open"), o = re(oe());
1273
- se();
1274
- const _ = Y("webx-audit"), w = ue(), b = W(""), y = W(""), m = W(null), z = W(!1);
1275
- let C;
1276
- function O(U) {
1277
- if (!U) return "";
1278
- try {
1279
- const S = new URL(U);
1280
- return S.pathname + S.search;
1281
- } catch {
1282
- return U;
1283
- }
1284
- }
1285
- const l = F(() => y.value.trim() !== "");
1286
- function k() {
1287
- clearTimeout(C), C = setTimeout(async () => {
1288
- try {
1289
- m.value = await o.hidePreview({ check: r.issue.check, pattern: b.value });
1290
- } catch {
1291
- m.value = null;
1292
- }
1293
- }, 300);
1294
- }
1295
- async function g() {
1296
- z.value = !0;
1297
- try {
1298
- const U = await o.hide({
1299
- check: r.issue.check,
1300
- pattern: b.value,
1301
- reason: y.value
1302
- });
1303
- Q.success(_("page.hidden-done")), d("hidden", U), n.value = !1;
1304
- } catch (U) {
1305
- Q.danger(w(U));
1306
- } finally {
1307
- z.value = !1;
1308
- }
1309
- }
1310
- return de(
1311
- [n, () => r.issue.id],
1312
- ([U]) => {
1313
- U && (b.value = O(r.issue.url), y.value = "", m.value = null, k());
1314
- },
1315
- { immediate: !0 }
1316
- ), de(b, () => {
1317
- n.value && k();
1318
- }), (U, S) => (t(), i(e(st), {
1319
- open: n.value,
1320
- "onUpdate:open": S[3] || (S[3] = (J) => n.value = J),
1321
- title: e(_)("page.hide-title"),
1322
- width: 560
1323
- }, {
1324
- footer: a(() => [
1325
- f(e(X), {
1326
- onClick: S[2] || (S[2] = (J) => n.value = !1)
1327
- }, {
1328
- default: a(() => [
1329
- c(s(e(_)("page.dismiss")), 1)
1330
- ]),
1331
- _: 1
1332
- }),
1333
- f(e(X), {
1334
- type: "primary",
1335
- loading: z.value,
1336
- disabled: !l.value,
1337
- onClick: g
1338
- }, {
1339
- default: a(() => [
1340
- c(s(e(_)("page.hide")), 1)
1341
- ]),
1342
- _: 1
1343
- }, 8, ["loading", "disabled"])
1344
- ]),
1345
- default: a(() => [
1346
- P("div", la, [
1347
- f(e(I), { weight: "semibold" }, {
1348
- default: a(() => [
1349
- c(s(r.title), 1)
1350
- ]),
1351
- _: 1
1352
- }),
1353
- f(e(I), {
1354
- size: "sm",
1355
- tone: "muted"
1356
- }, {
1357
- default: a(() => [
1358
- c(s(e(_)("page.hide-help")), 1)
1359
- ]),
1360
- _: 1
1361
- }),
1362
- f(e(Ee), {
1363
- label: e(_)("page.hide-pattern"),
1364
- help: e(_)("page.hide-pattern-help")
1365
- }, {
1366
- default: a(() => [
1367
- f(e(nt), {
1368
- modelValue: b.value,
1369
- "onUpdate:modelValue": S[0] || (S[0] = (J) => b.value = J),
1370
- placeholder: "/search/**"
1371
- }, null, 8, ["modelValue"])
1372
- ]),
1373
- _: 1
1374
- }, 8, ["label", "help"]),
1375
- f(e(Ee), {
1376
- label: e(_)("page.hide-reason"),
1377
- required: ""
1378
- }, {
1379
- default: a(() => [
1380
- f(e(ht), {
1381
- modelValue: y.value,
1382
- "onUpdate:modelValue": S[1] || (S[1] = (J) => y.value = J),
1383
- rows: 3
1384
- }, null, 8, ["modelValue"])
1385
- ]),
1386
- _: 1
1387
- }, 8, ["label"]),
1388
- m.value !== null ? (t(), i(e(I), {
1389
- key: 0,
1390
- size: "sm",
1391
- tone: "muted"
1392
- }, {
1393
- default: a(() => [
1394
- c(s(e(_)("page.hide-count", { count: m.value })), 1)
1395
- ]),
1396
- _: 1
1397
- })) : $("", !0)
1398
- ])
1399
- ]),
1400
- _: 1
1401
- }, 8, ["open", "title"]));
1402
- }
1403
- }), oa = /* @__PURE__ */ ne(ia, [["__scopeId", "data-v-1db364c4"]]), ua = { class: "wx-audit-links" }, ra = { class: "wx-audit-links__head" }, da = { class: "wx-audit-links__pages" }, Xe = 5, ca = /* @__PURE__ */ ae({
1404
- __name: "AuditLinkGroups",
1405
- props: {
1406
- issues: {}
1407
- },
1408
- setup(h) {
1409
- const u = h;
1410
- se();
1411
- const r = Y("webx-audit"), d = W(/* @__PURE__ */ new Set()), n = F(() => {
1412
- const y = /* @__PURE__ */ new Map();
1413
- for (const m of u.issues)
1414
- for (const z of m.details.table?.rows ?? []) {
1415
- const C = String(z.url ?? ""), O = String(z.location ?? ""), l = `${C}
1416
- ${O}`, k = y.get(l) ?? { url: C, location: O, status: null, pages: [], mixed: !1 }, g = { page: m.url ?? "", rel: o(z.rel), target: o(z.target) }, U = k.pages[0];
1417
- k.status ??= typeof z.status == "number" ? z.status : null, U && (U.rel !== g.rel || U.target !== g.target) && (k.mixed = !0), g.page && !k.pages.some((S) => S.page === g.page) && k.pages.push(g), y.set(l, k);
1418
- }
1419
- return [...y.values()].sort((m, z) => z.pages.length - m.pages.length);
1420
- });
1421
- function o(y) {
1422
- return typeof y == "string" && y !== "" ? y : null;
1423
- }
1424
- function _(y) {
1425
- return `${y.url}
1426
- ${y.location}`;
1427
- }
1428
- function w(y) {
1429
- return d.value.has(_(y)) ? y.pages : y.pages.slice(0, Xe);
1430
- }
1431
- function b(y) {
1432
- const m = new Set(d.value);
1433
- m.delete(_(y)) || m.add(_(y)), d.value = m;
1434
- }
1435
- return (y, m) => (t(), v("div", ua, [
1436
- (t(!0), v(R, null, q(n.value, (z) => (t(), v("div", {
1437
- key: _(z),
1438
- class: "wx-audit-links__card"
1439
- }, [
1440
- P("div", ra, [
1441
- f(fe, {
1442
- href: z.url,
1443
- type: "muted",
1444
- class: "wx-audit-links__from"
1445
- }, null, 8, ["href"]),
1446
- f(e(Le), {
1447
- name: "arrow-right",
1448
- size: "1em",
1449
- class: "wx-audit-links__arrow",
1450
- label: e(r)("page.leads-to")
1451
- }, null, 8, ["label"]),
1452
- f(fe, {
1453
- href: z.location,
1454
- strong: "",
1455
- class: "wx-audit-links__to"
1456
- }, null, 8, ["href"]),
1457
- (t(!0), v(R, null, q(e(it)(z.url, z.location), (C) => (t(), i(e(G), {
1458
- key: C,
1459
- type: "default",
1460
- size: "sm"
1461
- }, {
1462
- default: a(() => [
1463
- c(s(e(r)(`page.change-${C}`)), 1)
1464
- ]),
1465
- _: 2
1466
- }, 1024))), 128)),
1467
- !z.mixed && z.pages[0] ? (t(), i(ze, {
1468
- key: 0,
1469
- rel: z.pages[0].rel,
1470
- target: z.pages[0].target,
1471
- class: "wx-audit-links__fixed"
1472
- }, null, 8, ["rel", "target"])) : $("", !0),
1473
- z.status !== null ? (t(), i(_e, {
1474
- key: 1,
1475
- code: z.status
1476
- }, null, 8, ["code"])) : $("", !0),
1477
- f(e(I), {
1478
- size: "sm",
1479
- tone: "muted",
1480
- class: "wx-audit-links__count"
1481
- }, {
1482
- default: a(() => [
1483
- c(s(e(r)("page.link-pages", { count: z.pages.length })), 1)
1484
- ]),
1485
- _: 2
1486
- }, 1024)
1487
- ]),
1488
- P("ul", da, [
1489
- (t(!0), v(R, null, q(w(z), (C) => (t(), v("li", {
1490
- key: C.page
1491
- }, [
1492
- f(fe, {
1493
- href: C.page
1494
- }, null, 8, ["href"]),
1495
- z.mixed ? (t(), i(ze, {
1496
- key: 0,
1497
- rel: C.rel,
1498
- target: C.target,
1499
- class: "wx-audit-links__fixed"
1500
- }, null, 8, ["rel", "target"])) : $("", !0)
1501
- ]))), 128))
1502
- ]),
1503
- z.pages.length > Xe ? (t(), i(e(X), {
1504
- key: 0,
1505
- size: "sm",
1506
- variant: "text",
1507
- class: "wx-audit-links__more",
1508
- onClick: (C) => b(z)
1509
- }, {
1510
- default: a(() => [
1511
- c(s(d.value.has(_(z)) ? e(r)("page.link-collapse") : e(r)("page.link-show-all")), 1)
1512
- ]),
1513
- _: 2
1514
- }, 1032, ["onClick"])) : $("", !0)
1515
- ]))), 128))
1516
- ]));
1517
- }
1518
- }), pa = /* @__PURE__ */ ne(ca, [["__scopeId", "data-v-e8cc2899"]]), ga = { class: "wx-audit-issues" }, ha = { class: "wx-audit-issues__head" }, va = { class: "wx-audit-issues__body" }, fa = /* @__PURE__ */ ae({
1519
- __name: "AuditIssueList",
1520
- props: {
1521
- run: {},
1522
- query: {},
1523
- fixable: { type: Boolean },
1524
- title: {}
1525
- },
1526
- emits: ["changed"],
1527
- setup(h, { emit: u }) {
1528
- const r = h, d = u, n = oe(), o = re(n), _ = n.can("audit.manage");
1529
- se();
1530
- const w = Y("webx-audit"), b = ue(), y = W(null), m = W(!1), z = W(1), C = W(null), O = W(null), l = W(!1), k = W(null), g = W(!1), U = W("pages"), S = W(null), J = F(
1531
- () => (y.value?.[0]?.details.table?.columns ?? []).some((j) => j.key === "location")
1532
- ), ee = F(() => [
1533
- { value: "pages", label: w("page.view-pages") },
1534
- { value: "links", label: w("page.view-links") }
1535
- ]);
1536
- async function te() {
1537
- if (!S.value)
1538
- try {
1539
- const j = [];
1540
- let E = 1, B = 1;
1541
- do {
1542
- const he = await o.issues(r.run, { ...r.query, page: E, per_page: 200 });
1543
- j.push(...he.data), B = he.last_page, E++;
1544
- } while (E <= B);
1545
- S.value = j;
1546
- } catch (j) {
1547
- C.value = b(j);
1548
- }
1549
- }
1550
- function D(j) {
1551
- U.value = j, j === "links" && te();
1552
- }
1553
- function Z(j) {
1554
- k.value = j, g.value = !0;
1555
- }
1556
- function H(j) {
1557
- y.value && !j.pattern ? y.value = [] : y.value && k.value && (y.value = y.value.filter((E) => E.id !== k.value?.id)), d("changed");
1558
- }
1559
- async function le(j) {
1560
- if (j.ignore)
1561
- try {
1562
- await o.unhide(j.ignore.id), Q.success(w("page.unhidden")), d("changed");
1563
- } catch (E) {
1564
- Q.danger(b(E));
1565
- }
1566
- }
1567
- function N(j) {
1568
- const E = j.ignore;
1569
- return E ? E.created_by ? w("page.hidden-by", { who: E.created_by, reason: E.reason }) : w("page.hidden-reason", { reason: E.reason }) : "";
1570
- }
1571
- function K(j) {
1572
- O.value = j, l.value = !0;
1573
- }
1574
- function L(j) {
1575
- O.value && (O.value.fixed_with = j);
1576
- }
1577
- async function ge(j = 1) {
1578
- try {
1579
- const E = await o.issues(r.run, { ...r.query, page: j, per_page: 50 });
1580
- y.value = j === 1 ? E.data : [...y.value ?? [], ...E.data], z.value = E.current_page, m.value = E.current_page < E.last_page;
1581
- } catch (E) {
1582
- C.value = b(E);
1583
- }
1584
- }
1585
- return ye(() => ge()), (j, E) => (t(), v("div", ga, [
1586
- C.value ? (t(), i(e(I), {
1587
- key: 0,
1588
- size: "sm",
1589
- tone: "danger"
1590
- }, {
1591
- default: a(() => [
1592
- c(s(C.value), 1)
1593
- ]),
1594
- _: 1
1595
- })) : y.value ? (t(), v(R, { key: 2 }, [
1596
- J.value ? (t(), i(e(je), {
1597
- key: 0,
1598
- "model-value": U.value,
1599
- options: ee.value,
1600
- size: "sm",
1601
- class: "wx-audit-issues__view",
1602
- "onUpdate:modelValue": E[0] || (E[0] = (B) => D(B))
1603
- }, null, 8, ["model-value", "options"])) : $("", !0),
1604
- U.value === "links" ? (t(), v(R, { key: 1 }, [
1605
- S.value ? (t(), i(pa, {
1606
- key: 0,
1607
- issues: S.value
1608
- }, null, 8, ["issues"])) : (t(), i(e(me), {
1609
- key: 1,
1610
- rows: 2
1611
- }))
1612
- ], 64)) : (t(), v(R, { key: 2 }, [
1613
- (t(!0), v(R, null, q(y.value, (B) => (t(), v("div", {
1614
- key: B.id,
1615
- class: "wx-audit-issues__item"
1616
- }, [
1617
- P("div", ha, [
1618
- B.url ? (t(), i(fe, {
1619
- key: 0,
1620
- href: B.url,
1621
- strong: "",
1622
- class: "wx-audit-issues__url"
1623
- }, null, 8, ["href"])) : $("", !0),
1624
- B.state === "new" ? (t(), i(e(G), {
1625
- key: 1,
1626
- type: "primary",
1627
- size: "sm"
1628
- }, {
1629
- default: a(() => [
1630
- c(s(e(w)("page.state-new")), 1)
1631
- ]),
1632
- _: 1
1633
- })) : $("", !0),
1634
- B.details.count != null && B.details.table ? (t(), i(e(Ae), {
1635
- key: 2,
1636
- content: B.details.summary ?? void 0,
1637
- disabled: !B.details.summary
1638
- }, {
1639
- default: a(() => [
1640
- f(e(G), {
1641
- round: "",
1642
- size: "sm",
1643
- class: "wx-audit-issues__count"
1644
- }, {
1645
- default: a(() => [
1646
- c(s(B.details.count), 1)
1647
- ]),
1648
- _: 2
1649
- }, 1024)
1650
- ]),
1651
- _: 2
1652
- }, 1032, ["content", "disabled"])) : $("", !0),
1653
- B.fixed_with ? (t(), i(e(G), {
1654
- key: 3,
1655
- type: "success",
1656
- size: "sm"
1657
- }, {
1658
- default: a(() => [
1659
- c(s(e(w)("page.fix-pressed")), 1)
1660
- ]),
1661
- _: 1
1662
- })) : h.fixable && e(_) && !B.ignored ? (t(), i(e(X), {
1663
- key: 4,
1664
- size: "sm",
1665
- variant: "outline",
1666
- icon: "check",
1667
- class: "wx-audit-issues__fix",
1668
- onClick: (he) => K(B)
1669
- }, {
1670
- default: a(() => [
1671
- c(s(e(w)("page.fix-button")), 1)
1672
- ]),
1673
- _: 1
1674
- }, 8, ["onClick"])) : $("", !0),
1675
- e(_) && B.ignored && B.ignore ? (t(), i(e(X), {
1676
- key: 5,
1677
- size: "sm",
1678
- variant: "text",
1679
- icon: "eye",
1680
- class: "wx-audit-issues__end",
1681
- onClick: (he) => le(B)
1682
- }, {
1683
- default: a(() => [
1684
- c(s(e(w)("page.unhide")), 1)
1685
- ]),
1686
- _: 1
1687
- }, 8, ["onClick"])) : e(_) && !B.ignored ? (t(), i(e(X), {
1688
- key: 6,
1689
- size: "sm",
1690
- variant: "text",
1691
- icon: "eye-off",
1692
- class: Se({ "wx-audit-issues__end": !h.fixable || B.fixed_with }),
1693
- onClick: (he) => Z(B)
1694
- }, {
1695
- default: a(() => [
1696
- c(s(e(w)("page.hide")), 1)
1697
- ]),
1698
- _: 1
1699
- }, 8, ["class", "onClick"])) : $("", !0)
1700
- ]),
1701
- P("div", va, [
1702
- B.ignore ? (t(), i(e(I), {
1703
- key: 0,
1704
- size: "sm",
1705
- tone: "muted"
1706
- }, {
1707
- default: a(() => [
1708
- c(s(N(B)), 1)
1709
- ]),
1710
- _: 2
1711
- }, 1024)) : $("", !0),
1712
- f(Be, {
1713
- details: B.details,
1714
- counted: B.details.count != null && !!B.details.table
1715
- }, null, 8, ["details", "counted"])
1716
- ])
1717
- ]))), 128)),
1718
- m.value ? (t(), i(e(X), {
1719
- key: 0,
1720
- size: "sm",
1721
- variant: "text",
1722
- onClick: E[1] || (E[1] = (B) => ge(z.value + 1))
1723
- }, {
1724
- default: a(() => [...E[4] || (E[4] = [
1725
- c("…", -1)
1726
- ])]),
1727
- _: 1
1728
- })) : $("", !0)
1729
- ], 64))
1730
- ], 64)) : (t(), i(e(me), {
1731
- key: 1,
1732
- rows: 2
1733
- })),
1734
- O.value ? (t(), i(na, {
1735
- key: 3,
1736
- open: l.value,
1737
- "onUpdate:open": E[2] || (E[2] = (B) => l.value = B),
1738
- run: h.run,
1739
- issue: O.value,
1740
- onFixed: L
1741
- }, null, 8, ["open", "run", "issue"])) : $("", !0),
1742
- k.value ? (t(), i(oa, {
1743
- key: 4,
1744
- open: g.value,
1745
- "onUpdate:open": E[3] || (E[3] = (B) => g.value = B),
1746
- issue: k.value,
1747
- title: r.title ?? k.value.check,
1748
- onHidden: H
1749
- }, null, 8, ["open", "issue", "title"])) : $("", !0)
1750
- ]));
1751
- }
1752
- }), _a = /* @__PURE__ */ ne(fa, [["__scopeId", "data-v-ebf11b20"]]), ma = { class: "wx-audit-findings__filters" }, ya = { class: "wx-audit-findings__title" }, ka = { class: "wx-audit-findings__texts" }, wa = /* @__PURE__ */ ae({
1753
- __name: "AuditIssuesPage",
1754
- props: {
1755
- base: {}
1756
- },
1757
- setup(h) {
1758
- const u = h, r = re(oe());
1759
- se();
1760
- const d = Y("webx-audit"), n = Y("webx-admin"), o = ue(), _ = W(null), w = W(null), b = W(!1), y = W([]), m = W(null), z = W(null), C = W(null), O = F(() => ({ severity: m.value, group: z.value, state: C.value })), l = F(
1761
- () => [m.value, z.value, C.value].filter(Boolean).length
1762
- ), k = {
1763
- error: "danger",
1764
- warning: "warning",
1765
- notice: "info"
1766
- }, g = F(() => [
1767
- { key: "severity", label: d("page.severity"), width: 130 },
1768
- { key: "title", label: d("page.check") },
1769
- { key: "count", label: d("page.count"), width: 110, align: "right" }
1770
- ]), U = F(
1771
- () => ["error", "warning", "notice"].map((D) => ({
1772
- value: D,
1773
- label: d(`page.severity-${D}`)
1774
- }))
1775
- ), S = F(
1776
- () => [
1777
- "config",
1778
- "host",
1779
- "hosts",
1780
- "indexing",
1781
- "page",
1782
- "content",
1783
- "links",
1784
- "images",
1785
- "a11y",
1786
- "structure"
1787
- ].map((D) => ({ value: D, label: d(`page.group-${D}`) }))
1788
- ), J = F(
1789
- () => ["new", "persisting", "hidden"].map((D) => ({
1790
- value: D,
1791
- label: d(`page.state-${D}`)
1792
- }))
1793
- );
1794
- function ee(D) {
1795
- return typeof D == "string" && D !== "" ? D : null;
1796
- }
1797
- async function te() {
1798
- b.value = !0;
1799
- try {
1800
- _.value === null && (_.value = (await r.latest()).done?.id ?? null), w.value = _.value === null ? [] : await r.checks(_.value, O.value), y.value = [];
1801
- } catch (D) {
1802
- Q.danger(o(D));
1803
- } finally {
1804
- b.value = !1;
1805
- }
1806
- }
1807
- return de(O, () => {
1808
- te();
1809
- }), ye(te), (D, Z) => (t(), i(be, {
1810
- base: u.base,
1811
- current: "issues"
1812
- }, {
1813
- default: a(() => [
1814
- f(e(ke), {
1815
- expanded: y.value,
1816
- "onUpdate:expanded": Z[4] || (Z[4] = (H) => y.value = H),
1817
- data: w.value ?? [],
1818
- columns: g.value,
1819
- "row-key": "id",
1820
- expandable: "",
1821
- flush: "",
1822
- loading: b.value,
1823
- "filters-count": l.value,
1824
- "filters-label": e(n)("filters.title"),
1825
- "empty-text": _.value === null ? e(d)("page.never") : e(d)("page.empty")
1826
- }, {
1827
- filters: a(() => [
1828
- P("div", ma, [
1829
- f(e(pe), {
1830
- "model-value": m.value,
1831
- options: U.value,
1832
- placeholder: e(d)("page.any-severity"),
1833
- clearable: "",
1834
- "onUpdate:modelValue": Z[0] || (Z[0] = (H) => m.value = ee(H))
1835
- }, null, 8, ["model-value", "options", "placeholder"]),
1836
- f(e(pe), {
1837
- "model-value": z.value,
1838
- options: S.value,
1839
- placeholder: e(d)("page.any-group"),
1840
- clearable: "",
1841
- "onUpdate:modelValue": Z[1] || (Z[1] = (H) => z.value = ee(H))
1842
- }, null, 8, ["model-value", "options", "placeholder"]),
1843
- f(e(pe), {
1844
- "model-value": C.value,
1845
- options: J.value,
1846
- placeholder: e(d)("page.any-state"),
1847
- clearable: "",
1848
- "onUpdate:modelValue": Z[2] || (Z[2] = (H) => C.value = ee(H))
1849
- }, null, 8, ["model-value", "options", "placeholder"])
1850
- ])
1851
- ]),
1852
- "cell-severity": a(({ row: H }) => [
1853
- f(e(G), {
1854
- type: k[H.severity],
1855
- dot: ""
1856
- }, {
1857
- default: a(() => [
1858
- c(s(e(d)(`page.severity-${H.severity}`)), 1)
1859
- ]),
1860
- _: 2
1861
- }, 1032, ["type"])
1862
- ]),
1863
- "cell-title": a(({ row: H }) => [
1864
- P("span", ya, [
1865
- f(e(I), { size: "sm" }, {
1866
- default: a(() => [
1867
- c(s(H.title), 1)
1868
- ]),
1869
- _: 2
1870
- }, 1024),
1871
- H.new > 0 ? (t(), i(e(G), {
1872
- key: 0,
1873
- type: "primary",
1874
- size: "sm"
1875
- }, {
1876
- default: a(() => [
1877
- c(s(e(d)("page.state-new")), 1)
1878
- ]),
1879
- _: 1
1880
- })) : $("", !0),
1881
- f(e(qe), {
1882
- title: H.title,
1883
- width: "360"
1884
- }, {
1885
- trigger: a(() => [
1886
- f(e(X), {
1887
- size: "sm",
1888
- variant: "text",
1889
- icon: "question",
1890
- "aria-label": e(d)("page.explain"),
1891
- onClick: Z[3] || (Z[3] = dt(() => {
1892
- }, ["stop"]))
1893
- }, null, 8, ["aria-label"])
1894
- ]),
1895
- default: a(() => [
1896
- P("dl", ka, [
1897
- P("dt", null, s(e(d)("page.found")), 1),
1898
- P("dd", null, s(H.found), 1),
1899
- P("dt", null, s(e(d)("page.why")), 1),
1900
- P("dd", null, s(H.why), 1),
1901
- P("dt", null, s(e(d)("page.fix")), 1),
1902
- P("dd", null, s(H.fix), 1)
1903
- ])
1904
- ]),
1905
- _: 2
1906
- }, 1032, ["title"])
1907
- ])
1908
- ]),
1909
- expanded: a(({ row: H }) => [
1910
- _.value !== null ? (t(), i(_a, {
1911
- key: 0,
1912
- run: _.value,
1913
- query: { ...O.value, check: H.id },
1914
- fixable: (H.fixes ?? []).length > 0,
1915
- title: H.title,
1916
- onChanged: te
1917
- }, null, 8, ["run", "query", "fixable", "title"])) : $("", !0)
1918
- ]),
1919
- _: 1
1920
- }, 8, ["expanded", "data", "columns", "loading", "filters-count", "filters-label", "empty-text"])
1921
- ]),
1922
- _: 1
1923
- }, 8, ["base"]));
1924
- }
1925
- }), ba = /* @__PURE__ */ ne(wa, [["__scopeId", "data-v-7f790d95"]]), xa = { class: "wx-audit-overview" }, $a = { class: "wx-audit-overview__row" }, za = { class: "wx-audit-overview__row" }, Sa = { class: "wx-audit-overview__summary" }, Aa = { class: "wx-audit-overview__health" }, Ca = {
1926
- key: 0,
1927
- class: "wx-audit-overview__parts"
1928
- }, Pa = { class: "wx-audit-overview__stats" }, Oa = { class: "wx-audit-overview__meta" }, Wa = { class: "wx-audit-overview__groups" }, Ia = { class: "wx-audit-overview__badges" }, Ua = { class: "wx-audit-overview__title" }, Ta = { class: "wx-audit-overview__badges" }, Na = {
1929
- key: 0,
1930
- class: "wx-audit-overview__missing"
1931
- }, Ra = 2e3, Va = /* @__PURE__ */ ae({
1932
- __name: "AuditOverviewPage",
1933
- props: {
1934
- base: {}
1935
- },
1936
- setup(h) {
1937
- const u = h, r = oe(), d = re(r);
1938
- se();
1939
- const n = Y("webx-audit"), o = ue(), _ = W(null), w = W("quick"), b = W(!1);
1940
- let y;
1941
- const m = r.can("audit.run") || r.can("audit.manage"), z = F(() => _.value?.active ?? null), C = F(() => _.value?.done ?? null), O = F(() => C.value?.counts ?? null), l = F(() => [
1942
- { value: "quick", label: n("page.scope-quick") },
1943
- { value: "full", label: n("page.scope-full") }
1944
- ]), k = [
1945
- { key: "error", label: "page.errors", tone: "danger" },
1946
- { key: "warning", label: "page.warnings", tone: "warning" },
1947
- { key: "notice", label: "page.notices", tone: "info" }
1948
- ], g = F(() => O.value?.health_parts ?? null), U = F(() => {
1949
- const H = O.value?.health ?? 0;
1950
- return H >= 90 ? "success" : H >= 60 ? "warning" : "danger";
1951
- }), S = [
1952
- "config",
1953
- "host",
1954
- "hosts",
1955
- "indexing",
1956
- "page",
1957
- "content",
1958
- "links",
1959
- "images",
1960
- "a11y",
1961
- "structure"
1962
- ], J = F(
1963
- () => Object.entries(O.value?.groups ?? {}).map(([H, le]) => ({
1964
- id: H,
1965
- label: n(`page.group-${S.includes(H) ? H : "other"}`),
1966
- bySeverity: le
1967
- }))
1968
- );
1969
- function ee(H) {
1970
- return H.status === "queued" ? n("page.status-queued") : H.progress.stage ? n(`page.stage-${H.progress.stage}`) : n("page.status-running");
1971
- }
1972
- async function te() {
1973
- try {
1974
- _.value = await d.latest();
1975
- } catch (H) {
1976
- Q.danger(o(H));
1977
- }
1978
- clearTimeout(y), _.value?.active && (y = setTimeout(() => {
1979
- te();
1980
- }, Ra));
1981
- }
1982
- async function D() {
1983
- b.value = !0;
1984
- try {
1985
- await d.start(w.value), Q.success(n("page.started")), await te();
1986
- } catch (H) {
1987
- Q.danger(o(H));
1988
- } finally {
1989
- b.value = !1;
1990
- }
1991
- }
1992
- async function Z(H) {
1993
- try {
1994
- await d.cancel(H.id), await te();
1995
- } catch (le) {
1996
- Q.danger(o(le));
1997
- }
1998
- }
1999
- return ye(te), tt(() => clearTimeout(y)), (H, le) => (t(), i(be, {
2000
- base: u.base,
2001
- current: "overview",
2002
- card: !1
2003
- }, {
2004
- default: a(() => [
2005
- P("div", xa, [
2006
- _.value ? (t(), v(R, { key: 1 }, [
2007
- _.value.queue.sync ? (t(), i(e(ve), {
2008
- key: 0,
2009
- type: "warning",
2010
- description: e(n)("page.sync-queue")
2011
- }, null, 8, ["description"])) : $("", !0),
2012
- _.value.last && _.value.last.status === "failed" ? (t(), i(e(ve), {
2013
- key: 1,
2014
- type: "danger",
2015
- description: e(n)("page.last-failed", { error: _.value.last.error ?? "" })
2016
- }, null, 8, ["description"])) : $("", !0),
2017
- z.value ? (t(), i(e(ce), {
2018
- key: 2,
2019
- class: "wx-audit-overview__active"
2020
- }, {
2021
- default: a(() => [
2022
- P("div", $a, [
2023
- f(e(I), { weight: "semibold" }, {
2024
- default: a(() => [
2025
- c(s(ee(z.value)), 1)
2026
- ]),
2027
- _: 1
2028
- }),
2029
- f(e(I), {
2030
- size: "sm",
2031
- tone: "muted",
2032
- class: "wx-audit-overview__url"
2033
- }, {
2034
- default: a(() => [
2035
- c(s(z.value.base_url), 1)
2036
- ]),
2037
- _: 1
2038
- }),
2039
- e(m) ? (t(), i(e(X), {
2040
- key: 0,
2041
- size: "sm",
2042
- class: "wx-audit-overview__end",
2043
- onClick: le[0] || (le[0] = (N) => Z(z.value))
2044
- }, {
2045
- default: a(() => [
2046
- c(s(e(n)("page.cancel")), 1)
2047
- ]),
2048
- _: 1
2049
- })) : $("", !0)
2050
- ]),
2051
- f(e(Me), {
2052
- indeterminate: "",
2053
- "aria-label": ee(z.value)
2054
- }, null, 8, ["aria-label"]),
2055
- z.value.progress.resources ? (t(), i(e(I), {
2056
- key: 0,
2057
- size: "sm",
2058
- tone: "muted"
2059
- }, {
2060
- default: a(() => [
2061
- c(s(e(n)("page.resources-progress", {
2062
- checked: z.value.progress.resources.checked,
2063
- total: z.value.progress.resources.total
2064
- })), 1)
2065
- ]),
2066
- _: 1
2067
- })) : z.value.progress.stage === "crawl" ? (t(), i(e(I), {
2068
- key: 1,
2069
- size: "sm",
2070
- tone: "muted"
2071
- }, {
2072
- default: a(() => [
2073
- c(s(e(n)("page.pages-progress", {
2074
- crawled: z.value.progress.pages.crawled,
2075
- limit: z.value.progress.pages.limit
2076
- })), 1)
2077
- ]),
2078
- _: 1
2079
- })) : $("", !0)
2080
- ]),
2081
- _: 1
2082
- })) : e(m) && !_.value.queue.sync ? (t(), i(e(ce), { key: 3 }, {
2083
- default: a(() => [
2084
- P("div", za, [
2085
- f(e(je), {
2086
- modelValue: w.value,
2087
- "onUpdate:modelValue": le[1] || (le[1] = (N) => w.value = N),
2088
- options: l.value,
2089
- "aria-label": e(n)("page.scope")
2090
- }, null, 8, ["modelValue", "options", "aria-label"]),
2091
- f(e(I), {
2092
- size: "sm",
2093
- tone: "muted"
2094
- }, {
2095
- default: a(() => [
2096
- c(s(w.value === "full" ? e(n)("page.scope-full-help") : e(n)("page.scope-quick-help")), 1)
2097
- ]),
2098
- _: 1
2099
- }),
2100
- f(e(X), {
2101
- type: "primary",
2102
- icon: "refresh",
2103
- loading: b.value,
2104
- class: "wx-audit-overview__end",
2105
- onClick: D
2106
- }, {
2107
- default: a(() => [
2108
- c(s(e(n)("page.run")), 1)
2109
- ]),
2110
- _: 1
2111
- }, 8, ["loading"])
2112
- ])
2113
- ]),
2114
- _: 1
2115
- })) : $("", !0),
2116
- !C.value && !z.value ? (t(), i(e(ce), { key: 4 }, {
2117
- default: a(() => [
2118
- f(e(De), {
2119
- icon: "check-circle",
2120
- title: e(n)("page.never"),
2121
- description: e(n)("page.never-help")
2122
- }, null, 8, ["title", "description"])
2123
- ]),
2124
- _: 1
2125
- })) : $("", !0),
2126
- C.value && O.value ? (t(), v(R, { key: 5 }, [
2127
- f(e(ce), null, {
2128
- default: a(() => [
2129
- P("div", Sa, [
2130
- P("div", Aa, [
2131
- f(e(Me), {
2132
- type: "circle",
2133
- value: O.value.health,
2134
- status: U.value,
2135
- "show-value": "",
2136
- formatter: (N) => `${N}%`,
2137
- "aria-label": e(n)("page.health")
2138
- }, null, 8, ["value", "status", "formatter", "aria-label"]),
2139
- g.value ? (t(), v("div", Ca, [
2140
- g.value.pages > 0 ? (t(), i(e(I), {
2141
- key: 0,
2142
- size: "sm"
2143
- }, {
2144
- default: a(() => [
2145
- c(s(e(n)("page.health-pages", { clean: g.value.clean, pages: g.value.pages })), 1)
2146
- ]),
2147
- _: 1
2148
- })) : $("", !0),
2149
- g.value.site_errors > 0 ? (t(), i(e(I), {
2150
- key: 1,
2151
- size: "sm",
2152
- tone: "danger"
2153
- }, {
2154
- default: a(() => [
2155
- c(s(e(n)("page.health-site", { count: g.value.site_errors })), 1)
2156
- ]),
2157
- _: 1
2158
- })) : $("", !0),
2159
- g.value.warnings > 0 ? (t(), i(e(I), {
2160
- key: 2,
2161
- size: "sm",
2162
- tone: "warning"
2163
- }, {
2164
- default: a(() => [
2165
- c(s(e(n)("page.health-warnings", { count: g.value.warnings })), 1)
2166
- ]),
2167
- _: 1
2168
- })) : $("", !0),
2169
- f(e(I), {
2170
- size: "xs",
2171
- tone: "muted"
2172
- }, {
2173
- default: a(() => [
2174
- c(s(e(n)("page.health-help")), 1)
2175
- ]),
2176
- _: 1
2177
- })
2178
- ])) : $("", !0)
2179
- ]),
2180
- P("div", Pa, [
2181
- (t(), v(R, null, q(k, (N) => f(e(Re), {
2182
- key: N.key,
2183
- title: e(n)(N.label),
2184
- value: O.value.severity[N.key] ?? 0,
2185
- tone: (O.value.severity[N.key] ?? 0) > 0 ? N.tone : "muted"
2186
- }, null, 8, ["title", "value", "tone"])), 64)),
2187
- f(e(Re), {
2188
- title: e(n)("page.new"),
2189
- value: O.value.new
2190
- }, null, 8, ["title", "value"]),
2191
- f(e(Re), {
2192
- title: e(n)("page.fixed"),
2193
- value: O.value.fixed,
2194
- tone: "success"
2195
- }, null, 8, ["title", "value"])
2196
- ])
2197
- ]),
2198
- P("div", Oa, [
2199
- f(e(I), {
2200
- size: "sm",
2201
- tone: "muted"
2202
- }, {
2203
- default: a(() => [
2204
- c(s(e(n)("page.last-run")) + " ", 1),
2205
- f(e($e), {
2206
- value: C.value.finished_at
2207
- }, null, 8, ["value"]),
2208
- c(" · " + s(e(n)(`page.scope-${C.value.scope}`)) + " · ", 1)
2209
- ]),
2210
- _: 1
2211
- }),
2212
- f(e(I), {
2213
- size: "sm",
2214
- tone: "muted",
2215
- class: "wx-audit-overview__url"
2216
- }, {
2217
- default: a(() => [
2218
- c(s(C.value.base_url), 1)
2219
- ]),
2220
- _: 1
2221
- })
2222
- ])
2223
- ]),
2224
- _: 1
2225
- }),
2226
- J.value.length ? (t(), i(e(ce), {
2227
- key: 0,
2228
- title: e(n)("page.by-group")
2229
- }, {
2230
- default: a(() => [
2231
- P("ul", Wa, [
2232
- (t(!0), v(R, null, q(J.value, (N) => (t(), v("li", {
2233
- key: N.id
2234
- }, [
2235
- f(e(I), { size: "sm" }, {
2236
- default: a(() => [
2237
- c(s(N.label), 1)
2238
- ]),
2239
- _: 2
2240
- }, 1024),
2241
- P("span", Ia, [
2242
- (t(), v(R, null, q(k, (K) => (t(), v(R, {
2243
- key: K.key
2244
- }, [
2245
- (N.bySeverity[K.key] ?? 0) > 0 ? (t(), i(e(G), {
2246
- key: 0,
2247
- type: K.tone,
2248
- size: "sm"
2249
- }, {
2250
- default: a(() => [
2251
- c(s(e(n)(K.label)) + " · " + s(N.bySeverity[K.key]), 1)
2252
- ]),
2253
- _: 2
2254
- }, 1032, ["type"])) : $("", !0)
2255
- ], 64))), 64))
2256
- ])
2257
- ]))), 128))
2258
- ])
2259
- ]),
2260
- _: 1
2261
- }, 8, ["title"])) : (t(), i(e(ce), { key: 1 }, {
2262
- default: a(() => [
2263
- f(e(De), {
2264
- icon: "check-circle",
2265
- title: e(n)("page.clean"),
2266
- size: "sm"
2267
- }, null, 8, ["title"])
2268
- ]),
2269
- _: 1
2270
- })),
2271
- f(e(ce), null, {
2272
- header: a(() => [
2273
- P("span", Ua, [
2274
- c(s(e(n)("page.sources")) + " ", 1),
2275
- f(e(qe), {
2276
- title: e(n)("page.sources"),
2277
- width: 360,
2278
- teleport: ""
2279
- }, {
2280
- trigger: a(() => [
2281
- f(e(X), {
2282
- variant: "text",
2283
- size: "sm",
2284
- icon: "question",
2285
- "aria-label": e(n)("page.sources-help-label")
2286
- }, null, 8, ["aria-label"])
2287
- ]),
2288
- default: a(() => [
2289
- f(e(I), { size: "sm" }, {
2290
- default: a(() => [
2291
- c(s(e(n)("page.sources-help")), 1)
2292
- ]),
2293
- _: 1
2294
- })
2295
- ]),
2296
- _: 1
2297
- }, 8, ["title"])
2298
- ])
2299
- ]),
2300
- default: a(() => [
2301
- P("div", Ta, [
2302
- (t(!0), v(R, null, q(O.value.sources.searched, (N) => (t(), i(e(G), {
2303
- key: N,
2304
- type: "success"
2305
- }, {
2306
- default: a(() => [
2307
- c(s(N), 1)
2308
- ]),
2309
- _: 2
2310
- }, 1024))), 128))
2311
- ]),
2312
- O.value.sources.missing.length ? (t(), v("div", Na, [
2313
- f(e(I), {
2314
- size: "sm",
2315
- tone: "warning"
2316
- }, {
2317
- default: a(() => [
2318
- c(s(e(n)("page.sources-missing")), 1)
2319
- ]),
2320
- _: 1
2321
- }),
2322
- (t(!0), v(R, null, q(O.value.sources.missing, (N) => (t(), i(e(G), {
2323
- key: N,
2324
- type: "warning"
2325
- }, {
2326
- default: a(() => [
2327
- c(s(N), 1)
2328
- ]),
2329
- _: 2
2330
- }, 1024))), 128))
2331
- ])) : $("", !0)
2332
- ]),
2333
- _: 1
2334
- })
2335
- ], 64)) : $("", !0)
2336
- ], 64)) : (t(), i(e(ce), { key: 0 }, {
2337
- default: a(() => [
2338
- f(e(me), { rows: 4 })
2339
- ]),
2340
- _: 1
2341
- }))
2342
- ])
2343
- ]),
2344
- _: 1
2345
- }, 8, ["base"]));
2346
- }
2347
- }), Fa = /* @__PURE__ */ ne(Va, [["__scopeId", "data-v-5c088ef8"]]);
2348
- function Ha(h) {
2349
- const u = [];
2350
- let r = 0;
2351
- for (const [d, n] of h) {
2352
- for (let o = r + 1; r > 0 && o < d; o++)
2353
- u.push({ level: o, text: "", missing: !0, after: r });
2354
- u.push({ level: d, text: n, missing: !1 }), r = d;
2355
- }
2356
- return u;
2357
- }
2358
- function ot(h, u) {
2359
- if (!h.length) return [];
2360
- const r = h.filter(([_]) => _ === 1).length, d = h.filter(
2361
- ([_], w) => w > 0 && _ > h[w - 1][0] + 1
2362
- ).length, n = h.filter(([, _]) => _ === "").length, o = [];
2363
- return r === 0 && o.push(u("page.headings-no-h1")), r > 1 && o.push(u("page.headings-many-h1", { count: r })), r > 0 && h[0][0] !== 1 && o.push(u("page.headings-h1-not-first", { level: `H${h[0][0]}` })), d > 0 && o.push(u("page.headings-skipped", { count: d })), n > 0 && o.push(u("page.headings-empty", { count: n })), o;
2364
- }
2365
- const La = { class: "wx-audit-headings" }, ja = { class: "wx-audit-headings__hints" }, qa = { class: "wx-audit-headings__tree" }, Ba = { class: "wx-audit-headings__gap" }, Ea = {
2366
- key: 0,
2367
- class: "wx-audit-headings__text"
2368
- }, Ma = /* @__PURE__ */ ae({
2369
- __name: "AuditHeadings",
2370
- props: {
2371
- outline: {},
2372
- counts: {}
2373
- },
2374
- setup(h) {
2375
- const u = h;
2376
- se();
2377
- const r = Y("webx-audit"), d = F(() => Ha(u.outline ?? [])), n = F(() => ot(u.outline ?? [], r)), o = F(() => Object.values(u.counts).reduce((_, w) => _ + w, 0));
2378
- return (_, w) => (t(), v("div", La, [
2379
- u.outline === null && o.value > 0 ? (t(), i(e(I), {
2380
- key: 0,
2381
- tone: "muted"
2382
- }, {
2383
- default: a(() => [
2384
- c(s(e(r)("page.headings-recheck")), 1)
2385
- ]),
2386
- _: 1
2387
- })) : d.value.length ? (t(), v(R, { key: 2 }, [
2388
- n.value.length ? (t(), i(e(ve), {
2389
- key: 0,
2390
- type: "warning",
2391
- variant: "soft",
2392
- title: e(r)("page.headings-hints")
2393
- }, {
2394
- default: a(() => [
2395
- P("ul", ja, [
2396
- (t(!0), v(R, null, q(n.value, (b) => (t(), v("li", { key: b }, s(b), 1))), 128))
2397
- ])
2398
- ]),
2399
- _: 1
2400
- }, 8, ["title"])) : (t(), i(e(ve), {
2401
- key: 1,
2402
- type: "success",
2403
- variant: "soft",
2404
- title: e(r)("page.headings-fine")
2405
- }, null, 8, ["title"])),
2406
- P("ol", qa, [
2407
- (t(!0), v(R, null, q(d.value, (b, y) => (t(), v("li", {
2408
- key: y,
2409
- class: Se(["wx-audit-headings__row", { "is-missing": b.missing }])
2410
- }, [
2411
- (t(!0), v(R, null, q(b.level - 1, (m) => (t(), v("span", {
2412
- key: m,
2413
- class: "wx-audit-headings__guide"
2414
- }))), 128)),
2415
- b.missing ? (t(), v(R, { key: 0 }, [
2416
- P("span", Ba, "H" + s(b.level), 1),
2417
- f(e(I), {
2418
- size: "sm",
2419
- tone: "warning"
2420
- }, {
2421
- default: a(() => [
2422
- c(s(e(r)("page.heading-missing", { level: `H${b.level}`, after: `H${b.after}` })), 1)
2423
- ]),
2424
- _: 2
2425
- }, 1024)
2426
- ], 64)) : (t(), v(R, { key: 1 }, [
2427
- f(e(G), {
2428
- type: b.level === 1 ? "primary" : "info",
2429
- size: "sm"
2430
- }, {
2431
- default: a(() => [
2432
- c("H" + s(b.level), 1)
2433
- ]),
2434
- _: 2
2435
- }, 1032, ["type"]),
2436
- b.text ? (t(), v("span", Ea, s(b.text), 1)) : (t(), i(e(I), {
2437
- key: 1,
2438
- size: "sm",
2439
- tone: "danger"
2440
- }, {
2441
- default: a(() => [
2442
- c(s(e(r)("page.heading-empty")), 1)
2443
- ]),
2444
- _: 1
2445
- }))
2446
- ], 64))
2447
- ], 2))), 128))
2448
- ])
2449
- ], 64)) : (t(), i(e(I), {
2450
- key: 1,
2451
- tone: "muted"
2452
- }, {
2453
- default: a(() => [
2454
- c(s(e(r)("page.no-headings")), 1)
2455
- ]),
2456
- _: 1
2457
- }))
2458
- ]));
2459
- }
2460
- }), Da = /* @__PURE__ */ ne(Ma, [["__scopeId", "data-v-8e5c5aed"]]);
2461
- function Fe(h) {
2462
- return h.checked && h.status !== null && h.status < 400 && h.error === null;
2463
- }
2464
- const Ga = { class: "wx-audit-card__title" }, Ka = { class: "wx-audit-card__url" }, Ja = {
2465
- key: 0,
2466
- class: "wx-audit-card__extra"
2467
- }, Xa = {
2468
- key: 2,
2469
- class: "wx-audit-card"
2470
- }, Qa = { class: "wx-audit-card__recheck" }, Ya = {
2471
- key: 0,
2472
- class: "wx-audit-card__overview"
2473
- }, Za = { class: "wx-audit-card__tiles" }, es = { class: "wx-audit-card__box-head" }, ts = { class: "wx-audit-card__facts" }, as = { key: 0 }, ss = {
2474
- key: 1,
2475
- class: "wx-audit-card__pairs"
2476
- }, ns = { class: "wx-audit-card__key" }, ls = {
2477
- key: 2,
2478
- class: "wx-audit-card__heading-fact"
2479
- }, is = {
2480
- key: 0,
2481
- class: "wx-audit-card__heading-hints"
2482
- }, os = {
2483
- key: 3,
2484
- class: "wx-audit-card__tags"
2485
- }, us = {
2486
- key: 0,
2487
- class: "wx-audit-card__box"
2488
- }, rs = { class: "wx-audit-card__box-head" }, ds = { class: "wx-audit-card__facts" }, cs = { class: "wx-audit-card__code" }, ps = { class: "wx-audit-card__code" }, gs = {
2489
- key: 1,
2490
- class: "wx-audit-card__box wx-audit-card__headings"
2491
- }, hs = {
2492
- key: 2,
2493
- class: "wx-audit-card__issues"
2494
- }, vs = { class: "wx-audit-card__box-head wx-audit-card__issue-head" }, fs = { class: "wx-audit-card__box-body" }, _s = {
2495
- key: 0,
2496
- class: "wx-audit-card__picture"
2497
- }, ms = { class: "wx-audit-card__url" }, ys = {
2498
- key: 1,
2499
- class: "wx-audit-card__url"
2500
- }, ks = {
2501
- key: 4,
2502
- class: "wx-audit-card__issues"
2503
- }, ws = { class: "wx-audit-card__issue-head" }, bs = {
2504
- key: 1,
2505
- class: "wx-audit-card__source"
2506
- }, xs = { class: "wx-audit-card__url" }, $s = 2e3, zs = /* @__PURE__ */ ae({
2507
- __name: "AuditPageCard",
2508
- props: {
2509
- run: {},
2510
- base: {},
2511
- pageId: {},
2512
- titles: {}
2513
- },
2514
- emits: ["close"],
2515
- setup(h, { emit: u }) {
2516
- const r = h, d = u, n = oe(), o = re(n), _ = we();
2517
- se();
2518
- const w = n.can("audit.run") || n.can("audit.manage"), b = W(null), y = W(!1);
2519
- let m;
2520
- async function z() {
2521
- if (g.value) {
2522
- y.value = !0, b.value = null;
2523
- try {
2524
- C(await o.start("urls", [g.value.page.url]));
2525
- } catch (A) {
2526
- y.value = !1, Q.danger(k(A));
2527
- }
2528
- }
2529
- }
2530
- function C(A) {
2531
- if (clearTimeout(m), A.status === "queued" || A.status === "running") {
2532
- m = setTimeout(async () => {
2533
- try {
2534
- C(await o.run(A.id));
2535
- } catch (x) {
2536
- y.value = !1, Q.danger(k(x));
2537
- }
2538
- }, $s);
2539
- return;
2540
- }
2541
- y.value = !1, b.value = A;
2542
- }
2543
- function O() {
2544
- b.value && r.base && _.push({ path: `${r.base}/runs`, query: { to: String(b.value.id) } });
2545
- }
2546
- tt(() => clearTimeout(m));
2547
- const l = Y("webx-audit"), k = ue(), g = W(null), U = W(null), S = W("overview"), J = W(null), ee = W(!1), te = W(null), D = W(!1), Z = ["images", "css", "js"], H = F({
2548
- get: () => r.pageId !== null,
2549
- set: (A) => {
2550
- A || d("close");
2551
- }
2552
- }), le = F(() => [
2553
- { value: "overview", label: l("page.card-overview") },
2554
- { value: "issues", label: l("page.card-issues"), badge: g.value?.counts.issues || void 0 },
2555
- {
2556
- value: "headings",
2557
- label: l("page.card-headings"),
2558
- badge: N.value?.length || void 0
2559
- },
2560
- { value: "in", label: l("page.card-incoming"), badge: g.value?.counts.incoming || void 0 },
2561
- { value: "out", label: l("page.card-outgoing"), badge: g.value?.counts.outgoing || void 0 },
2562
- { value: "images", label: l("page.card-images"), badge: g.value?.counts.images || void 0 },
2563
- { value: "css", label: l("page.card-css"), badge: g.value?.counts.css || void 0 },
2564
- { value: "js", label: l("page.card-js"), badge: g.value?.counts.js || void 0 },
2565
- {
2566
- value: "microdata",
2567
- label: l("page.card-microdata"),
2568
- badge: g.value?.counts.microdata || void 0
2569
- }
2570
- ]), N = F(() => {
2571
- const A = g.value?.page.facts.outline;
2572
- return Array.isArray(A) ? A : null;
2573
- }), K = F(
2574
- () => Z.includes(S.value) ? S.value : null
2575
- ), L = {
2576
- error: "danger",
2577
- warning: "warning",
2578
- notice: "info"
2579
- }, ge = {
2580
- own: "success",
2581
- own_mirror: "warning",
2582
- dev: "danger",
2583
- external: "info"
2584
- }, j = F(() => [
2585
- { key: "url", label: l("page.address"), minWidth: 220 },
2586
- { key: "status", label: l("page.field-status"), width: 80 },
2587
- { key: "kind", label: l("page.kind"), width: 90 },
2588
- { key: "anchor", label: l("page.anchor"), minWidth: 140 },
2589
- { key: "host_class", label: l("page.host"), width: 120 }
2590
- ]), E = F(() => [
2591
- { key: "url", label: l("page.address"), minWidth: 220 },
2592
- { key: "status", label: l("page.field-status"), width: 80 },
2593
- { key: "bytes", label: l("page.size"), width: 110 },
2594
- ...K.value === "images" ? [{ key: "alt", label: l("page.alt"), minWidth: 120 }] : [
2595
- { key: "cache_control", label: l("page.cache"), minWidth: 120 },
2596
- { key: "compression", label: l("page.field-compression"), width: 100 }
2597
- ]
2598
- ]);
2599
- function B(A) {
2600
- try {
2601
- return JSON.stringify(JSON.parse(A), null, 2);
2602
- } catch {
2603
- return A;
2604
- }
2605
- }
2606
- function he(A) {
2607
- if (A.bytes === null) return "";
2608
- const x = A.bytes / 1024, p = x >= 1024 ? `${(x / 1024).toFixed(1)} MB` : `${Math.round(x)} KB`;
2609
- return A.width && A.height ? `${p} · ${A.width}×${A.height}` : p;
2610
- }
2611
- function We(A) {
2612
- const x = A / 1024;
2613
- return x >= 1024 ? `${(x / 1024).toFixed(1)} MB` : `${x.toFixed(1)} KB`;
2614
- }
2615
- const Ce = F(() => {
2616
- const A = g.value?.page;
2617
- return A ? [
2618
- {
2619
- label: l("page.field-status"),
2620
- value: String(A.status ?? l("page.status-none")),
2621
- status: A.status
2622
- },
2623
- A.bytes === null ? null : { label: l("page.size"), value: We(A.bytes) },
2624
- A.ttfb_ms === null ? null : { label: l("page.field-ttfb_ms"), value: String(A.ttfb_ms) },
2625
- A.total_ms === null ? null : { label: l("page.field-total_ms"), value: String(A.total_ms) },
2626
- A.word_count === null ? null : { label: l("page.field-word_count"), value: String(A.word_count) },
2627
- { label: l("page.field-links_in"), value: String(A.links_in) },
2628
- { label: l("page.field-links_out_internal"), value: String(A.links_out_internal) },
2629
- { label: l("page.field-links_out_external"), value: String(A.links_out_external) },
2630
- { label: l("page.field-images"), value: String(A.images) },
2631
- A.images_without_alt ? {
2632
- label: l("page.field-images_without_alt"),
2633
- value: String(A.images_without_alt),
2634
- danger: !0
2635
- } : null
2636
- ].filter((p) => p !== null) : [];
2637
- }), Ie = F(() => {
2638
- const A = g.value?.page;
2639
- return A ? [
2640
- [
2641
- l("page.section-answer"),
2642
- [
2643
- [l("page.field-final_status"), A.redirect_to ? A.final_status : null],
2644
- [l("page.field-redirect_to"), A.redirect_to],
2645
- [l("page.error"), A.error],
2646
- [l("page.field-content_type"), A.content_type],
2647
- [l("page.field-compression"), A.compression]
2648
- ]
2649
- ],
2650
- [
2651
- l("page.section-crawl"),
2652
- [
2653
- [l("page.field-source"), l(`page.source-${A.source}`)],
2654
- [l("page.field-depth"), A.depth],
2655
- [l("page.field-indexable"), A.indexable ? l("page.yes") : l("page.no")],
2656
- [l("page.field-blocked_by_robots"), A.blocked_by_robots ? l("page.yes") : null]
2657
- ]
2658
- ],
2659
- [
2660
- l("page.section-head"),
2661
- [
2662
- [l("page.field-title"), A.title],
2663
- [l("page.field-description"), A.description],
2664
- [l("page.field-h1"), A.h1.join(" · ") || null],
2665
- [
2666
- l("page.card-headings"),
2667
- N.value?.length ? { headings: N.value.length, hints: ot(N.value, l) } : null
2668
- ],
2669
- [l("page.field-canonical"), A.canonical],
2670
- [l("page.field-robots_meta"), A.robots_meta],
2671
- [l("page.field-x_robots_tag"), A.x_robots_tag],
2672
- [l("page.field-lang"), A.lang],
2673
- [
2674
- "hreflang",
2675
- A.hreflang.length ? { pairs: A.hreflang.map((p) => [p.lang, p.url]) } : null
2676
- ]
2677
- ]
2678
- ],
2679
- [
2680
- l("page.section-sharing"),
2681
- [
2682
- [
2683
- "Open Graph",
2684
- Object.keys(A.og).length ? {
2685
- pairs: Object.entries(A.og).map(([p, T]) => [`og:${p}`, String(T)])
2686
- } : null
2687
- ],
2688
- [
2689
- "Twitter",
2690
- Object.keys(A.twitter).length ? {
2691
- pairs: Object.entries(A.twitter).map(([p, T]) => [
2692
- `twitter:${p}`,
2693
- String(T)
2694
- ])
2695
- } : null
2696
- ],
2697
- [
2698
- "JSON-LD",
2699
- A.json_ld.length ? {
2700
- tags: A.json_ld.flatMap((p) => p.types),
2701
- error: A.json_ld.find((p) => p.error)?.error ?? null
2702
- } : null
2703
- ]
2704
- ]
2705
- ]
2706
- ].map(([p, T]) => ({
2707
- title: p,
2708
- facts: T.filter(([, V]) => V != null && V !== "").map(
2709
- ([V, M]) => [V, typeof M == "object" ? M : String(M)]
2710
- )
2711
- })).filter((p) => p.facts.length) : [];
2712
- });
2713
- async function Ue(A) {
2714
- clearTimeout(m), y.value = !1, b.value = null, g.value = null, U.value = null, J.value = null, te.value = null, S.value = "overview";
2715
- try {
2716
- g.value = await o.page(r.run, A);
2717
- } catch (x) {
2718
- U.value = k(x);
2719
- }
2720
- }
2721
- async function Te(A) {
2722
- if (!(r.pageId === null || S.value !== "in" && S.value !== "out")) {
2723
- ee.value = !0;
2724
- try {
2725
- J.value = await o.links(r.run, r.pageId, {
2726
- direction: S.value,
2727
- page: A.page,
2728
- per_page: A.perPage
2729
- });
2730
- } catch (x) {
2731
- U.value = k(x);
2732
- } finally {
2733
- ee.value = !1;
2734
- }
2735
- }
2736
- }
2737
- async function xe(A) {
2738
- const x = K.value;
2739
- if (!(r.pageId === null || x === null)) {
2740
- D.value = !0;
2741
- try {
2742
- te.value = await o.resources(r.run, r.pageId, {
2743
- tab: x,
2744
- page: A.page,
2745
- per_page: A.perPage
2746
- });
2747
- } catch (p) {
2748
- U.value = k(p);
2749
- } finally {
2750
- D.value = !1;
2751
- }
2752
- }
2753
- }
2754
- return de(
2755
- () => r.pageId,
2756
- (A) => {
2757
- A !== null && Ue(A);
2758
- },
2759
- { immediate: !0 }
2760
- ), de(S, () => {
2761
- J.value = null, te.value = null;
2762
- }), (A, x) => (t(), i(e(vt), {
2763
- open: H.value,
2764
- "onUpdate:open": x[2] || (x[2] = (p) => H.value = p),
2765
- size: "min(1100px, 75vw)",
2766
- "min-size": 480,
2767
- resizable: "",
2768
- persist: "webx-audit.page-card-wide"
2769
- }, {
2770
- title: a(() => [
2771
- P("span", Ga, [
2772
- g.value ? (t(), i(_e, {
2773
- key: 0,
2774
- code: g.value.page.status
2775
- }, null, 8, ["code"])) : $("", !0),
2776
- P("span", Ka, s(g.value?.page.url ?? ""), 1)
2777
- ])
2778
- ]),
2779
- extra: a(() => [
2780
- g.value ? (t(), v("span", Ja, [
2781
- e(w) ? (t(), i(e(X), {
2782
- key: 0,
2783
- size: "sm",
2784
- icon: "refresh",
2785
- loading: y.value,
2786
- onClick: z
2787
- }, {
2788
- default: a(() => [
2789
- c(s(e(l)("page.recheck")), 1)
2790
- ]),
2791
- _: 1
2792
- }, 8, ["loading"])) : $("", !0),
2793
- f(e(X), {
2794
- size: "sm",
2795
- variant: "text",
2796
- icon: "download",
2797
- href: e(o).pageFile(r.run, g.value.page.id)
2798
- }, {
2799
- default: a(() => [
2800
- c(s(e(l)("page.export-page")), 1)
2801
- ]),
2802
- _: 1
2803
- }, 8, ["href"]),
2804
- f(e(Oe), {
2805
- href: g.value.page.url,
2806
- target: "_blank"
2807
- }, {
2808
- default: a(() => [
2809
- c(s(e(l)("page.open-page")), 1)
2810
- ]),
2811
- _: 1
2812
- }, 8, ["href"])
2813
- ])) : $("", !0)
2814
- ]),
2815
- default: a(() => [
2816
- U.value ? (t(), i(e(I), {
2817
- key: 0,
2818
- tone: "danger"
2819
- }, {
2820
- default: a(() => [
2821
- c(s(U.value), 1)
2822
- ]),
2823
- _: 1
2824
- })) : g.value ? (t(), v("div", Xa, [
2825
- y.value ? (t(), i(e(ve), {
2826
- key: 0,
2827
- type: "info",
2828
- description: e(l)("page.recheck-running")
2829
- }, null, 8, ["description"])) : b.value && b.value.status === "done" && b.value.counts ? (t(), i(e(ve), {
2830
- key: 1,
2831
- type: b.value.counts.new > 0 ? "warning" : "success"
2832
- }, {
2833
- default: a(() => [
2834
- P("div", Qa, [
2835
- P("span", null, s(e(l)("page.recheck-fixed", { count: b.value.counts.fixed })), 1),
2836
- P("span", null, s(e(l)("page.recheck-new", { count: b.value.counts.new })), 1),
2837
- r.base ? (t(), i(e(X), {
2838
- key: 0,
2839
- size: "sm",
2840
- variant: "text",
2841
- onClick: O
2842
- }, {
2843
- default: a(() => [
2844
- c(s(e(l)("page.recheck-compare")), 1)
2845
- ]),
2846
- _: 1
2847
- })) : $("", !0)
2848
- ])
2849
- ]),
2850
- _: 1
2851
- }, 8, ["type"])) : b.value ? (t(), i(e(ve), {
2852
- key: 2,
2853
- type: "danger",
2854
- description: b.value.error ?? e(l)(`page.status-${b.value.status}`)
2855
- }, null, 8, ["description"])) : $("", !0),
2856
- g.value.page.title ? (t(), i(e(I), {
2857
- key: 3,
2858
- weight: "semibold"
2859
- }, {
2860
- default: a(() => [
2861
- c(s(g.value.page.title), 1)
2862
- ]),
2863
- _: 1
2864
- })) : $("", !0),
2865
- f(e(ft), {
2866
- modelValue: S.value,
2867
- "onUpdate:modelValue": x[1] || (x[1] = (p) => S.value = p),
2868
- items: le.value
2869
- }, {
2870
- default: a(() => [
2871
- S.value === "overview" ? (t(), v("div", Ya, [
2872
- P("div", Za, [
2873
- (t(!0), v(R, null, q(Ce.value, (p) => (t(), v("div", {
2874
- key: p.label,
2875
- class: "wx-audit-card__tile"
2876
- }, [
2877
- f(e(I), {
2878
- size: "sm",
2879
- tone: "muted"
2880
- }, {
2881
- default: a(() => [
2882
- c(s(p.label), 1)
2883
- ]),
2884
- _: 2
2885
- }, 1024),
2886
- p.status !== void 0 ? (t(), i(_e, {
2887
- key: 0,
2888
- code: p.status,
2889
- size: "md"
2890
- }, null, 8, ["code"])) : (t(), i(e(I), {
2891
- key: 1,
2892
- weight: "semibold",
2893
- tone: p.danger ? "danger" : void 0,
2894
- class: "wx-audit-card__number"
2895
- }, {
2896
- default: a(() => [
2897
- c(s(p.value), 1)
2898
- ]),
2899
- _: 2
2900
- }, 1032, ["tone"]))
2901
- ]))), 128))
2902
- ]),
2903
- (t(!0), v(R, null, q(Ie.value, (p) => (t(), v("section", {
2904
- key: p.title,
2905
- class: "wx-audit-card__box"
2906
- }, [
2907
- P("div", es, s(p.title), 1),
2908
- P("dl", ts, [
2909
- (t(!0), v(R, null, q(p.facts, ([T, V]) => (t(), v(R, { key: T }, [
2910
- P("dt", null, s(T), 1),
2911
- typeof V == "string" ? (t(), v("dd", as, s(V), 1)) : "pairs" in V ? (t(), v("dd", ss, [
2912
- (t(!0), v(R, null, q(V.pairs, ([M, Ne], ut) => (t(), v(R, { key: ut }, [
2913
- P("code", ns, s(M), 1),
2914
- P("span", null, s(Ne), 1)
2915
- ], 64))), 128))
2916
- ])) : "headings" in V ? (t(), v("dd", ls, [
2917
- P("span", null, [
2918
- f(e(I), {
2919
- tone: V.hints.length ? "warning" : "success"
2920
- }, {
2921
- default: a(() => [
2922
- c(s(V.hints.length ? e(l)("page.headings-summary-bad", { count: V.headings }) : e(l)("page.headings-summary-ok", { count: V.headings })), 1)
2923
- ]),
2924
- _: 2
2925
- }, 1032, ["tone"]),
2926
- f(e(Oe), {
2927
- as: "button",
2928
- class: "wx-audit-card__heading-open",
2929
- onClick: x[0] || (x[0] = (M) => S.value = "headings")
2930
- }, {
2931
- default: a(() => [
2932
- c(s(e(l)("page.headings-open")), 1)
2933
- ]),
2934
- _: 1
2935
- })
2936
- ]),
2937
- V.hints.length ? (t(), v("ul", is, [
2938
- (t(!0), v(R, null, q(V.hints, (M) => (t(), v("li", { key: M }, s(M), 1))), 128))
2939
- ])) : $("", !0)
2940
- ])) : (t(), v("dd", os, [
2941
- (t(!0), v(R, null, q(V.tags, (M, Ne) => (t(), i(e(G), {
2942
- key: Ne,
2943
- type: "info",
2944
- size: "sm"
2945
- }, {
2946
- default: a(() => [
2947
- c(s(M), 1)
2948
- ]),
2949
- _: 2
2950
- }, 1024))), 128)),
2951
- V.error ? (t(), i(e(I), {
2952
- key: 0,
2953
- size: "sm",
2954
- tone: "danger"
2955
- }, {
2956
- default: a(() => [
2957
- c(s(V.error), 1)
2958
- ]),
2959
- _: 2
2960
- }, 1024)) : $("", !0)
2961
- ]))
2962
- ], 64))), 128))
2963
- ])
2964
- ]))), 128)),
2965
- Object.keys(g.value.page.headers).length ? (t(), v("section", us, [
2966
- P("div", rs, s(e(l)("page.headers")), 1),
2967
- P("dl", ds, [
2968
- (t(!0), v(R, null, q(g.value.page.headers, (p, T) => (t(), v(R, { key: T }, [
2969
- P("dt", cs, s(T), 1),
2970
- P("dd", ps, s(p), 1)
2971
- ], 64))), 128))
2972
- ])
2973
- ])) : $("", !0)
2974
- ])) : S.value === "headings" ? (t(), v("div", gs, [
2975
- f(Da, {
2976
- outline: N.value,
2977
- counts: g.value.page.headings
2978
- }, null, 8, ["outline", "counts"])
2979
- ])) : S.value === "issues" ? (t(), v("div", hs, [
2980
- g.value.issues.length ? $("", !0) : (t(), i(e(I), {
2981
- key: 0,
2982
- tone: "muted"
2983
- }, {
2984
- default: a(() => [
2985
- c(s(e(l)("page.no-issues")), 1)
2986
- ]),
2987
- _: 1
2988
- })),
2989
- (t(!0), v(R, null, q(g.value.issues, (p) => (t(), v("div", {
2990
- key: p.id,
2991
- class: "wx-audit-card__box"
2992
- }, [
2993
- P("div", vs, [
2994
- f(e(G), {
2995
- type: L[p.severity],
2996
- dot: ""
2997
- }, {
2998
- default: a(() => [
2999
- c(s(e(l)(`page.severity-${p.severity}`)), 1)
3000
- ]),
3001
- _: 2
3002
- }, 1032, ["type"]),
3003
- f(e(I), {
3004
- size: "sm",
3005
- weight: "semibold"
3006
- }, {
3007
- default: a(() => [
3008
- c(s(r.titles[p.check] ?? p.check), 1)
3009
- ]),
3010
- _: 2
3011
- }, 1024),
3012
- p.state === "new" ? (t(), i(e(G), {
3013
- key: 0,
3014
- type: "primary",
3015
- size: "sm"
3016
- }, {
3017
- default: a(() => [
3018
- c(s(e(l)("page.state-new")), 1)
3019
- ]),
3020
- _: 1
3021
- })) : $("", !0),
3022
- p.details.count != null && p.details.table ? (t(), i(e(Ae), {
3023
- key: 1,
3024
- content: p.details.summary ?? void 0,
3025
- disabled: !p.details.summary
3026
- }, {
3027
- default: a(() => [
3028
- f(e(G), {
3029
- round: "",
3030
- size: "sm"
3031
- }, {
3032
- default: a(() => [
3033
- c(s(p.details.count), 1)
3034
- ]),
3035
- _: 2
3036
- }, 1024)
3037
- ]),
3038
- _: 2
3039
- }, 1032, ["content", "disabled"])) : $("", !0)
3040
- ]),
3041
- P("div", fs, [
3042
- f(Be, {
3043
- details: p.details,
3044
- counted: p.details.count != null && !!p.details.table
3045
- }, null, 8, ["details", "counted"])
3046
- ])
3047
- ]))), 128))
3048
- ])) : K.value ? (t(), i(e(ke), {
3049
- key: `resources-${String(S.value)}`,
3050
- data: te.value,
3051
- columns: E.value,
3052
- "row-key": "id",
3053
- flush: "",
3054
- loading: D.value,
3055
- "per-page-options": [],
3056
- "empty-text": e(l)("page.no-resources"),
3057
- onStateChange: xe
3058
- }, {
3059
- "cell-url": a(({ row: p }) => [
3060
- K.value === "images" ? (t(), v("span", _s, [
3061
- f(e(_t), {
3062
- src: e(Fe)(p) ? p.url : void 0,
3063
- alt: p.alt ?? "",
3064
- width: 48,
3065
- height: 48,
3066
- fit: "cover",
3067
- radius: "var(--wx-radius-sm)",
3068
- preview: "",
3069
- "preview-label": e(l)("page.view-full"),
3070
- class: Se(["wx-audit-card__thumb", { "is-unviewable": !e(Fe)(p) }])
3071
- }, at({ _: 2 }, [
3072
- e(Fe)(p) ? void 0 : {
3073
- name: "placeholder",
3074
- fn: a(() => [
3075
- f(e(Le), { name: "image" })
3076
- ]),
3077
- key: "0"
3078
- }
3079
- ]), 1032, ["src", "alt", "preview-label", "class"]),
3080
- P("span", ms, s(p.url), 1)
3081
- ])) : (t(), v("span", ys, s(p.url), 1)),
3082
- p.location ? (t(), i(e(I), {
3083
- key: 2,
3084
- size: "sm",
3085
- tone: "muted",
3086
- class: "wx-audit-card__url"
3087
- }, {
3088
- default: a(() => [
3089
- c(" → " + s(p.location), 1)
3090
- ]),
3091
- _: 2
3092
- }, 1024)) : $("", !0),
3093
- p.error ? (t(), i(e(I), {
3094
- key: 3,
3095
- size: "sm",
3096
- tone: "danger"
3097
- }, {
3098
- default: a(() => [
3099
- c(s(p.error), 1)
3100
- ]),
3101
- _: 2
3102
- }, 1024)) : $("", !0)
3103
- ]),
3104
- "cell-status": a(({ row: p }) => [
3105
- p.status !== null || p.checked ? (t(), i(_e, {
3106
- key: 0,
3107
- code: p.status
3108
- }, null, 8, ["code"])) : (t(), i(e(I), {
3109
- key: 1,
3110
- size: "sm",
3111
- tone: "muted"
3112
- }, {
3113
- default: a(() => [
3114
- c(s(e(l)("page.not-checked")), 1)
3115
- ]),
3116
- _: 1
3117
- }))
3118
- ]),
3119
- "cell-bytes": a(({ row: p }) => [
3120
- c(s(he(p)), 1)
3121
- ]),
3122
- "cell-alt": a(({ row: p }) => [
3123
- p.alt === null && p.kind === "img" ? (t(), i(e(I), {
3124
- key: 0,
3125
- size: "sm",
3126
- tone: "danger"
3127
- }, {
3128
- default: a(() => [
3129
- c(s(e(l)("page.missing")), 1)
3130
- ]),
3131
- _: 1
3132
- })) : (t(), v(R, { key: 1 }, [
3133
- c(s(p.alt ?? ""), 1)
3134
- ], 64))
3135
- ]),
3136
- _: 1
3137
- }, 8, ["data", "columns", "loading", "empty-text"])) : S.value === "microdata" ? (t(), v("div", ks, [
3138
- g.value.page.json_ld.length ? $("", !0) : (t(), i(e(I), {
3139
- key: 0,
3140
- tone: "muted"
3141
- }, {
3142
- default: a(() => [
3143
- c(s(e(l)("page.no-json-ld")), 1)
3144
- ]),
3145
- _: 1
3146
- })),
3147
- (t(!0), v(R, null, q(g.value.page.json_ld, (p, T) => (t(), v("div", {
3148
- key: T,
3149
- class: "wx-audit-card__issue"
3150
- }, [
3151
- P("div", ws, [
3152
- f(e(I), {
3153
- size: "sm",
3154
- weight: "semibold"
3155
- }, {
3156
- default: a(() => [
3157
- c(s(e(l)("page.jsonld-block", { number: T + 1 })), 1)
3158
- ]),
3159
- _: 2
3160
- }, 1024),
3161
- (t(!0), v(R, null, q(p.types, (V) => (t(), i(e(G), {
3162
- key: V,
3163
- size: "sm"
3164
- }, {
3165
- default: a(() => [
3166
- c(s(V), 1)
3167
- ]),
3168
- _: 2
3169
- }, 1024))), 128))
3170
- ]),
3171
- p.error ? (t(), i(e(I), {
3172
- key: 0,
3173
- size: "sm",
3174
- tone: "danger"
3175
- }, {
3176
- default: a(() => [
3177
- c(s(e(l)("page.jsonld-error")) + " " + s(p.error), 1)
3178
- ]),
3179
- _: 2
3180
- }, 1024)) : $("", !0),
3181
- (t(!0), v(R, null, q(p.items ?? [], (V, M) => (t(), v(R, { key: M }, [
3182
- V.missing.length ? (t(), i(e(I), {
3183
- key: 0,
3184
- size: "sm",
3185
- tone: "danger"
3186
- }, {
3187
- default: a(() => [
3188
- c(s(V.type) + " — " + s(e(l)("page.jsonld-required")) + " " + s(V.missing.join(", ")), 1)
3189
- ]),
3190
- _: 2
3191
- }, 1024)) : $("", !0),
3192
- V.recommended.length ? (t(), i(e(I), {
3193
- key: 1,
3194
- size: "sm",
3195
- tone: "muted"
3196
- }, {
3197
- default: a(() => [
3198
- c(s(V.type) + " — " + s(e(l)("page.jsonld-recommended")) + " " + s(V.recommended.join(", ")), 1)
3199
- ]),
3200
- _: 2
3201
- }, 1024)) : $("", !0),
3202
- !V.missing.length && !V.recommended.length ? (t(), i(e(I), {
3203
- key: 2,
3204
- size: "sm",
3205
- tone: "success"
3206
- }, {
3207
- default: a(() => [
3208
- c(s(V.type) + " — " + s(e(l)("page.jsonld-complete")), 1)
3209
- ]),
3210
- _: 2
3211
- }, 1024)) : $("", !0)
3212
- ], 64))), 128)),
3213
- p.source ? (t(), v("pre", bs, s(B(p.source)), 1)) : $("", !0)
3214
- ]))), 128))
3215
- ])) : (t(), i(e(ke), {
3216
- key: String(S.value),
3217
- data: J.value,
3218
- columns: j.value,
3219
- "row-key": "id",
3220
- flush: "",
3221
- loading: ee.value,
3222
- "per-page-options": [],
3223
- "empty-text": e(l)("page.no-links"),
3224
- onStateChange: Te
3225
- }, {
3226
- "cell-url": a(({ row: p }) => [
3227
- P("span", xs, s(p.url ?? "—"), 1)
3228
- ]),
3229
- "cell-status": a(({ row: p }) => [
3230
- p.status !== null ? (t(), i(_e, {
3231
- key: 0,
3232
- code: p.status
3233
- }, null, 8, ["code"])) : $("", !0)
3234
- ]),
3235
- "cell-host_class": a(({ row: p }) => [
3236
- p.host_class ? (t(), i(e(G), {
3237
- key: 0,
3238
- type: ge[p.host_class] ?? "info",
3239
- size: "sm"
3240
- }, {
3241
- default: a(() => [
3242
- c(s(e(l)(`page.host-${p.host_class}`)), 1)
3243
- ]),
3244
- _: 2
3245
- }, 1032, ["type"])) : $("", !0)
3246
- ]),
3247
- _: 1
3248
- }, 8, ["data", "columns", "loading", "empty-text"]))
3249
- ]),
3250
- _: 1
3251
- }, 8, ["modelValue", "items"])
3252
- ])) : (t(), i(e(me), {
3253
- key: 1,
3254
- rows: 6
3255
- }))
3256
- ]),
3257
- _: 1
3258
- }, 8, ["open"]));
3259
- }
3260
- }), Ss = /* @__PURE__ */ ne(zs, [["__scopeId", "data-v-b5c4ea4d"]]), ie = {
3261
- url: "url",
3262
- status: "status",
3263
- final_status: "status",
3264
- redirect_to: "url",
3265
- source: "source",
3266
- depth: "number",
3267
- indexable: "bool",
3268
- issues: "number",
3269
- title: "text",
3270
- description: "text",
3271
- h1: "text",
3272
- canonical: "url",
3273
- robots_meta: "text",
3274
- x_robots_tag: "text",
3275
- lang: "text",
3276
- content_type: "text",
3277
- bytes: "number",
3278
- ttfb_ms: "number",
3279
- total_ms: "number",
3280
- compression: "text",
3281
- word_count: "number",
3282
- links_in: "number",
3283
- links_out_internal: "number",
3284
- links_out_external: "number",
3285
- images: "number",
3286
- images_without_alt: "number",
3287
- in_sitemap: "bool",
3288
- in_registry: "bool",
3289
- blocked_by_robots: "bool"
3290
- }, As = [
3291
- "url",
3292
- "status",
3293
- "indexable",
3294
- "title",
3295
- "word_count",
3296
- "links_in",
3297
- "issues"
3298
- ], Qe = ["h1"], Ye = {
3299
- url: ["contains", "eq", "empty", "filled"],
3300
- text: ["contains", "eq", "empty", "filled"],
3301
- number: ["gt", "lt", "eq", "empty"],
3302
- status: ["eq", "gt", "lt", "empty"],
3303
- bool: ["yes", "no"],
3304
- source: ["eq"]
3305
- }, He = ["contains", "eq", "gt", "lt"], Cs = ["home", "sitemap", "registry", "link"], Ps = { class: "wx-audit-pages__filters" }, Ze = "webx-audit.pages.columns", Os = /* @__PURE__ */ ae({
3306
- __name: "AuditPagesPage",
3307
- props: {
3308
- base: {}
3309
- },
3310
- setup(h) {
3311
- const u = h, r = re(oe());
3312
- se();
3313
- const d = Y("webx-audit"), n = Y("webx-admin"), o = ue(), _ = pt(), w = W(null), b = W(!1), y = W(null), m = W(!1), z = W(null), C = W({}), O = W(null), l = W(null), k = W(null), g = W([]);
3314
- let U = { page: 1, perPage: 50, sort: null, search: "" };
3315
- const S = W(J());
3316
- function J() {
3317
- try {
3318
- const x = JSON.parse(window.localStorage.getItem(Ze) ?? "null");
3319
- if (Array.isArray(x)) {
3320
- const p = x.filter((T) => T in ie);
3321
- if (p.length) return p;
3322
- }
3323
- } catch {
3324
- }
3325
- return [...As];
3326
- }
3327
- de(S, (x) => {
3328
- try {
3329
- window.localStorage.setItem(Ze, JSON.stringify(x));
3330
- } catch {
3331
- }
3332
- });
3333
- const ee = Object.keys(ie), te = F(
3334
- () => ee.map((x) => ({ value: x, label: d(`page.field-${x}`) }))
3335
- ), D = F(
3336
- () => ee.filter((x) => !Qe.includes(x)).map((x) => ({ value: x, label: d(`page.field-${x}`) }))
3337
- ), Z = F(
3338
- () => (
3339
- /* The picker keeps the order things were ticked in; the table keeps the card's order. */
3340
- ee.filter((x) => S.value.includes(x)).map((x) => ({
3341
- key: x,
3342
- label: d(`page.field-${x}`),
3343
- sortable: !Qe.includes(x),
3344
- minWidth: ie[x] === "url" || ie[x] === "text" ? 220 : void 0,
3345
- align: ie[x] === "number" ? "right" : void 0
3346
- }))
3347
- )
3348
- ), H = F(() => [
3349
- ...["2xx", "3xx", "4xx", "5xx"].map((x) => ({ value: x, label: x })),
3350
- { value: "none", label: d("page.status-none") }
3351
- ]), le = F(() => [
3352
- { value: "1", label: d("page.indexable-yes") },
3353
- { value: "0", label: d("page.indexable-no") }
3354
- ]), N = F(
3355
- () => Object.entries(C.value).map(([x, p]) => ({ value: x, label: p }))
3356
- ), K = F(
3357
- () => [O.value, l.value, k.value].filter(Boolean).length + g.value.filter(ge).length
3358
- ), L = F(() => ({
3359
- status: O.value,
3360
- indexable: l.value === null ? null : l.value === "1",
3361
- check: k.value,
3362
- filters: g.value.filter(ge)
3363
- }));
3364
- function ge(x) {
3365
- return !He.includes(x.op) || (x.value ?? "").trim() !== "";
3366
- }
3367
- function j(x) {
3368
- return typeof x == "string" && x !== "" ? x : null;
3369
- }
3370
- function E(x) {
3371
- return Ye[ie[x]].map((p) => ({ value: p, label: d(`page.op-${p}`) }));
3372
- }
3373
- function B() {
3374
- g.value = [...g.value, { field: "title", op: "empty" }];
3375
- }
3376
- function he(x, p) {
3377
- const T = j(p);
3378
- T && (g.value = g.value.map(
3379
- (V, M) => M === x ? { field: T, op: Ye[ie[T]][0], value: "" } : V
3380
- ));
3381
- }
3382
- function We(x, p) {
3383
- const T = j(p);
3384
- T && (g.value = g.value.map((V, M) => M === x ? { ...V, op: T } : V));
3385
- }
3386
- function Ce(x, p) {
3387
- g.value = g.value.map((T, V) => V === x ? { ...T, value: p } : T);
3388
- }
3389
- function Ie(x) {
3390
- g.value = g.value.filter((p, T) => T !== x);
3391
- }
3392
- function Ue(x) {
3393
- const p = x.filter((T) => String(T) in ie);
3394
- S.value = p.length ? p : ["url"];
3395
- }
3396
- function Te(x) {
3397
- return x == null || x === "" ? "—" : String(x);
3398
- }
3399
- async function xe(x = U) {
3400
- if (U = x, w.value !== null) {
3401
- m.value = !0;
3402
- try {
3403
- y.value = await r.pages(w.value.id, {
3404
- ...L.value,
3405
- search: x.search,
3406
- sort: x.sort ? `${x.sort.order === "desc" ? "-" : ""}${x.sort.key}` : null,
3407
- page: x.page,
3408
- per_page: x.perPage
3409
- });
3410
- } catch (p) {
3411
- Q.danger(o(p));
3412
- } finally {
3413
- m.value = !1;
3414
- }
3415
- }
3416
- }
3417
- function A() {
3418
- w.value !== null && window.location.assign(
3419
- r.pagesFile(
3420
- w.value.id,
3421
- { ...L.value, search: U.search },
3422
- Z.value.map((x) => x.key)
3423
- )
3424
- );
3425
- }
3426
- return de(L, () => {
3427
- xe({ ...U, page: 1 });
3428
- }, { deep: !0 }), ye(async () => {
3429
- try {
3430
- if (w.value = (await r.latest()).crawled, w.value !== null) {
3431
- const x = await r.checks(w.value.id);
3432
- C.value = Object.fromEntries(x.map((p) => [p.id, p.title]));
3433
- }
3434
- } catch (x) {
3435
- Q.danger(o(x));
3436
- } finally {
3437
- b.value = !0;
3438
- }
3439
- xe();
3440
- }), (x, p) => (t(), i(be, {
3441
- base: u.base,
3442
- current: "pages"
3443
- }, {
3444
- default: a(() => [
3445
- b.value && w.value === null ? (t(), i(e(I), {
3446
- key: 0,
3447
- tone: "muted",
3448
- class: "wx-audit-pages__none"
3449
- }, {
3450
- default: a(() => [
3451
- c(s(e(d)("page.pages-none")), 1)
3452
- ]),
3453
- _: 1
3454
- })) : (t(), i(e(ke), {
3455
- key: 1,
3456
- data: y.value,
3457
- columns: Z.value,
3458
- "row-key": "id",
3459
- searchable: "",
3460
- clickable: "",
3461
- hover: "",
3462
- flush: "",
3463
- loading: m.value || !b.value,
3464
- "per-page-options": [50, 100, 200],
3465
- "search-placeholder": e(d)("page.search-url"),
3466
- "filters-count": K.value,
3467
- "filters-label": e(n)("filters.title"),
3468
- "filters-width": 420,
3469
- "empty-text": e(d)("page.empty"),
3470
- onStateChange: xe,
3471
- onRowClick: p[3] || (p[3] = (T) => z.value = T.id)
3472
- }, at({
3473
- title: a(() => [
3474
- w.value ? (t(), i(e(I), {
3475
- key: 0,
3476
- size: "sm",
3477
- tone: "muted"
3478
- }, {
3479
- default: a(() => [
3480
- c(s(e(d)("page.pages-run", { date: e(_).short(w.value.finished_at) })), 1)
3481
- ]),
3482
- _: 1
3483
- })) : $("", !0)
3484
- ]),
3485
- actions: a(() => [
3486
- f(e(qe), {
3487
- title: e(d)("page.columns"),
3488
- width: "300"
3489
- }, {
3490
- trigger: a(() => [
3491
- f(e(X), {
3492
- size: "sm",
3493
- variant: "text",
3494
- icon: "sliders"
3495
- }, {
3496
- default: a(() => [
3497
- c(s(e(d)("page.columns")), 1)
3498
- ]),
3499
- _: 1
3500
- })
3501
- ]),
3502
- default: a(() => [
3503
- f(e(mt), {
3504
- "model-value": S.value,
3505
- options: te.value,
3506
- size: "sm",
3507
- class: "wx-audit-pages__picker",
3508
- "onUpdate:modelValue": Ue
3509
- }, null, 8, ["model-value", "options"])
3510
- ]),
3511
- _: 1
3512
- }, 8, ["title"]),
3513
- f(e(X), {
3514
- size: "sm",
3515
- variant: "text",
3516
- icon: "download",
3517
- disabled: !w.value,
3518
- onClick: A
3519
- }, {
3520
- default: a(() => [
3521
- c(s(e(d)("page.export")), 1)
3522
- ]),
3523
- _: 1
3524
- }, 8, ["disabled"])
3525
- ]),
3526
- filters: a(() => [
3527
- P("div", Ps, [
3528
- f(e(pe), {
3529
- "model-value": O.value,
3530
- options: H.value,
3531
- placeholder: e(d)("page.any-status"),
3532
- clearable: "",
3533
- "onUpdate:modelValue": p[0] || (p[0] = (T) => O.value = j(T))
3534
- }, null, 8, ["model-value", "options", "placeholder"]),
3535
- f(e(pe), {
3536
- "model-value": l.value,
3537
- options: le.value,
3538
- placeholder: e(d)("page.any-indexable"),
3539
- clearable: "",
3540
- "onUpdate:modelValue": p[1] || (p[1] = (T) => l.value = j(T))
3541
- }, null, 8, ["model-value", "options", "placeholder"]),
3542
- f(e(pe), {
3543
- "model-value": k.value,
3544
- options: N.value,
3545
- placeholder: e(d)("page.any-check"),
3546
- clearable: "",
3547
- filterable: "",
3548
- "onUpdate:modelValue": p[2] || (p[2] = (T) => k.value = j(T))
3549
- }, null, 8, ["model-value", "options", "placeholder"]),
3550
- (t(!0), v(R, null, q(g.value, (T, V) => (t(), v("div", {
3551
- key: V,
3552
- class: "wx-audit-pages__filter"
3553
- }, [
3554
- f(e(pe), {
3555
- "model-value": T.field,
3556
- options: D.value,
3557
- filterable: "",
3558
- size: "sm",
3559
- "onUpdate:modelValue": (M) => he(V, M)
3560
- }, null, 8, ["model-value", "options", "onUpdate:modelValue"]),
3561
- f(e(pe), {
3562
- "model-value": T.op,
3563
- options: E(T.field),
3564
- size: "sm",
3565
- "onUpdate:modelValue": (M) => We(V, M)
3566
- }, null, 8, ["model-value", "options", "onUpdate:modelValue"]),
3567
- e(He).includes(T.op) && e(ie)[T.field] === "source" ? (t(), i(e(pe), {
3568
- key: 0,
3569
- "model-value": T.value ?? null,
3570
- options: e(Cs).map((M) => ({ value: M, label: e(d)(`page.source-${M}`) })),
3571
- size: "sm",
3572
- "onUpdate:modelValue": (M) => Ce(V, j(M) ?? "")
3573
- }, null, 8, ["model-value", "options", "onUpdate:modelValue"])) : e(He).includes(T.op) ? (t(), i(e(nt), {
3574
- key: 1,
3575
- "model-value": T.value ?? "",
3576
- placeholder: e(d)("page.value"),
3577
- size: "sm",
3578
- "onUpdate:modelValue": (M) => Ce(V, String(M ?? ""))
3579
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"])) : $("", !0),
3580
- f(e(X), {
3581
- size: "sm",
3582
- variant: "text",
3583
- icon: "close",
3584
- "aria-label": e(d)("page.remove-filter"),
3585
- onClick: (M) => Ie(V)
3586
- }, null, 8, ["aria-label", "onClick"])
3587
- ]))), 128)),
3588
- f(e(X), {
3589
- size: "sm",
3590
- variant: "text",
3591
- icon: "plus",
3592
- onClick: B
3593
- }, {
3594
- default: a(() => [
3595
- c(s(e(d)("page.add-filter")), 1)
3596
- ]),
3597
- _: 1
3598
- })
3599
- ])
3600
- ]),
3601
- _: 2
3602
- }, [
3603
- q(S.value, (T) => ({
3604
- name: `cell-${T}`,
3605
- fn: a(({ row: V }) => [
3606
- e(ie)[T] === "status" && V[T] !== null ? (t(), i(_e, {
3607
- key: 0,
3608
- code: Number(V[T])
3609
- }, null, 8, ["code"])) : e(ie)[T] === "status" ? (t(), i(e(I), {
3610
- key: 1,
3611
- size: "sm",
3612
- tone: "danger"
3613
- }, {
3614
- default: a(() => [
3615
- c(s(e(d)("page.status-none")), 1)
3616
- ]),
3617
- _: 1
3618
- })) : e(ie)[T] === "bool" ? (t(), v(R, { key: 2 }, [
3619
- c(s(V[T] ? e(d)("page.yes") : e(d)("page.no")), 1)
3620
- ], 64)) : e(ie)[T] === "source" ? (t(), v(R, { key: 3 }, [
3621
- c(s(e(d)(`page.source-${V[T]}`)), 1)
3622
- ], 64)) : T === "issues" && V.issues > 0 ? (t(), i(e(G), {
3623
- key: 4,
3624
- type: "warning",
3625
- size: "sm"
3626
- }, {
3627
- default: a(() => [
3628
- c(s(V.issues), 1)
3629
- ]),
3630
- _: 2
3631
- }, 1024)) : (t(), v("span", {
3632
- key: 5,
3633
- class: Se({ "wx-audit-pages__long": e(ie)[T] === "url" })
3634
- }, s(Te(V[T])), 3))
3635
- ])
3636
- }))
3637
- ]), 1032, ["data", "columns", "loading", "search-placeholder", "filters-count", "filters-label", "empty-text"])),
3638
- w.value ? (t(), i(Ss, {
3639
- key: 2,
3640
- run: w.value.id,
3641
- base: u.base,
3642
- "page-id": z.value,
3643
- titles: C.value,
3644
- onClose: p[4] || (p[4] = (T) => z.value = null)
3645
- }, null, 8, ["run", "base", "page-id", "titles"])) : $("", !0)
3646
- ]),
3647
- _: 1
3648
- }, 8, ["base"]));
3649
- }
3650
- }), Ws = /* @__PURE__ */ ne(Os, [["__scopeId", "data-v-c02a7bc9"]]), Is = { class: "wx-audit-compare" }, Us = /* @__PURE__ */ ae({
3651
- __name: "AuditCompareIssues",
3652
- props: {
3653
- from: {},
3654
- to: {},
3655
- row: {}
3656
- },
3657
- setup(h) {
3658
- const u = h, r = re(oe());
3659
- se();
3660
- const d = Y("webx-audit"), n = ue(), o = ["new", "fixed", "persisting"], _ = W(o.find((O) => u.row[O] > 0) ?? "new"), w = W(null), b = W(1), y = W(!1), m = W(null), z = F(
3661
- () => o.map((O) => ({
3662
- value: O,
3663
- label: `${d(`page.kind-${O}`)} · ${u.row[O]}`,
3664
- disabled: u.row[O] === 0
3665
- }))
3666
- );
3667
- async function C(O = 1) {
3668
- m.value = null;
3669
- try {
3670
- const l = await r.compareIssues({
3671
- from: u.from,
3672
- to: u.to,
3673
- kind: _.value,
3674
- check: u.row.check,
3675
- page: O,
3676
- per_page: 50
3677
- });
3678
- w.value = O === 1 ? l.data : [...w.value ?? [], ...l.data], b.value = l.current_page, y.value = l.current_page < l.last_page;
3679
- } catch (l) {
3680
- m.value = n(l);
3681
- }
3682
- }
3683
- return de(
3684
- _,
3685
- () => {
3686
- w.value = null, C();
3687
- },
3688
- { immediate: !0 }
3689
- ), (O, l) => (t(), v("div", Is, [
3690
- f(e(je), {
3691
- modelValue: _.value,
3692
- "onUpdate:modelValue": l[0] || (l[0] = (k) => _.value = k),
3693
- options: z.value,
3694
- size: "sm",
3695
- "aria-label": e(d)("page.compare")
3696
- }, null, 8, ["modelValue", "options", "aria-label"]),
3697
- m.value ? (t(), i(e(I), {
3698
- key: 0,
3699
- size: "sm",
3700
- tone: "danger"
3701
- }, {
3702
- default: a(() => [
3703
- c(s(m.value), 1)
3704
- ]),
3705
- _: 1
3706
- })) : w.value ? (t(), v(R, { key: 2 }, [
3707
- (t(!0), v(R, null, q(w.value, (k) => (t(), v("div", {
3708
- key: k.id,
3709
- class: "wx-audit-compare__item"
3710
- }, [
3711
- k.url ? (t(), i(e(Oe), {
3712
- key: 0,
3713
- href: k.url,
3714
- target: "_blank",
3715
- class: "wx-audit-compare__url"
3716
- }, {
3717
- default: a(() => [
3718
- c(s(k.url), 1)
3719
- ]),
3720
- _: 2
3721
- }, 1032, ["href"])) : $("", !0),
3722
- f(Be, {
3723
- details: k.details
3724
- }, null, 8, ["details"])
3725
- ]))), 128)),
3726
- y.value ? (t(), i(e(X), {
3727
- key: 0,
3728
- size: "sm",
3729
- variant: "text",
3730
- onClick: l[1] || (l[1] = (k) => C(b.value + 1))
3731
- }, {
3732
- default: a(() => [...l[2] || (l[2] = [
3733
- c("…", -1)
3734
- ])]),
3735
- _: 1
3736
- })) : $("", !0)
3737
- ], 64)) : (t(), i(e(me), {
3738
- key: 1,
3739
- rows: 2
3740
- }))
3741
- ]));
3742
- }
3743
- }), Ts = /* @__PURE__ */ ne(Us, [["__scopeId", "data-v-02d42bdb"]]), Ns = { class: "wx-audit-runs" }, Rs = {
3744
- key: 0,
3745
- class: "wx-audit-runs__counts"
3746
- }, Vs = /* @__PURE__ */ ae({
3747
- __name: "AuditRunsPage",
3748
- props: {
3749
- base: {}
3750
- },
3751
- setup(h) {
3752
- const u = h, r = oe(), d = re(r), n = lt();
3753
- se();
3754
- const o = Y("webx-audit"), _ = ue(), w = W(null), b = W(!1), y = W([]), m = W(null), z = W(!1), C = W([]), O = W(!1), l = r.can("audit.manage"), k = {
3755
- queued: "info",
3756
- running: "primary",
3757
- done: "success",
3758
- failed: "danger",
3759
- cancelled: "warning"
3760
- }, g = {
3761
- error: "danger",
3762
- warning: "warning",
3763
- notice: "info"
3764
- }, U = F(() => [
3765
- { key: "id", label: o("page.run-id"), width: 90 },
3766
- { key: "created_at", label: o("page.started-at"), minWidth: 160 },
3767
- { key: "scope", label: o("page.scope"), width: 120 },
3768
- { key: "status", label: o("page.status"), width: 130 },
3769
- { key: "health", label: o("page.health"), width: 100, align: "right" },
3770
- { key: "severity", label: o("page.severity"), minWidth: 170, hideBelow: 640 },
3771
- { key: "started_by", label: o("page.started-by"), minWidth: 130, hideBelow: 760 }
3772
- ]), S = F(() => [
3773
- { key: "severity", label: o("page.severity"), width: 130 },
3774
- { key: "title", label: o("page.check") },
3775
- { key: "new", label: o("page.kind-new"), width: 90, align: "right" },
3776
- { key: "fixed", label: o("page.kind-fixed"), width: 100, align: "right" },
3777
- { key: "persisting", label: o("page.kind-persisting"), width: 120, align: "right" }
3778
- ]), J = F(() => {
3779
- const N = y.value.map(Number).sort((K, L) => K - L);
3780
- return N.length === 0 ? null : N.length === 1 ? { to: N[0], from: null } : { to: N[N.length - 1], from: N[0] };
3781
- }), ee = F(
3782
- () => m.value !== null && m.value.from.scope !== m.value.to.scope
3783
- );
3784
- function te(N) {
3785
- return N.started_by === "schedule" ? o("page.by-schedule") : N.started_by === "mcp" ? o("page.by-mcp") : N.started_by === "console" ? o("page.by-console") : N.started_by ? o("page.by-person") : "";
3786
- }
3787
- async function D(N) {
3788
- b.value = !0;
3789
- try {
3790
- w.value = await d.runs({ page: N?.page ?? 1, per_page: N?.perPage ?? 20 });
3791
- } catch (K) {
3792
- Q.danger(_(K));
3793
- } finally {
3794
- b.value = !1;
3795
- }
3796
- }
3797
- async function Z() {
3798
- const N = J.value;
3799
- if (m.value = null, C.value = [], !!N) {
3800
- z.value = !0;
3801
- try {
3802
- m.value = await d.compare(N.to, N.from);
3803
- } catch (K) {
3804
- Q.danger(_(K));
3805
- } finally {
3806
- z.value = !1;
3807
- }
3808
- }
3809
- }
3810
- const H = F(
3811
- () => l && w.value?.total ? [
3812
- {
3813
- key: "clear",
3814
- label: o("page.clear"),
3815
- icon: "trash",
3816
- danger: !0,
3817
- disabled: O.value,
3818
- run: () => {
3819
- le();
3820
- }
3821
- }
3822
- ] : []
3823
- );
3824
- async function le() {
3825
- if (await yt({
3826
- title: o("page.clear-title"),
3827
- message: o("page.clear-text"),
3828
- confirmText: o("page.clear-confirm"),
3829
- cancelText: o("page.clear-cancel"),
3830
- tone: "danger"
3831
- })) {
3832
- O.value = !0;
3833
- try {
3834
- await d.clear(), y.value = [], Q.success(o("page.cleared")), await D();
3835
- } catch (K) {
3836
- Q.danger(_(K));
3837
- } finally {
3838
- O.value = !1;
3839
- }
3840
- }
3841
- }
3842
- return ye(() => {
3843
- const N = Number(n.query.to);
3844
- Number.isInteger(N) && N > 0 && (y.value = [N]);
3845
- }), de(y, (N) => {
3846
- N.length > 2 ? y.value = N.slice(-2) : Z();
3847
- }), (N, K) => (t(), i(be, {
3848
- base: u.base,
3849
- current: "runs",
3850
- card: !1,
3851
- actions: H.value
3852
- }, {
3853
- default: a(() => [
3854
- P("div", Ns, [
3855
- f(e(ce), null, {
3856
- default: a(() => [
3857
- !J.value && w.value?.total ? (t(), i(e(ve), {
3858
- key: 0,
3859
- type: "info",
3860
- description: e(o)("page.compare-help"),
3861
- class: "wx-audit-runs__note"
3862
- }, null, 8, ["description"])) : $("", !0),
3863
- f(e(ke), {
3864
- selected: y.value,
3865
- "onUpdate:selected": K[0] || (K[0] = (L) => y.value = L),
3866
- data: w.value,
3867
- columns: U.value,
3868
- "row-key": "id",
3869
- selectable: "",
3870
- "selectable-if": (L) => L.status === "done",
3871
- flush: "",
3872
- loading: b.value,
3873
- "empty-text": e(o)("page.runs-empty"),
3874
- onStateChange: D
3875
- }, {
3876
- "cell-created_at": a(({ row: L }) => [
3877
- f(e($e), {
3878
- value: L.created_at
3879
- }, null, 8, ["value"])
3880
- ]),
3881
- "cell-scope": a(({ row: L }) => [
3882
- c(s(e(o)(`page.scope-${L.scope}`)), 1)
3883
- ]),
3884
- "cell-status": a(({ row: L }) => [
3885
- f(e(G), {
3886
- type: k[L.status],
3887
- dot: ""
3888
- }, {
3889
- default: a(() => [
3890
- c(s(e(o)(`page.status-${L.status}`)), 1)
3891
- ]),
3892
- _: 2
3893
- }, 1032, ["type"])
3894
- ]),
3895
- "cell-health": a(({ row: L }) => [
3896
- c(s(L.counts ? `${L.counts.health}%` : ""), 1)
3897
- ]),
3898
- "cell-severity": a(({ row: L }) => [
3899
- L.counts ? (t(), v("span", Rs, [
3900
- (t(), v(R, null, q(g, (ge, j) => (t(), v(R, { key: j }, [
3901
- L.counts.severity[j] ? (t(), i(e(G), {
3902
- key: 0,
3903
- type: ge,
3904
- size: "sm"
3905
- }, {
3906
- default: a(() => [
3907
- c(s(L.counts.severity[j]), 1)
3908
- ]),
3909
- _: 2
3910
- }, 1032, ["type"])) : $("", !0)
3911
- ], 64))), 64))
3912
- ])) : $("", !0)
3913
- ]),
3914
- "cell-started_by": a(({ row: L }) => [
3915
- c(s(te(L)), 1)
3916
- ]),
3917
- _: 1
3918
- }, 8, ["selected", "data", "columns", "selectable-if", "loading", "empty-text"])
3919
- ]),
3920
- _: 1
3921
- }),
3922
- J.value ? (t(), i(e(ce), {
3923
- key: 0,
3924
- title: e(o)("page.compare")
3925
- }, {
3926
- default: a(() => [
3927
- m.value ? (t(), i(e(I), {
3928
- key: 0,
3929
- size: "sm",
3930
- tone: "muted",
3931
- class: "wx-audit-runs__pair"
3932
- }, {
3933
- default: a(() => [
3934
- c(s(e(o)("page.compare-from")) + " #" + s(m.value.from.id) + " · ", 1),
3935
- f(e($e), {
3936
- value: m.value.from.created_at
3937
- }, null, 8, ["value"]),
3938
- c(" → " + s(e(o)("page.compare-to")) + " #" + s(m.value.to.id) + " · ", 1),
3939
- f(e($e), {
3940
- value: m.value.to.created_at
3941
- }, null, 8, ["value"])
3942
- ]),
3943
- _: 1
3944
- })) : $("", !0),
3945
- ee.value ? (t(), i(e(ve), {
3946
- key: 1,
3947
- type: "info",
3948
- description: e(o)("page.compare-scopes"),
3949
- class: "wx-audit-runs__note"
3950
- }, null, 8, ["description"])) : $("", !0),
3951
- f(e(ke), {
3952
- expanded: C.value,
3953
- "onUpdate:expanded": K[1] || (K[1] = (L) => C.value = L),
3954
- data: m.value?.checks ?? [],
3955
- columns: S.value,
3956
- "row-key": "check",
3957
- expandable: "",
3958
- flush: "",
3959
- pagination: !1,
3960
- loading: z.value,
3961
- "empty-text": e(o)("page.compare-none")
3962
- }, {
3963
- "cell-severity": a(({ row: L }) => [
3964
- f(e(G), {
3965
- type: g[L.severity],
3966
- dot: ""
3967
- }, {
3968
- default: a(() => [
3969
- c(s(e(o)(`page.severity-${L.severity}`)), 1)
3970
- ]),
3971
- _: 2
3972
- }, 1032, ["type"])
3973
- ]),
3974
- "cell-new": a(({ row: L }) => [
3975
- f(e(I), {
3976
- tone: L.new ? "danger" : "muted",
3977
- size: "sm"
3978
- }, {
3979
- default: a(() => [
3980
- c(s(L.new), 1)
3981
- ]),
3982
- _: 2
3983
- }, 1032, ["tone"])
3984
- ]),
3985
- "cell-fixed": a(({ row: L }) => [
3986
- f(e(I), {
3987
- tone: L.fixed ? "success" : "muted",
3988
- size: "sm"
3989
- }, {
3990
- default: a(() => [
3991
- c(s(L.fixed), 1)
3992
- ]),
3993
- _: 2
3994
- }, 1032, ["tone"])
3995
- ]),
3996
- expanded: a(({ row: L }) => [
3997
- m.value ? (t(), i(Ts, {
3998
- key: 0,
3999
- from: m.value.from.id,
4000
- to: m.value.to.id,
4001
- row: L
4002
- }, null, 8, ["from", "to", "row"])) : $("", !0)
4003
- ]),
4004
- _: 1
4005
- }, 8, ["expanded", "data", "columns", "loading", "empty-text"])
4006
- ]),
4007
- _: 1
4008
- }, 8, ["title"])) : $("", !0)
4009
- ])
4010
- ]),
4011
- _: 1
4012
- }, 8, ["base", "actions"]));
4013
- }
4014
- }), Fs = /* @__PURE__ */ ne(Vs, [["__scopeId", "data-v-bbf74c27"]]), Hs = { class: "wx-audit-settings" }, Ls = /* @__PURE__ */ ae({
4015
- __name: "AuditSettingsPage",
4016
- props: {
4017
- base: {}
4018
- },
4019
- setup(h) {
4020
- const u = h, r = oe(), d = re(r);
4021
- se();
4022
- const n = Y("webx-audit"), o = Y("webx-admin"), _ = we(), w = ue(), b = W({}), y = W({}), m = W(!0), z = W(!1), C = r.can("audit.manage");
4023
- ye(async () => {
4024
- try {
4025
- b.value = await d.settings();
4026
- } catch (l) {
4027
- Q.danger(w(l));
4028
- } finally {
4029
- m.value = !1;
4030
- }
4031
- });
4032
- async function O() {
4033
- z.value = !0, y.value = {};
4034
- try {
4035
- b.value = await d.saveSettings(b.value), Q.success(n("page.saved"));
4036
- } catch (l) {
4037
- const k = l.body;
4038
- k?.errors && (y.value = k.errors), Q.danger(w(l));
4039
- } finally {
4040
- z.value = !1;
4041
- }
4042
- }
4043
- return (l, k) => (t(), i(be, {
4044
- base: u.base,
4045
- current: "settings",
4046
- card: !1
4047
- }, {
4048
- default: a(() => [
4049
- P("div", Hs, [
4050
- m.value ? (t(), i(e(me), {
4051
- key: 0,
4052
- rows: 6
4053
- })) : (t(), i(e(gt), {
4054
- key: 1,
4055
- modelValue: b.value,
4056
- "onUpdate:modelValue": k[0] || (k[0] = (g) => b.value = g),
4057
- name: "audit.settings",
4058
- errors: y.value,
4059
- disabled: !e(C)
4060
- }, null, 8, ["modelValue", "errors", "disabled"])),
4061
- m.value ? $("", !0) : (t(), i(e(kt), { key: 2 }, {
4062
- default: a(() => [
4063
- f(e(X), {
4064
- icon: "arrow-left",
4065
- onClick: k[1] || (k[1] = (g) => e(_).push(u.base))
4066
- }, {
4067
- default: a(() => [
4068
- c(s(e(o)("editor.back")), 1)
4069
- ]),
4070
- _: 1
4071
- }),
4072
- e(C) ? (t(), i(e(X), {
4073
- key: 0,
4074
- type: "primary",
4075
- loading: z.value,
4076
- onClick: O
4077
- }, {
4078
- default: a(() => [
4079
- c(s(e(n)("page.save")), 1)
4080
- ]),
4081
- _: 1
4082
- }, 8, ["loading"])) : $("", !0)
4083
- ]),
4084
- _: 1
4085
- }))
4086
- ])
4087
- ]),
4088
- _: 1
4089
- }, 8, ["base"]));
4090
- }
4091
- }), js = /* @__PURE__ */ ne(Ls, [["__scopeId", "data-v-37901757"]]);
4092
- function Ds(h = {}) {
4093
- const u = h.path ?? "/audit", r = { base: u };
4094
- return {
4095
- id: "audit",
4096
- path: u,
4097
- routes: [
4098
- { path: u, name: "webx.audit", component: Fa, props: r },
4099
- { path: `${u}/issues`, name: "webx.audit.issues", component: ba, props: r },
4100
- { path: `${u}/pages`, name: "webx.audit.pages", component: Ws, props: r },
4101
- { path: `${u}/hosts`, name: "webx.audit.hosts", component: Bt, props: r },
4102
- { path: `${u}/runs`, name: "webx.audit.runs", component: Fs, props: r },
4103
- {
4104
- path: `${u}/settings`,
4105
- name: "webx.audit.settings",
4106
- component: js,
4107
- props: r
4108
- }
4109
- ]
4110
- };
4111
- }
1
+ import "vue";
2
+ import { D as i, P as t, e as d, f as u, h as g, i as A, j as P, g as x, k as W, l as r, m as o, n as p, o as D, c as m, p as l } from "./index-BFYHJYU_.js";
4112
3
  export {
4113
- As as DEFAULT_COLUMNS,
4114
- ie as PAGE_FIELDS,
4115
- Be as WxAuditDetails,
4116
- oa as WxAuditHideDialog,
4117
- Bt as WxAuditHostsPage,
4118
- ba as WxAuditIssuesPage,
4119
- Fa as WxAuditOverviewPage,
4120
- Ss as WxAuditPageCard,
4121
- Ws as WxAuditPagesPage,
4122
- Fs as WxAuditRunsPage,
4123
- js as WxAuditSettingsPage,
4124
- Ds as audit,
4125
- Pt as auditMessages,
4126
- re as createAuditApi,
4127
- Ke as pageParams
4
+ i as DEFAULT_COLUMNS,
5
+ t as PAGE_FIELDS,
6
+ d as WxAuditDetails,
7
+ u as WxAuditHideDialog,
8
+ g as WxAuditHostsPage,
9
+ A as WxAuditIssuesPage,
10
+ P as WxAuditOverviewPage,
11
+ x as WxAuditPageCard,
12
+ W as WxAuditPagesPage,
13
+ r as WxAuditRunsPage,
14
+ o as WxAuditSettingsPage,
15
+ p as audit,
16
+ D as auditMessages,
17
+ m as createAuditApi,
18
+ l as pageParams
4128
19
  };
4129
20
  //# sourceMappingURL=index.js.map