@abpjs/ui 0.2.0-next.32 → 0.2.0-next.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/agent.d.ts +30 -4
- package/dist/agent.js +311 -102
- package/dist/agent.js.map +1 -1
- package/dist/guard.d.ts +10 -5
- package/dist/guard.js +544 -316
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +13 -5
- package/dist/index.js.map +1 -1
- package/dist/languages.d.ts +162 -0
- package/dist/languages.js +771 -0
- package/dist/languages.js.map +1 -0
- package/package.json +6 -1
package/dist/guard.js
CHANGED
|
@@ -215,10 +215,9 @@ var ar_default = {
|
|
|
215
215
|
"anonymousAccess.role": "\u0627\u0644\u062F\u0648\u0631",
|
|
216
216
|
"anonymousAccess.scope": "\u0623\u064A\u0646",
|
|
217
217
|
"anonymousAccess.since": "\u0645\u0646\u0630",
|
|
218
|
-
"anonymousAccess.revoke": "\
|
|
219
|
-
"anonymousAccess.revokeTitle": "\
|
|
220
|
-
"anonymousAccess.revoked": "\
|
|
221
|
-
"anonymousAccess.empty": "\u0644\u064A\u0633 \u0644\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646 \u0623\u064A \u062F\u0648\u0631.",
|
|
218
|
+
"anonymousAccess.revoke": "\u0633\u062D\u0628 \u0627\u0644\u062F\u0648\u0631",
|
|
219
|
+
"anonymousAccess.revokeTitle": "\u0633\u062D\u0628 {role} \u0641\u064A {scope} \u0645\u0646 \u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646\u061F",
|
|
220
|
+
"anonymousAccess.revoked": "\u0633\u064F\u062D\u0628 \u0627\u0644\u062F\u0648\u0631.",
|
|
222
221
|
"merge.mergeInto": "\u062F\u0645\u062C \u0641\u064A \u062D\u0633\u0627\u0628 \u0622\u062E\u0631",
|
|
223
222
|
"merge.pageTitle": "\u062F\u0645\u062C \u0641\u064A \u062D\u0633\u0627\u0628 \u0622\u062E\u0631",
|
|
224
223
|
"merge.pageHint": "\u0643\u0644 \u0645\u0627 \u0641\u0639\u0644\u0647 {username} \u0623\u0648 \u064A\u0645\u0644\u0643\u0647 \u0623\u0648 \u0630\u064F\u0643\u0631 \u0641\u064A\u0647 \u064A\u0646\u062A\u0642\u0644 \u0625\u0644\u0649 \u0627\u0644\u062D\u0633\u0627\u0628 \u0627\u0644\u0630\u064A \u062A\u062E\u062A\u0627\u0631\u0647: \u0627\u0644\u0633\u062C\u0644\u0627\u062A \u0648\u0627\u0644\u062A\u0639\u0644\u064A\u0642\u0627\u062A \u0648\u0627\u0644\u0633\u062C\u0644 \u0627\u0644\u062A\u0627\u0631\u064A\u062E\u064A \u0648\u0627\u0644\u0635\u0644\u0627\u062D\u064A\u0627\u062A \u0648\u0627\u0644\u0645\u062C\u0645\u0648\u0639\u0627\u062A \u0648\u0627\u0644\u0639\u0631\u0648\u0636 \u0648\u0644\u0648\u062D\u0627\u062A \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062A \u0648\u0627\u0644\u0627\u0634\u062A\u0631\u0627\u0643\u0627\u062A \u0648\u0645\u0627 \u062A\u062D\u0641\u0638\u0647 \u0627\u0644\u0625\u0636\u0627\u0641\u0627\u062A. \u064A\u0628\u0642\u0649 {username} \u062D\u0633\u0627\u0628\u064B\u0627 \u063A\u064A\u0631 \u0641\u0639\u0651\u0627\u0644 \u0644\u0627 \u064A\u0645\u0643\u0646\u0647 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644.",
|
|
@@ -440,7 +439,27 @@ var ar_default = {
|
|
|
440
439
|
"signUpSettings.domainTwice": "{domain} \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0627\u0644\u0642\u0627\u0626\u0645\u0629.",
|
|
441
440
|
"signUpSettings.emptyTitle": "\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0645\u062A\u0648\u0642\u0641",
|
|
442
441
|
"signUpSettings.emptyText": "\u0627\u0644\u0645\u062F\u064A\u0631\u0648\u0646 \u0641\u0642\u0637 \u064A\u0636\u064A\u0641\u0648\u0646 \u0627\u0644\u0623\u0634\u062E\u0627\u0635 \u0627\u0644\u0622\u0646. \u064A\u0645\u0643\u0646\u0643 \u0627\u0644\u0633\u0645\u0627\u062D \u0644\u0644\u0646\u0627\u0633 \u0628\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0628\u0623\u0646\u0641\u0633\u0647\u0645.",
|
|
443
|
-
"signUpSettings.turnOn": "\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644"
|
|
442
|
+
"signUpSettings.turnOn": "\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",
|
|
443
|
+
"anonymousAccess.giveRole": "\u0645\u0646\u062D \u062F\u0648\u0631",
|
|
444
|
+
"anonymousAccess.dialogTitle": "\u0645\u0646\u062D \u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646 \u062F\u0648\u0631\u064B\u0627",
|
|
445
|
+
"anonymousAccess.changeTitle": "\u062A\u063A\u064A\u064A\u0631 \u062F\u0648\u0631 \u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646 \u0641\u064A {scope}",
|
|
446
|
+
"anonymousAccess.chooseRole": "\u0627\u062E\u062A\u0631 \u062F\u0648\u0631\u064B\u0627",
|
|
447
|
+
"anonymousAccess.chooseWhere": "\u0627\u062E\u062A\u0631 \u0645\u0643\u0627\u0646\u064B\u0627",
|
|
448
|
+
"anonymousAccess.warning": "\u0623\u064A \u0634\u062E\u0635 \u0639\u0644\u0649 \u0627\u0644\u0625\u0646\u062A\u0631\u0646\u062A \u064A\u062D\u0635\u0644 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u062F\u0648\u0631\u060C \u062F\u0648\u0646 \u062A\u0633\u062C\u064A\u0644 \u062F\u062E\u0648\u0644.",
|
|
449
|
+
"anonymousAccess.who": "\u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u0648\u0646",
|
|
450
|
+
"anonymousAccess.can": "\u064A\u0645\u0643\u0646\u0647\u0645",
|
|
451
|
+
"anonymousAccess.give": "\u0645\u0646\u062D \u0627\u0644\u062F\u0648\u0631",
|
|
452
|
+
"anonymousAccess.change": "\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062F\u0648\u0631",
|
|
453
|
+
"anonymousAccess.given": "\u0645\u064F\u0646\u062D \u0627\u0644\u062F\u0648\u0631.",
|
|
454
|
+
"anonymousAccess.changed": "\u062A\u063A\u064A\u0651\u0631 \u0627\u0644\u062F\u0648\u0631.",
|
|
455
|
+
"anonymousAccess.emptyTitle": "\u0644\u064A\u0633 \u0644\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646 \u0623\u064A \u062F\u0648\u0631",
|
|
456
|
+
"anonymousAccess.emptyText": "\u064A\u062C\u0628 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0644\u0631\u0624\u064A\u0629 \u0623\u064A \u0634\u064A\u0621.",
|
|
457
|
+
"anonymousAccess.tableLabel": "\u0623\u062F\u0648\u0627\u0631 \u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646",
|
|
458
|
+
"anonymousAccess.actions": "\u0627\u0644\u0625\u062C\u0631\u0627\u0621\u0627\u062A",
|
|
459
|
+
"anonymousAccess.menuLabel": "\u0625\u062C\u0631\u0627\u0621\u0627\u062A {role} \u0641\u064A {scope}",
|
|
460
|
+
"anonymousAccess.notListed": "\u0644\u0645 \u064A\u0639\u062F \u0647\u0630\u0627 \u0627\u0644\u0645\u0643\u0627\u0646 \u064A\u062A\u064A\u062D \u0623\u062F\u0648\u0627\u0631\u064B\u0627 \u0644\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646. \u0627\u0633\u062D\u0628 \u0627\u0644\u062F\u0648\u0631 \u0628\u062F\u0644\u064B\u0627 \u0645\u0646 \u0630\u0644\u0643.",
|
|
461
|
+
"anonymousAccess.emptyTextNoPlaces": "\u064A\u062C\u0628 \u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0644\u0631\u0624\u064A\u0629 \u0623\u064A \u0634\u064A\u0621. \u0644\u0627 \u0634\u064A\u0621 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639 \u064A\u0645\u0643\u0646 \u0641\u062A\u062D\u0647 \u0644\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646 \u0628\u0639\u062F.",
|
|
462
|
+
"anonymousAccess.placeWithCode": "{place} \xB7 {code}"
|
|
444
463
|
};
|
|
445
464
|
|
|
446
465
|
// src/areas/guard/texts/en.json
|
|
@@ -649,10 +668,9 @@ var en_default = {
|
|
|
649
668
|
"anonymousAccess.role": "Role",
|
|
650
669
|
"anonymousAccess.scope": "Where",
|
|
651
670
|
"anonymousAccess.since": "Since",
|
|
652
|
-
"anonymousAccess.revoke": "
|
|
653
|
-
"anonymousAccess.revokeTitle": "
|
|
654
|
-
"anonymousAccess.revoked": "
|
|
655
|
-
"anonymousAccess.empty": "Anonymous visitors have no roles anywhere.",
|
|
671
|
+
"anonymousAccess.revoke": "Remove role",
|
|
672
|
+
"anonymousAccess.revokeTitle": "Remove {role} in {scope} from anonymous visitors?",
|
|
673
|
+
"anonymousAccess.revoked": "Role removed.",
|
|
656
674
|
"merge.mergeInto": "Merge into another account",
|
|
657
675
|
"merge.pageTitle": "Merge into another account",
|
|
658
676
|
"merge.pageHint": "Everything {username} did, owns or is named in moves to the account you choose: records, comments, history, grants, groups, views, dashboards, subscriptions and what plugins keep. {username} stays, inactive, and can't sign in.",
|
|
@@ -874,7 +892,27 @@ var en_default = {
|
|
|
874
892
|
"signUpSettings.domainTwice": "{domain} is in the list already.",
|
|
875
893
|
"signUpSettings.emptyTitle": "Sign-up is off",
|
|
876
894
|
"signUpSettings.emptyText": "Only admins can add people now. You can let people sign themselves up.",
|
|
877
|
-
"signUpSettings.turnOn": "Turn on sign-up"
|
|
895
|
+
"signUpSettings.turnOn": "Turn on sign-up",
|
|
896
|
+
"anonymousAccess.giveRole": "Give a role",
|
|
897
|
+
"anonymousAccess.dialogTitle": "Give anonymous visitors a role",
|
|
898
|
+
"anonymousAccess.changeTitle": "Change the role anonymous visitors have in {scope}",
|
|
899
|
+
"anonymousAccess.chooseRole": "Choose a role",
|
|
900
|
+
"anonymousAccess.chooseWhere": "Choose where",
|
|
901
|
+
"anonymousAccess.warning": "Anyone on the internet gets this role, without signing in.",
|
|
902
|
+
"anonymousAccess.who": "Anonymous visitors",
|
|
903
|
+
"anonymousAccess.can": "Can",
|
|
904
|
+
"anonymousAccess.give": "Give role",
|
|
905
|
+
"anonymousAccess.change": "Change role",
|
|
906
|
+
"anonymousAccess.given": "Role given.",
|
|
907
|
+
"anonymousAccess.changed": "Role changed.",
|
|
908
|
+
"anonymousAccess.emptyTitle": "Anonymous visitors have no roles",
|
|
909
|
+
"anonymousAccess.emptyText": "People must sign in to see anything.",
|
|
910
|
+
"anonymousAccess.tableLabel": "Roles for anonymous visitors",
|
|
911
|
+
"anonymousAccess.actions": "Actions",
|
|
912
|
+
"anonymousAccess.menuLabel": "Actions for {role} in {scope}",
|
|
913
|
+
"anonymousAccess.notListed": "This place doesn't offer roles to anonymous visitors now. Remove the role instead.",
|
|
914
|
+
"anonymousAccess.emptyTextNoPlaces": "People must sign in to see anything. Nothing on this site can be opened to anonymous visitors yet.",
|
|
915
|
+
"anonymousAccess.placeWithCode": "{place} \xB7 {code}"
|
|
878
916
|
};
|
|
879
917
|
|
|
880
918
|
// src/areas/guard/texts.ts
|
|
@@ -1688,19 +1726,110 @@ function CreateAccountPanel({ onDone, onCancel }) {
|
|
|
1688
1726
|
}
|
|
1689
1727
|
|
|
1690
1728
|
// src/areas/guard/AnonymousScreen.tsx
|
|
1691
|
-
import {
|
|
1692
|
-
import {
|
|
1693
|
-
import {
|
|
1694
|
-
import {
|
|
1695
|
-
|
|
1729
|
+
import { useMemo, useState as useState4 } from "react";
|
|
1730
|
+
import { HStack as HStack8, Stack as Stack7, Text as Text9 } from "@chakra-ui/react";
|
|
1731
|
+
import { Globe, Pencil, Trash2 } from "lucide-react";
|
|
1732
|
+
import {
|
|
1733
|
+
AppLink as AppLink4,
|
|
1734
|
+
Button as Button7,
|
|
1735
|
+
DataTable as DataTable6,
|
|
1736
|
+
EmptyState,
|
|
1737
|
+
Field as Field2,
|
|
1738
|
+
FormDialog,
|
|
1739
|
+
IconTile,
|
|
1740
|
+
InlineAlert as InlineAlert6,
|
|
1741
|
+
notify as notify5,
|
|
1742
|
+
PageHeader as PageHeader3,
|
|
1743
|
+
Panel as Panel7,
|
|
1744
|
+
PreviewCard,
|
|
1745
|
+
RecordKey as RecordKey4,
|
|
1746
|
+
RowMenu,
|
|
1747
|
+
SelectField as SelectField2,
|
|
1748
|
+
StatusPill as StatusPill6,
|
|
1749
|
+
errorText as errorText2,
|
|
1750
|
+
useApiAction as useApiAction6,
|
|
1751
|
+
useApiQuery as useApiQuery5,
|
|
1752
|
+
useAreaRequest as useAreaRequest7,
|
|
1753
|
+
useConfirm as useConfirm2,
|
|
1754
|
+
useFormatters as useFormatters6
|
|
1755
|
+
} from "@abpjs/ui";
|
|
1756
|
+
|
|
1757
|
+
// src/areas/guard/anonymousRules.ts
|
|
1758
|
+
function takenKey(roleId, scopeKey) {
|
|
1759
|
+
return `${roleId}\0${scopeKey}`;
|
|
1760
|
+
}
|
|
1761
|
+
function takenBy(grants, except) {
|
|
1762
|
+
return new Set(grants.filter((g) => g.id !== except && g.roleId && g.scopeKey).map((g) => takenKey(g.roleId, g.scopeKey)));
|
|
1763
|
+
}
|
|
1764
|
+
function rolesOffered(places, place, taken = /* @__PURE__ */ new Set()) {
|
|
1765
|
+
const pairs = (place ? [place] : places).flatMap((p) => p.roles.map((r) => [r, p.scopeKey]));
|
|
1766
|
+
const free = pairs.filter(([r, scopeKey]) => !taken.has(takenKey(r.id, scopeKey))).map(([r]) => r);
|
|
1767
|
+
return [...new Map(free.map((r) => [r.id, r])).values()];
|
|
1768
|
+
}
|
|
1769
|
+
function placesOffering(places, roleId, taken = /* @__PURE__ */ new Set()) {
|
|
1770
|
+
return places.filter((p) => p.roles.some((r) => (!roleId || r.id === roleId) && !taken.has(takenKey(r.id, p.scopeKey))));
|
|
1771
|
+
}
|
|
1772
|
+
function placeKept(places, scopeKey, roleId, taken = /* @__PURE__ */ new Set()) {
|
|
1773
|
+
if (!scopeKey) return "";
|
|
1774
|
+
const place = places.find((p) => p.scopeKey === scopeKey);
|
|
1775
|
+
if (!place) return "";
|
|
1776
|
+
if (!roleId) return scopeKey;
|
|
1777
|
+
return place.roles.some((r) => r.id === roleId) && !taken.has(takenKey(roleId, scopeKey)) ? scopeKey : "";
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
// src/areas/guard/AnonymousScreen.tsx
|
|
1781
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1782
|
+
function AnonymousScreen({ roleName, roleDescription } = {}) {
|
|
1696
1783
|
const t = useGuardNs("anonymousAccess");
|
|
1697
1784
|
const fmt = useFormatters6();
|
|
1785
|
+
const written = useWrittenName();
|
|
1698
1786
|
const confirm = useConfirm2();
|
|
1699
1787
|
const request = useAreaRequest7("guard");
|
|
1788
|
+
const action = useApiAction6();
|
|
1700
1789
|
const grants = useApiQuery5("guard", "/anonymous");
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1790
|
+
const places = useApiQuery5("guard", "/anonymous/places");
|
|
1791
|
+
const [editing, setEditing] = useState4(null);
|
|
1792
|
+
const [shown, setShown] = useState4({ mode: "give" });
|
|
1793
|
+
const [roleId, setRoleId] = useState4("");
|
|
1794
|
+
const [scopeKey, setScopeKey] = useState4("");
|
|
1795
|
+
const placeOf = useMemo(() => new Map((places.data ?? []).map((p) => [p.scopeKey, p])), [places.data]);
|
|
1796
|
+
const roleOf = useMemo(() => new Map((places.data ?? []).flatMap((p) => p.roles).map((r) => [r.id, r])), [places.data]);
|
|
1797
|
+
const nameOf = (r) => written(roleName?.(r.key, r.name) ?? r.name, r.names);
|
|
1798
|
+
const describe = (r) => written(roleDescription?.(r.key, r.description) ?? r.description ?? "", r.descriptions) || void 0;
|
|
1799
|
+
const grantRole = (g) => {
|
|
1800
|
+
const known = g.roleId ? roleOf.get(g.roleId) : void 0;
|
|
1801
|
+
return known ? nameOf(known) : written(roleName?.(g.roleKey, g.roleName) ?? g.roleName);
|
|
1802
|
+
};
|
|
1803
|
+
const whereOf = (g) => {
|
|
1804
|
+
const place = g.scopeKey ? placeOf.get(g.scopeKey) : void 0;
|
|
1805
|
+
return { label: place?.label ?? g.scope ?? g.scopeKey ?? "", code: place?.code ?? g.code ?? null, href: place?.href ?? g.href };
|
|
1806
|
+
};
|
|
1807
|
+
const taken = useMemo(() => takenBy(grants.data ?? [], shown.mode === "change" ? shown.grant.id : void 0), [grants.data, shown]);
|
|
1808
|
+
const chosenPlace = shown.mode === "change" ? shown.place : placeOf.get(scopeKey);
|
|
1809
|
+
const roleOptions = useMemo(() => rolesOffered(places.data ?? [], chosenPlace, taken), [chosenPlace, places.data, taken]);
|
|
1810
|
+
const chosenRole = roleOptions.find((r) => r.id === roleId);
|
|
1811
|
+
const placeOptions = placesOffering(places.data ?? [], roleId, taken);
|
|
1812
|
+
const unchanged = shown.mode === "change" && roleId === (shown.grant.roleId ?? "");
|
|
1813
|
+
function open(next) {
|
|
1814
|
+
setEditing(next);
|
|
1815
|
+
setShown(next);
|
|
1816
|
+
setRoleId(next.mode === "change" ? next.grant.roleId ?? "" : "");
|
|
1817
|
+
setScopeKey(next.mode === "change" ? next.place.scopeKey : "");
|
|
1818
|
+
action.setError(null);
|
|
1819
|
+
}
|
|
1820
|
+
async function save() {
|
|
1821
|
+
if (!editing) return;
|
|
1822
|
+
const done = await action.run(
|
|
1823
|
+
() => editing.mode === "give" ? request("/anonymous", { method: "POST", body: { roleId, scopeKey } }) : request(`/anonymous/${editing.grant.id}`, { method: "PUT", body: { roleId } })
|
|
1824
|
+
);
|
|
1825
|
+
if (done === void 0) return;
|
|
1826
|
+
notify5.success(editing.mode === "give" ? t("given") : t("changed"));
|
|
1827
|
+
setEditing(null);
|
|
1828
|
+
await grants.reload();
|
|
1829
|
+
}
|
|
1830
|
+
async function remove(g) {
|
|
1831
|
+
const where = whereOf(g);
|
|
1832
|
+
if (!await confirm({ title: t("revokeTitle", { role: grantRole(g), scope: where.label }), confirmLabel: t("revoke"), danger: true })) return;
|
|
1704
1833
|
try {
|
|
1705
1834
|
await request(`/anonymous/${g.id}`, { method: "DELETE" });
|
|
1706
1835
|
notify5.success(t("revoked"));
|
|
@@ -1709,57 +1838,156 @@ function AnonymousScreen({ roleName }) {
|
|
|
1709
1838
|
notify5.error(errorText2(e));
|
|
1710
1839
|
}
|
|
1711
1840
|
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1841
|
+
const canGive = placesOffering(places.data ?? [], "", takenBy(grants.data ?? [])).length > 0;
|
|
1842
|
+
const giveButton = canGive && /* @__PURE__ */ jsx9(Button7, { variant: "primary", onClick: () => open({ mode: "give" }), children: t("giveRole") });
|
|
1843
|
+
const empty = grants.data !== void 0 && grants.data.length === 0;
|
|
1844
|
+
const whereLabel = (p) => p.code ? t("placeWithCode", { place: p.label, code: p.code }) : p.label;
|
|
1845
|
+
const previewWhere = chosenPlace ? whereLabel(chosenPlace) : void 0;
|
|
1846
|
+
return /* @__PURE__ */ jsxs9(Stack7, { gap: "section", children: [
|
|
1847
|
+
/* @__PURE__ */ jsx9(PageHeader3, { title: t("title"), description: t("subtitle"), actions: !empty ? giveButton : void 0 }),
|
|
1848
|
+
/* @__PURE__ */ jsx9(InlineAlert6, { tone: "danger", children: grants.error ?? places.error }),
|
|
1849
|
+
empty ? /* @__PURE__ */ jsx9(
|
|
1850
|
+
EmptyState,
|
|
1851
|
+
{
|
|
1852
|
+
variant: "page",
|
|
1853
|
+
size: "md",
|
|
1854
|
+
kind: "first-use",
|
|
1855
|
+
illustration: "views",
|
|
1856
|
+
title: t("emptyTitle"),
|
|
1857
|
+
description: canGive || places.data === void 0 ? t("emptyText") : t("emptyTextNoPlaces"),
|
|
1858
|
+
action: giveButton || void 0
|
|
1859
|
+
}
|
|
1860
|
+
) : /* @__PURE__ */ jsx9(Panel7, { flush: true, children: /* @__PURE__ */ jsx9(
|
|
1716
1861
|
DataTable6,
|
|
1717
1862
|
{
|
|
1718
|
-
"aria-label": t("
|
|
1863
|
+
"aria-label": t("tableLabel"),
|
|
1719
1864
|
rows: grants.data,
|
|
1720
1865
|
loading: grants.loading,
|
|
1721
1866
|
getRowId: (g) => g.id,
|
|
1722
|
-
empty: /* @__PURE__ */ jsx9(Text9, { color: "fg.muted", children: t("empty") }),
|
|
1723
1867
|
columns: [
|
|
1724
|
-
{
|
|
1725
|
-
|
|
1726
|
-
|
|
1868
|
+
{
|
|
1869
|
+
id: "role",
|
|
1870
|
+
header: t("role"),
|
|
1871
|
+
cell: (g) => /* @__PURE__ */ jsx9(StatusPill6, { tone: "info", dot: false, children: grantRole(g) })
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
id: "scope",
|
|
1875
|
+
header: t("scope"),
|
|
1876
|
+
cell: (g) => {
|
|
1877
|
+
const where = whereOf(g);
|
|
1878
|
+
return /* @__PURE__ */ jsxs9(HStack8, { gap: "2", minW: "0", children: [
|
|
1879
|
+
/* @__PURE__ */ jsx9(Text9, { as: "span", fontWeight: "semibold", truncate: true, children: where.href ? /* @__PURE__ */ jsx9(AppLink4, { href: where.href, children: where.label }) : where.label }),
|
|
1880
|
+
where.code && /* @__PURE__ */ jsx9(RecordKey4, { value: where.code, variant: "muted" })
|
|
1881
|
+
] });
|
|
1882
|
+
}
|
|
1883
|
+
},
|
|
1884
|
+
{ id: "since", header: t("since"), nowrap: true, cell: (g) => /* @__PURE__ */ jsx9(Text9, { as: "span", color: "fg.muted", children: fmt.dateTime(g.createdAt, { dateStyle: "medium" }) }) },
|
|
1727
1885
|
{
|
|
1728
1886
|
id: "actions",
|
|
1729
|
-
header: /* @__PURE__ */ jsx9(Text9, { as: "span", srOnly: true, children: t("
|
|
1887
|
+
header: /* @__PURE__ */ jsx9(Text9, { as: "span", srOnly: true, children: t("actions") }),
|
|
1730
1888
|
align: "end",
|
|
1731
|
-
cell: (g) =>
|
|
1889
|
+
cell: (g) => {
|
|
1890
|
+
const place = g.scopeKey ? placeOf.get(g.scopeKey) : void 0;
|
|
1891
|
+
return /* @__PURE__ */ jsx9(
|
|
1892
|
+
RowMenu,
|
|
1893
|
+
{
|
|
1894
|
+
label: t("menuLabel", { role: grantRole(g), scope: whereOf(g).label }),
|
|
1895
|
+
items: [
|
|
1896
|
+
{ id: "change", label: t("change"), icon: /* @__PURE__ */ jsx9(Pencil, {}), disabled: !place, onSelect: () => place && open({ mode: "change", grant: g, place }) },
|
|
1897
|
+
...place ? [] : [{ note: t("notListed") }],
|
|
1898
|
+
{ separator: true },
|
|
1899
|
+
{ id: "remove", label: t("revoke"), icon: /* @__PURE__ */ jsx9(Trash2, {}), danger: true, onSelect: () => void remove(g) }
|
|
1900
|
+
]
|
|
1901
|
+
}
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1732
1904
|
}
|
|
1733
1905
|
]
|
|
1734
1906
|
}
|
|
1735
|
-
) })
|
|
1907
|
+
) }),
|
|
1908
|
+
/* @__PURE__ */ jsxs9(
|
|
1909
|
+
FormDialog,
|
|
1910
|
+
{
|
|
1911
|
+
open: editing !== null,
|
|
1912
|
+
onOpenChange: (o) => {
|
|
1913
|
+
if (!o) setEditing(null);
|
|
1914
|
+
},
|
|
1915
|
+
title: shown.mode === "change" ? t("changeTitle", { scope: shown.place.label }) : t("dialogTitle"),
|
|
1916
|
+
submitLabel: shown.mode === "change" ? t("change") : t("give"),
|
|
1917
|
+
submitDisabled: unchanged,
|
|
1918
|
+
onSubmit: save,
|
|
1919
|
+
busy: action.busy,
|
|
1920
|
+
error: action.error,
|
|
1921
|
+
preview: /* @__PURE__ */ jsx9(
|
|
1922
|
+
PreviewCard,
|
|
1923
|
+
{
|
|
1924
|
+
media: /* @__PURE__ */ jsx9(IconTile, { size: "md", children: /* @__PURE__ */ jsx9(Globe, {}) }),
|
|
1925
|
+
title: t("who"),
|
|
1926
|
+
subtitle: chosenRole ? nameOf(chosenRole) : void 0,
|
|
1927
|
+
items: [
|
|
1928
|
+
{ label: t("scope"), value: previewWhere },
|
|
1929
|
+
{ label: t("can"), wrap: true, value: chosenRole ? describe(chosenRole) : void 0 }
|
|
1930
|
+
]
|
|
1931
|
+
}
|
|
1932
|
+
),
|
|
1933
|
+
children: [
|
|
1934
|
+
/* @__PURE__ */ jsx9(Field2, { label: t("role"), required: true, children: /* @__PURE__ */ jsx9(
|
|
1935
|
+
SelectField2,
|
|
1936
|
+
{
|
|
1937
|
+
value: roleId,
|
|
1938
|
+
onChange: (e) => {
|
|
1939
|
+
const next = e.target.value;
|
|
1940
|
+
setRoleId(next);
|
|
1941
|
+
if (shown.mode === "give") setScopeKey(placeKept(places.data ?? [], scopeKey, next, taken));
|
|
1942
|
+
},
|
|
1943
|
+
options: [{ value: "", label: t("chooseRole") }, ...roleOptions.map((r) => ({ value: r.id, label: nameOf(r) }))]
|
|
1944
|
+
}
|
|
1945
|
+
) }),
|
|
1946
|
+
shown.mode === "change" ? (
|
|
1947
|
+
// The place a change keeps: a label and its value, not a field (there's nothing to fill in).
|
|
1948
|
+
/* @__PURE__ */ jsxs9(Stack7, { gap: "1.5", children: [
|
|
1949
|
+
/* @__PURE__ */ jsx9(Text9, { id: "anonymous-change-where", textStyle: "label", children: t("scope") }),
|
|
1950
|
+
/* @__PURE__ */ jsx9(Text9, { textStyle: "body.sm", "aria-labelledby": "anonymous-change-where", children: whereLabel(shown.place) })
|
|
1951
|
+
] })
|
|
1952
|
+
) : /* @__PURE__ */ jsx9(Field2, { label: t("scope"), required: true, children: /* @__PURE__ */ jsx9(
|
|
1953
|
+
SelectField2,
|
|
1954
|
+
{
|
|
1955
|
+
value: scopeKey,
|
|
1956
|
+
onChange: (e) => setScopeKey(e.target.value),
|
|
1957
|
+
options: [{ value: "", label: t("chooseWhere") }, ...placeOptions.map((p) => ({ value: p.scopeKey, label: whereLabel(p) }))]
|
|
1958
|
+
}
|
|
1959
|
+
) }),
|
|
1960
|
+
/* @__PURE__ */ jsx9(InlineAlert6, { tone: "warning", children: t("warning") })
|
|
1961
|
+
]
|
|
1962
|
+
}
|
|
1963
|
+
)
|
|
1736
1964
|
] });
|
|
1737
1965
|
}
|
|
1738
1966
|
|
|
1739
1967
|
// src/areas/guard/DirectoriesScreen.tsx
|
|
1740
|
-
import { useState as
|
|
1741
|
-
import { HStack as
|
|
1968
|
+
import { useState as useState6 } from "react";
|
|
1969
|
+
import { HStack as HStack10, Stack as Stack9 } from "@chakra-ui/react";
|
|
1742
1970
|
import { ArrowDown, ArrowUp, RefreshCw } from "lucide-react";
|
|
1743
1971
|
import {
|
|
1744
1972
|
AppLink as AppLink5,
|
|
1745
|
-
Button as
|
|
1973
|
+
Button as Button9,
|
|
1746
1974
|
DataTable as DataTable7,
|
|
1747
|
-
IconButton
|
|
1975
|
+
IconButton,
|
|
1748
1976
|
InlineAlert as InlineAlert8,
|
|
1749
1977
|
Loading as Loading2,
|
|
1750
1978
|
PageHeader as PageHeader4,
|
|
1751
1979
|
Panel as Panel8,
|
|
1752
|
-
StatusPill as
|
|
1980
|
+
StatusPill as StatusPill7,
|
|
1753
1981
|
Tooltip,
|
|
1754
|
-
useApiAction as
|
|
1982
|
+
useApiAction as useApiAction7,
|
|
1755
1983
|
useApiQuery as useApiQuery6,
|
|
1756
1984
|
useAreaRequest as useAreaRequest8
|
|
1757
1985
|
} from "@abpjs/ui";
|
|
1758
1986
|
|
|
1759
1987
|
// src/areas/guard/DirectoryForm.tsx
|
|
1760
|
-
import { useState as
|
|
1761
|
-
import { Fieldset, HStack as
|
|
1762
|
-
import { Button as
|
|
1988
|
+
import { useState as useState5 } from "react";
|
|
1989
|
+
import { Fieldset, HStack as HStack9, Input as Input3, SimpleGrid as SimpleGrid2, Stack as Stack8, Text as Text10 } from "@chakra-ui/react";
|
|
1990
|
+
import { Button as Button8, CheckboxField, errorText as errorText3, Field as Field3, HostSlot as HostSlot2, InlineAlert as InlineAlert7, SelectField as SelectField3, TranslatedInput as TranslatedInput2 } from "@abpjs/ui";
|
|
1763
1991
|
import { fromNamesValue, toNamesValue } from "@abpjs/ui/rules";
|
|
1764
1992
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1765
1993
|
function defaultsFor(type) {
|
|
@@ -1770,9 +1998,9 @@ function defaultsFor(type) {
|
|
|
1770
1998
|
function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSettings }) {
|
|
1771
1999
|
const t = useGuardNs("directoryForm");
|
|
1772
2000
|
const tc = useGuardNs("common");
|
|
1773
|
-
const [input, setInput] =
|
|
1774
|
-
const [error, setError] =
|
|
1775
|
-
const [busy, setBusy] =
|
|
2001
|
+
const [input, setInput] = useState5(initial);
|
|
2002
|
+
const [error, setError] = useState5(null);
|
|
2003
|
+
const [busy, setBusy] = useState5(false);
|
|
1776
2004
|
const type = types.find((x) => x.type === input.type);
|
|
1777
2005
|
const definitions = type?.settings ?? fallbackSettings ?? [];
|
|
1778
2006
|
function set(key, value) {
|
|
@@ -1800,9 +2028,9 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1800
2028
|
setBusy(false);
|
|
1801
2029
|
}
|
|
1802
2030
|
}
|
|
1803
|
-
return /* @__PURE__ */ jsx10("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs10(
|
|
2031
|
+
return /* @__PURE__ */ jsx10("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs10(Stack8, { gap: "field", children: [
|
|
1804
2032
|
/* @__PURE__ */ jsxs10(SimpleGrid2, { columns: { base: 1, md: 2 }, gap: "field", children: [
|
|
1805
|
-
/* @__PURE__ */ jsx10(
|
|
2033
|
+
/* @__PURE__ */ jsx10(Field3, { label: t("name"), required: true, children: /* @__PURE__ */ jsx10(
|
|
1806
2034
|
TranslatedInput2,
|
|
1807
2035
|
{
|
|
1808
2036
|
value: toNamesValue(input.name, input.names),
|
|
@@ -1813,8 +2041,8 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1813
2041
|
}
|
|
1814
2042
|
}
|
|
1815
2043
|
) }),
|
|
1816
|
-
/* @__PURE__ */ jsx10(
|
|
1817
|
-
|
|
2044
|
+
/* @__PURE__ */ jsx10(Field3, { label: t("type"), required: true, children: mode === "create" ? /* @__PURE__ */ jsx10(
|
|
2045
|
+
SelectField3,
|
|
1818
2046
|
{
|
|
1819
2047
|
value: input.type,
|
|
1820
2048
|
onChange: (e) => changeType(e.target.value),
|
|
@@ -1827,7 +2055,7 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1827
2055
|
]
|
|
1828
2056
|
}
|
|
1829
2057
|
) : /* @__PURE__ */ jsx10(Input3, { value: type?.displayName ?? input.type, readOnly: true }) }),
|
|
1830
|
-
/* @__PURE__ */ jsx10(
|
|
2058
|
+
/* @__PURE__ */ jsx10(Field3, { label: t("syncInterval"), helperText: t("syncIntervalHint"), children: /* @__PURE__ */ jsx10(
|
|
1831
2059
|
Input3,
|
|
1832
2060
|
{
|
|
1833
2061
|
type: "number",
|
|
@@ -1836,7 +2064,7 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1836
2064
|
onChange: (e) => set("syncIntervalMinutes", e.target.value === "" ? null : Number(e.target.value))
|
|
1837
2065
|
}
|
|
1838
2066
|
) }),
|
|
1839
|
-
/* @__PURE__ */ jsxs10(
|
|
2067
|
+
/* @__PURE__ */ jsxs10(Stack8, { gap: "2", justify: "flex-end", pb: "1", children: [
|
|
1840
2068
|
/* @__PURE__ */ jsx10(CheckboxField, { label: t("active"), checked: input.isActive, onCheckedChange: (v) => set("isActive", v) }),
|
|
1841
2069
|
/* @__PURE__ */ jsx10(CheckboxField, { label: t("signInEnabled"), checked: input.authenticationEnabled, onCheckedChange: (v) => set("authenticationEnabled", v) })
|
|
1842
2070
|
] })
|
|
@@ -1846,7 +2074,7 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1846
2074
|
/* @__PURE__ */ jsx10(Fieldset.Legend, { textStyle: "label", px: "1", children: t("connectionSettings") }),
|
|
1847
2075
|
/* @__PURE__ */ jsxs10(Fieldset.Content, { gap: "field", children: [
|
|
1848
2076
|
input.type && /* @__PURE__ */ jsx10(HostSlot2, { name: "guard.directory.presets", context: { type: input.type, apply: applyPreset } }),
|
|
1849
|
-
/* @__PURE__ */ jsx10(SimpleGrid2, { columns: { base: 1, md: 2 }, gap: "field", children: definitions.map((d) => /* @__PURE__ */ jsx10(
|
|
2077
|
+
/* @__PURE__ */ jsx10(SimpleGrid2, { columns: { base: 1, md: 2 }, gap: "field", children: definitions.map((d) => /* @__PURE__ */ jsx10(Field3, { label: d.label || d.name, helperText: d.help ?? void 0, required: d.required && !(d.secret && mode === "edit"), children: /* @__PURE__ */ jsx10(
|
|
1850
2078
|
Input3,
|
|
1851
2079
|
{
|
|
1852
2080
|
type: d.secret ? "password" : "text",
|
|
@@ -1860,19 +2088,19 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1860
2088
|
] })
|
|
1861
2089
|
] }),
|
|
1862
2090
|
/* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: error }),
|
|
1863
|
-
/* @__PURE__ */ jsxs10(
|
|
1864
|
-
/* @__PURE__ */ jsx10(
|
|
1865
|
-
onCancel && /* @__PURE__ */ jsx10(
|
|
2091
|
+
/* @__PURE__ */ jsxs10(HStack9, { gap: "2", children: [
|
|
2092
|
+
/* @__PURE__ */ jsx10(Button8, { type: "submit", variant: "primary", loading: busy, disabled: !input.type, children: mode === "create" ? t("create") : t("save") }),
|
|
2093
|
+
onCancel && /* @__PURE__ */ jsx10(Button8, { onClick: onCancel, children: tc("cancel") })
|
|
1866
2094
|
] })
|
|
1867
2095
|
] }) });
|
|
1868
2096
|
}
|
|
1869
2097
|
function DirectoryWarnings({ title, warnings }) {
|
|
1870
2098
|
if (!warnings || warnings.length === 0) return null;
|
|
1871
|
-
return /* @__PURE__ */ jsx10(InlineAlert7, { tone: "warning", title, "data-testid": "directory-warnings", children: /* @__PURE__ */ jsx10(
|
|
2099
|
+
return /* @__PURE__ */ jsx10(InlineAlert7, { tone: "warning", title, "data-testid": "directory-warnings", children: /* @__PURE__ */ jsx10(Stack8, { gap: "0.5", as: "ul", listStyle: "none", children: warnings.map((w) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10(Text10, { dir: "auto", children: w }) }, w)) }) });
|
|
1872
2100
|
}
|
|
1873
2101
|
|
|
1874
2102
|
// src/areas/guard/DirectoriesScreen.tsx
|
|
1875
|
-
import { Fragment as
|
|
2103
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1876
2104
|
var EMPTY_INPUT = {
|
|
1877
2105
|
name: "",
|
|
1878
2106
|
type: "",
|
|
@@ -1887,11 +2115,11 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
1887
2115
|
const request = useAreaRequest8("guard");
|
|
1888
2116
|
const dirs = useApiQuery6("guard", "/directories");
|
|
1889
2117
|
const types = useApiQuery6("guard", "/directory-types");
|
|
1890
|
-
const action =
|
|
1891
|
-
const [adding, setAdding] =
|
|
1892
|
-
const [notice, setNotice] =
|
|
1893
|
-
const [syncing, setSyncing] =
|
|
1894
|
-
const [added, setAdded] =
|
|
2118
|
+
const action = useApiAction7();
|
|
2119
|
+
const [adding, setAdding] = useState6(false);
|
|
2120
|
+
const [notice, setNotice] = useState6(null);
|
|
2121
|
+
const [syncing, setSyncing] = useState6(null);
|
|
2122
|
+
const [added, setAdded] = useState6(null);
|
|
1895
2123
|
const list = dirs.data ?? [];
|
|
1896
2124
|
async function move(index, delta) {
|
|
1897
2125
|
const target = index + delta;
|
|
@@ -1934,10 +2162,10 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
1934
2162
|
{
|
|
1935
2163
|
id: "name",
|
|
1936
2164
|
header: tc("name"),
|
|
1937
|
-
cell: (d) => /* @__PURE__ */ jsxs11(
|
|
2165
|
+
cell: (d) => /* @__PURE__ */ jsxs11(Stack9, { gap: "1", align: "flex-start", children: [
|
|
1938
2166
|
/* @__PURE__ */ jsx11(AppLink5, { href: routes.directory(d.id), fontWeight: "medium", children: d.name }),
|
|
1939
|
-
!d.connectorAvailable && /* @__PURE__ */ jsx11(
|
|
1940
|
-
d.warnings && d.warnings.length > 0 && /* @__PURE__ */ jsx11(
|
|
2167
|
+
!d.connectorAvailable && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.pluginKey ? t("pluginDisabledHint", { plugin: d.pluginKey }) : void 0, children: t("connectorDisabled") }),
|
|
2168
|
+
d.warnings && d.warnings.length > 0 && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.warnings.join("\n"), children: t("warnings", { count: d.warnings.length }) })
|
|
1941
2169
|
] })
|
|
1942
2170
|
},
|
|
1943
2171
|
{ id: "type", header: tc("type"), cell: (d) => d.typeDisplayName || d.type },
|
|
@@ -1952,20 +2180,20 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
1952
2180
|
align: "end",
|
|
1953
2181
|
nowrap: true,
|
|
1954
2182
|
// Its buttons as their ghosts while the list loads, so a placeholder row is as tall as a real one.
|
|
1955
|
-
skeleton: () => /* @__PURE__ */ jsx11(Loading2, { when: true, children: /* @__PURE__ */ jsxs11(
|
|
1956
|
-
/* @__PURE__ */ jsx11(
|
|
1957
|
-
/* @__PURE__ */ jsx11(
|
|
1958
|
-
/* @__PURE__ */ jsxs11(
|
|
2183
|
+
skeleton: () => /* @__PURE__ */ jsx11(Loading2, { when: true, children: /* @__PURE__ */ jsxs11(HStack10, { gap: "1", justify: "flex-end", children: [
|
|
2184
|
+
/* @__PURE__ */ jsx11(IconButton, { size: "sm", "aria-label": t("moveUp", { name: "" }), children: /* @__PURE__ */ jsx11(ArrowUp, {}) }),
|
|
2185
|
+
/* @__PURE__ */ jsx11(IconButton, { size: "sm", "aria-label": t("moveDown", { name: "" }), children: /* @__PURE__ */ jsx11(ArrowDown, {}) }),
|
|
2186
|
+
/* @__PURE__ */ jsxs11(Button9, { size: "sm", children: [
|
|
1959
2187
|
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
1960
2188
|
t("syncNow")
|
|
1961
2189
|
] })
|
|
1962
2190
|
] }) }),
|
|
1963
2191
|
cell: (d) => {
|
|
1964
2192
|
const i = list.indexOf(d);
|
|
1965
|
-
return /* @__PURE__ */ jsxs11(
|
|
1966
|
-
/* @__PURE__ */ jsx11(
|
|
1967
|
-
/* @__PURE__ */ jsx11(
|
|
1968
|
-
/* @__PURE__ */ jsx11(Tooltip, { content: t("connectorDisabled"), disabled: d.connectorAvailable, children: /* @__PURE__ */ jsxs11(
|
|
2193
|
+
return /* @__PURE__ */ jsxs11(HStack10, { gap: "1", justify: "flex-end", children: [
|
|
2194
|
+
/* @__PURE__ */ jsx11(IconButton, { size: "sm", "aria-label": t("moveUp", { name: d.name }), disabled: i === 0 || action.busy, onClick: () => move(i, -1), children: /* @__PURE__ */ jsx11(ArrowUp, {}) }),
|
|
2195
|
+
/* @__PURE__ */ jsx11(IconButton, { size: "sm", "aria-label": t("moveDown", { name: d.name }), disabled: i === list.length - 1 || action.busy, onClick: () => move(i, 1), children: /* @__PURE__ */ jsx11(ArrowDown, {}) }),
|
|
2196
|
+
/* @__PURE__ */ jsx11(Tooltip, { content: t("connectorDisabled"), disabled: d.connectorAvailable, children: /* @__PURE__ */ jsxs11(Button9, { size: "sm", disabled: syncing != null || !d.connectorAvailable, loading: syncing === d.id, onClick: () => sync(d), children: [
|
|
1969
2197
|
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
1970
2198
|
t("syncNow")
|
|
1971
2199
|
] }) })
|
|
@@ -1973,19 +2201,19 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
1973
2201
|
}
|
|
1974
2202
|
}
|
|
1975
2203
|
];
|
|
1976
|
-
return /* @__PURE__ */ jsxs11(
|
|
2204
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1977
2205
|
/* @__PURE__ */ jsx11(
|
|
1978
2206
|
PageHeader4,
|
|
1979
2207
|
{
|
|
1980
2208
|
title: t("title"),
|
|
1981
2209
|
description: t("subtitle"),
|
|
1982
|
-
actions: !adding && /* @__PURE__ */ jsx11(
|
|
2210
|
+
actions: !adding && /* @__PURE__ */ jsx11(Button9, { variant: "primary", onClick: () => {
|
|
1983
2211
|
setAdded(null);
|
|
1984
2212
|
setAdding(true);
|
|
1985
2213
|
}, children: t("add") })
|
|
1986
2214
|
}
|
|
1987
2215
|
),
|
|
1988
|
-
/* @__PURE__ */ jsxs11(
|
|
2216
|
+
/* @__PURE__ */ jsxs11(Stack9, { gap: "section", children: [
|
|
1989
2217
|
adding && /* @__PURE__ */ jsx11(Panel8, { title: t("add"), children: types.error ? /* @__PURE__ */ jsx11(InlineAlert8, { tone: "danger", children: types.error }) : (
|
|
1990
2218
|
// The form is there while the types load, its fields as their ghosts.
|
|
1991
2219
|
/* @__PURE__ */ jsx11(Loading2, { when: !types.data, children: /* @__PURE__ */ jsx11(
|
|
@@ -2024,30 +2252,30 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
2024
2252
|
}
|
|
2025
2253
|
|
|
2026
2254
|
// src/areas/guard/DirectoryScreen.tsx
|
|
2027
|
-
import { useMemo, useState as
|
|
2028
|
-
import { Box, Grid, HStack as
|
|
2255
|
+
import { useMemo as useMemo2, useState as useState7 } from "react";
|
|
2256
|
+
import { Box, Grid, HStack as HStack11, Input as Input4, List, Stack as Stack10, Text as Text11 } from "@chakra-ui/react";
|
|
2029
2257
|
import {
|
|
2030
2258
|
AppLink as AppLink6,
|
|
2031
|
-
Button as
|
|
2259
|
+
Button as Button10,
|
|
2032
2260
|
DataTable as DataTable8,
|
|
2033
2261
|
errorText as errorText4,
|
|
2034
|
-
Field as
|
|
2262
|
+
Field as Field4,
|
|
2035
2263
|
HostSlot as HostSlot3,
|
|
2036
2264
|
InlineAlert as InlineAlert9,
|
|
2037
2265
|
Loading as Loading3,
|
|
2038
2266
|
PageHeader as PageHeader5,
|
|
2039
2267
|
Panel as Panel9,
|
|
2040
2268
|
PropertyList as PropertyList3,
|
|
2041
|
-
StatusPill as
|
|
2269
|
+
StatusPill as StatusPill8,
|
|
2042
2270
|
TextSlot as TextSlot2,
|
|
2043
|
-
useApiAction as
|
|
2271
|
+
useApiAction as useApiAction8,
|
|
2044
2272
|
useApiQuery as useApiQuery7,
|
|
2045
2273
|
useAreaRequest as useAreaRequest9,
|
|
2046
2274
|
useConfirm as useConfirm3,
|
|
2047
2275
|
useFormatters as useFormatters7,
|
|
2048
2276
|
useNavigate as useNavigate2
|
|
2049
2277
|
} from "@abpjs/ui";
|
|
2050
|
-
import { Fragment as
|
|
2278
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2051
2279
|
var STEPS = ["Connection", "FindUser", "Authenticate", "Precedence"];
|
|
2052
2280
|
var PLACEHOLDER = { name: "", type: "", isActive: true, authenticationEnabled: true, syncIntervalMinutes: 60, settings: {} };
|
|
2053
2281
|
function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
@@ -2061,15 +2289,15 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2061
2289
|
const dirs = useApiQuery7("guard", "/directories");
|
|
2062
2290
|
const types = useApiQuery7("guard", "/directory-types");
|
|
2063
2291
|
const runs = useApiQuery7("guard", `/directories/${id}/sync-runs`);
|
|
2064
|
-
const action =
|
|
2065
|
-
const [saved, setSaved] =
|
|
2066
|
-
const [formKey, setFormKey] =
|
|
2067
|
-
const [test, setTest] =
|
|
2068
|
-
const [syncMsg, setSyncMsg] =
|
|
2292
|
+
const action = useApiAction8();
|
|
2293
|
+
const [saved, setSaved] = useState7(false);
|
|
2294
|
+
const [formKey, setFormKey] = useState7(0);
|
|
2295
|
+
const [test, setTest] = useState7(null);
|
|
2296
|
+
const [syncMsg, setSyncMsg] = useState7(null);
|
|
2069
2297
|
const dir = dirs.data?.find((d) => d.id === id);
|
|
2070
2298
|
const type = types.data?.find((x) => x.type === dir?.type);
|
|
2071
|
-
const secretNames =
|
|
2072
|
-
const initial =
|
|
2299
|
+
const secretNames = useMemo2(() => new Set((type?.settings ?? []).filter((s) => s.secret).map((s) => s.name)), [type]);
|
|
2300
|
+
const initial = useMemo2(() => {
|
|
2073
2301
|
if (!dir) return null;
|
|
2074
2302
|
const settings = {};
|
|
2075
2303
|
for (const [k, v] of Object.entries(dir.settings)) settings[k] = secretNames.has(k) || v === "********" ? "" : v;
|
|
@@ -2083,7 +2311,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2083
2311
|
settings
|
|
2084
2312
|
};
|
|
2085
2313
|
}, [dir, secretNames]);
|
|
2086
|
-
const fallbackSettings =
|
|
2314
|
+
const fallbackSettings = useMemo2(
|
|
2087
2315
|
() => Object.keys(dir?.settings ?? {}).map((name) => ({
|
|
2088
2316
|
name,
|
|
2089
2317
|
label: name,
|
|
@@ -2129,7 +2357,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2129
2357
|
if (dirs.error) return /* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", children: dirs.error });
|
|
2130
2358
|
const loading = !dirs.data || !types.data;
|
|
2131
2359
|
if (!loading && (!dir || !initial))
|
|
2132
|
-
return /* @__PURE__ */ jsxs12(
|
|
2360
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2133
2361
|
/* @__PURE__ */ jsx12(PageHeader5, { breadcrumbs: [{ label: tn("directories"), href: routes.directories }], title: t("notFound") }),
|
|
2134
2362
|
/* @__PURE__ */ jsx12(AppLink6, { href: routes.directories, children: t("back") })
|
|
2135
2363
|
] });
|
|
@@ -2154,21 +2382,21 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2154
2382
|
{
|
|
2155
2383
|
breadcrumbs: [{ label: tn("directories"), href: routes.directories }, { label: dir?.name }],
|
|
2156
2384
|
title: dir?.name,
|
|
2157
|
-
meta: /* @__PURE__ */ jsxs12(
|
|
2385
|
+
meta: /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2158
2386
|
/* @__PURE__ */ jsx12(Text11, { as: "span", children: /* @__PURE__ */ jsx12(TextSlot2, { width: 8, children: dir && (dir.typeDisplayName || dir.type) }) }),
|
|
2159
2387
|
/* @__PURE__ */ jsx12(Text11, { as: "span", children: /* @__PURE__ */ jsx12(TextSlot2, { width: 8, children: dir && t("order", { order: dir.order }) }) }),
|
|
2160
|
-
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.isActive, yes: tc("active"), no: tc("inactive") }) : /* @__PURE__ */ jsx12(
|
|
2161
|
-
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.authenticationEnabled, yes: t("signInEnabled"), no: t("signInDisabled") }) : /* @__PURE__ */ jsx12(
|
|
2162
|
-
dir && !dir.connectorAvailable && /* @__PURE__ */ jsx12(
|
|
2388
|
+
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.isActive, yes: tc("active"), no: tc("inactive") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2389
|
+
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.authenticationEnabled, yes: t("signInEnabled"), no: t("signInDisabled") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2390
|
+
dir && !dir.connectorAvailable && /* @__PURE__ */ jsx12(StatusPill8, { tone: "warning", children: t("connectorDisabled") })
|
|
2163
2391
|
] }),
|
|
2164
|
-
actions: /* @__PURE__ */ jsxs12(
|
|
2165
|
-
/* @__PURE__ */ jsx12(
|
|
2166
|
-
/* @__PURE__ */ jsx12(
|
|
2167
|
-
dir?.type !== "internal" && /* @__PURE__ */ jsx12(
|
|
2392
|
+
actions: /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2393
|
+
/* @__PURE__ */ jsx12(Button10, { onClick: testConnection, disabled: action.busy || dir?.connectorAvailable === false, children: t("testConnection") }),
|
|
2394
|
+
/* @__PURE__ */ jsx12(Button10, { onClick: syncNow, disabled: action.busy || dir?.connectorAvailable === false, children: t("syncNow") }),
|
|
2395
|
+
dir?.type !== "internal" && /* @__PURE__ */ jsx12(Button10, { danger: true, onClick: remove, disabled: action.busy, children: tc("delete") })
|
|
2168
2396
|
] })
|
|
2169
2397
|
}
|
|
2170
2398
|
),
|
|
2171
|
-
/* @__PURE__ */ jsxs12(
|
|
2399
|
+
/* @__PURE__ */ jsxs12(Stack10, { gap: "section", children: [
|
|
2172
2400
|
/* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", children: action.error }),
|
|
2173
2401
|
dir && /* @__PURE__ */ jsx12(DirectoryWarnings, { title: t("warningsTitle"), warnings: dir.warnings }),
|
|
2174
2402
|
test && /* @__PURE__ */ jsxs12(InlineAlert9, { tone: test.succeeded ? "success" : "warning", title: test.succeeded ? t("connectionSucceeded") : t("connectionFailed"), children: [
|
|
@@ -2177,7 +2405,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2177
2405
|
] }),
|
|
2178
2406
|
syncMsg && /* @__PURE__ */ jsx12(InlineAlert9, { tone: syncMsg.ok ? "success" : "warning", children: syncMsg.text }),
|
|
2179
2407
|
/* @__PURE__ */ jsxs12(Grid, { templateColumns: { base: "minmax(0, 1fr)", lg: "minmax(0, 1fr) {sizes.sidePanel}" }, gap: "section", alignItems: "start", children: [
|
|
2180
|
-
/* @__PURE__ */ jsx12(Panel9, { title: t("settings"), children: /* @__PURE__ */ jsxs12(
|
|
2408
|
+
/* @__PURE__ */ jsx12(Panel9, { title: t("settings"), children: /* @__PURE__ */ jsxs12(Stack10, { gap: "field", children: [
|
|
2181
2409
|
saved && /* @__PURE__ */ jsx12(InlineAlert9, { tone: "success", children: t("saved") }),
|
|
2182
2410
|
/* @__PURE__ */ jsx12(
|
|
2183
2411
|
DirectoryForm,
|
|
@@ -2191,7 +2419,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2191
2419
|
loading ? "loading" : formKey
|
|
2192
2420
|
)
|
|
2193
2421
|
] }) }),
|
|
2194
|
-
/* @__PURE__ */ jsxs12(
|
|
2422
|
+
/* @__PURE__ */ jsxs12(Stack10, { gap: "section", children: [
|
|
2195
2423
|
/* @__PURE__ */ jsx12(Panel9, { title: t("summary"), children: /* @__PURE__ */ jsx12(
|
|
2196
2424
|
PropertyList3,
|
|
2197
2425
|
{
|
|
@@ -2235,11 +2463,11 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2235
2463
|
const tc = useGuardNs("common");
|
|
2236
2464
|
const ts = useGuardNs("directoryDetail.steps");
|
|
2237
2465
|
const request = useAreaRequest9("guard");
|
|
2238
|
-
const [username, setUsername] =
|
|
2239
|
-
const [password, setPassword] =
|
|
2240
|
-
const [result, setResult] =
|
|
2241
|
-
const [error, setError] =
|
|
2242
|
-
const [busy, setBusy] =
|
|
2466
|
+
const [username, setUsername] = useState7("");
|
|
2467
|
+
const [password, setPassword] = useState7("");
|
|
2468
|
+
const [result, setResult] = useState7(null);
|
|
2469
|
+
const [error, setError] = useState7(null);
|
|
2470
|
+
const [busy, setBusy] = useState7(false);
|
|
2243
2471
|
async function submit(e) {
|
|
2244
2472
|
e.preventDefault();
|
|
2245
2473
|
setBusy(true);
|
|
@@ -2258,15 +2486,15 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2258
2486
|
...STEPS.map((step) => ({ step, label: ts(step), r: result.steps.find((s) => s.step === step) })),
|
|
2259
2487
|
...result.steps.filter((s) => !known.has(s.step)).map((s) => ({ step: s.step, label: s.step, r: s }))
|
|
2260
2488
|
] : [];
|
|
2261
|
-
return /* @__PURE__ */ jsx12(Panel9, { title: t("testLogin"), description: t("testLoginHint"), children: /* @__PURE__ */ jsxs12(
|
|
2262
|
-
/* @__PURE__ */ jsx12("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs12(
|
|
2263
|
-
/* @__PURE__ */ jsx12(
|
|
2264
|
-
/* @__PURE__ */ jsx12(
|
|
2265
|
-
/* @__PURE__ */ jsx12(
|
|
2489
|
+
return /* @__PURE__ */ jsx12(Panel9, { title: t("testLogin"), description: t("testLoginHint"), children: /* @__PURE__ */ jsxs12(Stack10, { gap: "stack", children: [
|
|
2490
|
+
/* @__PURE__ */ jsx12("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs12(Stack10, { gap: "stack", children: [
|
|
2491
|
+
/* @__PURE__ */ jsx12(Field4, { label: tc("username"), required: true, children: /* @__PURE__ */ jsx12(Input4, { size: "sm", value: username, onChange: (e) => setUsername(e.target.value), autoComplete: "off" }) }),
|
|
2492
|
+
/* @__PURE__ */ jsx12(Field4, { label: tc("password"), required: true, children: /* @__PURE__ */ jsx12(Input4, { size: "sm", type: "password", value: password, onChange: (e) => setPassword(e.target.value), autoComplete: "new-password" }) }),
|
|
2493
|
+
/* @__PURE__ */ jsx12(Button10, { type: "submit", size: "sm", w: "full", loading: busy, disabled, children: t("runTest") })
|
|
2266
2494
|
] }) }),
|
|
2267
2495
|
/* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", size: "sm", children: error }),
|
|
2268
2496
|
result && /* @__PURE__ */ jsx12(List.Root, { as: "ol", gap: "2", listStyle: "none", "aria-label": t("testSteps"), children: rows.map(({ step, label, r }) => /* @__PURE__ */ jsx12(List.Item, { layerStyle: "sunken", px: "3", py: "2", children: /* @__PURE__ */ jsxs12(Box, { w: "full", children: [
|
|
2269
|
-
/* @__PURE__ */ jsxs12(
|
|
2497
|
+
/* @__PURE__ */ jsxs12(HStack11, { justify: "space-between", gap: "2", children: [
|
|
2270
2498
|
/* @__PURE__ */ jsx12(Text11, { textStyle: "label", children: label }),
|
|
2271
2499
|
/* @__PURE__ */ jsx12(PassFail, { ok: r ? r.succeeded : null })
|
|
2272
2500
|
] }),
|
|
@@ -2276,27 +2504,27 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2276
2504
|
}
|
|
2277
2505
|
|
|
2278
2506
|
// src/areas/guard/GroupScreen.tsx
|
|
2279
|
-
import { useEffect, useState as
|
|
2280
|
-
import { Grid as Grid2, HStack as
|
|
2507
|
+
import { useEffect, useState as useState10 } from "react";
|
|
2508
|
+
import { Grid as Grid2, HStack as HStack14, Input as Input5, List as List3, Stack as Stack12, Text as Text14, Textarea } from "@chakra-ui/react";
|
|
2281
2509
|
import {
|
|
2282
2510
|
AppLink as AppLink8,
|
|
2283
|
-
Button as
|
|
2511
|
+
Button as Button11,
|
|
2284
2512
|
DataTable as DataTable9,
|
|
2285
2513
|
errorText as errorText7,
|
|
2286
|
-
Field as
|
|
2514
|
+
Field as Field5,
|
|
2287
2515
|
InlineAlert as InlineAlert11,
|
|
2288
2516
|
Loading as Loading4,
|
|
2289
2517
|
notify as notify7,
|
|
2290
2518
|
PageHeader as PageHeader6,
|
|
2291
2519
|
Panel as Panel11,
|
|
2292
2520
|
PathChips as PathChips2,
|
|
2293
|
-
RecordKey as
|
|
2521
|
+
RecordKey as RecordKey5,
|
|
2294
2522
|
SearchInput as SearchInput2,
|
|
2295
|
-
StatusPill as
|
|
2523
|
+
StatusPill as StatusPill10,
|
|
2296
2524
|
TextBone,
|
|
2297
2525
|
TextSlot as TextSlot3,
|
|
2298
2526
|
TranslatedInput as TranslatedInput3,
|
|
2299
|
-
useApiAction as
|
|
2527
|
+
useApiAction as useApiAction9,
|
|
2300
2528
|
useApiQuery as useApiQuery8,
|
|
2301
2529
|
useAreaRequest as useAreaRequest12,
|
|
2302
2530
|
useConfirm as useConfirm4,
|
|
@@ -2306,10 +2534,10 @@ import {
|
|
|
2306
2534
|
import { fromNamesValue as fromNamesValue2, splitList, toNamesValue as toNamesValue2 } from "@abpjs/ui/rules";
|
|
2307
2535
|
|
|
2308
2536
|
// src/areas/guard/GroupTree.tsx
|
|
2309
|
-
import { useState as
|
|
2310
|
-
import { Box as Box2, HStack as
|
|
2537
|
+
import { useState as useState8 } from "react";
|
|
2538
|
+
import { Box as Box2, HStack as HStack12, List as List2, Text as Text12 } from "@chakra-ui/react";
|
|
2311
2539
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
2312
|
-
import { AppLink as AppLink7, DirectionalIcon, errorText as errorText5, IconButton as
|
|
2540
|
+
import { AppLink as AppLink7, DirectionalIcon, errorText as errorText5, IconButton as IconButton2, StatusPill as StatusPill9, useAreaRequest as useAreaRequest10 } from "@abpjs/ui";
|
|
2313
2541
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2314
2542
|
function GroupTree({ rootId, rootName, rootMembers, routes = guardRoutes() }) {
|
|
2315
2543
|
return /* @__PURE__ */ jsxs13(Box2, { textStyle: "md", role: "tree", "aria-label": rootName, children: [
|
|
@@ -2329,9 +2557,9 @@ function Children({ members, ancestors, routes }) {
|
|
|
2329
2557
|
function Node({ member, ancestors, routes }) {
|
|
2330
2558
|
const t = useGuardNs("groupDetail");
|
|
2331
2559
|
const request = useAreaRequest10("guard");
|
|
2332
|
-
const [open, setOpen] =
|
|
2333
|
-
const [detail, setDetail] =
|
|
2334
|
-
const [error, setError] =
|
|
2560
|
+
const [open, setOpen] = useState8(false);
|
|
2561
|
+
const [detail, setDetail] = useState8(null);
|
|
2562
|
+
const [error, setError] = useState8(null);
|
|
2335
2563
|
const cyclic = ancestors.includes(member.memberId);
|
|
2336
2564
|
async function toggle() {
|
|
2337
2565
|
const next = !open;
|
|
@@ -2346,9 +2574,9 @@ function Node({ member, ancestors, routes }) {
|
|
|
2346
2574
|
}
|
|
2347
2575
|
}
|
|
2348
2576
|
return /* @__PURE__ */ jsxs13(List2.Item, { role: "treeitem", "aria-expanded": cyclic ? void 0 : open, display: "block", children: [
|
|
2349
|
-
/* @__PURE__ */ jsxs13(
|
|
2577
|
+
/* @__PURE__ */ jsxs13(HStack12, { gap: "1", children: [
|
|
2350
2578
|
cyclic ? /* @__PURE__ */ jsx13(Box2, { boxSize: "control.xs", flexShrink: "0" }) : /* @__PURE__ */ jsx13(
|
|
2351
|
-
|
|
2579
|
+
IconButton2,
|
|
2352
2580
|
{
|
|
2353
2581
|
size: "xs",
|
|
2354
2582
|
"aria-label": open ? t("collapse", { name: member.name }) : t("expand", { name: member.name }),
|
|
@@ -2357,7 +2585,7 @@ function Node({ member, ancestors, routes }) {
|
|
|
2357
2585
|
}
|
|
2358
2586
|
),
|
|
2359
2587
|
/* @__PURE__ */ jsx13(AppLink7, { href: routes.group(member.memberId), children: member.name }),
|
|
2360
|
-
cyclic && /* @__PURE__ */ jsx13(
|
|
2588
|
+
cyclic && /* @__PURE__ */ jsx13(StatusPill9, { tone: "warning", children: t("cycle") })
|
|
2361
2589
|
] }),
|
|
2362
2590
|
open && !cyclic && /* @__PURE__ */ jsxs13(Box2, { children: [
|
|
2363
2591
|
error && /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.danger", ms: "7", children: error }),
|
|
@@ -2368,16 +2596,16 @@ function Node({ member, ancestors, routes }) {
|
|
|
2368
2596
|
}
|
|
2369
2597
|
|
|
2370
2598
|
// src/areas/guard/GroupTwoFactorPanel.tsx
|
|
2371
|
-
import { useState as
|
|
2372
|
-
import { Box as Box3, chakra, HStack as
|
|
2599
|
+
import { useState as useState9 } from "react";
|
|
2600
|
+
import { Box as Box3, chakra, HStack as HStack13, Stack as Stack11, Text as Text13 } from "@chakra-ui/react";
|
|
2373
2601
|
import { errorText as errorText6, Indicator, InlineAlert as InlineAlert10, notify as notify6, Panel as Panel10, useAreaRequest as useAreaRequest11 } from "@abpjs/ui";
|
|
2374
2602
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2375
2603
|
var TWO_FACTOR_MODES = ["off", "optional", "required", "strong"];
|
|
2376
2604
|
function GroupTwoFactorPanel({ group, onSaved }) {
|
|
2377
2605
|
const t = useGuardNs("groupDetail.twoFactor");
|
|
2378
2606
|
const request = useAreaRequest11("guard");
|
|
2379
|
-
const [mode, setMode] =
|
|
2380
|
-
const [error, setError] =
|
|
2607
|
+
const [mode, setMode] = useState9(group.twoFactor ?? "off");
|
|
2608
|
+
const [error, setError] = useState9(null);
|
|
2381
2609
|
async function choose(next) {
|
|
2382
2610
|
if (next === mode) return;
|
|
2383
2611
|
const before = mode;
|
|
@@ -2392,9 +2620,9 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2392
2620
|
setError(errorText6(e));
|
|
2393
2621
|
}
|
|
2394
2622
|
}
|
|
2395
|
-
return /* @__PURE__ */ jsx14(Panel10, { title: t("title"), description: t("hint"), "data-testid": "group-two-factor", children: /* @__PURE__ */ jsxs14(
|
|
2623
|
+
return /* @__PURE__ */ jsx14(Panel10, { title: t("title"), description: t("hint"), "data-testid": "group-two-factor", children: /* @__PURE__ */ jsxs14(Stack11, { gap: "2", children: [
|
|
2396
2624
|
/* @__PURE__ */ jsx14(InlineAlert10, { tone: "danger", children: error }),
|
|
2397
|
-
/* @__PURE__ */ jsx14(
|
|
2625
|
+
/* @__PURE__ */ jsx14(HStack13, { gap: "1", p: "1", rounded: "l2", bg: "bg.subtle", w: "fit-content", maxW: "full", wrap: "wrap", role: "radiogroup", "aria-label": t("title"), children: TWO_FACTOR_MODES.map((choice) => /* @__PURE__ */ jsxs14(
|
|
2398
2626
|
chakra.button,
|
|
2399
2627
|
{
|
|
2400
2628
|
type: "button",
|
|
@@ -2423,7 +2651,7 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2423
2651
|
}
|
|
2424
2652
|
|
|
2425
2653
|
// src/areas/guard/GroupScreen.tsx
|
|
2426
|
-
import { Fragment as
|
|
2654
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2427
2655
|
function isSystemGroup(group) {
|
|
2428
2656
|
return group.system ?? false;
|
|
2429
2657
|
}
|
|
@@ -2438,8 +2666,8 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2438
2666
|
const navigate = useNavigate3();
|
|
2439
2667
|
const request = useAreaRequest12("guard");
|
|
2440
2668
|
const detail = useApiQuery8("guard", `/groups/${id}`);
|
|
2441
|
-
const action =
|
|
2442
|
-
const [treeKey, setTreeKey] =
|
|
2669
|
+
const action = useApiAction9();
|
|
2670
|
+
const [treeKey, setTreeKey] = useState10(0);
|
|
2443
2671
|
async function reload() {
|
|
2444
2672
|
await detail.reload();
|
|
2445
2673
|
setTreeKey((k) => k + 1);
|
|
@@ -2472,15 +2700,15 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2472
2700
|
id: "type",
|
|
2473
2701
|
header: tc("type"),
|
|
2474
2702
|
sortValue: (m) => m.memberType === "Group" ? 0 : 1,
|
|
2475
|
-
cell: (m) => m.memberType === "Group" ? /* @__PURE__ */ jsx15(
|
|
2703
|
+
cell: (m) => m.memberType === "Group" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tc("group") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tc("account") }),
|
|
2476
2704
|
skeleton: "pill"
|
|
2477
2705
|
},
|
|
2478
2706
|
{
|
|
2479
2707
|
id: "name",
|
|
2480
2708
|
header: tc("name"),
|
|
2481
2709
|
sortValue: (m) => m.name,
|
|
2482
|
-
cell: (m) => /* @__PURE__ */ jsxs15(
|
|
2483
|
-
m.memberType === "Group" ? /* @__PURE__ */ jsx15(AppLink8, { href: routes.group(m.memberId), fontWeight: "medium", children: m.name }) : /* @__PURE__ */ jsx15(
|
|
2710
|
+
cell: (m) => /* @__PURE__ */ jsxs15(HStack14, { gap: "2", wrap: "wrap", children: [
|
|
2711
|
+
m.memberType === "Group" ? /* @__PURE__ */ jsx15(AppLink8, { href: routes.group(m.memberId), fontWeight: "medium", children: m.name }) : /* @__PURE__ */ jsx15(RecordKey5, { value: m.name, href: routes.account(m.memberId) }),
|
|
2484
2712
|
m.displayName && m.displayName !== m.name && /* @__PURE__ */ jsx15(Text14, { as: "span", textStyle: "caption", color: "fg.muted", children: m.displayName })
|
|
2485
2713
|
] }),
|
|
2486
2714
|
skeleton: "key"
|
|
@@ -2490,15 +2718,15 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2490
2718
|
id: "source",
|
|
2491
2719
|
header: tc("source"),
|
|
2492
2720
|
sortValue: (m) => m.source,
|
|
2493
|
-
cell: (m) => m.source === "Directory" ? /* @__PURE__ */ jsx15(
|
|
2721
|
+
cell: (m) => m.source === "Directory" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: t("fromDirectory") }) : m.source === "Domain" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: t("byDomain") }) : m.source === "Import" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: t("fromImport") }) : /* @__PURE__ */ jsx15(StatusPill10, { tone: "accent", children: t("manual") }),
|
|
2494
2722
|
skeleton: "pill"
|
|
2495
2723
|
},
|
|
2496
2724
|
{
|
|
2497
2725
|
id: "actions",
|
|
2498
2726
|
header: /* @__PURE__ */ jsx15(Text14, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2499
2727
|
align: "end",
|
|
2500
|
-
cell: (m) => m.removable && /* @__PURE__ */ jsx15(
|
|
2501
|
-
skeleton: () => /* @__PURE__ */ jsx15(
|
|
2728
|
+
cell: (m) => m.removable && /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, onClick: () => removeMember(m), disabled: action.busy, children: t("remove") }),
|
|
2729
|
+
skeleton: () => /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, children: t("remove") })
|
|
2502
2730
|
}
|
|
2503
2731
|
];
|
|
2504
2732
|
const effectiveColumns = [
|
|
@@ -2506,7 +2734,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2506
2734
|
id: "username",
|
|
2507
2735
|
header: tc("username"),
|
|
2508
2736
|
sortValue: (m) => m.username,
|
|
2509
|
-
cell: (m) => /* @__PURE__ */ jsx15(
|
|
2737
|
+
cell: (m) => /* @__PURE__ */ jsx15(RecordKey5, { value: m.username, href: routes.account(m.accountId) }),
|
|
2510
2738
|
skeleton: "key"
|
|
2511
2739
|
},
|
|
2512
2740
|
{ id: "displayName", header: tc("displayName"), sortValue: (m) => m.displayName, cell: (m) => m.displayName, skeleton: "person" },
|
|
@@ -2519,17 +2747,17 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2519
2747
|
breadcrumbs: [{ label: tn("groups"), href: routes.groups }, { label: group && written(group.name, group.names) }],
|
|
2520
2748
|
title: group && written(group.name, group.names),
|
|
2521
2749
|
description: group?.description ?? void 0,
|
|
2522
|
-
meta: /* @__PURE__ */ jsxs15(
|
|
2750
|
+
meta: /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2523
2751
|
/* @__PURE__ */ jsx15(Text14, { as: "span", children: /* @__PURE__ */ jsx15(TextSlot3, { width: 10, children: group?.directoryName }) }),
|
|
2524
|
-
/* @__PURE__ */ jsx15(
|
|
2525
|
-
!group ? /* @__PURE__ */ jsx15(
|
|
2526
|
-
!group ? /* @__PURE__ */ jsx15(
|
|
2527
|
-
group && group.twoFactor && group.twoFactor !== "off" && /* @__PURE__ */ jsx15(
|
|
2752
|
+
/* @__PURE__ */ jsx15(StatusPill10, { dot: false, children: group && tg(`kinds.${group.kind}`) }),
|
|
2753
|
+
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.isLocal ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "accent", children: tg("local") }) : /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tg("synced") }),
|
|
2754
|
+
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.writable ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "success", children: t("writable") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tg("readOnly") }),
|
|
2755
|
+
group && group.twoFactor && group.twoFactor !== "off" && /* @__PURE__ */ jsx15(StatusPill10, { tone: "accent", "data-testid": "group-two-factor-pill", children: tf("pill", { mode: tf(`modes.${group.twoFactor}`) }) })
|
|
2528
2756
|
] }),
|
|
2529
|
-
actions: (!group || group.isLocal && !group.computed && !isSystemGroup(group)) && /* @__PURE__ */ jsx15(
|
|
2757
|
+
actions: (!group || group.isLocal && !group.computed && !isSystemGroup(group)) && /* @__PURE__ */ jsx15(Button11, { danger: true, onClick: deleteGroup, disabled: action.busy, children: t("delete") })
|
|
2530
2758
|
}
|
|
2531
2759
|
),
|
|
2532
|
-
/* @__PURE__ */ jsxs15(
|
|
2760
|
+
/* @__PURE__ */ jsxs15(Stack12, { gap: "section", children: [
|
|
2533
2761
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error }),
|
|
2534
2762
|
group && group.writable && group.isLocal && /* @__PURE__ */ jsx15(GroupNames, { group, onSaved: reload }),
|
|
2535
2763
|
/* @__PURE__ */ jsxs15(Grid2, { templateColumns: { base: "minmax(0, 1fr)", lg: "minmax(0, 1fr) {sizes.sidePanel}" }, gap: "section", alignItems: "start", children: [
|
|
@@ -2544,8 +2772,8 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2544
2772
|
empty: t("noMembers")
|
|
2545
2773
|
}
|
|
2546
2774
|
) }),
|
|
2547
|
-
/* @__PURE__ */ jsxs15(
|
|
2548
|
-
/* @__PURE__ */ jsx15(Panel11, { title: /* @__PURE__ */ jsx15(TextSlot3, { width: 14, children: t("memberOf", { count: parents?.length ?? 0 }) }), children: !parents ? /* @__PURE__ */ jsx15(Text14, { textStyle: "body", children: /* @__PURE__ */ jsx15(TextBone, { width: t("notNested").length }) }) : parents.length === 0 ? /* @__PURE__ */ jsx15(Text14, { textStyle: "body", color: "fg.muted", children: t("notNested") }) : /* @__PURE__ */ jsx15(List3.Root, { listStyle: "none", gap: "1.5", children: parents.map((p) => /* @__PURE__ */ jsx15(List3.Item, { children: /* @__PURE__ */ jsxs15(
|
|
2775
|
+
/* @__PURE__ */ jsxs15(Stack12, { gap: "section", children: [
|
|
2776
|
+
/* @__PURE__ */ jsx15(Panel11, { title: /* @__PURE__ */ jsx15(TextSlot3, { width: 14, children: t("memberOf", { count: parents?.length ?? 0 }) }), children: !parents ? /* @__PURE__ */ jsx15(Text14, { textStyle: "body", children: /* @__PURE__ */ jsx15(TextBone, { width: t("notNested").length }) }) : parents.length === 0 ? /* @__PURE__ */ jsx15(Text14, { textStyle: "body", color: "fg.muted", children: t("notNested") }) : /* @__PURE__ */ jsx15(List3.Root, { listStyle: "none", gap: "1.5", children: parents.map((p) => /* @__PURE__ */ jsx15(List3.Item, { children: /* @__PURE__ */ jsxs15(HStack14, { justify: "space-between", gap: "2", w: "full", children: [
|
|
2549
2777
|
/* @__PURE__ */ jsx15(AppLink8, { href: routes.group(p.id), children: written(p.name, p.names) }),
|
|
2550
2778
|
/* @__PURE__ */ jsx15(Text14, { as: "span", textStyle: "caption", color: "fg.muted", children: p.directoryName })
|
|
2551
2779
|
] }) }, p.id)) }) }),
|
|
@@ -2573,11 +2801,11 @@ function OrganizationPanel({ group, onSaved }) {
|
|
|
2573
2801
|
const t = useGuardNs("groupDetail");
|
|
2574
2802
|
const tg = useGuardNs("groups");
|
|
2575
2803
|
const request = useAreaRequest12("guard");
|
|
2576
|
-
const [domains, setDomains] =
|
|
2577
|
-
const [attributes, setAttributes] =
|
|
2804
|
+
const [domains, setDomains] = useState10(group.emailDomains.join(", "));
|
|
2805
|
+
const [attributes, setAttributes] = useState10(
|
|
2578
2806
|
Object.entries(group.attributes).map(([k, v]) => `${k} = ${v}`).join("\n")
|
|
2579
2807
|
);
|
|
2580
|
-
const action =
|
|
2808
|
+
const action = useApiAction9();
|
|
2581
2809
|
async function save() {
|
|
2582
2810
|
const parsed = {};
|
|
2583
2811
|
for (const line of attributes.split("\n").map((l) => l.trim()).filter(Boolean)) {
|
|
@@ -2596,24 +2824,24 @@ function OrganizationPanel({ group, onSaved }) {
|
|
|
2596
2824
|
await onSaved();
|
|
2597
2825
|
}
|
|
2598
2826
|
}
|
|
2599
|
-
return /* @__PURE__ */ jsx15(Panel11, { title: t("organization"), description: t("organizationHint"), "data-testid": "organization", children: /* @__PURE__ */ jsxs15(
|
|
2600
|
-
/* @__PURE__ */ jsx15(
|
|
2601
|
-
/* @__PURE__ */ jsx15(
|
|
2827
|
+
return /* @__PURE__ */ jsx15(Panel11, { title: t("organization"), description: t("organizationHint"), "data-testid": "organization", children: /* @__PURE__ */ jsxs15(Stack12, { gap: "field", maxW: "2xl", children: [
|
|
2828
|
+
/* @__PURE__ */ jsx15(Field5, { label: tg("domains"), helperText: tg("domainsHint"), children: /* @__PURE__ */ jsx15(Input5, { value: domains, onChange: (e) => setDomains(e.target.value), dir: "ltr", placeholder: "acme.com" }) }),
|
|
2829
|
+
/* @__PURE__ */ jsx15(Field5, { label: t("attributes"), helperText: t("attributesHint"), children: /* @__PURE__ */ jsx15(Textarea, { value: attributes, onChange: (e) => setAttributes(e.target.value), rows: 4, fontFamily: "mono", fontSize: "sm" }) }),
|
|
2602
2830
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error }),
|
|
2603
|
-
/* @__PURE__ */ jsx15(
|
|
2831
|
+
/* @__PURE__ */ jsx15(HStack14, { children: /* @__PURE__ */ jsx15(Button11, { onClick: () => void save(), loading: action.busy, children: t("saveOrganization") }) })
|
|
2604
2832
|
] }) });
|
|
2605
2833
|
}
|
|
2606
2834
|
function AddMember({ groupId, existing, onAdded }) {
|
|
2607
2835
|
const t = useGuardNs("groupDetail");
|
|
2608
2836
|
const tc = useGuardNs("common");
|
|
2609
2837
|
const request = useAreaRequest12("guard");
|
|
2610
|
-
const [query, setQuery] =
|
|
2838
|
+
const [query, setQuery] = useState10("");
|
|
2611
2839
|
const settled = useSettledValue(query.trim());
|
|
2612
|
-
const [accounts, setAccounts] =
|
|
2613
|
-
const [groups, setGroups] =
|
|
2614
|
-
const [searchError, setSearchError] =
|
|
2615
|
-
const [error, setError] =
|
|
2616
|
-
const [busyId, setBusyId] =
|
|
2840
|
+
const [accounts, setAccounts] = useState10([]);
|
|
2841
|
+
const [groups, setGroups] = useState10([]);
|
|
2842
|
+
const [searchError, setSearchError] = useState10(null);
|
|
2843
|
+
const [error, setError] = useState10(null);
|
|
2844
|
+
const [busyId, setBusyId] = useState10(null);
|
|
2617
2845
|
useEffect(() => {
|
|
2618
2846
|
if (!settled) {
|
|
2619
2847
|
setAccounts([]);
|
|
@@ -2655,13 +2883,13 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2655
2883
|
id: "type",
|
|
2656
2884
|
header: tc("type"),
|
|
2657
2885
|
width: "24",
|
|
2658
|
-
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(
|
|
2886
|
+
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tc("group") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tc("account") })
|
|
2659
2887
|
},
|
|
2660
2888
|
{
|
|
2661
2889
|
id: "name",
|
|
2662
2890
|
header: tc("name"),
|
|
2663
|
-
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(Text14, { as: "span", fontWeight: "medium", children: c.group.name }) : /* @__PURE__ */ jsxs15(
|
|
2664
|
-
/* @__PURE__ */ jsx15(
|
|
2891
|
+
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(Text14, { as: "span", fontWeight: "medium", children: c.group.name }) : /* @__PURE__ */ jsxs15(HStack14, { gap: "2", children: [
|
|
2892
|
+
/* @__PURE__ */ jsx15(RecordKey5, { value: c.account.username }),
|
|
2665
2893
|
/* @__PURE__ */ jsx15(Text14, { as: "span", textStyle: "caption", color: "fg.muted", children: c.account.displayName })
|
|
2666
2894
|
] })
|
|
2667
2895
|
},
|
|
@@ -2676,7 +2904,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2676
2904
|
return /* @__PURE__ */ jsx15(Text14, { as: "span", textStyle: "caption", color: "fg.muted", children: t("alreadyMember") });
|
|
2677
2905
|
const key = keyOf(c);
|
|
2678
2906
|
return /* @__PURE__ */ jsx15(
|
|
2679
|
-
|
|
2907
|
+
Button11,
|
|
2680
2908
|
{
|
|
2681
2909
|
size: "sm",
|
|
2682
2910
|
disabled: busyId != null,
|
|
@@ -2688,7 +2916,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2688
2916
|
}
|
|
2689
2917
|
}
|
|
2690
2918
|
];
|
|
2691
|
-
return /* @__PURE__ */ jsx15(Panel11, { title: t("addMember"), children: /* @__PURE__ */ jsxs15(
|
|
2919
|
+
return /* @__PURE__ */ jsx15(Panel11, { title: t("addMember"), children: /* @__PURE__ */ jsxs15(Stack12, { gap: "stack", children: [
|
|
2692
2920
|
/* @__PURE__ */ jsx15(SearchInput2, { maxW: "md", placeholder: t("searchMembers"), value: query, onChange: (e) => setQuery(e.target.value), "aria-label": t("searchMembers") }),
|
|
2693
2921
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: error }),
|
|
2694
2922
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: searchError }),
|
|
@@ -2700,8 +2928,8 @@ function GroupNames({ group, onSaved }) {
|
|
|
2700
2928
|
const t = useGuardNs("groupDetail");
|
|
2701
2929
|
const tc = useGuardNs("common");
|
|
2702
2930
|
const request = useAreaRequest12("guard");
|
|
2703
|
-
const action =
|
|
2704
|
-
const [value, setValue] =
|
|
2931
|
+
const action = useApiAction9();
|
|
2932
|
+
const [value, setValue] = useState10(() => toNamesValue2(group.name, group.names));
|
|
2705
2933
|
const { name, names } = fromNamesValue2(value);
|
|
2706
2934
|
const unchanged = name === group.name && JSON.stringify(names) === JSON.stringify(fromNamesValue2(toNamesValue2(group.name, group.names)).names);
|
|
2707
2935
|
async function save(e) {
|
|
@@ -2716,32 +2944,32 @@ function GroupNames({ group, onSaved }) {
|
|
|
2716
2944
|
if (ok) await onSaved();
|
|
2717
2945
|
}
|
|
2718
2946
|
return /* @__PURE__ */ jsx15(Panel11, { title: t("names"), description: t("namesHint"), children: /* @__PURE__ */ jsxs15("form", { onSubmit: save, children: [
|
|
2719
|
-
/* @__PURE__ */ jsxs15(
|
|
2947
|
+
/* @__PURE__ */ jsxs15(HStack14, { gap: "2", align: "start", wrap: "wrap", children: [
|
|
2720
2948
|
/* @__PURE__ */ jsx15(TranslatedInput3, { value, onChange: setValue, "aria-label": tc("name"), suggest: false }),
|
|
2721
|
-
/* @__PURE__ */ jsx15(
|
|
2949
|
+
/* @__PURE__ */ jsx15(Button11, { type: "submit", loading: action.busy, disabled: !name || unchanged, children: t("saveNames") })
|
|
2722
2950
|
] }),
|
|
2723
2951
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error })
|
|
2724
2952
|
] }) });
|
|
2725
2953
|
}
|
|
2726
2954
|
|
|
2727
2955
|
// src/areas/guard/GroupsScreen.tsx
|
|
2728
|
-
import { useState as
|
|
2729
|
-
import { HStack as
|
|
2956
|
+
import { useState as useState11 } from "react";
|
|
2957
|
+
import { HStack as HStack15, Input as Input6, SimpleGrid as SimpleGrid3, Stack as Stack13, Text as Text15 } from "@chakra-ui/react";
|
|
2730
2958
|
import {
|
|
2731
2959
|
AppLink as AppLink9,
|
|
2732
|
-
Button as
|
|
2960
|
+
Button as Button12,
|
|
2733
2961
|
DataTable as DataTable10,
|
|
2734
2962
|
EMPTY_VALUE as EMPTY_VALUE4,
|
|
2735
2963
|
errorText as errorText8,
|
|
2736
|
-
Field as
|
|
2964
|
+
Field as Field6,
|
|
2737
2965
|
InlineAlert as InlineAlert12,
|
|
2738
2966
|
ListFooter as ListFooter2,
|
|
2739
2967
|
notify as notify8,
|
|
2740
2968
|
PageHeader as PageHeader7,
|
|
2741
2969
|
Panel as Panel12,
|
|
2742
2970
|
SearchInput as SearchInput3,
|
|
2743
|
-
SelectField as
|
|
2744
|
-
StatusPill as
|
|
2971
|
+
SelectField as SelectField4,
|
|
2972
|
+
StatusPill as StatusPill11,
|
|
2745
2973
|
TranslatedInput as TranslatedInput4,
|
|
2746
2974
|
useApiQuery as useApiQuery9,
|
|
2747
2975
|
useAreaListSource as useAreaListSource2,
|
|
@@ -2750,7 +2978,7 @@ import {
|
|
|
2750
2978
|
useListState as useListState2
|
|
2751
2979
|
} from "@abpjs/ui";
|
|
2752
2980
|
import { fromNamesValue as fromNamesValue3, splitList as splitList2 } from "@abpjs/ui/rules";
|
|
2753
|
-
import { Fragment as
|
|
2981
|
+
import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2754
2982
|
var KINDS = ["standard", "directory", "ou", "organization"];
|
|
2755
2983
|
function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
2756
2984
|
const t = useGuardNs("groups");
|
|
@@ -2761,7 +2989,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2761
2989
|
const dirs = useApiQuery9("guard", "/directories");
|
|
2762
2990
|
const served = useAreaListSource2("guard", "/groups/page");
|
|
2763
2991
|
const list = useListState2(source ?? served, { initial: { sort: { columnId: "name", direction: "asc" } } });
|
|
2764
|
-
const [creating, setCreating] =
|
|
2992
|
+
const [creating, setCreating] = useState11(false);
|
|
2765
2993
|
const columns = [
|
|
2766
2994
|
{
|
|
2767
2995
|
id: "name",
|
|
@@ -2769,7 +2997,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2769
2997
|
sortValue: (g) => g.name,
|
|
2770
2998
|
cell: (g) => /* @__PURE__ */ jsx16(AppLink9, { href: routes.group(g.id), fontWeight: "medium", children: written(g.name, g.names) })
|
|
2771
2999
|
},
|
|
2772
|
-
{ id: "kind", header: t("kind"), sortValue: (g) => g.kind, cell: (g) => /* @__PURE__ */ jsx16(
|
|
3000
|
+
{ id: "kind", header: t("kind"), sortValue: (g) => g.kind, cell: (g) => /* @__PURE__ */ jsx16(StatusPill11, { dot: false, children: t(`kinds.${g.kind}`) }), skeleton: "pill" },
|
|
2773
3001
|
{
|
|
2774
3002
|
id: "description",
|
|
2775
3003
|
header: tc("description"),
|
|
@@ -2779,22 +3007,22 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2779
3007
|
{
|
|
2780
3008
|
id: "source",
|
|
2781
3009
|
header: tc("source"),
|
|
2782
|
-
cell: (g) => g.isLocal ? /* @__PURE__ */ jsx16(
|
|
3010
|
+
cell: (g) => g.isLocal ? /* @__PURE__ */ jsx16(StatusPill11, { tone: "accent", children: t("local") }) : /* @__PURE__ */ jsx16(StatusPill11, { tone: "info", children: t("synced") }),
|
|
2783
3011
|
skeleton: "pill"
|
|
2784
3012
|
},
|
|
2785
3013
|
{ id: "members", header: t("directMembers"), numeric: true, cell: (g) => num(g.directMemberCount) },
|
|
2786
3014
|
{ id: "memberGroups", header: t("memberGroups"), numeric: true, cell: (g) => num(g.memberGroupCount) }
|
|
2787
3015
|
];
|
|
2788
|
-
return /* @__PURE__ */ jsxs16(
|
|
3016
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2789
3017
|
/* @__PURE__ */ jsx16(
|
|
2790
3018
|
PageHeader7,
|
|
2791
3019
|
{
|
|
2792
3020
|
title: t("title"),
|
|
2793
3021
|
description: t("subtitle"),
|
|
2794
|
-
actions: !creating && admin && /* @__PURE__ */ jsx16(
|
|
3022
|
+
actions: !creating && admin && /* @__PURE__ */ jsx16(Button12, { variant: "primary", onClick: () => setCreating(true), children: t("create") })
|
|
2795
3023
|
}
|
|
2796
3024
|
),
|
|
2797
|
-
/* @__PURE__ */ jsxs16(
|
|
3025
|
+
/* @__PURE__ */ jsxs16(Stack13, { gap: "section", children: [
|
|
2798
3026
|
creating && /* @__PURE__ */ jsx16(
|
|
2799
3027
|
CreateGroupPanel,
|
|
2800
3028
|
{
|
|
@@ -2807,8 +3035,8 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2807
3035
|
}
|
|
2808
3036
|
}
|
|
2809
3037
|
),
|
|
2810
|
-
/* @__PURE__ */ jsxs16(
|
|
2811
|
-
/* @__PURE__ */ jsxs16(
|
|
3038
|
+
/* @__PURE__ */ jsxs16(Stack13, { gap: "field", children: [
|
|
3039
|
+
/* @__PURE__ */ jsxs16(HStack15, { gap: "2", wrap: "wrap", children: [
|
|
2812
3040
|
/* @__PURE__ */ jsx16(
|
|
2813
3041
|
SearchInput3,
|
|
2814
3042
|
{
|
|
@@ -2821,7 +3049,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2821
3049
|
}
|
|
2822
3050
|
),
|
|
2823
3051
|
/* @__PURE__ */ jsx16(
|
|
2824
|
-
|
|
3052
|
+
SelectField4,
|
|
2825
3053
|
{
|
|
2826
3054
|
size: "sm",
|
|
2827
3055
|
maxW: "14rem",
|
|
@@ -2832,7 +3060,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2832
3060
|
}
|
|
2833
3061
|
),
|
|
2834
3062
|
/* @__PURE__ */ jsx16(
|
|
2835
|
-
|
|
3063
|
+
SelectField4,
|
|
2836
3064
|
{
|
|
2837
3065
|
size: "sm",
|
|
2838
3066
|
maxW: "14rem",
|
|
@@ -2853,14 +3081,14 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2853
3081
|
const t = useGuardNs("groups");
|
|
2854
3082
|
const tc = useGuardNs("common");
|
|
2855
3083
|
const request = useAreaRequest13("guard");
|
|
2856
|
-
const [nameValue, setNameValue] =
|
|
3084
|
+
const [nameValue, setNameValue] = useState11({});
|
|
2857
3085
|
const { name, names } = fromNamesValue3(nameValue);
|
|
2858
|
-
const [description, setDescription] =
|
|
2859
|
-
const [directoryId, setDirectoryId] =
|
|
2860
|
-
const [kind, setKind] =
|
|
2861
|
-
const [domains, setDomains] =
|
|
2862
|
-
const [error, setError] =
|
|
2863
|
-
const [busy, setBusy] =
|
|
3086
|
+
const [description, setDescription] = useState11("");
|
|
3087
|
+
const [directoryId, setDirectoryId] = useState11("");
|
|
3088
|
+
const [kind, setKind] = useState11("standard");
|
|
3089
|
+
const [domains, setDomains] = useState11("");
|
|
3090
|
+
const [error, setError] = useState11(null);
|
|
3091
|
+
const [busy, setBusy] = useState11(false);
|
|
2864
3092
|
async function submit(e) {
|
|
2865
3093
|
e.preventDefault();
|
|
2866
3094
|
setBusy(true);
|
|
@@ -2884,12 +3112,12 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2884
3112
|
setBusy(false);
|
|
2885
3113
|
}
|
|
2886
3114
|
}
|
|
2887
|
-
return /* @__PURE__ */ jsx16(Panel12, { title: t("create"), children: /* @__PURE__ */ jsx16("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs16(
|
|
3115
|
+
return /* @__PURE__ */ jsx16(Panel12, { title: t("create"), children: /* @__PURE__ */ jsx16("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs16(Stack13, { gap: "field", children: [
|
|
2888
3116
|
/* @__PURE__ */ jsxs16(SimpleGrid3, { columns: { base: 1, md: 3 }, gap: "field", children: [
|
|
2889
|
-
/* @__PURE__ */ jsx16(
|
|
2890
|
-
/* @__PURE__ */ jsx16(
|
|
2891
|
-
/* @__PURE__ */ jsx16(
|
|
2892
|
-
|
|
3117
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("name"), required: true, children: /* @__PURE__ */ jsx16(TranslatedInput4, { value: nameValue, onChange: setNameValue, "aria-label": tc("name") }) }),
|
|
3118
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("description"), children: /* @__PURE__ */ jsx16(Input6, { value: description, onChange: (e) => setDescription(e.target.value) }) }),
|
|
3119
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("directory"), helperText: t("directoryHint"), children: /* @__PURE__ */ jsx16(
|
|
3120
|
+
SelectField4,
|
|
2893
3121
|
{
|
|
2894
3122
|
value: directoryId,
|
|
2895
3123
|
onChange: (e) => setDirectoryId(e.target.value),
|
|
@@ -2899,50 +3127,50 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2899
3127
|
]
|
|
2900
3128
|
}
|
|
2901
3129
|
) }),
|
|
2902
|
-
/* @__PURE__ */ jsx16(
|
|
2903
|
-
|
|
3130
|
+
/* @__PURE__ */ jsx16(Field6, { label: t("kind"), helperText: t("kindHint"), children: /* @__PURE__ */ jsx16(
|
|
3131
|
+
SelectField4,
|
|
2904
3132
|
{
|
|
2905
3133
|
value: kind,
|
|
2906
3134
|
onChange: (e) => setKind(e.target.value),
|
|
2907
3135
|
options: ["standard", "organization"].map((k) => ({ value: k, label: t(`kinds.${k}`) }))
|
|
2908
3136
|
}
|
|
2909
3137
|
) }),
|
|
2910
|
-
kind === "organization" && /* @__PURE__ */ jsx16(
|
|
3138
|
+
kind === "organization" && /* @__PURE__ */ jsx16(Field6, { label: t("domains"), helperText: t("domainsHint"), children: /* @__PURE__ */ jsx16(Input6, { value: domains, onChange: (e) => setDomains(e.target.value), dir: "ltr", placeholder: "acme.com" }) })
|
|
2911
3139
|
] }),
|
|
2912
3140
|
/* @__PURE__ */ jsx16(InlineAlert12, { tone: "danger", children: error }),
|
|
2913
|
-
/* @__PURE__ */ jsxs16(
|
|
2914
|
-
/* @__PURE__ */ jsx16(
|
|
2915
|
-
/* @__PURE__ */ jsx16(
|
|
3141
|
+
/* @__PURE__ */ jsxs16(HStack15, { gap: "2", children: [
|
|
3142
|
+
/* @__PURE__ */ jsx16(Button12, { type: "submit", variant: "primary", loading: busy, children: t("create") }),
|
|
3143
|
+
/* @__PURE__ */ jsx16(Button12, { onClick: onCancel, children: tc("cancel") })
|
|
2916
3144
|
] })
|
|
2917
3145
|
] }) }) });
|
|
2918
3146
|
}
|
|
2919
3147
|
|
|
2920
3148
|
// src/areas/guard/MergeScreen.tsx
|
|
2921
|
-
import { useEffect as useEffect2, useRef, useState as
|
|
2922
|
-
import { HStack as
|
|
3149
|
+
import { useEffect as useEffect2, useRef, useState as useState12 } from "react";
|
|
3150
|
+
import { HStack as HStack16, Input as Input7, SimpleGrid as SimpleGrid4, Stack as Stack14, Text as Text16 } from "@chakra-ui/react";
|
|
2923
3151
|
import {
|
|
2924
3152
|
boneWidth,
|
|
2925
|
-
Button as
|
|
3153
|
+
Button as Button13,
|
|
2926
3154
|
EMPTY_VALUE as EMPTY_VALUE5,
|
|
2927
|
-
Field as
|
|
3155
|
+
Field as Field7,
|
|
2928
3156
|
InlineAlert as InlineAlert13,
|
|
2929
3157
|
Loading as Loading5,
|
|
2930
3158
|
notify as notify9,
|
|
2931
3159
|
PageHeader as PageHeader8,
|
|
2932
3160
|
Panel as Panel13,
|
|
2933
3161
|
PropertyList as PropertyList4,
|
|
2934
|
-
RecordKey as
|
|
3162
|
+
RecordKey as RecordKey6,
|
|
2935
3163
|
SearchPicker,
|
|
2936
|
-
StatusPill as
|
|
3164
|
+
StatusPill as StatusPill12,
|
|
2937
3165
|
TextBone as TextBone2,
|
|
2938
3166
|
TextSlot as TextSlot4,
|
|
2939
|
-
useApiAction as
|
|
3167
|
+
useApiAction as useApiAction10,
|
|
2940
3168
|
useApiQuery as useApiQuery10,
|
|
2941
3169
|
useAreaRequest as useAreaRequest14,
|
|
2942
3170
|
useFormatters as useFormatters8,
|
|
2943
3171
|
useNavigate as useNavigate4
|
|
2944
3172
|
} from "@abpjs/ui";
|
|
2945
|
-
import { Fragment as
|
|
3173
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2946
3174
|
function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
2947
3175
|
const t = useGuardNs("merge");
|
|
2948
3176
|
const tn = useGuardNs("nav");
|
|
@@ -2950,12 +3178,12 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
2950
3178
|
const navigate = useNavigate4();
|
|
2951
3179
|
const request = useAreaRequest14("guard");
|
|
2952
3180
|
const source = useApiQuery10("guard", `/accounts/${id}`);
|
|
2953
|
-
const [survivor, setSurvivor] =
|
|
3181
|
+
const [survivor, setSurvivor] = useState12(null);
|
|
2954
3182
|
const pickedByHand = useRef(false);
|
|
2955
|
-
const [preview, setPreview] =
|
|
2956
|
-
const [confirm, setConfirm] =
|
|
2957
|
-
const loading =
|
|
2958
|
-
const merging =
|
|
3183
|
+
const [preview, setPreview] = useState12(null);
|
|
3184
|
+
const [confirm, setConfirm] = useState12("");
|
|
3185
|
+
const loading = useApiAction10();
|
|
3186
|
+
const merging = useApiAction10();
|
|
2959
3187
|
useEffect2(() => {
|
|
2960
3188
|
if (!into) return;
|
|
2961
3189
|
let live = true;
|
|
@@ -3008,8 +3236,8 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3008
3236
|
description: /* @__PURE__ */ jsx17(TextSlot4, { width: t("pageHint", { username: "" }).length + 16, children: t("pageHint", { username: account?.username ?? "" }) })
|
|
3009
3237
|
}
|
|
3010
3238
|
),
|
|
3011
|
-
/* @__PURE__ */ jsxs17(
|
|
3012
|
-
account?.mergedIntoId ? /* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: t("alreadyMerged", { survivor: source.data?.mergedIntoUsername ?? "" }) }) : /* @__PURE__ */ jsx17(Panel13, { title: t("chooseTitle"), description: t("chooseHint"), children: /* @__PURE__ */ jsx17(
|
|
3239
|
+
/* @__PURE__ */ jsxs17(Stack14, { gap: "section", children: [
|
|
3240
|
+
account?.mergedIntoId ? /* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: t("alreadyMerged", { survivor: source.data?.mergedIntoUsername ?? "" }) }) : /* @__PURE__ */ jsx17(Panel13, { title: t("chooseTitle"), description: t("chooseHint"), children: /* @__PURE__ */ jsx17(Field7, { label: t("survivor"), children: /* @__PURE__ */ jsx17(
|
|
3013
3241
|
SearchPicker,
|
|
3014
3242
|
{
|
|
3015
3243
|
"aria-label": t("survivor"),
|
|
@@ -3022,7 +3250,7 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3022
3250
|
known: [],
|
|
3023
3251
|
getId: (a) => a.id,
|
|
3024
3252
|
label: (a) => `${a.displayName} (@${a.username})`,
|
|
3025
|
-
renderOption: (a) => /* @__PURE__ */ jsxs17(
|
|
3253
|
+
renderOption: (a) => /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3026
3254
|
/* @__PURE__ */ jsx17(Text16, { as: "span", textStyle: "body.sm", fontWeight: "medium", children: a.displayName }),
|
|
3027
3255
|
" ",
|
|
3028
3256
|
/* @__PURE__ */ jsxs17(Text16, { as: "span", textStyle: "caption", color: "fg.muted", dir: "ltr", children: [
|
|
@@ -3044,19 +3272,19 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3044
3272
|
/* @__PURE__ */ jsx17(Side, { title: t("survivorTitle"), hint: t("survivorHint"), account: preview?.survivor, routes })
|
|
3045
3273
|
] }),
|
|
3046
3274
|
/* @__PURE__ */ jsx17(Panel13, { title: t("previewTitle"), description: t("previewHint"), "data-testid": "merge-preview", children: preview ? /* @__PURE__ */ jsx17(Parts, { preview }) : /* @__PURE__ */ jsx17(PartsComing, {}) }),
|
|
3047
|
-
/* @__PURE__ */ jsx17(Panel13, { title: t("confirmTitle"), children: /* @__PURE__ */ jsxs17(
|
|
3048
|
-
preview?.needsConfirmation && /* @__PURE__ */ jsxs17(
|
|
3275
|
+
/* @__PURE__ */ jsx17(Panel13, { title: t("confirmTitle"), children: /* @__PURE__ */ jsxs17(Stack14, { gap: "field", maxW: "xl", children: [
|
|
3276
|
+
preview?.needsConfirmation && /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3049
3277
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: preview.sameDirectory ? t("activeWarning", { username: account?.username ?? "" }) : t("activeOtherDirectory", { username: account?.username ?? "" }) }),
|
|
3050
|
-
/* @__PURE__ */ jsx17(
|
|
3278
|
+
/* @__PURE__ */ jsx17(Field7, { label: t("typeUsername", { username: account?.username ?? "" }), children: /* @__PURE__ */ jsx17(Input7, { value: confirm, onChange: (e) => setConfirm(e.target.value), autoComplete: "off", dir: "ltr" }) })
|
|
3051
3279
|
] }),
|
|
3052
3280
|
/* @__PURE__ */ jsx17(Text16, { textStyle: "body.sm", color: "fg.muted", children: t("noUndo") }),
|
|
3053
3281
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "danger", children: merging.error }),
|
|
3054
|
-
/* @__PURE__ */ jsxs17(
|
|
3055
|
-
/* @__PURE__ */ jsx17(
|
|
3282
|
+
/* @__PURE__ */ jsxs17(HStack16, { gap: "2", children: [
|
|
3283
|
+
/* @__PURE__ */ jsx17(Button13, { variant: "primary", danger: true, onClick: merge, loading: merging.busy, disabled: !confirmed, children: t("mergeButton", {
|
|
3056
3284
|
source: preview?.source.username ?? account?.username ?? "",
|
|
3057
3285
|
survivor: preview?.survivor.username ?? survivor.username
|
|
3058
3286
|
}) }),
|
|
3059
|
-
/* @__PURE__ */ jsx17(
|
|
3287
|
+
/* @__PURE__ */ jsx17(Button13, { onClick: () => navigate(routes.account(account?.id ?? id)), children: tc("cancel") })
|
|
3060
3288
|
] })
|
|
3061
3289
|
] }) })
|
|
3062
3290
|
] })
|
|
@@ -3070,18 +3298,18 @@ function Side({ title, hint, account, routes }) {
|
|
|
3070
3298
|
PropertyList4,
|
|
3071
3299
|
{
|
|
3072
3300
|
items: [
|
|
3073
|
-
{ label: tc("username"), value: /* @__PURE__ */ jsx17(
|
|
3301
|
+
{ label: tc("username"), value: /* @__PURE__ */ jsx17(RecordKey6, { value: account?.username, href: account && routes.account(account.id) }) },
|
|
3074
3302
|
{ label: tc("displayName"), value: account?.displayName },
|
|
3075
3303
|
{ label: tc("email"), value: account && (account.email ?? EMPTY_VALUE5) },
|
|
3076
3304
|
{ label: tc("directory"), value: account?.directoryName },
|
|
3077
|
-
{ label: tc("status"), value: account ? /* @__PURE__ */ jsx17(AccountStatusPill, { status: account.status }) : /* @__PURE__ */ jsx17(
|
|
3305
|
+
{ label: tc("status"), value: account ? /* @__PURE__ */ jsx17(AccountStatusPill, { status: account.status }) : /* @__PURE__ */ jsx17(StatusPill12, {}) },
|
|
3078
3306
|
{ label: tc("lastSignIn"), value: account && fmt.dateTime(account.lastLoginAt) }
|
|
3079
3307
|
]
|
|
3080
3308
|
}
|
|
3081
3309
|
) });
|
|
3082
3310
|
}
|
|
3083
3311
|
function PartsComing() {
|
|
3084
|
-
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs17(
|
|
3312
|
+
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
3085
3313
|
/* @__PURE__ */ jsx17(Text16, { fontWeight: "medium", children: /* @__PURE__ */ jsx17(TextBone2, { width: boneWidth(i, 8, 14) }) }),
|
|
3086
3314
|
/* @__PURE__ */ jsx17(Text16, { textStyle: "body.sm", children: /* @__PURE__ */ jsx17(TextBone2, { width: boneWidth(i + 3, 12, 22) }) })
|
|
3087
3315
|
] }, i)) });
|
|
@@ -3091,28 +3319,28 @@ function Parts({ preview }) {
|
|
|
3091
3319
|
const partLabel = usePartLabel();
|
|
3092
3320
|
const moving = preview.parts.filter((p) => p.counts.length > 0 || p.error);
|
|
3093
3321
|
if (moving.length === 0) return /* @__PURE__ */ jsx17(Text16, { color: "fg.muted", children: t("nothing") });
|
|
3094
|
-
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: moving.map((p) => /* @__PURE__ */ jsxs17(
|
|
3322
|
+
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: moving.map((p) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
3095
3323
|
/* @__PURE__ */ jsx17(Text16, { fontWeight: "medium", children: partLabel(p.key, p.plugin) }),
|
|
3096
3324
|
p.error ? /* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: t("pluginError", { error: p.error }) }) : /* @__PURE__ */ jsx17(CountList, { counts: p.counts })
|
|
3097
3325
|
] }, p.key)) });
|
|
3098
3326
|
}
|
|
3099
3327
|
|
|
3100
3328
|
// src/areas/guard/MySecondFactorsPanel.tsx
|
|
3101
|
-
import { useEffect as useEffect4, useState as
|
|
3102
|
-
import { HStack as
|
|
3329
|
+
import { useEffect as useEffect4, useState as useState14 } from "react";
|
|
3330
|
+
import { HStack as HStack18, Input as Input9, Stack as Stack16, Text as Text18 } from "@chakra-ui/react";
|
|
3103
3331
|
import {
|
|
3104
3332
|
AbpApiError,
|
|
3105
|
-
Button as
|
|
3333
|
+
Button as Button15,
|
|
3106
3334
|
createPasskey,
|
|
3107
3335
|
DataTable as DataTable11,
|
|
3108
3336
|
errorText as errorText10,
|
|
3109
|
-
Field as
|
|
3110
|
-
FormDialog,
|
|
3337
|
+
Field as Field9,
|
|
3338
|
+
FormDialog as FormDialog2,
|
|
3111
3339
|
InlineAlert as InlineAlert15,
|
|
3112
3340
|
notify as notify11,
|
|
3113
3341
|
Panel as Panel14,
|
|
3114
3342
|
passkeysSupported,
|
|
3115
|
-
StatusPill as
|
|
3343
|
+
StatusPill as StatusPill13,
|
|
3116
3344
|
useApiQuery as useApiQuery11,
|
|
3117
3345
|
useAreaRequest as useAreaRequest15,
|
|
3118
3346
|
useConfirm as useConfirm5,
|
|
@@ -3120,9 +3348,9 @@ import {
|
|
|
3120
3348
|
} from "@abpjs/ui";
|
|
3121
3349
|
|
|
3122
3350
|
// src/areas/guard/SecondFactorParts.tsx
|
|
3123
|
-
import { useEffect as useEffect3, useState as
|
|
3124
|
-
import { Box as Box4, chakra as chakra2, Grid as Grid3, HStack as
|
|
3125
|
-
import { AppLink as AppLink10, Button as
|
|
3351
|
+
import { useEffect as useEffect3, useState as useState13 } from "react";
|
|
3352
|
+
import { Box as Box4, chakra as chakra2, Grid as Grid3, HStack as HStack17, Image, Input as Input8, Stack as Stack15, Text as Text17 } from "@chakra-ui/react";
|
|
3353
|
+
import { AppLink as AppLink10, Button as Button14, errorText as errorText9, Field as Field8, InlineAlert as InlineAlert14, looksLikeCode, notify as notify10 } from "@abpjs/ui";
|
|
3126
3354
|
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3127
3355
|
function groupedKey(secret) {
|
|
3128
3356
|
return secret.replace(/(.{4})/g, "$1 ").trim();
|
|
@@ -3162,10 +3390,10 @@ function CodeInput({
|
|
|
3162
3390
|
}
|
|
3163
3391
|
function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
3164
3392
|
const t = useGuardNs("secondFactor.setup");
|
|
3165
|
-
const [enrolment, setEnrolment] =
|
|
3166
|
-
const [code, setCode] =
|
|
3167
|
-
const [error, setError] =
|
|
3168
|
-
const [busy, setBusy] =
|
|
3393
|
+
const [enrolment, setEnrolment] = useState13(null);
|
|
3394
|
+
const [code, setCode] = useState13("");
|
|
3395
|
+
const [error, setError] = useState13(null);
|
|
3396
|
+
const [busy, setBusy] = useState13(false);
|
|
3169
3397
|
useEffect3(() => {
|
|
3170
3398
|
let live = true;
|
|
3171
3399
|
start().then(
|
|
@@ -3194,11 +3422,11 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3194
3422
|
setBusy(false);
|
|
3195
3423
|
}
|
|
3196
3424
|
}
|
|
3197
|
-
return /* @__PURE__ */ jsx18("form", { onSubmit: (e) => void verify(e), "data-testid": "app-setup", children: /* @__PURE__ */ jsxs18(
|
|
3425
|
+
return /* @__PURE__ */ jsx18("form", { onSubmit: (e) => void verify(e), "data-testid": "app-setup", children: /* @__PURE__ */ jsxs18(Stack15, { gap: "field", children: [
|
|
3198
3426
|
/* @__PURE__ */ jsx18(Text17, { color: "fg.muted", children: t("scan") }),
|
|
3199
3427
|
/* @__PURE__ */ jsxs18(Grid3, { templateColumns: { base: "1fr", sm: "auto minmax(0, 1fr)" }, gap: "5", alignItems: "center", children: [
|
|
3200
3428
|
/* @__PURE__ */ jsx18(Box4, { bg: "white", p: "2", rounded: "l2", borderWidth: "1px", w: "fit-content", children: enrolment ? /* @__PURE__ */ jsx18(Image, { src: enrolment.qr, alt: t("qrAlt"), width: "44", height: "44", "data-testid": "app-setup-qr" }) : /* @__PURE__ */ jsx18(Box4, { width: "44", height: "44" }) }),
|
|
3201
|
-
/* @__PURE__ */ jsxs18(
|
|
3429
|
+
/* @__PURE__ */ jsxs18(Stack15, { gap: "2", minW: "0", children: [
|
|
3202
3430
|
/* @__PURE__ */ jsx18(Text17, { textStyle: "body.sm", color: "fg.muted", children: t("cantScan") }),
|
|
3203
3431
|
/* @__PURE__ */ jsx18(
|
|
3204
3432
|
Box4,
|
|
@@ -3219,11 +3447,11 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3219
3447
|
enrolment && /* @__PURE__ */ jsx18(AppLink10, { href: enrolment.address, textStyle: "body.sm", children: t("onThisDevice") })
|
|
3220
3448
|
] })
|
|
3221
3449
|
] }),
|
|
3222
|
-
/* @__PURE__ */ jsx18(
|
|
3450
|
+
/* @__PURE__ */ jsx18(Field8, { label: t("code"), helperText: t("codeHint"), children: /* @__PURE__ */ jsx18(CodeInput, { value: code, onChange: setCode, autoFocus: false }) }),
|
|
3223
3451
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "danger", children: error }),
|
|
3224
|
-
/* @__PURE__ */ jsxs18(
|
|
3225
|
-
/* @__PURE__ */ jsx18(
|
|
3226
|
-
onCancel && /* @__PURE__ */ jsx18(
|
|
3452
|
+
/* @__PURE__ */ jsxs18(HStack17, { children: [
|
|
3453
|
+
/* @__PURE__ */ jsx18(Button14, { type: "submit", loading: busy, disabled: !enrolment || !looksLikeCode(code, false), children: t("verify") }),
|
|
3454
|
+
onCancel && /* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: onCancel, disabled: busy, children: t("cancel") })
|
|
3227
3455
|
] })
|
|
3228
3456
|
] }) });
|
|
3229
3457
|
}
|
|
@@ -3252,19 +3480,19 @@ ${codes.join("\n")}
|
|
|
3252
3480
|
link.click();
|
|
3253
3481
|
URL.revokeObjectURL(url);
|
|
3254
3482
|
}
|
|
3255
|
-
return /* @__PURE__ */ jsxs18(
|
|
3483
|
+
return /* @__PURE__ */ jsxs18(Stack15, { gap: "field", "data-testid": "recovery-codes", children: [
|
|
3256
3484
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "warning", children: t("hint") }),
|
|
3257
3485
|
/* @__PURE__ */ jsx18(Grid3, { templateColumns: "repeat(2, max-content)", columnGap: "6", rowGap: "1.5", dir: "ltr", bg: "bg.muted", p: "3", rounded: "l2", w: "fit-content", children: codes.map((c) => /* @__PURE__ */ jsx18(chakra2.code, { fontFamily: "mono", fontSize: "sm", children: c }, c)) }),
|
|
3258
|
-
/* @__PURE__ */ jsxs18(
|
|
3259
|
-
/* @__PURE__ */ jsx18(
|
|
3260
|
-
/* @__PURE__ */ jsx18(
|
|
3261
|
-
/* @__PURE__ */ jsx18(
|
|
3486
|
+
/* @__PURE__ */ jsxs18(HStack17, { wrap: "wrap", children: [
|
|
3487
|
+
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: () => void copy(), children: t("copy") }),
|
|
3488
|
+
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: download, children: t("download") }),
|
|
3489
|
+
/* @__PURE__ */ jsx18(Button14, { onClick: onSaved, "data-testid": "recovery-codes-saved", children: savedLabel ?? t("saved") })
|
|
3262
3490
|
] })
|
|
3263
3491
|
] });
|
|
3264
3492
|
}
|
|
3265
3493
|
|
|
3266
3494
|
// src/areas/guard/MySecondFactorsPanel.tsx
|
|
3267
|
-
import { Fragment as
|
|
3495
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3268
3496
|
function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
3269
3497
|
const t = useGuardNs("secondFactor");
|
|
3270
3498
|
const fmt = useFormatters9();
|
|
@@ -3272,16 +3500,16 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3272
3500
|
const request = useAreaRequest15("guard");
|
|
3273
3501
|
const mine = useApiQuery11("guard", "/me/second-factors");
|
|
3274
3502
|
const nameOf = useSenderName();
|
|
3275
|
-
const [choice, setChoice] =
|
|
3503
|
+
const [choice, setChoice] = useState14(null);
|
|
3276
3504
|
const settingUp = choice ?? setUpNow;
|
|
3277
|
-
const [codes, setCodes] =
|
|
3278
|
-
const [error, setError] =
|
|
3505
|
+
const [codes, setCodes] = useState14(null);
|
|
3506
|
+
const [error, setError] = useState14(null);
|
|
3279
3507
|
const canPasskey = passkeysSupported();
|
|
3280
|
-
const [addingPasskey, setAddingPasskey] =
|
|
3281
|
-
const [passkeyName, setPasskeyName] =
|
|
3282
|
-
const [busy, setBusy] =
|
|
3283
|
-
const [renaming, setRenaming] =
|
|
3284
|
-
const [newName, setNewName] =
|
|
3508
|
+
const [addingPasskey, setAddingPasskey] = useState14(false);
|
|
3509
|
+
const [passkeyName, setPasskeyName] = useState14("");
|
|
3510
|
+
const [busy, setBusy] = useState14(false);
|
|
3511
|
+
const [renaming, setRenaming] = useState14(null);
|
|
3512
|
+
const [newName, setNewName] = useState14("");
|
|
3285
3513
|
const data = mine.data;
|
|
3286
3514
|
const factors = data?.factors ?? [];
|
|
3287
3515
|
useEffect4(() => {
|
|
@@ -3360,9 +3588,9 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3360
3588
|
}
|
|
3361
3589
|
}
|
|
3362
3590
|
const hasApp = factors.some((f) => f.kind === "app");
|
|
3363
|
-
const actions = !settingUp && !addingPasskey && !codes && data && !data.disabled && /* @__PURE__ */ jsxs19(
|
|
3591
|
+
const actions = !settingUp && !addingPasskey && !codes && data && !data.disabled && /* @__PURE__ */ jsxs19(HStack18, { gap: "2", wrap: "wrap", children: [
|
|
3364
3592
|
canPasskey && /* @__PURE__ */ jsx19(
|
|
3365
|
-
|
|
3593
|
+
Button15,
|
|
3366
3594
|
{
|
|
3367
3595
|
size: "sm",
|
|
3368
3596
|
variant: factors.length ? "secondary" : "primary",
|
|
@@ -3375,14 +3603,14 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3375
3603
|
children: t("addPasskey")
|
|
3376
3604
|
}
|
|
3377
3605
|
),
|
|
3378
|
-
/* @__PURE__ */ jsx19(
|
|
3606
|
+
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: factors.length || canPasskey ? "secondary" : "primary", onClick: () => setSettingUp(true), "data-testid": "second-factor-set-up", children: hasApp ? t("addAnother") : t("setUp") })
|
|
3379
3607
|
] });
|
|
3380
3608
|
return /* @__PURE__ */ jsxs19(Panel14, { id: "second-factor", title: t("title"), description: t("panelHint"), actions, "data-testid": "second-factor", children: [
|
|
3381
|
-
/* @__PURE__ */ jsxs19(
|
|
3609
|
+
/* @__PURE__ */ jsxs19(Stack16, { gap: "field", children: [
|
|
3382
3610
|
/* @__PURE__ */ jsx19(InlineAlert15, { tone: "danger", children: mine.error ?? error }),
|
|
3383
3611
|
data?.disabled && /* @__PURE__ */ jsx19(InlineAlert15, { tone: "neutral", children: t("disabled") }),
|
|
3384
|
-
data && /* @__PURE__ */ jsxs19(
|
|
3385
|
-
factors.length > 0 && !data.disabled ? /* @__PURE__ */ jsx19(
|
|
3612
|
+
data && /* @__PURE__ */ jsxs19(HStack18, { gap: "2", wrap: "wrap", children: [
|
|
3613
|
+
factors.length > 0 && !data.disabled ? /* @__PURE__ */ jsx19(StatusPill13, { tone: "success", children: t("on") }) : /* @__PURE__ */ jsx19(StatusPill13, { children: t("off") }),
|
|
3386
3614
|
/* @__PURE__ */ jsx19(Text18, { color: "fg.muted", textStyle: "body.sm", "data-testid": "second-factor-mode", children: t(`modeHint.${data.mode}`) })
|
|
3387
3615
|
] }),
|
|
3388
3616
|
data?.senders && data.senders.length > 0 && /* @__PURE__ */ jsx19(Text18, { color: "fg.muted", textStyle: "body.sm", "data-testid": "second-factor-senders", children: t("alsoBy", { list: data.senders.map((s) => `${nameOf(s)} (${s.to})`).join(", ") }) }),
|
|
@@ -3409,18 +3637,18 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3409
3637
|
void addPasskey();
|
|
3410
3638
|
},
|
|
3411
3639
|
"data-testid": "passkey-add-form",
|
|
3412
|
-
children: /* @__PURE__ */ jsxs19(
|
|
3640
|
+
children: /* @__PURE__ */ jsxs19(Stack16, { gap: "field", maxW: "md", children: [
|
|
3413
3641
|
/* @__PURE__ */ jsx19(Text18, { color: "fg.muted", textStyle: "body.sm", children: t("passkeyHint") }),
|
|
3414
|
-
/* @__PURE__ */ jsx19(
|
|
3415
|
-
/* @__PURE__ */ jsxs19(
|
|
3416
|
-
/* @__PURE__ */ jsx19(
|
|
3417
|
-
/* @__PURE__ */ jsx19(
|
|
3642
|
+
/* @__PURE__ */ jsx19(Field9, { label: t("passkeyName"), children: /* @__PURE__ */ jsx19(Input9, { value: passkeyName, maxLength: 64, autoFocus: true, onChange: (e) => setPasskeyName(e.target.value), "data-testid": "passkey-name" }) }),
|
|
3643
|
+
/* @__PURE__ */ jsxs19(HStack18, { children: [
|
|
3644
|
+
/* @__PURE__ */ jsx19(Button15, { type: "submit", loading: busy, "data-testid": "passkey-create", children: t("passkeyCreate") }),
|
|
3645
|
+
/* @__PURE__ */ jsx19(Button15, { variant: "secondary", onClick: () => setAddingPasskey(false), disabled: busy, children: t("cancel") })
|
|
3418
3646
|
] })
|
|
3419
3647
|
] })
|
|
3420
3648
|
}
|
|
3421
3649
|
),
|
|
3422
3650
|
codes && /* @__PURE__ */ jsx19(RecoveryCodes, { codes, onSaved: () => setCodes(null) }),
|
|
3423
|
-
!settingUp && !addingPasskey && !codes && /* @__PURE__ */ jsxs19(
|
|
3651
|
+
!settingUp && !addingPasskey && !codes && /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
3424
3652
|
/* @__PURE__ */ jsx19(
|
|
3425
3653
|
DataTable11,
|
|
3426
3654
|
{
|
|
@@ -3435,7 +3663,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3435
3663
|
{
|
|
3436
3664
|
id: "kind",
|
|
3437
3665
|
header: t("title"),
|
|
3438
|
-
cell: (f) => f.kind === "passkey" ? /* @__PURE__ */ jsxs19(
|
|
3666
|
+
cell: (f) => f.kind === "passkey" ? /* @__PURE__ */ jsxs19(Stack16, { gap: "0", children: [
|
|
3439
3667
|
/* @__PURE__ */ jsx19(Text18, { fontWeight: "medium", children: f.name || t("kinds.passkey") }),
|
|
3440
3668
|
/* @__PURE__ */ jsx19(Text18, { textStyle: "caption", color: "fg.muted", children: f.provider ? `${t("kinds.passkey")} \xB7 ${f.provider}` : t("kinds.passkey") })
|
|
3441
3669
|
] }) : /* @__PURE__ */ jsx19(Text18, { fontWeight: "medium", children: t(`kinds.${f.kind}`) })
|
|
@@ -3445,9 +3673,9 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3445
3673
|
{
|
|
3446
3674
|
id: "remove",
|
|
3447
3675
|
header: "",
|
|
3448
|
-
cell: (f) => /* @__PURE__ */ jsxs19(
|
|
3676
|
+
cell: (f) => /* @__PURE__ */ jsxs19(HStack18, { gap: "2", justify: "flex-end", children: [
|
|
3449
3677
|
f.kind === "passkey" && /* @__PURE__ */ jsx19(
|
|
3450
|
-
|
|
3678
|
+
Button15,
|
|
3451
3679
|
{
|
|
3452
3680
|
size: "sm",
|
|
3453
3681
|
variant: "ghost",
|
|
@@ -3458,20 +3686,20 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3458
3686
|
children: t("rename")
|
|
3459
3687
|
}
|
|
3460
3688
|
),
|
|
3461
|
-
/* @__PURE__ */ jsx19(
|
|
3689
|
+
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: "secondary", onClick: () => void remove(f), children: t("remove") })
|
|
3462
3690
|
] })
|
|
3463
3691
|
}
|
|
3464
3692
|
]
|
|
3465
3693
|
}
|
|
3466
3694
|
),
|
|
3467
|
-
factors.length > 0 && /* @__PURE__ */ jsxs19(
|
|
3695
|
+
factors.length > 0 && /* @__PURE__ */ jsxs19(HStack18, { justify: "space-between", wrap: "wrap", gap: "2", children: [
|
|
3468
3696
|
/* @__PURE__ */ jsx19(Text18, { textStyle: "body.sm", color: "fg.muted", "data-testid": "recovery-left", children: t("recoveryLeft", { count: num(data?.recoveryCodesLeft ?? 0) }) }),
|
|
3469
|
-
/* @__PURE__ */ jsx19(
|
|
3697
|
+
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: "secondary", onClick: () => void renew(), children: t("renew") })
|
|
3470
3698
|
] })
|
|
3471
3699
|
] })
|
|
3472
3700
|
] }),
|
|
3473
3701
|
/* @__PURE__ */ jsx19(
|
|
3474
|
-
|
|
3702
|
+
FormDialog2,
|
|
3475
3703
|
{
|
|
3476
3704
|
open: renaming != null,
|
|
3477
3705
|
onOpenChange: (open) => !open && setRenaming(null),
|
|
@@ -3479,7 +3707,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3479
3707
|
submitLabel: t("save"),
|
|
3480
3708
|
onSubmit: rename,
|
|
3481
3709
|
submitDisabled: !newName.trim(),
|
|
3482
|
-
children: /* @__PURE__ */ jsx19(
|
|
3710
|
+
children: /* @__PURE__ */ jsx19(Field9, { label: t("passkeyName"), required: true, children: /* @__PURE__ */ jsx19(Input9, { value: newName, maxLength: 64, required: true, onChange: (e) => setNewName(e.target.value), "data-testid": "passkey-rename" }) })
|
|
3483
3711
|
}
|
|
3484
3712
|
)
|
|
3485
3713
|
] });
|
|
@@ -3489,23 +3717,23 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3489
3717
|
import { useSyncExternalStore } from "react";
|
|
3490
3718
|
|
|
3491
3719
|
// src/areas/guard/SignUpScreen.tsx
|
|
3492
|
-
import { useEffect as useEffect5, useMemo as
|
|
3493
|
-
import { Grid as Grid4, HStack as
|
|
3720
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef2, useState as useState15 } from "react";
|
|
3721
|
+
import { Grid as Grid4, HStack as HStack19, Input as Input10, Stack as Stack17, Text as Text19 } from "@chakra-ui/react";
|
|
3494
3722
|
import { Trash2 as Trash22 } from "lucide-react";
|
|
3495
3723
|
import {
|
|
3496
3724
|
AddButton,
|
|
3497
|
-
Button as
|
|
3498
|
-
EmptyState,
|
|
3499
|
-
Field as
|
|
3500
|
-
IconButton as
|
|
3725
|
+
Button as Button16,
|
|
3726
|
+
EmptyState as EmptyState2,
|
|
3727
|
+
Field as Field10,
|
|
3728
|
+
IconButton as IconButton3,
|
|
3501
3729
|
InlineAlert as InlineAlert16,
|
|
3502
3730
|
notify as notify12,
|
|
3503
3731
|
PageHeader as PageHeader9,
|
|
3504
3732
|
Panel as Panel15,
|
|
3505
3733
|
SaveBar,
|
|
3506
|
-
SelectField as
|
|
3734
|
+
SelectField as SelectField5,
|
|
3507
3735
|
SwitchField,
|
|
3508
|
-
useApiAction as
|
|
3736
|
+
useApiAction as useApiAction11,
|
|
3509
3737
|
useApiQuery as useApiQuery12,
|
|
3510
3738
|
useAreaRequest as useAreaRequest16
|
|
3511
3739
|
} from "@abpjs/ui";
|
|
@@ -3531,19 +3759,19 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3531
3759
|
const t = useGuardNs("signUpSettings");
|
|
3532
3760
|
const request = useAreaRequest16("guard");
|
|
3533
3761
|
const settings = useApiQuery12("guard", "/signup/settings");
|
|
3534
|
-
const action =
|
|
3535
|
-
const [form, setForm] =
|
|
3536
|
-
const [started, setStarted] =
|
|
3537
|
-
const [adding, setAdding] =
|
|
3538
|
-
const [draft, setDraft] =
|
|
3539
|
-
const [draftError, setDraftError] =
|
|
3540
|
-
const [directoryError, setDirectoryError] =
|
|
3762
|
+
const action = useApiAction11();
|
|
3763
|
+
const [form, setForm] = useState15({ enabled: false, directoryId: "", domains: [] });
|
|
3764
|
+
const [started, setStarted] = useState15(false);
|
|
3765
|
+
const [adding, setAdding] = useState15(false);
|
|
3766
|
+
const [draft, setDraft] = useState15("");
|
|
3767
|
+
const [draftError, setDraftError] = useState15("");
|
|
3768
|
+
const [directoryError, setDirectoryError] = useState15("");
|
|
3541
3769
|
const addButton = useRef2(null);
|
|
3542
3770
|
const draftInput = useRef2(null);
|
|
3543
3771
|
useEffect5(() => {
|
|
3544
3772
|
if (settings.data) setForm(fromSettings(settings.data));
|
|
3545
3773
|
}, [settings.data]);
|
|
3546
|
-
const saved =
|
|
3774
|
+
const saved = useMemo3(() => settings.data ? fromSettings(settings.data) : form, [settings.data, form]);
|
|
3547
3775
|
const changes = settings.data ? signUpChanges(saved, form) + Number(draft.trim() !== "") : 0;
|
|
3548
3776
|
if (settings.error) return /* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: settings.error });
|
|
3549
3777
|
const listed = settings.data?.directories ?? [];
|
|
@@ -3622,10 +3850,10 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3622
3850
|
}
|
|
3623
3851
|
const saveBar = /* @__PURE__ */ jsx20(SaveBar, { open: changes > 0, count: changes, onSave: () => void save(), onDiscard: discard, busy: action.busy });
|
|
3624
3852
|
if (neverSetUp && !started && changes === 0) {
|
|
3625
|
-
return /* @__PURE__ */ jsxs20(
|
|
3853
|
+
return /* @__PURE__ */ jsxs20(Stack17, { gap: "section", children: [
|
|
3626
3854
|
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3627
3855
|
/* @__PURE__ */ jsx20(
|
|
3628
|
-
|
|
3856
|
+
EmptyState2,
|
|
3629
3857
|
{
|
|
3630
3858
|
variant: "page",
|
|
3631
3859
|
size: "md",
|
|
@@ -3633,7 +3861,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3633
3861
|
illustration: "records",
|
|
3634
3862
|
title: t("emptyTitle"),
|
|
3635
3863
|
description: t("emptyText"),
|
|
3636
|
-
action: /* @__PURE__ */ jsx20(
|
|
3864
|
+
action: /* @__PURE__ */ jsx20(Button16, { variant: "primary", onClick: () => {
|
|
3637
3865
|
setStarted(true);
|
|
3638
3866
|
change({ enabled: true });
|
|
3639
3867
|
}, children: t("turnOn") })
|
|
@@ -3641,16 +3869,16 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3641
3869
|
)
|
|
3642
3870
|
] });
|
|
3643
3871
|
}
|
|
3644
|
-
return /* @__PURE__ */ jsxs20(
|
|
3872
|
+
return /* @__PURE__ */ jsxs20(Stack17, { gap: "section", children: [
|
|
3645
3873
|
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3646
|
-
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(
|
|
3874
|
+
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(Stack17, { gap: "5", children: [
|
|
3647
3875
|
/* @__PURE__ */ jsx20(SwitchField, { label: t("enabled"), checked: form.enabled, onCheckedChange: (c) => {
|
|
3648
3876
|
change({ enabled: c });
|
|
3649
3877
|
if (!c) setDirectoryError("");
|
|
3650
3878
|
} }),
|
|
3651
3879
|
form.enabled ? /* @__PURE__ */ jsxs20(Grid4, { templateColumns: { base: "minmax(0, 1fr)", md: "repeat(2, minmax(0, 1fr))" }, gap: { base: "5", md: "4 8" }, alignItems: "start", children: [
|
|
3652
3880
|
/* @__PURE__ */ jsx20(
|
|
3653
|
-
|
|
3881
|
+
Field10,
|
|
3654
3882
|
{
|
|
3655
3883
|
label: t("directory"),
|
|
3656
3884
|
required: true,
|
|
@@ -3658,7 +3886,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3658
3886
|
errorText: directoryError,
|
|
3659
3887
|
helperText: chosen ? t("grantHint", { group: `${chosen.name} (everyone)` }) : directoriesPage ? t("directoryHint") : t("directoryHintPlain"),
|
|
3660
3888
|
children: /* @__PURE__ */ jsx20(
|
|
3661
|
-
|
|
3889
|
+
SelectField5,
|
|
3662
3890
|
{
|
|
3663
3891
|
value: form.directoryId,
|
|
3664
3892
|
onChange: (e) => {
|
|
@@ -3670,14 +3898,14 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3670
3898
|
)
|
|
3671
3899
|
}
|
|
3672
3900
|
),
|
|
3673
|
-
/* @__PURE__ */ jsxs20(
|
|
3901
|
+
/* @__PURE__ */ jsxs20(Stack17, { gap: "2", minW: "0", role: "group", "aria-labelledby": "signup-domains", children: [
|
|
3674
3902
|
/* @__PURE__ */ jsx20(Text19, { id: "signup-domains", textStyle: "label", children: t("domains") }),
|
|
3675
|
-
/* @__PURE__ */ jsxs20(
|
|
3903
|
+
/* @__PURE__ */ jsxs20(Stack17, { gap: "1", children: [
|
|
3676
3904
|
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(Text19, { textStyle: "body.sm", color: "fg.muted", py: "1.5", children: t("anyDomain") }),
|
|
3677
|
-
form.domains.map((d) => /* @__PURE__ */ jsxs20(
|
|
3905
|
+
form.domains.map((d) => /* @__PURE__ */ jsxs20(HStack19, { gap: "2", minH: "11", ps: "3", pe: "1", borderRadius: "l2", bg: "bg.subtle", textStyle: "body.sm", children: [
|
|
3678
3906
|
/* @__PURE__ */ jsx20(Text19, { flex: "1", minW: "0", fontWeight: "bold", dir: "ltr", textAlign: "start", truncate: true, children: d }),
|
|
3679
3907
|
/* @__PURE__ */ jsx20(
|
|
3680
|
-
|
|
3908
|
+
IconButton3,
|
|
3681
3909
|
{
|
|
3682
3910
|
remove: true,
|
|
3683
3911
|
size: "sm",
|
|
@@ -3688,7 +3916,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3688
3916
|
)
|
|
3689
3917
|
] }, d))
|
|
3690
3918
|
] }),
|
|
3691
|
-
adding ? /* @__PURE__ */ jsx20(
|
|
3919
|
+
adding ? /* @__PURE__ */ jsx20(Field10, { invalid: !!draftError, errorText: draftError, children: /* @__PURE__ */ jsxs20(HStack19, { gap: "3", align: "center", w: "full", children: [
|
|
3692
3920
|
/* @__PURE__ */ jsx20(
|
|
3693
3921
|
Input10,
|
|
3694
3922
|
{
|