@moh-sso/data-validation 0.0.0-stage → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/dist/_types/apps/data-validation/src/api/dqa.api.d.ts +2936 -0
- package/dist/_types/apps/data-validation/src/api/index.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-engine-panel.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-flags-panel.d.ts +3 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-rule-form.d.ts +10 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-rule-mapping-panel.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-rules-panel.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-runs-panel.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-schedule-run-modal.d.ts +11 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-table-form.d.ts +9 -0
- package/dist/_types/apps/data-validation/src/components/dqa/dqa-tables-panel.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/dqa.types.d.ts +144 -0
- package/dist/_types/apps/data-validation/src/index.d.ts +4 -0
- package/dist/_types/apps/data-validation/src/pages/data-validation.page.d.ts +1 -0
- package/dist/_types/apps/data-validation/src/root.component.d.ts +2 -0
- package/dist/_types/apps/data-validation/src/routes.d.ts +2 -0
- package/dist/_types/apps/data-validation/src/single-spa.d.ts +1 -0
- package/dist/_types/packages/api/src/api/baseApi.d.ts +2 -0
- package/dist/_types/packages/api/src/index.d.ts +1 -0
- package/dist/_types/packages/auth/src/api/auth.api.d.ts +531 -0
- package/dist/_types/packages/auth/src/api/health-context.api.d.ts +374 -0
- package/dist/_types/packages/auth/src/auth/AuthBootstrap.d.ts +1 -0
- package/dist/_types/packages/auth/src/auth/HealthContextProvider.d.ts +20 -0
- package/dist/_types/packages/auth/src/auth/PermissionGuard.d.ts +10 -0
- package/dist/_types/packages/auth/src/auth/auth.selectors.d.ts +896 -0
- package/dist/_types/packages/auth/src/auth/auth.slice.d.ts +14 -0
- package/dist/_types/packages/auth/src/auth/auth.types.d.ts +61 -0
- package/dist/_types/packages/auth/src/auth/login-url.d.ts +2 -0
- package/dist/_types/packages/auth/src/auth/permissions.d.ts +58 -0
- package/dist/_types/packages/auth/src/auth/rbac.d.ts +8 -0
- package/dist/_types/packages/auth/src/auth/system-launch-url.d.ts +9 -0
- package/dist/_types/packages/auth/src/auth/useAuthorization.d.ts +14 -0
- package/dist/_types/packages/auth/src/index.d.ts +14 -0
- package/dist/_types/packages/config/src/appMeta.d.ts +3 -0
- package/dist/_types/packages/config/src/index.d.ts +6 -0
- package/dist/_types/packages/config/src/lib/constants/api.constants.d.ts +178 -0
- package/dist/_types/packages/config/src/lib/constants/document-templates.d.ts +11 -0
- package/dist/_types/packages/config/src/lib/errors/errorMessages.d.ts +2 -0
- package/dist/_types/packages/config/src/lib/errors/errorSeverity.d.ts +3 -0
- package/dist/_types/packages/config/src/lib/errors/errorTypes.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/basename.d.ts +1 -0
- package/dist/_types/packages/microfrontend/src/index.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/lifecycle.d.ts +6 -0
- package/dist/_types/packages/microfrontend/src/navigation.d.ts +2 -0
- package/dist/_types/packages/microfrontend/src/props.d.ts +44 -0
- package/dist/_types/packages/microfrontend/src/react-lifecycle.d.ts +11 -0
- package/dist/_types/packages/microfrontend/src/routes.d.ts +13 -0
- package/dist/_types/packages/state/src/clients/clients.selectors.d.ts +534 -0
- package/dist/_types/packages/state/src/clients/clients.slice.d.ts +4 -0
- package/dist/_types/packages/state/src/document/documents.selectors.d.ts +1 -0
- package/dist/_types/packages/state/src/index.d.ts +29 -0
- package/dist/_types/packages/state/src/ui/ui.state.d.ts +1 -0
- package/dist/_types/packages/types/src/index.d.ts +6 -0
- package/dist/_types/packages/types/src/types/announcement-summary.types.d.ts +16 -0
- package/dist/_types/packages/types/src/types/client-role.types.d.ts +6 -0
- package/dist/_types/packages/types/src/types/client.types.d.ts +46 -0
- package/dist/_types/packages/types/src/types/document-processing.types.d.ts +1 -0
- package/dist/_types/packages/types/src/types/notifications.types.d.ts +96 -0
- package/dist/_types/packages/types/src/types/system-navigation.types.d.ts +18 -0
- package/dist/_types/packages/ui/src/accessibility/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/accessibility/useFocusTrap.d.ts +10 -0
- package/dist/_types/packages/ui/src/branding/BuildMeta.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/PublicFooter.d.ts +6 -0
- package/dist/_types/packages/ui/src/branding/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/data-display/DataTablePagination.d.ts +12 -0
- package/dist/_types/packages/ui/src/data-display/DataTableShell.d.ts +35 -0
- package/dist/_types/packages/ui/src/data-display/RowActionsCell.d.ts +7 -0
- package/dist/_types/packages/ui/src/data-display/TableEmptyState.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/TableStatusTag.d.ts +8 -0
- package/dist/_types/packages/ui/src/data-display/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/comingsoon/ComingSoon.d.ts +7 -0
- package/dist/_types/packages/ui/src/feedback/emptystate/EmptyState.d.ts +15 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/ErrorState.d.ts +14 -0
- package/dist/_types/packages/ui/src/feedback/errorstate/MicrofrontendErrorBoundary.d.ts +16 -0
- package/dist/_types/packages/ui/src/feedback/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/feedback/loadingstate/LoadingState.d.ts +5 -0
- package/dist/_types/packages/ui/src/forms/CaseFormsGrid.d.ts +1 -0
- package/dist/_types/packages/ui/src/forms/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/index.d.ts +16 -0
- package/dist/_types/packages/ui/src/layout/PageShell/PageShell.d.ts +9 -0
- package/dist/_types/packages/ui/src/layout/SectionCard/SectionCard.d.ts +11 -0
- package/dist/_types/packages/ui/src/layout/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppGridContent.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenu.component.d.ts +6 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/AppMenuItem.component.d.ts +13 -0
- package/dist/_types/packages/ui/src/navigation/appmenu/appMenuGroups.d.ts +11 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/AppBreadcrumbs.d.ts +12 -0
- package/dist/_types/packages/ui/src/navigation/breadcrumbs/BreadcrumbBar.d.ts +10 -0
- package/dist/_types/packages/ui/src/navigation/index.d.ts +2 -0
- package/dist/_types/packages/ui/src/navigation/sidenav/ClientSideNav.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/FormInlineAlert.d.ts +7 -0
- package/dist/_types/packages/ui/src/notifications/NotificationsPanel.d.ts +14 -0
- package/dist/_types/packages/ui/src/notifications/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/notifications/toast/ToastProvider.d.ts +20 -0
- package/dist/_types/packages/ui/src/notifications/toast/useToast.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/ReusableHeaderPanel.d.ts +17 -0
- package/dist/_types/packages/ui/src/overlays/header-panel/header-panel.context.d.ts +23 -0
- package/dist/_types/packages/ui/src/overlays/index.d.ts +4 -0
- package/dist/_types/packages/ui/src/overlays/modal/ReusableModal.d.ts +20 -0
- package/dist/_types/packages/ui/src/overlays/modal/modal.context.d.ts +14 -0
- package/dist/_types/packages/ui/src/shell/ExternalAppHeader.d.ts +22 -0
- package/dist/_types/packages/ui/src/shell/PublicHeader.component.d.ts +8 -0
- package/dist/_types/packages/ui/src/shell/UserHeader.component.d.ts +17 -0
- package/dist/_types/packages/ui/src/shell/index.d.ts +5 -0
- package/dist/_types/packages/ui/src/theme/ThemeProvider.d.ts +8 -0
- package/dist/_types/packages/ui/src/theme/index.d.ts +1 -0
- package/dist/_types/packages/ui/src/utils/severity.d.ts +22 -0
- package/dist/_types/packages/ui/src/utils/status.d.ts +1 -0
- package/dist/api.js +44 -0
- package/dist/api.js.map +1 -0
- package/dist/assets/data-validation-lOVvOVbh.css +1 -0
- package/dist/assets/dqa.api-CFS6woCz.js +158 -0
- package/dist/assets/dqa.api-CFS6woCz.js.map +1 -0
- package/dist/assets/root.component-Cj9uPVaA.js +981 -0
- package/dist/assets/root.component-Cj9uPVaA.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/routes.d.ts +1 -0
- package/dist/routes.js +33 -0
- package/dist/routes.js.map +1 -0
- package/dist/single-spa.d.ts +1 -0
- package/dist/single-spa.js +32 -0
- package/dist/single-spa.js.map +1 -0
- package/package.json +53 -4
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { useToast as ee, TableStatusTag as X, PageShell as fe } from "@moh-sso/ui";
|
|
3
|
+
import { Select as O, SelectItem as q, Button as R, ComposedModal as te, ModalHeader as ne, ModalBody as le, InlineNotification as G, TableContainer as W, Table as j, TableHead as H, TableRow as A, TableHeader as I, TableBody as J, TableCell as g, Checkbox as ve, ModalFooter as ue, Stack as z, TextInput as M, TextArea as Ce, Toggle as _e, CodeSnippet as oe, DataTable as ae, MultiSelect as Z, ContentSwitcher as ke, Switch as K } from "@carbon/react";
|
|
4
|
+
import { useState as h, useMemo as me, useEffect as we } from "react";
|
|
5
|
+
import { k as re, l as Se, u as xe, b as Te, h as De, o as Ae, c as Re, g as Le, i as $e, m as Ie, n as Qe, a as Pe, j as qe, f as Me, p as Ne, e as ze } from "./dqa.api-CFS6woCz.js";
|
|
6
|
+
import { Add as pe, TrashCan as ge, Play as Ee, ChevronUp as Fe, ChevronDown as Be } from "@carbon/react/icons";
|
|
7
|
+
function Oe() {
|
|
8
|
+
const a = ee(), { data: t = [] } = re(), [u, Q] = h(""), [S, k] = h(null), [i, f] = h(/* @__PURE__ */ new Set()), [C, { isLoading: x }] = Se(), [L, { isLoading: s }] = xe(), _ = async () => {
|
|
9
|
+
if (!u) {
|
|
10
|
+
a.error("Pick a table", "Choose the table you want to map rules onto.");
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const n = await C({ table_id: u }).unwrap();
|
|
15
|
+
k(n), f(new Set(n.filter((m) => m.mappable && !m.already_on_table).map((m) => m.code)));
|
|
16
|
+
} catch {
|
|
17
|
+
a.error("Could not check rules", "Please try again.");
|
|
18
|
+
}
|
|
19
|
+
}, $ = (n) => {
|
|
20
|
+
f((m) => {
|
|
21
|
+
const y = new Set(m);
|
|
22
|
+
return y.has(n) ? y.delete(n) : y.add(n), y;
|
|
23
|
+
});
|
|
24
|
+
}, r = async () => {
|
|
25
|
+
const n = [...i];
|
|
26
|
+
if (n.length === 0) {
|
|
27
|
+
a.error("Nothing selected", "Select at least one rule to apply.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const m = await L({ table_id: u, codes: n }).unwrap();
|
|
32
|
+
m.failed.length > 0 ? a.error(
|
|
33
|
+
"Some rules were not applied",
|
|
34
|
+
`${m.applied.length} applied, ${m.failed.length} failed.`
|
|
35
|
+
) : a.success("Rules applied", `${m.applied.length} rule(s) now run on ${u}.`), k(null), f(/* @__PURE__ */ new Set());
|
|
36
|
+
} catch {
|
|
37
|
+
a.error("Could not apply rules", "Please try again.");
|
|
38
|
+
}
|
|
39
|
+
}, b = S?.filter((n) => n.mappable) ?? [], v = S?.filter((n) => !n.mappable) ?? [];
|
|
40
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
41
|
+
/* @__PURE__ */ e("p", { style: { marginBottom: "1rem", color: "var(--cds-text-secondary)" }, children: "Check the rules that already exist on other tables against a table's column structure, then apply the ones that fit." }),
|
|
42
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", gap: "1rem", alignItems: "flex-end", marginBottom: "1rem" }, children: [
|
|
43
|
+
/* @__PURE__ */ e("div", { style: { minWidth: "20rem" }, children: /* @__PURE__ */ l(
|
|
44
|
+
O,
|
|
45
|
+
{
|
|
46
|
+
id: "dqa-mapping-table",
|
|
47
|
+
labelText: "Map rules onto",
|
|
48
|
+
value: u,
|
|
49
|
+
onChange: (n) => Q(n.target.value),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ e(q, { value: "", text: "Select a table…" }),
|
|
52
|
+
t.map((n) => /* @__PURE__ */ e(q, { value: n.table_id, text: `${n.table_id} → ${n.physical_table}` }, n.table_id))
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
) }),
|
|
56
|
+
/* @__PURE__ */ e(R, { onClick: _, disabled: x, children: x ? "Checking…" : "Check rules" })
|
|
57
|
+
] }),
|
|
58
|
+
S ? /* @__PURE__ */ l(te, { open: !0, size: "lg", onClose: () => k(null), children: [
|
|
59
|
+
/* @__PURE__ */ e(ne, { title: `Rules that can map onto ${u}` }),
|
|
60
|
+
/* @__PURE__ */ l(le, { hasScrollingContent: !0, children: [
|
|
61
|
+
/* @__PURE__ */ e(
|
|
62
|
+
G,
|
|
63
|
+
{
|
|
64
|
+
kind: b.length > 0 ? "success" : "warning",
|
|
65
|
+
title: `${b.length} of ${S.length} rules fit this table`,
|
|
66
|
+
subtitle: v.length > 0 ? `${v.length} cannot be mapped because the table is missing columns they use.` : "Every existing rule compiles against this table.",
|
|
67
|
+
lowContrast: !0,
|
|
68
|
+
hideCloseButton: !0
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ e(W, { title: "Can be mapped", style: { marginTop: "1rem" }, children: /* @__PURE__ */ l(j, { size: "sm", children: [
|
|
72
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ l(A, { children: [
|
|
73
|
+
/* @__PURE__ */ e(I, {}),
|
|
74
|
+
/* @__PURE__ */ e(I, { children: "Code" }),
|
|
75
|
+
/* @__PURE__ */ e(I, { children: "From" }),
|
|
76
|
+
/* @__PURE__ */ e(I, { children: "Type" }),
|
|
77
|
+
/* @__PURE__ */ e(I, { children: "Name" }),
|
|
78
|
+
/* @__PURE__ */ e(I, { children: "Status" })
|
|
79
|
+
] }) }),
|
|
80
|
+
/* @__PURE__ */ e(J, { children: b.length === 0 ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: 6, children: "No existing rule fits this table." }) }) : b.map((n) => /* @__PURE__ */ l(A, { children: [
|
|
81
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
82
|
+
ve,
|
|
83
|
+
{
|
|
84
|
+
id: `map-${n.code}`,
|
|
85
|
+
labelText: "",
|
|
86
|
+
checked: i.has(n.code),
|
|
87
|
+
onChange: () => $(n.code)
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
/* @__PURE__ */ e(g, { children: n.code }),
|
|
91
|
+
/* @__PURE__ */ e(g, { children: n.source_table_id }),
|
|
92
|
+
/* @__PURE__ */ e(g, { children: n.type }),
|
|
93
|
+
/* @__PURE__ */ e(g, { children: n.name || "—" }),
|
|
94
|
+
/* @__PURE__ */ e(g, { children: n.already_on_table ? /* @__PURE__ */ e(X, { status: "already mapped", kind: "blue" }) : /* @__PURE__ */ e(X, { status: "new", kind: "green" }) })
|
|
95
|
+
] }, n.code)) })
|
|
96
|
+
] }) }),
|
|
97
|
+
v.length > 0 ? /* @__PURE__ */ e(W, { title: "Cannot be mapped", style: { marginTop: "1.5rem" }, children: /* @__PURE__ */ l(j, { size: "sm", children: [
|
|
98
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ l(A, { children: [
|
|
99
|
+
/* @__PURE__ */ e(I, { children: "Code" }),
|
|
100
|
+
/* @__PURE__ */ e(I, { children: "From" }),
|
|
101
|
+
/* @__PURE__ */ e(I, { children: "Why not" })
|
|
102
|
+
] }) }),
|
|
103
|
+
/* @__PURE__ */ e(J, { children: v.map((n) => /* @__PURE__ */ l(A, { children: [
|
|
104
|
+
/* @__PURE__ */ e(g, { children: n.code }),
|
|
105
|
+
/* @__PURE__ */ e(g, { children: n.source_table_id }),
|
|
106
|
+
/* @__PURE__ */ e(g, { children: n.reason })
|
|
107
|
+
] }, n.code)) })
|
|
108
|
+
] }) }) : null
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ l(ue, { children: [
|
|
111
|
+
/* @__PURE__ */ e(R, { kind: "secondary", onClick: () => k(null), children: "Cancel" }),
|
|
112
|
+
/* @__PURE__ */ e(R, { kind: "primary", onClick: r, disabled: s || i.size === 0, children: s ? "Applying…" : `Apply ${i.size} rule(s)` })
|
|
113
|
+
] })
|
|
114
|
+
] }) : null
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
const de = [
|
|
118
|
+
{ value: "row_expression", label: "Row expression", description: "Flag rows failing a boolean predicate, e.g. tested >= positive." },
|
|
119
|
+
{ value: "metric", label: "Metric", description: "Measure an aggregate (sum, avg, missing %, …) and compare it to thresholds." },
|
|
120
|
+
{ value: "row_join", label: "Row join", description: "Evaluate a predicate across two row-aligned tables." },
|
|
121
|
+
{ value: "aggregate_compare", label: "Aggregate compare", description: "Compare totals across two tables within a tolerance." },
|
|
122
|
+
{ value: "reference", label: "Reference", description: "Check referential integrity via an anti-join." },
|
|
123
|
+
{ value: "raw_sql", label: "Raw SQL", description: "Escape hatch: a SELECT whose rows are the violations." }
|
|
124
|
+
], se = {
|
|
125
|
+
row_expression: `{
|
|
126
|
+
"expr": "total_tested >= total_positive"
|
|
127
|
+
}`,
|
|
128
|
+
metric: `{
|
|
129
|
+
"metric": "missing_percent",
|
|
130
|
+
"column": "district"
|
|
131
|
+
}`,
|
|
132
|
+
row_join: `{
|
|
133
|
+
"left": "table_a",
|
|
134
|
+
"right": "table_b",
|
|
135
|
+
"join_keys": ["vht_id"],
|
|
136
|
+
"expr": "a.total = b.total"
|
|
137
|
+
}`,
|
|
138
|
+
aggregate_compare: `{
|
|
139
|
+
"left": { "table": "table_a", "agg": "SUM(total)" },
|
|
140
|
+
"right": { "table": "table_b", "agg": "SUM(total)" },
|
|
141
|
+
"op": "=",
|
|
142
|
+
"tolerance": 0.5
|
|
143
|
+
}`,
|
|
144
|
+
reference: `{
|
|
145
|
+
"left": "table_a",
|
|
146
|
+
"right": "table_b",
|
|
147
|
+
"join_keys": ["vht_id"]
|
|
148
|
+
}`,
|
|
149
|
+
raw_sql: `{
|
|
150
|
+
"fail_query": "SELECT * FROM report.my_table WHERE total < 0"
|
|
151
|
+
}`
|
|
152
|
+
};
|
|
153
|
+
function We(a) {
|
|
154
|
+
if (!a.trim()) return { value: {} };
|
|
155
|
+
try {
|
|
156
|
+
const t = JSON.parse(a);
|
|
157
|
+
return typeof t != "object" || t === null || Array.isArray(t) ? { error: "Definition must be a JSON object." } : { value: t };
|
|
158
|
+
} catch (t) {
|
|
159
|
+
return { error: t instanceof Error ? t.message : "Invalid JSON" };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function je({ tableOptions: a, initialRule: t, isSubmitting: u, onSubmit: Q, onClose: S }) {
|
|
163
|
+
const [k, i] = h(t?.code ?? ""), [f, C] = h(t?.table_id ?? a[0] ?? ""), [x, L] = h(t?.type ?? "row_expression"), [s, _] = h(t?.category ?? "custom"), [$, r] = h(t?.name ?? ""), [b, v] = h(t?.row_filter ?? ""), [n, m] = h(t?.zones?.warn ?? ""), [y, D] = h(t?.zones?.fail ?? "when > 0"), [o, T] = h(t?.enabled ?? !0), [w, p] = h(
|
|
164
|
+
t ? JSON.stringify(t.definition ?? {}, null, 2) : se[x]
|
|
165
|
+
), [P, { isLoading: c }] = Te(), [N, E] = h(null), U = me(() => de.find((d) => d.value === x), [x]), V = () => {
|
|
166
|
+
if (!k.trim()) return { error: "Code is required." };
|
|
167
|
+
if (!f.trim()) return { error: "Table is required." };
|
|
168
|
+
const d = We(w);
|
|
169
|
+
return d.error ? { error: `Definition: ${d.error}` } : {
|
|
170
|
+
input: {
|
|
171
|
+
code: k.trim(),
|
|
172
|
+
table_id: f.trim(),
|
|
173
|
+
type: x,
|
|
174
|
+
category: s.trim() || "custom",
|
|
175
|
+
name: $.trim(),
|
|
176
|
+
enabled: o,
|
|
177
|
+
row_filter: b.trim() || void 0,
|
|
178
|
+
zones: { warn: n.trim(), fail: y.trim() },
|
|
179
|
+
definition: d.value ?? {}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}, Y = async () => {
|
|
183
|
+
const { input: d, error: F } = V();
|
|
184
|
+
if (F || !d) {
|
|
185
|
+
E({ error: F });
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const B = await P(d).unwrap();
|
|
190
|
+
E({ sql: B.measure_sql, sample: B.sample_sql });
|
|
191
|
+
} catch (B) {
|
|
192
|
+
const ye = B && typeof B == "object" && "data" in B ? (
|
|
193
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
194
|
+
B.data?.error?.message ?? "Compile failed"
|
|
195
|
+
) : "Compile failed";
|
|
196
|
+
E({ error: String(ye) });
|
|
197
|
+
}
|
|
198
|
+
}, be = async () => {
|
|
199
|
+
const { input: d, error: F } = V();
|
|
200
|
+
if (F || !d) {
|
|
201
|
+
E({ error: F });
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
await Q(d);
|
|
205
|
+
};
|
|
206
|
+
return /* @__PURE__ */ l(z, { gap: 5, children: [
|
|
207
|
+
/* @__PURE__ */ e(
|
|
208
|
+
M,
|
|
209
|
+
{
|
|
210
|
+
id: "dqa-rule-code",
|
|
211
|
+
labelText: "Code",
|
|
212
|
+
placeholder: "e.g. MAL-04",
|
|
213
|
+
value: k,
|
|
214
|
+
disabled: !!t,
|
|
215
|
+
onChange: (d) => i(d.target.value)
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
a.length > 0 ? /* @__PURE__ */ e(
|
|
219
|
+
O,
|
|
220
|
+
{
|
|
221
|
+
id: "dqa-rule-table",
|
|
222
|
+
labelText: "Table",
|
|
223
|
+
value: f,
|
|
224
|
+
disabled: !!t,
|
|
225
|
+
onChange: (d) => C(d.target.value),
|
|
226
|
+
children: a.map((d) => /* @__PURE__ */ e(q, { value: d, text: d }, d))
|
|
227
|
+
}
|
|
228
|
+
) : /* @__PURE__ */ e(
|
|
229
|
+
M,
|
|
230
|
+
{
|
|
231
|
+
id: "dqa-rule-table-text",
|
|
232
|
+
labelText: "Table ID",
|
|
233
|
+
helperText: "No tables are registered yet — register one in the Tables tab first.",
|
|
234
|
+
value: f,
|
|
235
|
+
disabled: !!t,
|
|
236
|
+
onChange: (d) => C(d.target.value)
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ e(
|
|
240
|
+
O,
|
|
241
|
+
{
|
|
242
|
+
id: "dqa-rule-type",
|
|
243
|
+
labelText: "Rule type",
|
|
244
|
+
value: x,
|
|
245
|
+
disabled: !!t,
|
|
246
|
+
onChange: (d) => {
|
|
247
|
+
const F = d.target.value;
|
|
248
|
+
L(F), t || p(se[F]);
|
|
249
|
+
},
|
|
250
|
+
children: de.map((d) => /* @__PURE__ */ e(q, { value: d.value, text: d.label }, d.value))
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
U ? /* @__PURE__ */ e("p", { style: { fontSize: "0.75rem", color: "var(--cds-text-secondary)", marginTop: "-1rem" }, children: U.description }) : null,
|
|
254
|
+
/* @__PURE__ */ e(
|
|
255
|
+
M,
|
|
256
|
+
{
|
|
257
|
+
id: "dqa-rule-category",
|
|
258
|
+
labelText: "Category",
|
|
259
|
+
placeholder: "e.g. malaria",
|
|
260
|
+
value: s,
|
|
261
|
+
onChange: (d) => _(d.target.value)
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ e(
|
|
265
|
+
M,
|
|
266
|
+
{
|
|
267
|
+
id: "dqa-rule-name",
|
|
268
|
+
labelText: "Name / description",
|
|
269
|
+
value: $,
|
|
270
|
+
onChange: (d) => r(d.target.value)
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ e(
|
|
274
|
+
M,
|
|
275
|
+
{
|
|
276
|
+
id: "dqa-rule-row-filter",
|
|
277
|
+
labelText: "Row filter (optional WHERE predicate)",
|
|
278
|
+
placeholder: "e.g. district IS NOT NULL",
|
|
279
|
+
value: b,
|
|
280
|
+
onChange: (d) => v(d.target.value)
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
/* @__PURE__ */ e(
|
|
284
|
+
Ce,
|
|
285
|
+
{
|
|
286
|
+
id: "dqa-rule-definition",
|
|
287
|
+
labelText: "Definition (JSON)",
|
|
288
|
+
rows: 6,
|
|
289
|
+
value: w,
|
|
290
|
+
onChange: (d) => p(d.target.value)
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
/* @__PURE__ */ l(z, { orientation: "horizontal", gap: 5, children: [
|
|
294
|
+
/* @__PURE__ */ e(
|
|
295
|
+
M,
|
|
296
|
+
{
|
|
297
|
+
id: "dqa-rule-warn",
|
|
298
|
+
labelText: "Warn zone",
|
|
299
|
+
placeholder: "when > 5",
|
|
300
|
+
value: n,
|
|
301
|
+
onChange: (d) => m(d.target.value)
|
|
302
|
+
}
|
|
303
|
+
),
|
|
304
|
+
/* @__PURE__ */ e(
|
|
305
|
+
M,
|
|
306
|
+
{
|
|
307
|
+
id: "dqa-rule-fail",
|
|
308
|
+
labelText: "Fail zone",
|
|
309
|
+
placeholder: "when > 0",
|
|
310
|
+
value: y,
|
|
311
|
+
onChange: (d) => D(d.target.value)
|
|
312
|
+
}
|
|
313
|
+
)
|
|
314
|
+
] }),
|
|
315
|
+
/* @__PURE__ */ e(
|
|
316
|
+
_e,
|
|
317
|
+
{
|
|
318
|
+
id: "dqa-rule-enabled",
|
|
319
|
+
labelText: "Enabled",
|
|
320
|
+
toggled: o,
|
|
321
|
+
onToggle: (d) => T(d)
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ e(R, { kind: "tertiary", onClick: Y, disabled: c, children: c ? "Compiling…" : "Preview compiled SQL" }),
|
|
325
|
+
N?.error ? /* @__PURE__ */ e(G, { kind: "error", title: "Compile failed", subtitle: N.error, lowContrast: !0, hideCloseButton: !0 }) : null,
|
|
326
|
+
N?.sql ? /* @__PURE__ */ l("div", { children: [
|
|
327
|
+
/* @__PURE__ */ e("p", { style: { fontSize: "0.75rem", marginBottom: "0.25rem" }, children: "Measure SQL" }),
|
|
328
|
+
/* @__PURE__ */ e(oe, { type: "multi", feedback: "Copied", children: N.sql }),
|
|
329
|
+
N.sample ? /* @__PURE__ */ l(ie, { children: [
|
|
330
|
+
/* @__PURE__ */ e("p", { style: { fontSize: "0.75rem", margin: "0.75rem 0 0.25rem" }, children: "Sample SQL (failing rows)" }),
|
|
331
|
+
/* @__PURE__ */ e(oe, { type: "multi", feedback: "Copied", children: N.sample })
|
|
332
|
+
] }) : null
|
|
333
|
+
] }) : null,
|
|
334
|
+
/* @__PURE__ */ l(z, { orientation: "horizontal", gap: 4, children: [
|
|
335
|
+
/* @__PURE__ */ e(R, { kind: "primary", onClick: be, disabled: u, children: u ? "Saving…" : t ? "Save changes" : "Create rule" }),
|
|
336
|
+
/* @__PURE__ */ e(R, { kind: "ghost", onClick: S, children: "Cancel" })
|
|
337
|
+
] })
|
|
338
|
+
] });
|
|
339
|
+
}
|
|
340
|
+
const He = [
|
|
341
|
+
{ key: "enabled", header: "" },
|
|
342
|
+
{ key: "code", header: "Code" },
|
|
343
|
+
{ key: "table_id", header: "Table" },
|
|
344
|
+
{ key: "type", header: "Type" },
|
|
345
|
+
{ key: "category", header: "Category" },
|
|
346
|
+
{ key: "name", header: "Name" },
|
|
347
|
+
{ key: "actions", header: "" }
|
|
348
|
+
];
|
|
349
|
+
function Je() {
|
|
350
|
+
const a = ee(), [t, u] = h(null), { data: Q = [] } = re(), [S, k] = h(""), { data: i = [], isLoading: f } = De({ tableId: S || void 0 }), [C, { isLoading: x }] = Ae(), [L] = Re(), s = Q.map((r) => r.table_id), _ = async (r) => {
|
|
351
|
+
try {
|
|
352
|
+
await C(r).unwrap(), a.success("Rule saved", `${r.code} is now active on ${r.table_id}.`), u(null);
|
|
353
|
+
} catch {
|
|
354
|
+
a.error("Rule not saved", "Check the definition JSON and try again.");
|
|
355
|
+
}
|
|
356
|
+
}, $ = i.map((r) => ({
|
|
357
|
+
id: `${r.table_id}:${r.code}`,
|
|
358
|
+
enabled: r.enabled,
|
|
359
|
+
code: r.code,
|
|
360
|
+
table_id: r.table_id,
|
|
361
|
+
type: r.type,
|
|
362
|
+
category: r.category,
|
|
363
|
+
name: r.name || "—",
|
|
364
|
+
raw: r
|
|
365
|
+
}));
|
|
366
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
367
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginBottom: "1rem" }, children: [
|
|
368
|
+
/* @__PURE__ */ e("div", { style: { minWidth: "16rem" }, children: /* @__PURE__ */ l(O, { id: "dqa-rules-table-filter", labelText: "Filter by table", value: S, onChange: (r) => k(r.target.value), children: [
|
|
369
|
+
/* @__PURE__ */ e(q, { value: "", text: "All tables" }),
|
|
370
|
+
s.map((r) => /* @__PURE__ */ e(q, { value: r, text: r }, r))
|
|
371
|
+
] }) }),
|
|
372
|
+
/* @__PURE__ */ e(R, { renderIcon: pe, onClick: () => u({ mode: "create" }), children: "Add rule" })
|
|
373
|
+
] }),
|
|
374
|
+
f ? /* @__PURE__ */ e("p", { children: "Loading…" }) : /* @__PURE__ */ e(ae, { rows: $, headers: He, children: ({ rows: r, headers: b, getHeaderProps: v, getRowProps: n, getTableProps: m }) => /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(j, { ...m(), size: "sm", children: [
|
|
375
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(A, { children: b.map((y) => {
|
|
376
|
+
const { key: D, ...o } = v({ header: y });
|
|
377
|
+
return /* @__PURE__ */ e(I, { ...o, children: y.header }, D);
|
|
378
|
+
}) }) }),
|
|
379
|
+
/* @__PURE__ */ e(J, { children: r.length === 0 ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: b.length, children: "No rules yet." }) }) : r.map((y) => {
|
|
380
|
+
const D = i.find((w) => `${w.table_id}:${w.code}` === y.id), { key: o, ...T } = n({ row: y });
|
|
381
|
+
return /* @__PURE__ */ e(A, { ...T, children: y.cells.map((w) => w.info.header === "enabled" ? /* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(X, { status: w.value ? "on" : "off", kind: w.value ? "green" : "gray" }) }, w.id) : w.info.header === "actions" ? /* @__PURE__ */ e(g, { children: /* @__PURE__ */ l("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
382
|
+
/* @__PURE__ */ e(
|
|
383
|
+
R,
|
|
384
|
+
{
|
|
385
|
+
kind: "ghost",
|
|
386
|
+
size: "sm",
|
|
387
|
+
onClick: () => D && u({ mode: "edit", rule: D }),
|
|
388
|
+
children: "Edit"
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
/* @__PURE__ */ e(
|
|
392
|
+
R,
|
|
393
|
+
{
|
|
394
|
+
kind: "ghost",
|
|
395
|
+
size: "sm",
|
|
396
|
+
hasIconOnly: !0,
|
|
397
|
+
iconDescription: "Delete",
|
|
398
|
+
renderIcon: ge,
|
|
399
|
+
onClick: () => D && L({ tableId: D.table_id, code: D.code })
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
] }) }, w.id) : /* @__PURE__ */ e(g, { children: String(w.value) }, w.id)) }, o);
|
|
403
|
+
}) })
|
|
404
|
+
] }) }) }),
|
|
405
|
+
t ? /* @__PURE__ */ l(te, { open: !0, size: "lg", onClose: () => u(null), children: [
|
|
406
|
+
/* @__PURE__ */ e(
|
|
407
|
+
ne,
|
|
408
|
+
{
|
|
409
|
+
title: t.mode === "edit" ? `Edit rule: ${t.rule.code}` : "Add DQA rule"
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
/* @__PURE__ */ e(le, { hasScrollingContent: !0, children: /* @__PURE__ */ e(
|
|
413
|
+
je,
|
|
414
|
+
{
|
|
415
|
+
tableOptions: s,
|
|
416
|
+
initialRule: t.mode === "edit" ? t.rule : void 0,
|
|
417
|
+
isSubmitting: x,
|
|
418
|
+
onSubmit: _,
|
|
419
|
+
onClose: () => u(null)
|
|
420
|
+
},
|
|
421
|
+
t.mode === "edit" ? `${t.rule.table_id}:${t.rule.code}` : "new"
|
|
422
|
+
) })
|
|
423
|
+
] }) : null
|
|
424
|
+
] });
|
|
425
|
+
}
|
|
426
|
+
const Ue = [
|
|
427
|
+
{ key: "severity", header: "Severity" },
|
|
428
|
+
{ key: "rule_code", header: "Rule" },
|
|
429
|
+
{ key: "category", header: "Category" },
|
|
430
|
+
{ key: "entity_name", header: "Entity" },
|
|
431
|
+
{ key: "district", header: "District" },
|
|
432
|
+
{ key: "period_date", header: "Period" },
|
|
433
|
+
{ key: "detail", header: "Detail" }
|
|
434
|
+
];
|
|
435
|
+
function Ve({ runId: a }) {
|
|
436
|
+
const [t, u] = h(""), { data: Q = [], isLoading: S } = Le({ runId: a, severity: t || void 0 }), k = Q.map((i) => ({
|
|
437
|
+
id: String(i.id),
|
|
438
|
+
severity: i.severity,
|
|
439
|
+
rule_code: i.rule_code,
|
|
440
|
+
category: i.category,
|
|
441
|
+
entity_name: i.entity_name || i.entity_id || "—",
|
|
442
|
+
district: i.district || "—",
|
|
443
|
+
period_date: i.period_date || "—",
|
|
444
|
+
detail: i.detail
|
|
445
|
+
}));
|
|
446
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
447
|
+
/* @__PURE__ */ e("div", { style: { marginBottom: "1rem", maxWidth: "16rem" }, children: /* @__PURE__ */ l(
|
|
448
|
+
O,
|
|
449
|
+
{
|
|
450
|
+
id: "dqa-flags-severity",
|
|
451
|
+
labelText: "Filter by severity",
|
|
452
|
+
value: t,
|
|
453
|
+
onChange: (i) => u(i.target.value),
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ e(q, { value: "", text: "All" }),
|
|
456
|
+
/* @__PURE__ */ e(q, { value: "fail", text: "Fail" }),
|
|
457
|
+
/* @__PURE__ */ e(q, { value: "warn", text: "Warn" })
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
) }),
|
|
461
|
+
S ? /* @__PURE__ */ e("p", { children: "Loading…" }) : /* @__PURE__ */ e(ae, { rows: k, headers: Ue, children: ({ rows: i, headers: f, getHeaderProps: C, getRowProps: x, getTableProps: L }) => /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(j, { ...L(), size: "sm", children: [
|
|
462
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(A, { children: f.map((s) => {
|
|
463
|
+
const { key: _, ...$ } = C({ header: s });
|
|
464
|
+
return /* @__PURE__ */ e(I, { ...$, children: s.header }, _);
|
|
465
|
+
}) }) }),
|
|
466
|
+
/* @__PURE__ */ e(J, { children: i.length === 0 ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: f.length, children: "No flags for this run." }) }) : i.map((s) => {
|
|
467
|
+
const { key: _, ...$ } = x({ row: s });
|
|
468
|
+
return /* @__PURE__ */ e(A, { ...$, children: s.cells.map(
|
|
469
|
+
(r) => r.info.header === "severity" ? /* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(
|
|
470
|
+
X,
|
|
471
|
+
{
|
|
472
|
+
status: String(r.value),
|
|
473
|
+
kind: r.value === "fail" ? "red" : "magenta"
|
|
474
|
+
}
|
|
475
|
+
) }, r.id) : /* @__PURE__ */ e(g, { children: r.value }, r.id)
|
|
476
|
+
) }, _);
|
|
477
|
+
}) })
|
|
478
|
+
] }) }) })
|
|
479
|
+
] });
|
|
480
|
+
}
|
|
481
|
+
const ce = [
|
|
482
|
+
"January",
|
|
483
|
+
"February",
|
|
484
|
+
"March",
|
|
485
|
+
"April",
|
|
486
|
+
"May",
|
|
487
|
+
"June",
|
|
488
|
+
"July",
|
|
489
|
+
"August",
|
|
490
|
+
"September",
|
|
491
|
+
"October",
|
|
492
|
+
"November",
|
|
493
|
+
"December"
|
|
494
|
+
];
|
|
495
|
+
function Ye() {
|
|
496
|
+
const a = (/* @__PURE__ */ new Date()).getFullYear();
|
|
497
|
+
return Array.from({ length: 5 }, (t, u) => a - u);
|
|
498
|
+
}
|
|
499
|
+
function Ge({
|
|
500
|
+
table: a,
|
|
501
|
+
isRunning: t,
|
|
502
|
+
isScheduling: u,
|
|
503
|
+
onRunNow: Q,
|
|
504
|
+
onRunLater: S,
|
|
505
|
+
onClose: k
|
|
506
|
+
}) {
|
|
507
|
+
const [i, f] = h([]), [C, x] = h([]), [L, s] = h({}), [_, $] = h(""), [r, b] = h(null), v = a.filter_columns ?? [], n = !!a.period_column, m = me(() => {
|
|
508
|
+
const p = [];
|
|
509
|
+
for (const P of i)
|
|
510
|
+
for (const c of C)
|
|
511
|
+
p.push({ year: P, month: ce.indexOf(c) + 1 });
|
|
512
|
+
return p;
|
|
513
|
+
}, [i, C]), y = () => {
|
|
514
|
+
const p = Object.entries(L).filter(([, P]) => P.trim() !== "").map(([P, c]) => ({ column: P, value: c.trim() }));
|
|
515
|
+
return { periods: m, filters: p };
|
|
516
|
+
}, D = () => i.length > 0 && C.length === 0 ? (b("Pick at least one month to go with the selected year(s)."), !1) : C.length > 0 && i.length === 0 ? (b("Pick at least one year to go with the selected month(s)."), !1) : (b(null), !0), o = async () => {
|
|
517
|
+
D() && await Q(y());
|
|
518
|
+
}, T = async () => {
|
|
519
|
+
if (!D()) return;
|
|
520
|
+
if (!_) {
|
|
521
|
+
b("Pick the date and time the run should execute.");
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const p = new Date(_);
|
|
525
|
+
if (Number.isNaN(p.getTime())) {
|
|
526
|
+
b("That date and time could not be read.");
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
if (p.getTime() <= Date.now()) {
|
|
530
|
+
b("The execution time is in the past.");
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
await S(y(), p);
|
|
534
|
+
}, w = t || u;
|
|
535
|
+
return /* @__PURE__ */ l(te, { open: !0, size: "lg", onClose: k, children: [
|
|
536
|
+
/* @__PURE__ */ e(ne, { title: `Schedule a run for ${a.table_id}` }),
|
|
537
|
+
/* @__PURE__ */ e(le, { hasScrollingContent: !0, children: /* @__PURE__ */ l(z, { gap: 5, children: [
|
|
538
|
+
/* @__PURE__ */ e("p", { style: { color: "var(--cds-text-secondary)" }, children: "Choose the data this scan should cover. Leave everything blank to scan the whole table." }),
|
|
539
|
+
n ? /* @__PURE__ */ l(z, { orientation: "horizontal", gap: 4, children: [
|
|
540
|
+
/* @__PURE__ */ e("div", { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
541
|
+
Z,
|
|
542
|
+
{
|
|
543
|
+
id: "dqa-scope-years",
|
|
544
|
+
titleText: "Years",
|
|
545
|
+
label: i.length ? `${i.length} selected` : "Any year",
|
|
546
|
+
items: Ye(),
|
|
547
|
+
itemToString: (p) => String(p),
|
|
548
|
+
selectedItems: i,
|
|
549
|
+
onChange: ({ selectedItems: p }) => f(p ?? [])
|
|
550
|
+
}
|
|
551
|
+
) }),
|
|
552
|
+
/* @__PURE__ */ e("div", { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
553
|
+
Z,
|
|
554
|
+
{
|
|
555
|
+
id: "dqa-scope-months",
|
|
556
|
+
titleText: "Months",
|
|
557
|
+
label: C.length ? `${C.length} selected` : "Any month",
|
|
558
|
+
items: ce,
|
|
559
|
+
selectedItems: C,
|
|
560
|
+
onChange: ({ selectedItems: p }) => x(p ?? [])
|
|
561
|
+
}
|
|
562
|
+
) })
|
|
563
|
+
] }) : /* @__PURE__ */ e(
|
|
564
|
+
G,
|
|
565
|
+
{
|
|
566
|
+
kind: "info",
|
|
567
|
+
title: "No period column configured",
|
|
568
|
+
subtitle: `Set a period column on ${a.table_id} to scope runs by month.`,
|
|
569
|
+
lowContrast: !0,
|
|
570
|
+
hideCloseButton: !0
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
m.length > 0 ? /* @__PURE__ */ l("p", { style: { fontSize: "0.75rem", color: "var(--cds-text-secondary)" }, children: [
|
|
574
|
+
"Scanning ",
|
|
575
|
+
m.length,
|
|
576
|
+
" period",
|
|
577
|
+
m.length === 1 ? "" : "s",
|
|
578
|
+
"."
|
|
579
|
+
] }) : null,
|
|
580
|
+
v.length > 0 ? /* @__PURE__ */ e(z, { gap: 4, children: v.map((p) => /* @__PURE__ */ e(
|
|
581
|
+
M,
|
|
582
|
+
{
|
|
583
|
+
id: `dqa-scope-filter-${p}`,
|
|
584
|
+
labelText: p,
|
|
585
|
+
placeholder: "Any value",
|
|
586
|
+
value: L[p] ?? "",
|
|
587
|
+
onChange: (P) => s((c) => ({ ...c, [p]: P.target.value }))
|
|
588
|
+
},
|
|
589
|
+
p
|
|
590
|
+
)) }) : /* @__PURE__ */ e("p", { style: { fontSize: "0.75rem", color: "var(--cds-text-secondary)" }, children: "No filter columns are configured for this table." }),
|
|
591
|
+
/* @__PURE__ */ e(
|
|
592
|
+
M,
|
|
593
|
+
{
|
|
594
|
+
id: "dqa-schedule-at",
|
|
595
|
+
type: "datetime-local",
|
|
596
|
+
labelText: "Run later: date and time",
|
|
597
|
+
helperText: "Leave empty and press Run now to scan immediately.",
|
|
598
|
+
value: _,
|
|
599
|
+
onChange: (p) => $(p.target.value)
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
r ? /* @__PURE__ */ e(G, { kind: "error", title: "Check the form", subtitle: r, lowContrast: !0, hideCloseButton: !0 }) : null
|
|
603
|
+
] }) }),
|
|
604
|
+
/* @__PURE__ */ l(ue, { children: [
|
|
605
|
+
/* @__PURE__ */ e(R, { kind: "secondary", onClick: k, disabled: w, children: "Cancel" }),
|
|
606
|
+
/* @__PURE__ */ e(R, { kind: "tertiary", onClick: T, disabled: w, children: u ? "Scheduling…" : "Run later" }),
|
|
607
|
+
/* @__PURE__ */ e(R, { kind: "primary", onClick: o, disabled: w, children: t ? "Running…" : "Run now" })
|
|
608
|
+
] })
|
|
609
|
+
] });
|
|
610
|
+
}
|
|
611
|
+
const Ke = [
|
|
612
|
+
{ key: "expand", header: "" },
|
|
613
|
+
{ key: "table_id", header: "Table" },
|
|
614
|
+
{ key: "run_at", header: "Run at" },
|
|
615
|
+
{ key: "rules_evaluated", header: "Rules" },
|
|
616
|
+
{ key: "total_flags", header: "Flags" },
|
|
617
|
+
{ key: "errors", header: "Fails" },
|
|
618
|
+
{ key: "warnings", header: "Warns" },
|
|
619
|
+
{ key: "triggered_by", header: "Triggered by" }
|
|
620
|
+
];
|
|
621
|
+
function Xe() {
|
|
622
|
+
const { data: a = [] } = re(), [t, u] = h(""), { data: Q = [], isLoading: S } = $e({ tableId: t || void 0 }), [k, { isLoading: i }] = Ie(), [f, { isLoading: C }] = Qe(), [x] = Pe(), { data: L = [] } = qe({ status: "pending" }), [s, _] = h(null), [$, r] = h(!1), b = ee(), v = a.find((o) => o.table_id === t), n = () => {
|
|
623
|
+
if (!t) {
|
|
624
|
+
b.error("Select a table", "Choose a table to scan first.");
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
r(!0);
|
|
628
|
+
}, m = async (o) => {
|
|
629
|
+
try {
|
|
630
|
+
const T = await k({ tableId: t, scope: o }).unwrap();
|
|
631
|
+
b.success(
|
|
632
|
+
"Scan complete",
|
|
633
|
+
`${T.rules_evaluated} rule(s) evaluated, ${T.total_flags} flag(s) (${T.fails} fail, ${T.warns} warn).`
|
|
634
|
+
), r(!1);
|
|
635
|
+
} catch {
|
|
636
|
+
b.error("Scan failed", "Check the table mapping and rule definitions, then try again.");
|
|
637
|
+
}
|
|
638
|
+
}, y = async (o, T) => {
|
|
639
|
+
try {
|
|
640
|
+
await f({
|
|
641
|
+
table_id: t,
|
|
642
|
+
scope: o,
|
|
643
|
+
scheduled_at: T.toISOString()
|
|
644
|
+
}).unwrap(), b.success("Run scheduled", `${t} will be scanned at ${T.toLocaleString()}.`), r(!1);
|
|
645
|
+
} catch {
|
|
646
|
+
b.error("Could not schedule the run", "Check the period and filters, then try again.");
|
|
647
|
+
}
|
|
648
|
+
}, D = Q.map((o) => ({
|
|
649
|
+
id: String(o.id),
|
|
650
|
+
expand: "",
|
|
651
|
+
table_id: o.table_id,
|
|
652
|
+
run_at: new Date(o.run_at).toLocaleString(),
|
|
653
|
+
rules_evaluated: o.rules_evaluated,
|
|
654
|
+
total_flags: o.total_flags,
|
|
655
|
+
errors: o.errors,
|
|
656
|
+
warnings: o.warnings,
|
|
657
|
+
triggered_by: o.triggered_by || "—"
|
|
658
|
+
}));
|
|
659
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
660
|
+
/* @__PURE__ */ l("div", { style: { display: "flex", gap: "1rem", alignItems: "flex-end", marginBottom: "1.5rem", flexWrap: "wrap" }, children: [
|
|
661
|
+
/* @__PURE__ */ e("div", { style: { minWidth: "16rem" }, children: /* @__PURE__ */ l(
|
|
662
|
+
O,
|
|
663
|
+
{
|
|
664
|
+
id: "dqa-runs-table-filter",
|
|
665
|
+
labelText: "Table",
|
|
666
|
+
value: t,
|
|
667
|
+
onChange: (o) => u(o.target.value),
|
|
668
|
+
children: [
|
|
669
|
+
/* @__PURE__ */ e(q, { value: "", text: "All tables" }),
|
|
670
|
+
a.map((o) => /* @__PURE__ */ e(q, { value: o.table_id, text: o.table_id }, o.table_id))
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
) }),
|
|
674
|
+
/* @__PURE__ */ e(R, { renderIcon: Ee, onClick: n, disabled: i || !t, children: "Schedule run" })
|
|
675
|
+
] }),
|
|
676
|
+
L.length > 0 ? /* @__PURE__ */ e("div", { style: { marginBottom: "1.5rem" }, children: /* @__PURE__ */ e(W, { title: "Scheduled runs", description: "Queued scans that have not executed yet.", children: /* @__PURE__ */ l(j, { size: "sm", children: [
|
|
677
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ l(A, { children: [
|
|
678
|
+
/* @__PURE__ */ e(I, { children: "Table" }),
|
|
679
|
+
/* @__PURE__ */ e(I, { children: "Scheduled for" }),
|
|
680
|
+
/* @__PURE__ */ e(I, { children: "Scope" }),
|
|
681
|
+
/* @__PURE__ */ e(I, { children: "Created by" }),
|
|
682
|
+
/* @__PURE__ */ e(I, {})
|
|
683
|
+
] }) }),
|
|
684
|
+
/* @__PURE__ */ e(J, { children: L.map((o) => /* @__PURE__ */ l(A, { children: [
|
|
685
|
+
/* @__PURE__ */ e(g, { children: o.table_id }),
|
|
686
|
+
/* @__PURE__ */ e(g, { children: new Date(o.scheduled_at).toLocaleString() }),
|
|
687
|
+
/* @__PURE__ */ l(g, { children: [
|
|
688
|
+
o.scope?.periods?.length ? `${o.scope.periods.length} period(s)` : "Whole table",
|
|
689
|
+
o.scope?.filters?.length ? `, ${o.scope.filters.length} filter(s)` : ""
|
|
690
|
+
] }),
|
|
691
|
+
/* @__PURE__ */ e(g, { children: o.created_by || "—" }),
|
|
692
|
+
/* @__PURE__ */ e(g, { children: /* @__PURE__ */ e(R, { kind: "ghost", size: "sm", onClick: () => x(o.id), children: "Cancel" }) })
|
|
693
|
+
] }, o.id)) })
|
|
694
|
+
] }) }) }) : null,
|
|
695
|
+
$ && v ? /* @__PURE__ */ e(
|
|
696
|
+
Ge,
|
|
697
|
+
{
|
|
698
|
+
table: v,
|
|
699
|
+
isRunning: i,
|
|
700
|
+
isScheduling: C,
|
|
701
|
+
onRunNow: m,
|
|
702
|
+
onRunLater: y,
|
|
703
|
+
onClose: () => r(!1)
|
|
704
|
+
}
|
|
705
|
+
) : null,
|
|
706
|
+
S ? /* @__PURE__ */ e("p", { children: "Loading…" }) : /* @__PURE__ */ e(ae, { rows: D, headers: Ke, children: ({ rows: o, headers: T, getHeaderProps: w, getRowProps: p, getTableProps: P }) => /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(j, { ...P(), size: "sm", children: [
|
|
707
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(A, { children: T.map((c) => {
|
|
708
|
+
const { key: N, ...E } = w({ header: c });
|
|
709
|
+
return /* @__PURE__ */ e(I, { ...E, children: c.header }, N);
|
|
710
|
+
}) }) }),
|
|
711
|
+
/* @__PURE__ */ e(J, { children: o.length === 0 ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: T.length, children: "No runs yet." }) }) : o.map((c) => {
|
|
712
|
+
const { key: N, ...E } = p({ row: c }), U = Number(c.id), V = s === U;
|
|
713
|
+
return /* @__PURE__ */ l(ie, { children: [
|
|
714
|
+
/* @__PURE__ */ e(
|
|
715
|
+
A,
|
|
716
|
+
{
|
|
717
|
+
...E,
|
|
718
|
+
style: { cursor: "pointer" },
|
|
719
|
+
onClick: () => _(V ? null : U),
|
|
720
|
+
children: c.cells.map(
|
|
721
|
+
(Y) => Y.info.header === "expand" ? /* @__PURE__ */ e(g, { children: V ? /* @__PURE__ */ e(Fe, { size: 16 }) : /* @__PURE__ */ e(Be, { size: 16 }) }, Y.id) : /* @__PURE__ */ e(g, { children: Y.value }, Y.id)
|
|
722
|
+
)
|
|
723
|
+
},
|
|
724
|
+
N
|
|
725
|
+
),
|
|
726
|
+
V ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: T.length, children: /* @__PURE__ */ e(Ve, { runId: U }) }) }, `${N}-flags`) : null
|
|
727
|
+
] });
|
|
728
|
+
}) })
|
|
729
|
+
] }) }) })
|
|
730
|
+
] });
|
|
731
|
+
}
|
|
732
|
+
function Ze({ initialTable: a, isSubmitting: t, onSubmit: u, onClose: Q }) {
|
|
733
|
+
const [S, k] = h(a?.table_id ?? ""), [i, f] = h(a?.physical_table ?? ""), [C, x] = h(a?.description ?? ""), [L, s] = h(a?.period_column ?? ""), [_, $] = h(a?.dim_columns ?? []), [r, b] = h(a?.filter_columns ?? []), [v, n] = h(null), [m, { data: y = [], isFetching: D, isError: o }] = Me();
|
|
734
|
+
we(() => {
|
|
735
|
+
a?.physical_table && m(a.physical_table);
|
|
736
|
+
}, [a?.physical_table, m]);
|
|
737
|
+
const T = y.map((c) => c.name), w = T.length > 0, p = () => {
|
|
738
|
+
const c = i.trim();
|
|
739
|
+
if (!c) {
|
|
740
|
+
n("Enter the physical table first.");
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
n(null), m(c);
|
|
744
|
+
}, P = async () => {
|
|
745
|
+
if (!S.trim() || !i.trim()) {
|
|
746
|
+
n("Table ID and physical table are required.");
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
n(null), await u({
|
|
750
|
+
table_id: S.trim(),
|
|
751
|
+
physical_table: i.trim(),
|
|
752
|
+
description: C.trim(),
|
|
753
|
+
is_active: a?.is_active ?? !0,
|
|
754
|
+
period_column: L || void 0,
|
|
755
|
+
dim_columns: _,
|
|
756
|
+
filter_columns: r
|
|
757
|
+
});
|
|
758
|
+
};
|
|
759
|
+
return /* @__PURE__ */ l(z, { gap: 5, children: [
|
|
760
|
+
/* @__PURE__ */ e(
|
|
761
|
+
M,
|
|
762
|
+
{
|
|
763
|
+
id: "dqa-table-id",
|
|
764
|
+
labelText: "Table ID",
|
|
765
|
+
helperText: "The logical name rules refer to, e.g. vht_monthly",
|
|
766
|
+
value: S,
|
|
767
|
+
disabled: !!a,
|
|
768
|
+
onChange: (c) => k(c.target.value)
|
|
769
|
+
}
|
|
770
|
+
),
|
|
771
|
+
/* @__PURE__ */ l(z, { orientation: "horizontal", gap: 4, style: { alignItems: "flex-end" }, children: [
|
|
772
|
+
/* @__PURE__ */ e("div", { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
773
|
+
M,
|
|
774
|
+
{
|
|
775
|
+
id: "dqa-table-physical",
|
|
776
|
+
labelText: "Physical table (schema.table)",
|
|
777
|
+
placeholder: "e.g. report.cht_form_097b_with_vhts",
|
|
778
|
+
value: i,
|
|
779
|
+
onChange: (c) => f(c.target.value)
|
|
780
|
+
}
|
|
781
|
+
) }),
|
|
782
|
+
/* @__PURE__ */ e(R, { kind: "tertiary", onClick: p, disabled: D, children: D ? "Loading…" : "Load columns" })
|
|
783
|
+
] }),
|
|
784
|
+
/* @__PURE__ */ e(
|
|
785
|
+
M,
|
|
786
|
+
{
|
|
787
|
+
id: "dqa-table-description",
|
|
788
|
+
labelText: "Description",
|
|
789
|
+
value: C,
|
|
790
|
+
onChange: (c) => x(c.target.value)
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
o ? /* @__PURE__ */ e(
|
|
794
|
+
G,
|
|
795
|
+
{
|
|
796
|
+
kind: "error",
|
|
797
|
+
title: "Table not found",
|
|
798
|
+
subtitle: "Check the schema and table name, then load the columns again.",
|
|
799
|
+
lowContrast: !0,
|
|
800
|
+
hideCloseButton: !0
|
|
801
|
+
}
|
|
802
|
+
) : null,
|
|
803
|
+
w ? /* @__PURE__ */ l(ie, { children: [
|
|
804
|
+
/* @__PURE__ */ l(
|
|
805
|
+
O,
|
|
806
|
+
{
|
|
807
|
+
id: "dqa-table-period-column",
|
|
808
|
+
labelText: "Period column",
|
|
809
|
+
helperText: "Used to scope a run to a reporting period",
|
|
810
|
+
value: L,
|
|
811
|
+
onChange: (c) => s(c.target.value),
|
|
812
|
+
children: [
|
|
813
|
+
/* @__PURE__ */ e(q, { value: "", text: "— none —" }),
|
|
814
|
+
y.map((c) => /* @__PURE__ */ e(q, { value: c.name, text: `${c.name} (${c.type})` }, c.name))
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ e(
|
|
819
|
+
Z,
|
|
820
|
+
{
|
|
821
|
+
id: "dqa-table-dim-columns",
|
|
822
|
+
titleText: "Dimension columns to keep",
|
|
823
|
+
helperText: "Stored on every flag. Leave empty to keep every identifying column.",
|
|
824
|
+
label: _.length ? `${_.length} selected` : "Select columns",
|
|
825
|
+
items: T,
|
|
826
|
+
selectedItems: _,
|
|
827
|
+
onChange: ({ selectedItems: c }) => $(c ?? [])
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ e(
|
|
831
|
+
Z,
|
|
832
|
+
{
|
|
833
|
+
id: "dqa-table-filter-columns",
|
|
834
|
+
titleText: "Filter columns",
|
|
835
|
+
helperText: "Offered as filters when a run is launched, e.g. VHT or facility.",
|
|
836
|
+
label: r.length ? `${r.length} selected` : "Select columns",
|
|
837
|
+
items: T,
|
|
838
|
+
selectedItems: r,
|
|
839
|
+
onChange: ({ selectedItems: c }) => b(c ?? [])
|
|
840
|
+
}
|
|
841
|
+
)
|
|
842
|
+
] }) : /* @__PURE__ */ e("p", { style: { fontSize: "0.75rem", color: "var(--cds-text-secondary)" }, children: "Load the columns to choose the period, dimension and filter columns." }),
|
|
843
|
+
v ? /* @__PURE__ */ e(G, { kind: "error", title: "Check the form", subtitle: v, lowContrast: !0, hideCloseButton: !0 }) : null,
|
|
844
|
+
/* @__PURE__ */ l(z, { orientation: "horizontal", gap: 4, children: [
|
|
845
|
+
/* @__PURE__ */ e(R, { kind: "primary", onClick: P, disabled: t, children: t ? "Saving…" : a ? "Save changes" : "Register table" }),
|
|
846
|
+
/* @__PURE__ */ e(R, { kind: "ghost", onClick: Q, children: "Cancel" })
|
|
847
|
+
] })
|
|
848
|
+
] });
|
|
849
|
+
}
|
|
850
|
+
const et = [
|
|
851
|
+
{ key: "table_id", header: "Table ID" },
|
|
852
|
+
{ key: "physical_table", header: "Physical table" },
|
|
853
|
+
{ key: "period_column", header: "Period column" },
|
|
854
|
+
{ key: "dim_columns", header: "Dimensions" },
|
|
855
|
+
{ key: "filter_columns", header: "Filters" },
|
|
856
|
+
{ key: "actions", header: "" }
|
|
857
|
+
];
|
|
858
|
+
function tt() {
|
|
859
|
+
const { data: a = [], isLoading: t } = re(), [u, { isLoading: Q }] = Ne(), [S] = ze(), k = ee(), [i, f] = h(null), C = async (s) => {
|
|
860
|
+
try {
|
|
861
|
+
await u(s).unwrap(), k.success("Table saved", `${s.table_id} now maps to ${s.physical_table}.`), f(null);
|
|
862
|
+
} catch {
|
|
863
|
+
k.error("Could not save table mapping", "Please try again.");
|
|
864
|
+
}
|
|
865
|
+
}, x = (s) => s.length === 0 ? "All" : s.length <= 2 ? s.join(", ") : `${s.length} columns`, L = a.map((s) => ({
|
|
866
|
+
id: s.table_id,
|
|
867
|
+
table_id: s.table_id,
|
|
868
|
+
physical_table: s.physical_table,
|
|
869
|
+
period_column: s.period_column || "—",
|
|
870
|
+
dim_columns: x(s.dim_columns ?? []),
|
|
871
|
+
filter_columns: x(s.filter_columns ?? [])
|
|
872
|
+
}));
|
|
873
|
+
return /* @__PURE__ */ l("div", { children: [
|
|
874
|
+
/* @__PURE__ */ l("p", { style: { marginBottom: "1rem", color: "var(--cds-text-secondary)" }, children: [
|
|
875
|
+
"Register a logical table_id used by rules to the real DWH table it scans, e.g.",
|
|
876
|
+
" ",
|
|
877
|
+
/* @__PURE__ */ e("code", { children: "vht_monthly" }),
|
|
878
|
+
" → ",
|
|
879
|
+
/* @__PURE__ */ e("code", { children: "report.echis_vht_monthly" }),
|
|
880
|
+
"."
|
|
881
|
+
] }),
|
|
882
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-end", marginBottom: "1.5rem" }, children: /* @__PURE__ */ e(R, { renderIcon: pe, onClick: () => f({ mode: "create" }), children: "Register table" }) }),
|
|
883
|
+
t ? /* @__PURE__ */ e("p", { children: "Loading…" }) : /* @__PURE__ */ e(ae, { rows: L, headers: et, children: ({ rows: s, headers: _, getHeaderProps: $, getRowProps: r, getTableProps: b }) => /* @__PURE__ */ e(W, { children: /* @__PURE__ */ l(j, { ...b(), children: [
|
|
884
|
+
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(A, { children: _.map((v) => {
|
|
885
|
+
const { key: n, ...m } = $({ header: v });
|
|
886
|
+
return /* @__PURE__ */ e(I, { ...m, children: v.header }, n);
|
|
887
|
+
}) }) }),
|
|
888
|
+
/* @__PURE__ */ e(J, { children: s.length === 0 ? /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(g, { colSpan: _.length, children: "No tables registered yet." }) }) : s.map((v) => {
|
|
889
|
+
const { key: n, ...m } = r({ row: v });
|
|
890
|
+
return /* @__PURE__ */ e(A, { ...m, children: v.cells.map(
|
|
891
|
+
(y) => y.info.header === "actions" ? /* @__PURE__ */ e(g, { children: /* @__PURE__ */ l("div", { style: { display: "flex", gap: "0.5rem" }, children: [
|
|
892
|
+
/* @__PURE__ */ e(
|
|
893
|
+
R,
|
|
894
|
+
{
|
|
895
|
+
kind: "ghost",
|
|
896
|
+
size: "sm",
|
|
897
|
+
onClick: () => {
|
|
898
|
+
const D = a.find((o) => o.table_id === v.id);
|
|
899
|
+
D && f({ mode: "edit", table: D });
|
|
900
|
+
},
|
|
901
|
+
children: "Configure"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
/* @__PURE__ */ e(
|
|
905
|
+
R,
|
|
906
|
+
{
|
|
907
|
+
kind: "ghost",
|
|
908
|
+
size: "sm",
|
|
909
|
+
hasIconOnly: !0,
|
|
910
|
+
iconDescription: "Remove",
|
|
911
|
+
renderIcon: ge,
|
|
912
|
+
onClick: () => S(v.id)
|
|
913
|
+
}
|
|
914
|
+
)
|
|
915
|
+
] }) }, y.id) : /* @__PURE__ */ e(g, { children: y.value }, y.id)
|
|
916
|
+
) }, n);
|
|
917
|
+
}) })
|
|
918
|
+
] }) }) }),
|
|
919
|
+
i ? /* @__PURE__ */ l(te, { open: !0, size: "lg", onClose: () => f(null), children: [
|
|
920
|
+
/* @__PURE__ */ e(
|
|
921
|
+
ne,
|
|
922
|
+
{
|
|
923
|
+
title: i.mode === "edit" ? `Configure ${i.table.table_id}` : "Register a table"
|
|
924
|
+
}
|
|
925
|
+
),
|
|
926
|
+
/* @__PURE__ */ e(le, { hasScrollingContent: !0, children: /* @__PURE__ */ e(
|
|
927
|
+
Ze,
|
|
928
|
+
{
|
|
929
|
+
initialTable: i.mode === "edit" ? i.table : void 0,
|
|
930
|
+
isSubmitting: Q,
|
|
931
|
+
onSubmit: C,
|
|
932
|
+
onClose: () => f(null)
|
|
933
|
+
},
|
|
934
|
+
i.mode === "edit" ? i.table.table_id : "new"
|
|
935
|
+
) })
|
|
936
|
+
] }) : null
|
|
937
|
+
] });
|
|
938
|
+
}
|
|
939
|
+
const he = ["tables", "rules", "mapping", "runs"];
|
|
940
|
+
function nt() {
|
|
941
|
+
const [a, t] = h("tables");
|
|
942
|
+
return /* @__PURE__ */ l("div", { className: "dqa-engine-panel", children: [
|
|
943
|
+
/* @__PURE__ */ e("p", { style: { marginBottom: "1rem", color: "var(--cds-text-secondary)" }, children: "The DQA engine compiles declarative rules to SQL and runs them directly against the DWH. Register a table, add or seed rules, then trigger a scan." }),
|
|
944
|
+
/* @__PURE__ */ l(
|
|
945
|
+
ke,
|
|
946
|
+
{
|
|
947
|
+
selectedIndex: he.indexOf(a),
|
|
948
|
+
onChange: ({ index: u }) => t(he[u ?? 0]),
|
|
949
|
+
style: { marginBottom: "1.5rem", maxWidth: "32rem" },
|
|
950
|
+
children: [
|
|
951
|
+
/* @__PURE__ */ e(K, { name: "tables", text: "Tables" }),
|
|
952
|
+
/* @__PURE__ */ e(K, { name: "rules", text: "Rules" }),
|
|
953
|
+
/* @__PURE__ */ e(K, { name: "mapping", text: "Rule mapping" }),
|
|
954
|
+
/* @__PURE__ */ e(K, { name: "runs", text: "Runs & flags" })
|
|
955
|
+
]
|
|
956
|
+
}
|
|
957
|
+
),
|
|
958
|
+
a === "tables" ? /* @__PURE__ */ e(tt, {}) : null,
|
|
959
|
+
a === "rules" ? /* @__PURE__ */ e(Je, {}) : null,
|
|
960
|
+
a === "mapping" ? /* @__PURE__ */ e(Oe, {}) : null,
|
|
961
|
+
a === "runs" ? /* @__PURE__ */ e(Xe, {}) : null
|
|
962
|
+
] });
|
|
963
|
+
}
|
|
964
|
+
function lt() {
|
|
965
|
+
return /* @__PURE__ */ e("div", { className: "data-validation-page", children: /* @__PURE__ */ e(nt, {}) });
|
|
966
|
+
}
|
|
967
|
+
function ct(a) {
|
|
968
|
+
return /* @__PURE__ */ e("div", { className: "moh-microfrontend-root", children: /* @__PURE__ */ e(
|
|
969
|
+
fe,
|
|
970
|
+
{
|
|
971
|
+
title: "Data Validation",
|
|
972
|
+
subtitle: "Manage validation rules, run data quality checks, and review flagged records.",
|
|
973
|
+
children: /* @__PURE__ */ e(lt, {})
|
|
974
|
+
}
|
|
975
|
+
) });
|
|
976
|
+
}
|
|
977
|
+
export {
|
|
978
|
+
lt as D,
|
|
979
|
+
ct as a
|
|
980
|
+
};
|
|
981
|
+
//# sourceMappingURL=root.component-Cj9uPVaA.js.map
|