@burdenoff/microfe-bigconsole 2026.1119.10 → 2026.1120.1
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/bigconsole/components/explore/queryAccess/GrantsPanel.d.ts +10 -0
- package/dist/bigconsole/components/explore/queryAccess/GrantsPanel.js +467 -0
- package/dist/bigconsole/components/explore/queryAccess/QueryAccessAdmin.d.ts +5 -0
- package/dist/bigconsole/components/explore/queryAccess/QueryAccessAdmin.js +228 -0
- package/dist/bigconsole/components/explore/queryAccess/QueryAccessEntry.d.ts +5 -0
- package/dist/bigconsole/components/explore/queryAccess/QueryAccessEntry.js +39 -0
- package/dist/bigconsole/components/explore/queryAccess/RelationEditor.d.ts +11 -0
- package/dist/bigconsole/components/explore/queryAccess/RelationEditor.js +276 -0
- package/dist/bigconsole/components/explore/queryAccess/shared.d.ts +16 -0
- package/dist/bigconsole/components/explore/queryAccess/shared.js +26 -0
- package/dist/bigconsole/hooks/useQueryAccess.d.ts +50 -0
- package/dist/bigconsole/hooks/useQueryAccess.js +255 -0
- package/dist/bigconsole/pages/DataSinksPage.js +547 -542
- package/dist/bigconsole/utils/queryAccess.d.ts +169 -0
- package/dist/bigconsole/utils/queryAccess.js +345 -0
- package/dist/generated/wspace-operations.d.ts +177 -0
- package/dist/generated/wspace-operations.js +944 -78
- package/dist/generated/wspace-types.d.ts +2346 -13
- package/dist/generated/wspace-types.js +9 -7
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { QueryRelation } from '../../../utils/queryAccess';
|
|
3
|
+
interface GrantsPanelProps {
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
sinkName: string;
|
|
6
|
+
relation: QueryRelation;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const GrantsPanel: FC<GrantsPanelProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import { useTr as e } from "../../../../shared/hooks/useTr.js";
|
|
2
|
+
import { useQueryAccessMutations as t, useQueryGrants as n, useWorkspaceMemberDirectory as r } from "../../../hooks/useQueryAccess.js";
|
|
3
|
+
import { QUERY_ACCESS_LIMITS as i, grantInput as a, grantToDraft as o, validateGrantDraft as s } from "../../../utils/queryAccess.js";
|
|
4
|
+
import { ErrorLine as c, buttonClass as l, cellClass as u, dangerButtonClass as d, headerCellClass as f, hintClass as p, inputClass as m, labelClass as h, primaryButtonClass as g, useProblemText as _, useQueryAccessErrorText as v } from "./shared.js";
|
|
5
|
+
import { useId as y, useMemo as b, useState as x } from "react";
|
|
6
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
7
|
+
// src/bigconsole/components/explore/queryAccess/GrantsPanel.tsx
|
|
8
|
+
var w = ({ workspaceId: i, sinkName: a, relation: o, onClose: s }) => {
|
|
9
|
+
let m = e(), h = v(), _ = y(), w = n(i, o.dataSinkId), E = r(i, !0), { revokeGrant: D } = t(i), [O, k] = x(null), [A, j] = x(null), [M, N] = x(null), [P, F] = x(null), I = b(() => new Map((E.data ?? []).map((e) => [e.userId, e])), [E.data]), L = (e) => o.fields.find((t) => t.id === e)?.name ?? e, R = (e) => {
|
|
10
|
+
let t = I.get(e);
|
|
11
|
+
return t ? t.email ? `${t.displayName} (${t.email})` : t.displayName : e;
|
|
12
|
+
}, z = (e) => e.allRows ? m("bigconsole.queryAccess.grants.allRows", "All rows") : e.rowFilter ? m("bigconsole.queryAccess.grants.filterSummary", "{{field}} in {{values}}", {
|
|
13
|
+
field: L(e.rowFilter.fieldId),
|
|
14
|
+
values: e.rowFilter.values.length ? e.rowFilter.values.join(", ") : "∅"
|
|
15
|
+
}) : "—", B = (e) => e.fields.map((e) => e.access === "REDACT" ? m("bigconsole.queryAccess.grants.redactedField", "{{field}} (redacted)", { field: L(e.fieldId) }) : L(e.fieldId)).join(", "), V = (e) => {
|
|
16
|
+
N(null), F(null), D.mutate({
|
|
17
|
+
dataSinkId: o.dataSinkId,
|
|
18
|
+
actorId: e.actorId
|
|
19
|
+
}, {
|
|
20
|
+
onSuccess: () => {
|
|
21
|
+
j(null), O?.mode === "edit" && O.grant.actorId === e.actorId && k(null), F(m("bigconsole.queryAccess.grants.revoked", "Access for {{member}} was revoked.", { member: R(e.actorId) }));
|
|
22
|
+
},
|
|
23
|
+
onError: (e) => N(h(e))
|
|
24
|
+
});
|
|
25
|
+
}, H = new Set((w.data ?? []).map((e) => e.actorId));
|
|
26
|
+
return /* @__PURE__ */ C("section", {
|
|
27
|
+
"aria-labelledby": _,
|
|
28
|
+
"data-testid": "bigconsole-query-grants",
|
|
29
|
+
className: "rounded-card border border-border-seam bg-bg-canvas p-4",
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ C("div", {
|
|
32
|
+
className: "mb-3 flex flex-wrap items-start justify-between gap-2",
|
|
33
|
+
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("h3", {
|
|
34
|
+
id: _,
|
|
35
|
+
className: "text-body-md font-semibold text-text-primary",
|
|
36
|
+
children: m("bigconsole.queryAccess.grants.title", "Grants on {{relation}} ({{sink}})", {
|
|
37
|
+
relation: o.name,
|
|
38
|
+
sink: a
|
|
39
|
+
})
|
|
40
|
+
}), /* @__PURE__ */ S("p", {
|
|
41
|
+
className: p,
|
|
42
|
+
children: m("bigconsole.queryAccess.grants.hint", "A grant gives one workspace member SQL and Explore access to this relation. Fields a grant does not list are omitted from that member’s schema. The member also needs Data Sink read permission.")
|
|
43
|
+
})] }), /* @__PURE__ */ C("div", {
|
|
44
|
+
className: "flex gap-2",
|
|
45
|
+
children: [/* @__PURE__ */ S("button", {
|
|
46
|
+
type: "button",
|
|
47
|
+
className: g,
|
|
48
|
+
disabled: O?.mode === "new",
|
|
49
|
+
onClick: () => {
|
|
50
|
+
N(null), F(null), k({ mode: "new" });
|
|
51
|
+
},
|
|
52
|
+
children: m("bigconsole.queryAccess.grants.add", "Add grant")
|
|
53
|
+
}), /* @__PURE__ */ S("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
className: l,
|
|
56
|
+
onClick: s,
|
|
57
|
+
children: m("bigconsole.queryAccess.close", "Close")
|
|
58
|
+
})]
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ C("div", {
|
|
62
|
+
className: "flex flex-col gap-2",
|
|
63
|
+
children: [P && /* @__PURE__ */ S("p", {
|
|
64
|
+
role: "status",
|
|
65
|
+
className: "text-body-sm text-status-success-text",
|
|
66
|
+
children: P
|
|
67
|
+
}), /* @__PURE__ */ S(c, { message: M })]
|
|
68
|
+
}),
|
|
69
|
+
w.error ? /* @__PURE__ */ C("div", {
|
|
70
|
+
role: "alert",
|
|
71
|
+
className: "flex flex-wrap items-center gap-2 text-body-sm text-status-error-text",
|
|
72
|
+
children: [/* @__PURE__ */ C("span", { children: [
|
|
73
|
+
m("bigconsole.queryAccess.grants.loadFailed", "The grants could not be loaded."),
|
|
74
|
+
" ",
|
|
75
|
+
h(w.error)
|
|
76
|
+
] }), /* @__PURE__ */ S("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
className: l,
|
|
79
|
+
onClick: () => void w.refetch(),
|
|
80
|
+
children: m("bigconsole.queryAccess.retry", "Retry")
|
|
81
|
+
})]
|
|
82
|
+
}) : w.isPending ? /* @__PURE__ */ S("p", {
|
|
83
|
+
role: "status",
|
|
84
|
+
className: "text-body-sm text-text-muted",
|
|
85
|
+
children: m("bigconsole.queryAccess.grants.loading", "Loading grants…")
|
|
86
|
+
}) : w.data.length === 0 ? /* @__PURE__ */ S("p", {
|
|
87
|
+
className: "text-body-sm text-text-muted",
|
|
88
|
+
children: m("bigconsole.queryAccess.grants.empty", "Nobody has access to this relation yet.")
|
|
89
|
+
}) : /* @__PURE__ */ S("div", {
|
|
90
|
+
className: "overflow-x-auto",
|
|
91
|
+
children: /* @__PURE__ */ C("table", {
|
|
92
|
+
className: "w-full min-w-[720px] border-collapse",
|
|
93
|
+
"data-testid": "bigconsole-query-grant-list",
|
|
94
|
+
children: [/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ C("tr", {
|
|
95
|
+
className: "border-b border-border-seam",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ S("th", {
|
|
98
|
+
scope: "col",
|
|
99
|
+
className: f,
|
|
100
|
+
children: m("bigconsole.queryAccess.grants.member", "Member")
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ S("th", {
|
|
103
|
+
scope: "col",
|
|
104
|
+
className: f,
|
|
105
|
+
children: m("bigconsole.queryAccess.grants.rows", "Rows")
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ S("th", {
|
|
108
|
+
scope: "col",
|
|
109
|
+
className: f,
|
|
110
|
+
children: m("bigconsole.queryAccess.grants.fields", "Visible fields")
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ S("th", {
|
|
113
|
+
scope: "col",
|
|
114
|
+
className: f,
|
|
115
|
+
children: /* @__PURE__ */ S("span", {
|
|
116
|
+
className: "sr-only",
|
|
117
|
+
children: m("bigconsole.queryAccess.columns.actions", "Actions")
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
}) }), /* @__PURE__ */ S("tbody", { children: w.data.map((e) => {
|
|
122
|
+
let t = R(e.actorId);
|
|
123
|
+
return /* @__PURE__ */ C("tr", {
|
|
124
|
+
"data-actor-id": e.actorId,
|
|
125
|
+
className: "border-b border-border-seam last:border-b-0",
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ C("td", {
|
|
128
|
+
className: u,
|
|
129
|
+
children: [/* @__PURE__ */ S("div", {
|
|
130
|
+
className: "text-text-primary",
|
|
131
|
+
children: t
|
|
132
|
+
}), !e.valid && /* @__PURE__ */ S("div", {
|
|
133
|
+
className: "mt-1 text-xs text-[var(--color-status-warning-text)]",
|
|
134
|
+
children: m("bigconsole.queryAccess.grants.invalid", "The query reader would refuse this grant. Edit and save it to repair it.")
|
|
135
|
+
})]
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ S("td", {
|
|
138
|
+
className: `${u} text-text-secondary`,
|
|
139
|
+
children: z(e)
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ S("td", {
|
|
142
|
+
className: `${u} text-text-secondary`,
|
|
143
|
+
children: B(e) || "—"
|
|
144
|
+
}),
|
|
145
|
+
/* @__PURE__ */ S("td", {
|
|
146
|
+
className: `${u} text-right`,
|
|
147
|
+
children: A === e.actorId ? /* @__PURE__ */ C("div", {
|
|
148
|
+
className: "flex flex-col items-end gap-2",
|
|
149
|
+
role: "group",
|
|
150
|
+
children: [/* @__PURE__ */ S("span", {
|
|
151
|
+
className: "text-body-sm text-text-primary",
|
|
152
|
+
children: m("bigconsole.queryAccess.grants.revokeConfirm", "Revoke access for {{member}}?", { member: t })
|
|
153
|
+
}), /* @__PURE__ */ C("div", {
|
|
154
|
+
className: "flex gap-2",
|
|
155
|
+
children: [/* @__PURE__ */ S("button", {
|
|
156
|
+
type: "button",
|
|
157
|
+
className: d,
|
|
158
|
+
disabled: D.isPending,
|
|
159
|
+
onClick: () => V(e),
|
|
160
|
+
children: D.isPending ? m("bigconsole.queryAccess.grants.revoking", "Revoking…") : m("bigconsole.queryAccess.grants.revoke", "Revoke")
|
|
161
|
+
}), /* @__PURE__ */ S("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
className: l,
|
|
164
|
+
disabled: D.isPending,
|
|
165
|
+
onClick: () => j(null),
|
|
166
|
+
children: m("bigconsole.queryAccess.cancel", "Cancel")
|
|
167
|
+
})]
|
|
168
|
+
})]
|
|
169
|
+
}) : /* @__PURE__ */ C("div", {
|
|
170
|
+
className: "flex justify-end gap-2",
|
|
171
|
+
children: [/* @__PURE__ */ S("button", {
|
|
172
|
+
type: "button",
|
|
173
|
+
className: l,
|
|
174
|
+
"aria-label": `${m("bigconsole.queryAccess.grants.edit", "Edit")} ${t}`,
|
|
175
|
+
onClick: () => {
|
|
176
|
+
N(null), F(null), k({
|
|
177
|
+
mode: "edit",
|
|
178
|
+
grant: e
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
children: m("bigconsole.queryAccess.grants.edit", "Edit")
|
|
182
|
+
}), /* @__PURE__ */ S("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
className: d,
|
|
185
|
+
"aria-label": `${m("bigconsole.queryAccess.grants.revoke", "Revoke")} ${t}`,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
N(null), F(null), j(e.actorId);
|
|
188
|
+
},
|
|
189
|
+
children: m("bigconsole.queryAccess.grants.revoke", "Revoke")
|
|
190
|
+
})]
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
}, e.actorId);
|
|
195
|
+
}) })]
|
|
196
|
+
})
|
|
197
|
+
}),
|
|
198
|
+
O && /* @__PURE__ */ S(T, {
|
|
199
|
+
workspaceId: i,
|
|
200
|
+
relation: o,
|
|
201
|
+
grant: O.mode === "edit" ? O.grant : void 0,
|
|
202
|
+
members: E.data ?? [],
|
|
203
|
+
membersLoading: E.isPending,
|
|
204
|
+
membersError: E.error ? h(E.error) : null,
|
|
205
|
+
alreadyGranted: H,
|
|
206
|
+
memberLabel: R,
|
|
207
|
+
onCancel: () => k(null),
|
|
208
|
+
onSaved: (e) => {
|
|
209
|
+
k(null), F(m("bigconsole.queryAccess.grants.saved", "Access for {{member}} was saved.", { member: R(e.actorId) }));
|
|
210
|
+
}
|
|
211
|
+
}, O.mode === "edit" ? `edit-${O.grant.actorId}` : "new")
|
|
212
|
+
]
|
|
213
|
+
});
|
|
214
|
+
}, T = ({ workspaceId: n, relation: r, grant: d, members: f, membersLoading: w, membersError: T, alreadyGranted: E, memberLabel: D, onCancel: O, onSaved: k }) => {
|
|
215
|
+
let A = e(), j = v(), M = _(), { setGrant: N } = t(n), P = y(), F = y(), I = y(), L = y(), R = y(), [z, B] = x(() => o(d, r.fields)), [V, H] = x(""), [U, W] = x(null), G = b(() => {
|
|
216
|
+
let e = V.trim().toLowerCase();
|
|
217
|
+
return f.filter((t) => !E.has(t.userId) && (!e || t.displayName.toLowerCase().includes(e) || (t.email ?? "").toLowerCase().includes(e)));
|
|
218
|
+
}, [
|
|
219
|
+
f,
|
|
220
|
+
E,
|
|
221
|
+
V
|
|
222
|
+
]), K = r.fields.find((e) => e.id === z.filterFieldId), q = (e, t) => B((n) => ({
|
|
223
|
+
...n,
|
|
224
|
+
decisions: {
|
|
225
|
+
...n.decisions,
|
|
226
|
+
[e]: t
|
|
227
|
+
}
|
|
228
|
+
})), J = () => {
|
|
229
|
+
W(null);
|
|
230
|
+
let e = s(z, r.fields);
|
|
231
|
+
e ? W(M(e)) : N.mutate({
|
|
232
|
+
dataSinkId: r.dataSinkId,
|
|
233
|
+
input: a(z, r.fields)
|
|
234
|
+
}, {
|
|
235
|
+
onSuccess: k,
|
|
236
|
+
onError: (e) => W(j(e))
|
|
237
|
+
});
|
|
238
|
+
}, Y = (e) => e === "READ" ? A("bigconsole.queryAccess.grant.read", "Read") : e === "REDACT" ? A("bigconsole.queryAccess.grant.redact", "Redacted") : A("bigconsole.queryAccess.grant.omit", "Omitted");
|
|
239
|
+
return /* @__PURE__ */ C("div", {
|
|
240
|
+
role: "group",
|
|
241
|
+
"aria-labelledby": P,
|
|
242
|
+
"data-testid": "bigconsole-query-grant-editor",
|
|
243
|
+
className: "mt-4 rounded-card border border-border-seam bg-bg-surface p-4",
|
|
244
|
+
children: [
|
|
245
|
+
/* @__PURE__ */ S("h4", {
|
|
246
|
+
id: P,
|
|
247
|
+
className: "mb-3 text-body-md font-semibold text-text-primary",
|
|
248
|
+
children: d ? A("bigconsole.queryAccess.grant.editTitle", "Edit access for {{member}}", { member: D(d.actorId) }) : A("bigconsole.queryAccess.grant.newTitle", "New grant")
|
|
249
|
+
}),
|
|
250
|
+
!d && /* @__PURE__ */ C("fieldset", {
|
|
251
|
+
className: "mb-4 max-w-xl",
|
|
252
|
+
children: [/* @__PURE__ */ S("legend", {
|
|
253
|
+
className: "block text-body-sm font-medium text-text-primary",
|
|
254
|
+
children: A("bigconsole.queryAccess.grant.member", "Workspace member")
|
|
255
|
+
}), T ? /* @__PURE__ */ C("p", {
|
|
256
|
+
role: "alert",
|
|
257
|
+
className: "text-body-sm text-status-error-text",
|
|
258
|
+
children: [
|
|
259
|
+
A("bigconsole.queryAccess.grant.membersFailed", "Workspace members could not be loaded."),
|
|
260
|
+
" ",
|
|
261
|
+
T
|
|
262
|
+
]
|
|
263
|
+
}) : w ? /* @__PURE__ */ S("p", {
|
|
264
|
+
role: "status",
|
|
265
|
+
className: "text-body-sm text-text-muted",
|
|
266
|
+
children: A("bigconsole.queryAccess.grant.membersLoading", "Loading workspace members…")
|
|
267
|
+
}) : /* @__PURE__ */ C("div", {
|
|
268
|
+
className: "flex flex-col gap-2",
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ S("label", {
|
|
271
|
+
htmlFor: F,
|
|
272
|
+
className: "sr-only",
|
|
273
|
+
children: A("bigconsole.queryAccess.grant.searchMembers", "Search members")
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ S("input", {
|
|
276
|
+
id: F,
|
|
277
|
+
type: "search",
|
|
278
|
+
className: m,
|
|
279
|
+
placeholder: A("bigconsole.queryAccess.grant.searchMembers", "Search members"),
|
|
280
|
+
value: V,
|
|
281
|
+
onChange: (e) => H(e.target.value)
|
|
282
|
+
}),
|
|
283
|
+
/* @__PURE__ */ S("label", {
|
|
284
|
+
htmlFor: I,
|
|
285
|
+
className: "sr-only",
|
|
286
|
+
children: A("bigconsole.queryAccess.grant.member", "Workspace member")
|
|
287
|
+
}),
|
|
288
|
+
/* @__PURE__ */ C("select", {
|
|
289
|
+
id: I,
|
|
290
|
+
className: m,
|
|
291
|
+
value: z.actorId,
|
|
292
|
+
onChange: (e) => B((t) => ({
|
|
293
|
+
...t,
|
|
294
|
+
actorId: e.target.value
|
|
295
|
+
})),
|
|
296
|
+
children: [/* @__PURE__ */ S("option", {
|
|
297
|
+
value: "",
|
|
298
|
+
children: A("bigconsole.queryAccess.grant.chooseMember", "Choose a member")
|
|
299
|
+
}), G.map((e) => /* @__PURE__ */ S("option", {
|
|
300
|
+
value: e.userId,
|
|
301
|
+
children: e.email ? `${e.displayName} (${e.email})` : e.displayName
|
|
302
|
+
}, e.userId))]
|
|
303
|
+
}),
|
|
304
|
+
G.length === 0 && /* @__PURE__ */ S("p", {
|
|
305
|
+
className: "text-xs text-text-muted",
|
|
306
|
+
children: A("bigconsole.queryAccess.grant.noCandidates", "No other active members match. Members who already have a grant are edited from the list.")
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})]
|
|
310
|
+
}),
|
|
311
|
+
/* @__PURE__ */ C("fieldset", {
|
|
312
|
+
className: "mb-4",
|
|
313
|
+
children: [/* @__PURE__ */ S("legend", {
|
|
314
|
+
className: h,
|
|
315
|
+
children: A("bigconsole.queryAccess.grant.rows", "Rows")
|
|
316
|
+
}), /* @__PURE__ */ C("div", {
|
|
317
|
+
className: "mt-1 flex flex-col gap-2",
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ C("label", {
|
|
320
|
+
className: "flex items-center gap-2 text-body-sm text-text-primary",
|
|
321
|
+
children: [/* @__PURE__ */ S("input", {
|
|
322
|
+
type: "radio",
|
|
323
|
+
name: `${P}-rows`,
|
|
324
|
+
checked: z.rows === "all",
|
|
325
|
+
onChange: () => B((e) => ({
|
|
326
|
+
...e,
|
|
327
|
+
rows: "all"
|
|
328
|
+
}))
|
|
329
|
+
}), A("bigconsole.queryAccess.grant.allRows", "All rows")]
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ C("label", {
|
|
332
|
+
className: "flex items-center gap-2 text-body-sm text-text-primary",
|
|
333
|
+
children: [/* @__PURE__ */ S("input", {
|
|
334
|
+
type: "radio",
|
|
335
|
+
name: `${P}-rows`,
|
|
336
|
+
checked: z.rows === "filter",
|
|
337
|
+
onChange: () => B((e) => ({
|
|
338
|
+
...e,
|
|
339
|
+
rows: "filter"
|
|
340
|
+
}))
|
|
341
|
+
}), A("bigconsole.queryAccess.grant.filteredRows", "Only rows where a field has one of these values")]
|
|
342
|
+
}),
|
|
343
|
+
z.rows === "filter" && /* @__PURE__ */ C("div", {
|
|
344
|
+
className: "ml-6 grid max-w-xl gap-2",
|
|
345
|
+
children: [/* @__PURE__ */ C("div", { children: [
|
|
346
|
+
/* @__PURE__ */ S("label", {
|
|
347
|
+
htmlFor: L,
|
|
348
|
+
className: "block text-body-sm font-medium text-text-primary",
|
|
349
|
+
children: A("bigconsole.queryAccess.grant.filterField", "Filter field")
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ S("select", {
|
|
352
|
+
id: L,
|
|
353
|
+
className: m,
|
|
354
|
+
value: z.filterFieldId,
|
|
355
|
+
onChange: (e) => B((t) => ({
|
|
356
|
+
...t,
|
|
357
|
+
filterFieldId: e.target.value
|
|
358
|
+
})),
|
|
359
|
+
children: r.fields.map((e) => /* @__PURE__ */ S("option", {
|
|
360
|
+
value: e.id,
|
|
361
|
+
children: `${e.name} (${e.type})`
|
|
362
|
+
}, e.id))
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ S("p", {
|
|
365
|
+
className: "text-xs text-text-muted",
|
|
366
|
+
children: A("bigconsole.queryAccess.grant.filterFieldHint", "The filter field does not have to be visible to the member.")
|
|
367
|
+
})
|
|
368
|
+
] }), /* @__PURE__ */ C("div", { children: [
|
|
369
|
+
/* @__PURE__ */ S("label", {
|
|
370
|
+
htmlFor: R,
|
|
371
|
+
className: "block text-body-sm font-medium text-text-primary",
|
|
372
|
+
children: A("bigconsole.queryAccess.grant.filterValues", "Admitted values, one per line")
|
|
373
|
+
}),
|
|
374
|
+
/* @__PURE__ */ S("textarea", {
|
|
375
|
+
id: R,
|
|
376
|
+
className: `${m} font-mono`,
|
|
377
|
+
rows: 4,
|
|
378
|
+
spellCheck: !1,
|
|
379
|
+
value: z.filterValues,
|
|
380
|
+
onChange: (e) => B((t) => ({
|
|
381
|
+
...t,
|
|
382
|
+
filterValues: e.target.value
|
|
383
|
+
}))
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ S("p", {
|
|
386
|
+
className: "text-xs text-text-muted",
|
|
387
|
+
children: K?.type === "BOOLEAN" ? A("bigconsole.queryAccess.grant.booleanHint", "Use true or false.") : A("bigconsole.queryAccess.grant.valuesHint", "Values must fit the field type. Up to {{max}} values; an empty list admits no rows.", { max: i.rowValues })
|
|
388
|
+
})
|
|
389
|
+
] })]
|
|
390
|
+
})
|
|
391
|
+
]
|
|
392
|
+
})]
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ C("fieldset", {
|
|
395
|
+
className: "mb-4",
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ S("legend", {
|
|
398
|
+
className: h,
|
|
399
|
+
children: A("bigconsole.queryAccess.grant.fields", "Field access")
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ S("p", {
|
|
402
|
+
className: p,
|
|
403
|
+
children: A("bigconsole.queryAccess.grant.fieldsHint", "Read follows the sink’s own masking rules. Redacted shows the column with every value as [redacted]. Omitted fields stay outside the member’s schema.")
|
|
404
|
+
}),
|
|
405
|
+
/* @__PURE__ */ S("div", {
|
|
406
|
+
className: "mt-2 overflow-x-auto",
|
|
407
|
+
children: /* @__PURE__ */ S("table", {
|
|
408
|
+
className: "w-full min-w-[480px] border-collapse",
|
|
409
|
+
children: /* @__PURE__ */ S("tbody", { children: r.fields.map((e) => /* @__PURE__ */ C("tr", {
|
|
410
|
+
className: "border-b border-border-seam last:border-b-0",
|
|
411
|
+
children: [/* @__PURE__ */ C("th", {
|
|
412
|
+
scope: "row",
|
|
413
|
+
className: `${u} font-mono font-normal text-text-primary`,
|
|
414
|
+
children: [e.name, /* @__PURE__ */ S("span", {
|
|
415
|
+
className: "ml-2 text-xs text-text-muted",
|
|
416
|
+
children: e.type
|
|
417
|
+
})]
|
|
418
|
+
}), /* @__PURE__ */ S("td", {
|
|
419
|
+
className: u,
|
|
420
|
+
children: /* @__PURE__ */ S("div", {
|
|
421
|
+
className: "flex flex-wrap gap-3",
|
|
422
|
+
role: "radiogroup",
|
|
423
|
+
"aria-label": A("bigconsole.queryAccess.grant.accessFor", "Access to {{field}}", { field: e.name }),
|
|
424
|
+
children: [
|
|
425
|
+
"READ",
|
|
426
|
+
"REDACT",
|
|
427
|
+
"OMIT"
|
|
428
|
+
].map((t) => /* @__PURE__ */ C("label", {
|
|
429
|
+
className: "flex items-center gap-1 text-body-sm text-text-primary",
|
|
430
|
+
children: [/* @__PURE__ */ S("input", {
|
|
431
|
+
type: "radio",
|
|
432
|
+
name: `${P}-field-${e.id}`,
|
|
433
|
+
value: t,
|
|
434
|
+
checked: (z.decisions[e.id] ?? "OMIT") === t,
|
|
435
|
+
onChange: () => q(e.id, t)
|
|
436
|
+
}), Y(t)]
|
|
437
|
+
}, t))
|
|
438
|
+
})
|
|
439
|
+
})]
|
|
440
|
+
}, e.id)) })
|
|
441
|
+
})
|
|
442
|
+
})
|
|
443
|
+
]
|
|
444
|
+
}),
|
|
445
|
+
/* @__PURE__ */ C("div", {
|
|
446
|
+
className: "flex flex-col gap-2",
|
|
447
|
+
children: [/* @__PURE__ */ S(c, { message: U }), /* @__PURE__ */ C("div", {
|
|
448
|
+
className: "flex gap-2",
|
|
449
|
+
children: [/* @__PURE__ */ S("button", {
|
|
450
|
+
type: "button",
|
|
451
|
+
className: g,
|
|
452
|
+
disabled: N.isPending,
|
|
453
|
+
onClick: J,
|
|
454
|
+
children: N.isPending ? A("bigconsole.queryAccess.saving", "Saving…") : A("bigconsole.queryAccess.grant.save", "Save grant")
|
|
455
|
+
}), /* @__PURE__ */ S("button", {
|
|
456
|
+
type: "button",
|
|
457
|
+
className: l,
|
|
458
|
+
disabled: N.isPending,
|
|
459
|
+
onClick: O,
|
|
460
|
+
children: A("bigconsole.queryAccess.cancel", "Cancel")
|
|
461
|
+
})]
|
|
462
|
+
})]
|
|
463
|
+
})
|
|
464
|
+
]
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
export { w as GrantsPanel };
|