@declarion/react 0.255.0 → 0.302.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-lib/components/detail-layout/DetailHighlights.js +40 -40
- package/dist-lib/components/detail-layout/useQuickAdd.js +45 -47
- package/dist-lib/components/fields/EnumField.js +25 -25
- package/dist-lib/components/fields/cells/factories/badge.js +14 -27
- package/dist-lib/components/fields/cells/factories/statusPill.js +13 -26
- package/dist-lib/components/fields/cells/factories/tagList.js +13 -26
- package/dist-lib/components/pages/SmartDetailPage.impl.js +416 -415
- package/dist-lib/components/pages/auth/AuthShell.js +57 -76
- package/dist-lib/components/pages/list/ListCardRow.js +66 -66
- package/dist-lib/components/pages/list/columns.js +89 -89
- package/dist-lib/components/pages/profile/Profile.impl.js +130 -126
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +107 -109
- package/dist-lib/components/params/ParamsBlock.js +42 -37
- package/dist-lib/components/params/param-editors.js +20 -33
- package/dist-lib/components/primitives/Pill.js +36 -15
- package/dist-lib/components/shared/StatusGroupsDisplay.js +49 -49
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/hooks/useDeclaredEnum.js +38 -0
- package/dist-lib/index.d.ts +34 -12
- package/dist-lib/index.js +123 -122
- package/dist-lib/lib/evidence-verdict.js +6 -5
- package/dist-lib/lib/fill-from.js +15 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/{useResponsiveMode-CgwjOaEE.d.ts → useResponsiveMode-CBSHZBY5.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -4,104 +4,102 @@ import { Btn as n } from "../../primitives/Btn.js";
|
|
|
4
4
|
import { Spinner as r } from "../../primitives/Spinner.js";
|
|
5
5
|
import { Select as i, TextInput as a } from "../../primitives/Fields.js";
|
|
6
6
|
import { BoolToggle as o } from "../../primitives/BoolToggle.js";
|
|
7
|
-
import { useAllParams as s, useCarrierParamOverrides as
|
|
8
|
-
import { useAuthStore as
|
|
9
|
-
import { EditParamDialog as
|
|
10
|
-
import { useResponsiveMode as
|
|
11
|
-
import { PageHeader as
|
|
12
|
-
import { PageShell as
|
|
7
|
+
import { useAllParams as s, useCarrierParamOverrides as c } from "../../../hooks/useParams.js";
|
|
8
|
+
import { useAuthStore as l } from "../../../stores/auth.js";
|
|
9
|
+
import { EditParamDialog as ee, ErrorLine as u, ResetParamControl as d, ValuePreview as f, paramTenantEditable as p, useParamRefLabels as m } from "../../params/param-editors.js";
|
|
10
|
+
import { useResponsiveMode as h } from "../../../hooks/useResponsiveMode.js";
|
|
11
|
+
import { PageHeader as g } from "../../chrome/PageHeader.js";
|
|
12
|
+
import { PageShell as te } from "../../chrome/PageShell.js";
|
|
13
13
|
import { dataTableCellStyle as _, dataTableHeadCellStyle as v, dataTableStyle as y } from "../../primitives/dataTableStyles.js";
|
|
14
14
|
import { useText as b } from "../../../hooks/useText.js";
|
|
15
15
|
import { useSchema as x } from "../../../hooks/useSchema.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { useDeclaredEnum as S } from "../../../hooks/useDeclaredEnum.js";
|
|
17
|
+
import { useMemo as C, useState as w } from "react";
|
|
18
|
+
import { jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
18
19
|
// src/components/pages/tenant-params/TenantParamsPage.impl.tsx
|
|
19
|
-
var
|
|
20
|
+
var D = "my_tenant", ne = [
|
|
20
21
|
"yaml",
|
|
21
22
|
"env",
|
|
22
23
|
"tenant"
|
|
23
|
-
],
|
|
24
|
+
], re = [
|
|
24
25
|
"29%",
|
|
25
26
|
"12%",
|
|
26
27
|
"11%",
|
|
27
28
|
"21%",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
29
|
+
"13%",
|
|
30
|
+
"14%"
|
|
30
31
|
], O = {
|
|
31
32
|
..._,
|
|
32
33
|
overflow: "hidden",
|
|
33
34
|
textOverflow: "ellipsis",
|
|
34
35
|
whiteSpace: "nowrap"
|
|
35
|
-
},
|
|
36
|
+
}, ie = {
|
|
36
37
|
..._,
|
|
37
38
|
whiteSpace: "nowrap",
|
|
38
39
|
textAlign: "right"
|
|
39
40
|
};
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
await Y(e, t) && H((t) => t === e ? null : t);
|
|
49
|
-
}, X = S(() => A.data?.params ?? [], [A.data]), { data: Z } = x(), Q = S(() => {
|
|
50
|
-
let e = new Map((Z?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
|
|
41
|
+
function k(e) {
|
|
42
|
+
let t = b(), n = S("param_source").valueOf, d = b("errors"), p = l((e) => e.activeTenant?.id) ?? "", { isPhone: k } = h(), M = s("tenant"), [N, P] = w(""), [F, I] = w(""), [L, R] = w(""), [z, B] = w(!1), [V, H] = w(null), { overrideByCode: U, missingParams: W, isLoading: G, retry: K, error: q, clearError: J, save: ae, reset: oe } = c({
|
|
43
|
+
carrierEntityCode: D,
|
|
44
|
+
rowId: p
|
|
45
|
+
}), se = async (e, t) => {
|
|
46
|
+
await ae(e, t) && H((t) => t === e ? null : t);
|
|
47
|
+
}, Y = C(() => M.data?.params ?? [], [M.data]), { data: X } = x(), Z = C(() => {
|
|
48
|
+
let e = new Map((X?.enums?.parameter_category?.values ?? []).map((e) => [e.code, t(e.name) || e.code]));
|
|
51
49
|
return (t) => t ? e.get(t) ?? t : "";
|
|
52
|
-
}, [
|
|
50
|
+
}, [X, t]), Q = C(() => Array.from(new Set(Y.map((e) => e.category).filter(Boolean))).map((e) => ({
|
|
53
51
|
value: e,
|
|
54
|
-
label:
|
|
52
|
+
label: Z(e)
|
|
55
53
|
})).sort((e, n) => e.label.localeCompare(n.label, t.language)), [
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
Y,
|
|
55
|
+
Z,
|
|
58
56
|
t.language
|
|
59
|
-
]),
|
|
60
|
-
let e =
|
|
61
|
-
return
|
|
57
|
+
]), ce = C(() => {
|
|
58
|
+
let e = N.trim().toLowerCase();
|
|
59
|
+
return Y.filter((n) => !(F && n.category !== F || L && n.source !== L || z && !U.has(n.code) || e && !`${n.code} ${t(n.name)}`.toLowerCase().includes(e))).sort((e, n) => (t(e.name) || e.code).localeCompare(t(n.name) || n.code, t.language) || e.code.localeCompare(n.code));
|
|
62
60
|
}, [
|
|
63
61
|
t,
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
Y,
|
|
63
|
+
N,
|
|
66
64
|
F,
|
|
67
65
|
L,
|
|
68
66
|
z,
|
|
69
67
|
U
|
|
70
|
-
]),
|
|
68
|
+
]), le = M.isLoading || G, ue = m(Y, M.data?.refs), $ = ce.map((e) => {
|
|
71
69
|
let t = U.get(e.code);
|
|
72
70
|
return {
|
|
73
71
|
param: e,
|
|
74
|
-
state: /* @__PURE__ */
|
|
72
|
+
state: /* @__PURE__ */ T(A, {
|
|
75
73
|
param: e,
|
|
76
74
|
override: t
|
|
77
75
|
}),
|
|
78
|
-
value: /* @__PURE__ */
|
|
76
|
+
value: /* @__PURE__ */ T(f, {
|
|
79
77
|
type: e.type,
|
|
80
78
|
value: e.value,
|
|
81
79
|
values: e.values,
|
|
82
80
|
structure: e.structure,
|
|
83
|
-
label:
|
|
81
|
+
label: ue(e),
|
|
84
82
|
maxWidth: "100%"
|
|
85
83
|
}),
|
|
86
|
-
actions: /* @__PURE__ */
|
|
84
|
+
actions: /* @__PURE__ */ T(j, {
|
|
87
85
|
param: e,
|
|
88
86
|
stored: t !== void 0,
|
|
89
87
|
onEdit: () => {
|
|
90
88
|
J(), H(e);
|
|
91
89
|
},
|
|
92
|
-
onReset: (e) => void
|
|
90
|
+
onReset: (e) => void oe(e)
|
|
93
91
|
})
|
|
94
92
|
};
|
|
95
93
|
});
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
header: /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ E(te, {
|
|
95
|
+
header: /* @__PURE__ */ T(g, { description: t("params.tenant.subtitle", "Tenant configuration. Editing a value stores a tenant override; Reset restores the platform default.") }),
|
|
98
96
|
children: [
|
|
99
|
-
q && /* @__PURE__ */
|
|
100
|
-
W && /* @__PURE__ */
|
|
101
|
-
text:
|
|
97
|
+
q && /* @__PURE__ */ T(u, { text: q }),
|
|
98
|
+
W && /* @__PURE__ */ T(u, {
|
|
99
|
+
text: d("param.overrides_unreadable", "The current parameter overrides could not be read."),
|
|
102
100
|
onRetry: K
|
|
103
101
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ E("div", {
|
|
105
103
|
"data-testid": "tenant-params-filters",
|
|
106
104
|
style: {
|
|
107
105
|
display: "flex",
|
|
@@ -110,63 +108,63 @@ function j(e) {
|
|
|
110
108
|
alignItems: "center"
|
|
111
109
|
},
|
|
112
110
|
children: [
|
|
113
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ T("div", {
|
|
114
112
|
style: {
|
|
115
113
|
minWidth: 200,
|
|
116
114
|
flex: 1
|
|
117
115
|
},
|
|
118
|
-
children: /* @__PURE__ */
|
|
119
|
-
value:
|
|
116
|
+
children: /* @__PURE__ */ T(a, {
|
|
117
|
+
value: N,
|
|
120
118
|
onChange: P,
|
|
121
119
|
placeholder: t("params.search", "Search name or code…")
|
|
122
120
|
})
|
|
123
121
|
}),
|
|
124
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ T("div", {
|
|
125
123
|
style: { minWidth: 160 },
|
|
126
|
-
children: /* @__PURE__ */
|
|
124
|
+
children: /* @__PURE__ */ T(i, {
|
|
127
125
|
value: F,
|
|
128
126
|
options: [{
|
|
129
127
|
value: "",
|
|
130
128
|
label: t("params.filter.all_categories", "All categories")
|
|
131
|
-
}, ...
|
|
129
|
+
}, ...Q],
|
|
132
130
|
onChange: I
|
|
133
131
|
})
|
|
134
132
|
}),
|
|
135
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ T("div", {
|
|
136
134
|
style: { minWidth: 140 },
|
|
137
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ T(i, {
|
|
138
136
|
value: L,
|
|
139
137
|
options: [{
|
|
140
138
|
value: "",
|
|
141
139
|
label: t("params.filter.all_sources", "All sources")
|
|
142
|
-
}, ...
|
|
140
|
+
}, ...ne.map((e) => ({
|
|
143
141
|
value: e,
|
|
144
|
-
label:
|
|
142
|
+
label: n(e).label
|
|
145
143
|
}))],
|
|
146
144
|
onChange: R
|
|
147
145
|
})
|
|
148
146
|
}),
|
|
149
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ E("label", {
|
|
150
148
|
style: {
|
|
151
149
|
display: "flex",
|
|
152
150
|
alignItems: "center",
|
|
153
151
|
gap: 6,
|
|
154
152
|
fontSize: 12
|
|
155
153
|
},
|
|
156
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ T(o, {
|
|
157
155
|
value: z,
|
|
158
156
|
onChange: B
|
|
159
157
|
}), t("params.filter.overridden_only", "Overridden only")]
|
|
160
158
|
})
|
|
161
159
|
]
|
|
162
160
|
}),
|
|
163
|
-
|
|
161
|
+
le ? /* @__PURE__ */ T("div", {
|
|
164
162
|
style: {
|
|
165
163
|
padding: "24px 0",
|
|
166
164
|
textAlign: "center"
|
|
167
165
|
},
|
|
168
|
-
children: /* @__PURE__ */
|
|
169
|
-
}) : $.length === 0 ? /* @__PURE__ */
|
|
166
|
+
children: /* @__PURE__ */ T(r, { size: 18 })
|
|
167
|
+
}) : $.length === 0 ? /* @__PURE__ */ T("div", {
|
|
170
168
|
style: {
|
|
171
169
|
padding: 16,
|
|
172
170
|
color: "var(--text-4)",
|
|
@@ -174,14 +172,14 @@ function j(e) {
|
|
|
174
172
|
fontSize: 12.5
|
|
175
173
|
},
|
|
176
174
|
children: t("params.empty", "No parameters match.")
|
|
177
|
-
}) :
|
|
175
|
+
}) : k ? /* @__PURE__ */ T("div", {
|
|
178
176
|
"data-testid": "tenant-params-cards",
|
|
179
177
|
style: {
|
|
180
178
|
display: "flex",
|
|
181
179
|
flexDirection: "column",
|
|
182
180
|
gap: 8
|
|
183
181
|
},
|
|
184
|
-
children: $.map(({ param: e, state: n, value: r, actions: i }) => /* @__PURE__ */
|
|
182
|
+
children: $.map(({ param: e, state: n, value: r, actions: i }) => /* @__PURE__ */ E("div", {
|
|
185
183
|
"data-testid": `tenant-param-row-${e.code}`,
|
|
186
184
|
style: {
|
|
187
185
|
border: "1px solid var(--border)",
|
|
@@ -194,14 +192,14 @@ function j(e) {
|
|
|
194
192
|
minWidth: 0
|
|
195
193
|
},
|
|
196
194
|
children: [
|
|
197
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ E("div", {
|
|
198
196
|
style: {
|
|
199
197
|
display: "flex",
|
|
200
198
|
alignItems: "center",
|
|
201
199
|
gap: 8,
|
|
202
200
|
minWidth: 0
|
|
203
201
|
},
|
|
204
|
-
children: [/* @__PURE__ */
|
|
202
|
+
children: [/* @__PURE__ */ T("div", {
|
|
205
203
|
style: {
|
|
206
204
|
flex: 1,
|
|
207
205
|
minWidth: 0,
|
|
@@ -213,7 +211,7 @@ function j(e) {
|
|
|
213
211
|
children: t(e.name) || e.code
|
|
214
212
|
}), n]
|
|
215
213
|
}),
|
|
216
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ T("div", {
|
|
217
215
|
className: "mono",
|
|
218
216
|
style: {
|
|
219
217
|
fontSize: 11.5,
|
|
@@ -222,29 +220,29 @@ function j(e) {
|
|
|
222
220
|
},
|
|
223
221
|
children: e.code
|
|
224
222
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ T("div", {
|
|
226
224
|
style: { minWidth: 0 },
|
|
227
225
|
children: r
|
|
228
226
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ E("div", {
|
|
230
228
|
style: {
|
|
231
229
|
display: "flex",
|
|
232
230
|
alignItems: "center",
|
|
233
231
|
gap: 6,
|
|
234
232
|
flexWrap: "wrap"
|
|
235
233
|
},
|
|
236
|
-
children: [/* @__PURE__ */
|
|
234
|
+
children: [/* @__PURE__ */ T("span", {
|
|
237
235
|
style: {
|
|
238
236
|
flex: 1,
|
|
239
237
|
fontSize: 11.5,
|
|
240
238
|
color: "var(--text-3)"
|
|
241
239
|
},
|
|
242
|
-
children: [
|
|
240
|
+
children: [Z(e.category), e.type].filter(Boolean).join(" · ")
|
|
243
241
|
}), i]
|
|
244
242
|
})
|
|
245
243
|
]
|
|
246
244
|
}, e.code))
|
|
247
|
-
}) : /* @__PURE__ */
|
|
245
|
+
}) : /* @__PURE__ */ T("div", {
|
|
248
246
|
"data-testid": "tenant-params-table",
|
|
249
247
|
style: {
|
|
250
248
|
border: "1px solid var(--border)",
|
|
@@ -252,48 +250,48 @@ function j(e) {
|
|
|
252
250
|
background: "var(--surface)",
|
|
253
251
|
overflow: "hidden"
|
|
254
252
|
},
|
|
255
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ E("table", {
|
|
256
254
|
style: {
|
|
257
255
|
...y,
|
|
258
256
|
tableLayout: "fixed"
|
|
259
257
|
},
|
|
260
258
|
children: [
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ T("colgroup", { children: re.map((e, t) => /* @__PURE__ */ T("col", { style: { width: e } }, t)) }),
|
|
260
|
+
/* @__PURE__ */ T("thead", { children: /* @__PURE__ */ E("tr", { children: [
|
|
261
|
+
/* @__PURE__ */ T("th", {
|
|
264
262
|
style: v,
|
|
265
263
|
children: t("params.column.name", "Name")
|
|
266
264
|
}),
|
|
267
|
-
/* @__PURE__ */
|
|
265
|
+
/* @__PURE__ */ T("th", {
|
|
268
266
|
style: v,
|
|
269
267
|
children: t("params.column.category", "Category")
|
|
270
268
|
}),
|
|
271
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ T("th", {
|
|
272
270
|
style: v,
|
|
273
271
|
children: t("params.column.type", "Type")
|
|
274
272
|
}),
|
|
275
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ T("th", {
|
|
276
274
|
style: v,
|
|
277
275
|
children: t("params.value", "Value")
|
|
278
276
|
}),
|
|
279
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ T("th", {
|
|
280
278
|
style: v,
|
|
281
279
|
children: t("params.column.source", "Source")
|
|
282
280
|
}),
|
|
283
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ T("th", { style: v })
|
|
284
282
|
] }) }),
|
|
285
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ T("tbody", { children: $.map(({ param: e, state: n, value: r, actions: i }) => /* @__PURE__ */ E("tr", {
|
|
286
284
|
"data-testid": `tenant-param-row-${e.code}`,
|
|
287
285
|
children: [
|
|
288
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ E("td", {
|
|
289
287
|
style: {
|
|
290
288
|
..._,
|
|
291
289
|
overflowWrap: "anywhere"
|
|
292
290
|
},
|
|
293
|
-
children: [/* @__PURE__ */
|
|
291
|
+
children: [/* @__PURE__ */ T("div", {
|
|
294
292
|
style: { color: "var(--text)" },
|
|
295
293
|
children: t(e.name) || e.code
|
|
296
|
-
}), t(e.name) && t(e.name) !== e.code && /* @__PURE__ */
|
|
294
|
+
}), t(e.name) && t(e.name) !== e.code && /* @__PURE__ */ T("div", {
|
|
297
295
|
"data-testid": "tenant-param-code",
|
|
298
296
|
className: "mono",
|
|
299
297
|
style: {
|
|
@@ -303,26 +301,26 @@ function j(e) {
|
|
|
303
301
|
children: e.code
|
|
304
302
|
})]
|
|
305
303
|
}),
|
|
306
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ T("td", {
|
|
307
305
|
style: O,
|
|
308
|
-
title:
|
|
309
|
-
children:
|
|
306
|
+
title: Z(e.category) || void 0,
|
|
307
|
+
children: Z(e.category) || "—"
|
|
310
308
|
}),
|
|
311
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ T("td", {
|
|
312
310
|
style: O,
|
|
313
311
|
title: e.type,
|
|
314
312
|
children: e.type
|
|
315
313
|
}),
|
|
316
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ T("td", {
|
|
317
315
|
style: O,
|
|
318
316
|
children: r
|
|
319
317
|
}),
|
|
320
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ T("td", {
|
|
321
319
|
style: O,
|
|
322
320
|
children: n
|
|
323
321
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
style:
|
|
322
|
+
/* @__PURE__ */ T("td", {
|
|
323
|
+
style: ie,
|
|
326
324
|
children: i
|
|
327
325
|
})
|
|
328
326
|
]
|
|
@@ -330,58 +328,58 @@ function j(e) {
|
|
|
330
328
|
]
|
|
331
329
|
})
|
|
332
330
|
}),
|
|
333
|
-
V && /* @__PURE__ */
|
|
331
|
+
V && /* @__PURE__ */ T(ee, {
|
|
334
332
|
param: V,
|
|
335
333
|
current: U.get(V.code)?.value ?? V.value,
|
|
336
334
|
error: q,
|
|
337
335
|
onCancel: () => {
|
|
338
336
|
H(null), J();
|
|
339
337
|
},
|
|
340
|
-
onSave: (e) =>
|
|
338
|
+
onSave: (e) => se(V, e)
|
|
341
339
|
})
|
|
342
340
|
]
|
|
343
341
|
});
|
|
344
342
|
}
|
|
345
|
-
function
|
|
346
|
-
let r = b();
|
|
347
|
-
return n !== void 0 && e.source !== "tenant" ? /* @__PURE__ */
|
|
343
|
+
function A({ param: e, override: n }) {
|
|
344
|
+
let r = b(), i = S("param_source").valueOf(e.source);
|
|
345
|
+
return n !== void 0 && e.source !== "tenant" ? /* @__PURE__ */ T("span", {
|
|
348
346
|
"data-testid": `tenant-param-not-applied-${e.code}`,
|
|
349
347
|
title: r("params.tenant.not_applied_hint", "This tenant is set to {value}, and it no longer satisfies the parameter's declaration. Source of the value in effect: {source}. Reset to remove it, or edit it to a value the declaration accepts.", {
|
|
350
348
|
value: JSON.stringify(n.value),
|
|
351
|
-
source:
|
|
349
|
+
source: i.label
|
|
352
350
|
}),
|
|
353
|
-
children: /* @__PURE__ */
|
|
351
|
+
children: /* @__PURE__ */ T(t, {
|
|
354
352
|
tone: "amber",
|
|
355
353
|
size: "xs",
|
|
356
354
|
dot: !0,
|
|
357
355
|
children: r("params.not_applied", "not applied")
|
|
358
356
|
})
|
|
359
|
-
}) : /* @__PURE__ */
|
|
360
|
-
tone:
|
|
357
|
+
}) : /* @__PURE__ */ T(t, {
|
|
358
|
+
tone: i.tone,
|
|
361
359
|
size: "xs",
|
|
362
|
-
children:
|
|
360
|
+
children: i.label
|
|
363
361
|
});
|
|
364
362
|
}
|
|
365
|
-
function
|
|
363
|
+
function j({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
366
364
|
let o = b();
|
|
367
|
-
return
|
|
365
|
+
return p(t) ? /* @__PURE__ */ E("span", {
|
|
368
366
|
style: {
|
|
369
367
|
display: "inline-flex",
|
|
370
368
|
flexWrap: "wrap",
|
|
371
369
|
justifyContent: "flex-end",
|
|
372
370
|
gap: 6
|
|
373
371
|
},
|
|
374
|
-
children: [/* @__PURE__ */
|
|
372
|
+
children: [/* @__PURE__ */ T(n, {
|
|
375
373
|
size: "xs",
|
|
376
|
-
icon: /* @__PURE__ */
|
|
374
|
+
icon: /* @__PURE__ */ T(e.edit, { size: 12 }),
|
|
377
375
|
onClick: i,
|
|
378
376
|
children: o("params.edit", "Edit")
|
|
379
|
-
}), r && /* @__PURE__ */
|
|
377
|
+
}), r && /* @__PURE__ */ T(d, {
|
|
380
378
|
param: t,
|
|
381
379
|
description: o("params.reset_confirm.tenant_description", "The value this tenant set is removed, and the platform default applies again."),
|
|
382
380
|
onReset: a
|
|
383
381
|
})]
|
|
384
|
-
}) : /* @__PURE__ */
|
|
382
|
+
}) : /* @__PURE__ */ E("span", {
|
|
385
383
|
title: o("params.tenant.read_only_hint", "Not editable at tenant scope (its declared scopes do not admit tenant)."),
|
|
386
384
|
style: {
|
|
387
385
|
display: "inline-flex",
|
|
@@ -391,10 +389,10 @@ function N({ param: t, stored: r, onEdit: i, onReset: a }) {
|
|
|
391
389
|
fontSize: 11
|
|
392
390
|
},
|
|
393
391
|
children: [
|
|
394
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ T(e.lock, { size: 12 }),
|
|
395
393
|
" ",
|
|
396
394
|
o("params.read_only", "read-only")
|
|
397
395
|
]
|
|
398
396
|
});
|
|
399
397
|
}
|
|
400
|
-
export {
|
|
398
|
+
export { k as TenantParamsPage };
|
|
@@ -4,7 +4,8 @@ import { Pill as n } from "../primitives/Pill.js";
|
|
|
4
4
|
import { Icon as r } from "../primitives/Icons.js";
|
|
5
5
|
import { Spinner as i } from "../primitives/Spinner.js";
|
|
6
6
|
import { useAllParams as a, useCarrierParamOverrides as o } from "../../hooks/useParams.js";
|
|
7
|
-
import { EditParamDialog as s, ErrorLine as c, ResetParamControl as l, ValuePreview as u,
|
|
7
|
+
import { EditParamDialog as s, ErrorLine as c, ResetParamControl as l, ValuePreview as u, useParamRefLabels as d } from "./param-editors.js";
|
|
8
|
+
import { useDeclaredEnum as f } from "../../hooks/useDeclaredEnum.js";
|
|
8
9
|
import { useText as p } from "../../hooks/useText.js";
|
|
9
10
|
import { useMemo as m, useState as h } from "react";
|
|
10
11
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
@@ -12,35 +13,39 @@ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
|
12
13
|
function v(e) {
|
|
13
14
|
return e === "tenant" || e === "role" || e === "user" ? e : "object";
|
|
14
15
|
}
|
|
15
|
-
function y(e, t) {
|
|
16
|
-
return e ? e.filter((e) => e.scopes?.includes(t)) : [];
|
|
16
|
+
function y(e, t, n) {
|
|
17
|
+
return e ? e.filter((e) => e.scopes?.includes(t) && (!n || n.includes(e.code))) : [];
|
|
17
18
|
}
|
|
18
|
-
function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w, writeOneByOne: T }) {
|
|
19
|
-
let
|
|
19
|
+
function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w, writeOneByOne: T, only: E }) {
|
|
20
|
+
let D = p(), O = f("param_source").valueOf, k = p("errors"), A = a(), j = m(() => y(A.data?.params, x, E), [
|
|
21
|
+
A.data,
|
|
22
|
+
x,
|
|
23
|
+
E
|
|
24
|
+
]), [M, N] = h(null), { overrideByCode: P, missingParams: F, isLoading: I, retry: L, error: R, clearError: z, save: B, reset: V } = o({
|
|
20
25
|
carrierEntityCode: b,
|
|
21
26
|
rowId: S,
|
|
22
|
-
enabled:
|
|
27
|
+
enabled: j.length > 0,
|
|
23
28
|
writeOneByOne: T
|
|
24
|
-
}),
|
|
25
|
-
let t =
|
|
29
|
+
}), H = v(x) === "object", U = m(() => j.map((e) => {
|
|
30
|
+
let t = H ? P.get(e.code) : void 0;
|
|
26
31
|
return t ? {
|
|
27
32
|
...e,
|
|
28
33
|
value: t.value
|
|
29
34
|
} : e;
|
|
30
35
|
}), [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]),
|
|
35
|
-
await
|
|
36
|
+
j,
|
|
37
|
+
H,
|
|
38
|
+
P
|
|
39
|
+
]), W = d(U, A.data?.refs), G = async (e, t) => {
|
|
40
|
+
await B(e, t) && N((t) => t === e ? null : t);
|
|
36
41
|
};
|
|
37
|
-
return
|
|
38
|
-
title: C ??
|
|
42
|
+
return j.length === 0 ? null : /* @__PURE__ */ _(e, {
|
|
43
|
+
title: C ?? D("params.title", "Parameters"),
|
|
39
44
|
icon: w ?? /* @__PURE__ */ g(r.settings, { size: 14 }),
|
|
40
|
-
children: [
|
|
41
|
-
text:
|
|
42
|
-
onRetry:
|
|
43
|
-
}) :
|
|
45
|
+
children: [F ? /* @__PURE__ */ g(c, {
|
|
46
|
+
text: k("param.overrides_unreadable", "The current parameter overrides could not be read."),
|
|
47
|
+
onRetry: L
|
|
48
|
+
}) : I ? /* @__PURE__ */ g("div", {
|
|
44
49
|
style: { padding: "8px 0" },
|
|
45
50
|
children: /* @__PURE__ */ g(i, { size: 16 })
|
|
46
51
|
}) : /* @__PURE__ */ _("div", {
|
|
@@ -49,8 +54,8 @@ function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w,
|
|
|
49
54
|
flexDirection: "column",
|
|
50
55
|
gap: 10
|
|
51
56
|
},
|
|
52
|
-
children: [
|
|
53
|
-
let i =
|
|
57
|
+
children: [R && !M && /* @__PURE__ */ g(c, { text: R }), U.map((e) => {
|
|
58
|
+
let i = P.get(e.code), a = i !== void 0, o = a && (H || e.source === v(x));
|
|
54
59
|
return /* @__PURE__ */ _("div", {
|
|
55
60
|
"data-testid": `param-row-${e.code}`,
|
|
56
61
|
style: {
|
|
@@ -66,56 +71,56 @@ function b({ carrierEntityCode: b, carrierScope: x, rowId: S, title: C, icon: w,
|
|
|
66
71
|
fontSize: 12.5,
|
|
67
72
|
fontWeight: 500
|
|
68
73
|
},
|
|
69
|
-
children:
|
|
74
|
+
children: D(e.name) || e.code
|
|
70
75
|
}),
|
|
71
76
|
/* @__PURE__ */ g(u, {
|
|
72
77
|
type: e.type,
|
|
73
78
|
value: e.value,
|
|
74
79
|
values: e.values,
|
|
75
80
|
structure: e.structure,
|
|
76
|
-
label:
|
|
81
|
+
label: W(e)
|
|
77
82
|
}),
|
|
78
83
|
o && /* @__PURE__ */ g(n, {
|
|
79
84
|
tone: "violet",
|
|
80
85
|
size: "xs",
|
|
81
|
-
children:
|
|
86
|
+
children: D("params.overridden", "overridden")
|
|
82
87
|
}),
|
|
83
88
|
a && !o && /* @__PURE__ */ g("span", {
|
|
84
89
|
"data-testid": `param-not-applied-${e.code}`,
|
|
85
|
-
title:
|
|
90
|
+
title: D("params.block.not_applied_hint", "You set {value}, and it no longer satisfies this parameter's declaration. Source of the value in effect: {source}. Reset to remove what you set, or edit it to a value the declaration accepts.", {
|
|
86
91
|
value: JSON.stringify(i.value),
|
|
87
|
-
source:
|
|
92
|
+
source: O(e.source).label
|
|
88
93
|
}),
|
|
89
94
|
children: /* @__PURE__ */ g(n, {
|
|
90
95
|
tone: "amber",
|
|
91
96
|
size: "xs",
|
|
92
|
-
children:
|
|
97
|
+
children: D("params.not_applied", "not applied")
|
|
93
98
|
})
|
|
94
99
|
}),
|
|
95
100
|
/* @__PURE__ */ g(t, {
|
|
96
101
|
size: "xs",
|
|
97
102
|
icon: /* @__PURE__ */ g(r.edit, { size: 12 }),
|
|
98
103
|
onClick: () => {
|
|
99
|
-
|
|
104
|
+
z(), N(e);
|
|
100
105
|
},
|
|
101
|
-
children:
|
|
106
|
+
children: D("params.edit", "Edit")
|
|
102
107
|
}),
|
|
103
108
|
a && /* @__PURE__ */ g(l, {
|
|
104
109
|
param: e,
|
|
105
|
-
description:
|
|
106
|
-
onReset: (e) => void
|
|
110
|
+
description: D("params.reset_confirm.block_description", "The value set here is removed, and the value it inherits applies again."),
|
|
111
|
+
onReset: (e) => void V(e)
|
|
107
112
|
})
|
|
108
113
|
]
|
|
109
114
|
}, e.code);
|
|
110
115
|
})]
|
|
111
|
-
}),
|
|
112
|
-
param:
|
|
113
|
-
current:
|
|
114
|
-
error:
|
|
116
|
+
}), M && /* @__PURE__ */ g(s, {
|
|
117
|
+
param: M,
|
|
118
|
+
current: P.get(M.code)?.value ?? M.value,
|
|
119
|
+
error: R,
|
|
115
120
|
onCancel: () => {
|
|
116
|
-
|
|
121
|
+
N(null), z();
|
|
117
122
|
},
|
|
118
|
-
onSave: (e) =>
|
|
123
|
+
onSave: (e) => G(M, e)
|
|
119
124
|
})]
|
|
120
125
|
});
|
|
121
126
|
}
|