@abpjs/ui 0.2.0-next.34 → 0.2.0-next.36
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 +38 -0
- package/dist/guard.d.ts +5 -2
- package/dist/guard.js +387 -252
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +89 -1
- package/dist/index.js +1153 -694
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/guard.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createAreaTexts } from "@abpjs/ui";
|
|
|
13
13
|
var ar_default = {
|
|
14
14
|
"directories.title": "\u0627\u0644\u0623\u062F\u0644\u0629",
|
|
15
15
|
"directories.subtitle": "\u0623\u062F\u0644\u0629 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645\u064A\u0646 \u0645\u0631\u062A\u0628\u0629 \u062D\u0633\u0628 \u0627\u0644\u0623\u0633\u0628\u0642\u064A\u0629. \u0625\u0630\u0627 \u0639\u0631\u0641 \u062F\u0644\u064A\u0644\u0627\u0646 \u0627\u0633\u0645 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645 \u0646\u0641\u0633\u0647\u060C \u0641\u0647\u0648 \u0644\u0623\u0648\u0644 \u062F\u0644\u064A\u0644 \u0646\u0634\u0637 \u0645\u0646\u0647\u0645\u0627.",
|
|
16
|
-
"directories.add": "\
|
|
16
|
+
"directories.add": "\u062F\u0644\u064A\u0644 \u062C\u062F\u064A\u062F",
|
|
17
17
|
"directories.empty": "\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062F\u0644\u0629.",
|
|
18
18
|
"directories.signIn": "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644",
|
|
19
19
|
"directories.lastSync": "\u0622\u062E\u0631 \u0645\u0632\u0627\u0645\u0646\u0629",
|
|
@@ -26,7 +26,6 @@ var ar_default = {
|
|
|
26
26
|
"directories.syncFailed": "\u0641\u0634\u0644\u062A \u0645\u0632\u0627\u0645\u0646\u0629 {name}: {error}",
|
|
27
27
|
"directories.internalType": "\u062F\u0627\u062E\u0644\u064A (\u064A\u062D\u0641\u0638\u0647 {product})",
|
|
28
28
|
"directories.warnings": "{count, plural, one {\u062A\u062D\u0630\u064A\u0631} two {\u062A\u062D\u0630\u064A\u0631\u0627\u0646} few {# \u062A\u062D\u0630\u064A\u0631\u0627\u062A} many {# \u062A\u062D\u0630\u064A\u0631\u064B\u0627} other {# \u062A\u062D\u0630\u064A\u0631}}",
|
|
29
|
-
"directories.addedWithWarnings": "\u0623\u064F\u0636\u064A\u0641 {name}. \u0641\u064A \u0625\u0639\u062F\u0627\u062F\u0627\u062A\u0647 \u062A\u062D\u0630\u064A\u0631\u0627\u062A:",
|
|
30
29
|
"directoryDetail.notFound": "\u0627\u0644\u062F\u0644\u064A\u0644 \u063A\u064A\u0631 \u0645\u0648\u062C\u0648\u062F",
|
|
31
30
|
"directoryDetail.back": "\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062F\u0644\u0629",
|
|
32
31
|
"directoryDetail.order": "\u0627\u0644\u062A\u0631\u062A\u064A\u0628 {order}",
|
|
@@ -74,10 +73,10 @@ var ar_default = {
|
|
|
74
73
|
"directoryForm.type": "\u0627\u0644\u0646\u0648\u0639",
|
|
75
74
|
"directoryForm.selectType": "\u0627\u062E\u062A\u0631 \u0646\u0648\u0639\u064B\u0627",
|
|
76
75
|
"directoryForm.typeFromPlugin": "{name} (\u0627\u0644\u0625\u0636\u0627\u0641\u0629 {plugin})",
|
|
77
|
-
"directoryForm.syncInterval": "\
|
|
78
|
-
"directoryForm.syncIntervalHint": "\
|
|
76
|
+
"directoryForm.syncInterval": "\u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629 \u0643\u0644",
|
|
77
|
+
"directoryForm.syncIntervalHint": "\u0641\u0627\u0631\u063A = \u0639\u0646\u062F \u0627\u0644\u0637\u0644\u0628 \u0641\u0642\u0637",
|
|
79
78
|
"directoryForm.active": "\u0646\u0634\u0637",
|
|
80
|
-
"directoryForm.signInEnabled": "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644
|
|
79
|
+
"directoryForm.signInEnabled": "\u0627\u0644\u0633\u0645\u0627\u062D \u0628\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644",
|
|
81
80
|
"directoryForm.capabilities": "\u0627\u0644\u0642\u062F\u0631\u0627\u062A: {list}",
|
|
82
81
|
"directoryForm.connectionSettings": "\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0627\u062A\u0635\u0627\u0644",
|
|
83
82
|
"directoryForm.fillFromPreset": "\u062A\u0639\u0628\u0626\u0629 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F \u062C\u0627\u0647\u0632",
|
|
@@ -459,14 +458,33 @@ var ar_default = {
|
|
|
459
458
|
"anonymousAccess.menuLabel": "\u0625\u062C\u0631\u0627\u0621\u0627\u062A {role} \u0641\u064A {scope}",
|
|
460
459
|
"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
460
|
"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}"
|
|
461
|
+
"anonymousAccess.placeWithCode": "{place} \xB7 {code}",
|
|
462
|
+
"directories.priority": "\u0627\u0644\u0623\u0648\u0644\u0648\u064A\u0629",
|
|
463
|
+
"directories.on": "\u0645\u0641\u0639\u0651\u0644",
|
|
464
|
+
"directories.off": "\u0645\u062A\u0648\u0642\u0641",
|
|
465
|
+
"directories.menuLabel": "\u0625\u062C\u0631\u0627\u0621\u0627\u062A {name}",
|
|
466
|
+
"directories.edit": "\u062A\u0639\u062F\u064A\u0644",
|
|
467
|
+
"directories.openPage": "\u0641\u062A\u062D \u0635\u0641\u062D\u062A\u0647",
|
|
468
|
+
"directories.deactivate": "\u0625\u064A\u0642\u0627\u0641",
|
|
469
|
+
"directories.activate": "\u062A\u0641\u0639\u064A\u0644",
|
|
470
|
+
"directories.newTitle": "\u062F\u0644\u064A\u0644 \u062C\u062F\u064A\u062F",
|
|
471
|
+
"directories.editTitle": "\u062A\u0639\u062F\u064A\u0644 \u0627\u0644\u062F\u0644\u064A\u0644",
|
|
472
|
+
"directories.deleteDirectory": "\u062D\u0630\u0641 \u0627\u0644\u062F\u0644\u064A\u0644",
|
|
473
|
+
"directories.namePreview": "\u0627\u0633\u0645 \u0627\u0644\u062F\u0644\u064A\u0644",
|
|
474
|
+
"directories.sync": "\u0627\u0644\u0645\u0632\u0627\u0645\u0646\u0629",
|
|
475
|
+
"directories.syncEvery": "{count, plural, one {\u0643\u0644 \u062F\u0642\u064A\u0642\u0629} two {\u0643\u0644 \u062F\u0642\u064A\u0642\u062A\u064A\u0646} few {\u0643\u0644 # \u062F\u0642\u0627\u0626\u0642} many {\u0643\u0644 # \u062F\u0642\u064A\u0642\u0629} other {\u0643\u0644 # \u062F\u0642\u064A\u0642\u0629}}",
|
|
476
|
+
"directories.onRequest": "\u0639\u0646\u062F \u0627\u0644\u0637\u0644\u0628 \u0641\u0642\u0637",
|
|
477
|
+
"directories.savedWithWarnings": "\u062D\u064F\u0641\u0638 {name}. \u0641\u064A \u0625\u0639\u062F\u0627\u062F\u0627\u062A\u0647 \u062A\u062D\u0630\u064A\u0631\u0627\u062A:",
|
|
478
|
+
"directoryForm.minutes": "\u062F\u0642\u064A\u0642\u0629",
|
|
479
|
+
"directoryForm.namePlaceholder": "\u0645\u062B\u0627\u0644: \u062F\u0644\u064A\u0644 \u0627\u0644\u0634\u0631\u0643\u0629",
|
|
480
|
+
"directories.internal": "\u062F\u0627\u062E\u0644\u064A"
|
|
463
481
|
};
|
|
464
482
|
|
|
465
483
|
// src/areas/guard/texts/en.json
|
|
466
484
|
var en_default = {
|
|
467
485
|
"directories.title": "Directories",
|
|
468
486
|
"directories.subtitle": "User directories in precedence order. When two directories know the same username, the first active one owns it.",
|
|
469
|
-
"directories.add": "
|
|
487
|
+
"directories.add": "New directory",
|
|
470
488
|
"directories.empty": "No directories.",
|
|
471
489
|
"directories.signIn": "Sign-in",
|
|
472
490
|
"directories.lastSync": "Last sync",
|
|
@@ -479,7 +497,6 @@ var en_default = {
|
|
|
479
497
|
"directories.syncFailed": "Sync of {name} failed: {error}",
|
|
480
498
|
"directories.internalType": "Internal (kept by {product})",
|
|
481
499
|
"directories.warnings": "{count, plural, one {A warning} other {# warnings}}",
|
|
482
|
-
"directories.addedWithWarnings": "{name} is added. Its settings have warnings:",
|
|
483
500
|
"directoryDetail.notFound": "Directory not found",
|
|
484
501
|
"directoryDetail.back": "Back to directories",
|
|
485
502
|
"directoryDetail.order": "Order {order}",
|
|
@@ -527,10 +544,10 @@ var en_default = {
|
|
|
527
544
|
"directoryForm.type": "Type",
|
|
528
545
|
"directoryForm.selectType": "Select a type",
|
|
529
546
|
"directoryForm.typeFromPlugin": "{name} (plugin {plugin})",
|
|
530
|
-
"directoryForm.syncInterval": "Sync
|
|
531
|
-
"directoryForm.syncIntervalHint": "
|
|
547
|
+
"directoryForm.syncInterval": "Sync every",
|
|
548
|
+
"directoryForm.syncIntervalHint": "Empty = on request only",
|
|
532
549
|
"directoryForm.active": "Active",
|
|
533
|
-
"directoryForm.signInEnabled": "
|
|
550
|
+
"directoryForm.signInEnabled": "Allow sign-in",
|
|
534
551
|
"directoryForm.capabilities": "Capabilities: {list}",
|
|
535
552
|
"directoryForm.connectionSettings": "Connection settings",
|
|
536
553
|
"directoryForm.fillFromPreset": "Fill from preset",
|
|
@@ -912,7 +929,26 @@ var en_default = {
|
|
|
912
929
|
"anonymousAccess.menuLabel": "Actions for {role} in {scope}",
|
|
913
930
|
"anonymousAccess.notListed": "This place doesn't offer roles to anonymous visitors now. Remove the role instead.",
|
|
914
931
|
"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}"
|
|
932
|
+
"anonymousAccess.placeWithCode": "{place} \xB7 {code}",
|
|
933
|
+
"directories.priority": "Priority",
|
|
934
|
+
"directories.on": "On",
|
|
935
|
+
"directories.off": "Off",
|
|
936
|
+
"directories.menuLabel": "Actions for {name}",
|
|
937
|
+
"directories.edit": "Edit",
|
|
938
|
+
"directories.openPage": "Open its page",
|
|
939
|
+
"directories.deactivate": "Deactivate",
|
|
940
|
+
"directories.activate": "Activate",
|
|
941
|
+
"directories.newTitle": "New directory",
|
|
942
|
+
"directories.editTitle": "Edit directory",
|
|
943
|
+
"directories.deleteDirectory": "Delete directory",
|
|
944
|
+
"directories.namePreview": "Directory name",
|
|
945
|
+
"directories.sync": "Sync",
|
|
946
|
+
"directories.syncEvery": "{count, plural, one {Every minute} other {Every # minutes}}",
|
|
947
|
+
"directories.onRequest": "On request only",
|
|
948
|
+
"directories.savedWithWarnings": "{name} is saved. Its settings have warnings:",
|
|
949
|
+
"directoryForm.minutes": "minutes",
|
|
950
|
+
"directoryForm.namePlaceholder": "e.g. Company directory",
|
|
951
|
+
"directories.internal": "Internal"
|
|
916
952
|
};
|
|
917
953
|
|
|
918
954
|
// src/areas/guard/texts.ts
|
|
@@ -1965,29 +2001,67 @@ function AnonymousScreen({ roleName, roleDescription } = {}) {
|
|
|
1965
2001
|
}
|
|
1966
2002
|
|
|
1967
2003
|
// src/areas/guard/DirectoriesScreen.tsx
|
|
1968
|
-
import { useState as useState6 } from "react";
|
|
1969
|
-
import {
|
|
1970
|
-
import { ArrowDown, ArrowUp, RefreshCw } from "lucide-react";
|
|
2004
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
2005
|
+
import { chakra, Stack as Stack9, Text as Text11 } from "@chakra-ui/react";
|
|
2006
|
+
import { ArrowDown, ArrowUp, ExternalLink, FolderTree, Pencil as Pencil2, Power, PowerOff, RefreshCw, Trash2 as Trash22 } from "lucide-react";
|
|
1971
2007
|
import {
|
|
1972
|
-
AppLink as AppLink5,
|
|
1973
2008
|
Button as Button9,
|
|
1974
2009
|
DataTable as DataTable7,
|
|
1975
|
-
|
|
2010
|
+
FormDialog as FormDialog2,
|
|
2011
|
+
IconTile as IconTile2,
|
|
1976
2012
|
InlineAlert as InlineAlert8,
|
|
1977
2013
|
Loading as Loading2,
|
|
1978
2014
|
PageHeader as PageHeader4,
|
|
1979
2015
|
Panel as Panel8,
|
|
2016
|
+
PreviewCard as PreviewCard2,
|
|
2017
|
+
RowMenu as RowMenu2,
|
|
1980
2018
|
StatusPill as StatusPill7,
|
|
1981
|
-
|
|
2019
|
+
errorText as errorText4,
|
|
1982
2020
|
useApiAction as useApiAction7,
|
|
1983
2021
|
useApiQuery as useApiQuery6,
|
|
1984
|
-
useAreaRequest as useAreaRequest8
|
|
2022
|
+
useAreaRequest as useAreaRequest8,
|
|
2023
|
+
useConfirm as useConfirm3,
|
|
2024
|
+
useNavigate as useNavigate2
|
|
1985
2025
|
} from "@abpjs/ui";
|
|
1986
2026
|
|
|
1987
2027
|
// src/areas/guard/DirectoryForm.tsx
|
|
1988
2028
|
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,
|
|
2029
|
+
import { Fieldset, HStack as HStack9, Input as Input3, InputGroup, SimpleGrid as SimpleGrid2, Stack as Stack8, Text as Text10 } from "@chakra-ui/react";
|
|
2030
|
+
import { Button as Button8, errorText as errorText3, Field as Field3, HostSlot as HostSlot2, InlineAlert as InlineAlert7, SelectField as SelectField3, SwitchField, TranslatedInput as TranslatedInput2 } from "@abpjs/ui";
|
|
2031
|
+
|
|
2032
|
+
// src/areas/guard/directoryRules.ts
|
|
2033
|
+
var MASKED_SECRET = "********";
|
|
2034
|
+
function editInput(dir, secretNames = /* @__PURE__ */ new Set()) {
|
|
2035
|
+
const settings = {};
|
|
2036
|
+
for (const [k, v] of Object.entries(dir.settings)) settings[k] = secretNames.has(k) || v === MASKED_SECRET ? "" : v;
|
|
2037
|
+
const minutes = dir.syncIntervalMinutes === null || dir.syncIntervalMinutes === "" ? null : Number(dir.syncIntervalMinutes);
|
|
2038
|
+
return {
|
|
2039
|
+
name: dir.name,
|
|
2040
|
+
names: dir.names,
|
|
2041
|
+
type: dir.type,
|
|
2042
|
+
isActive: dir.isActive,
|
|
2043
|
+
authenticationEnabled: dir.authenticationEnabled,
|
|
2044
|
+
// 0 is "on request" as empty is: kept as empty, so the field's minimum of 1 doesn't stop a save.
|
|
2045
|
+
syncIntervalMinutes: minutes !== null && Number.isFinite(minutes) && minutes > 0 ? minutes : null,
|
|
2046
|
+
settings
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
function syncs(capabilities) {
|
|
2050
|
+
return (capabilities ?? []).some((c) => c === "Sync" || c === "IncrementalSync");
|
|
2051
|
+
}
|
|
2052
|
+
function moved(ids, id, delta) {
|
|
2053
|
+
const out = [...ids];
|
|
2054
|
+
const i = out.indexOf(id);
|
|
2055
|
+
const j = i + delta;
|
|
2056
|
+
if (i < 0 || j < 0 || j >= out.length) return out;
|
|
2057
|
+
[out[i], out[j]] = [out[j], out[i]];
|
|
2058
|
+
return out;
|
|
2059
|
+
}
|
|
2060
|
+
function forType(input, capabilities) {
|
|
2061
|
+
return syncs(capabilities) ? input : { ...input, syncIntervalMinutes: null };
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
// src/areas/guard/DirectoryForm.tsx
|
|
1991
2065
|
import { fromNamesValue, toNamesValue } from "@abpjs/ui/rules";
|
|
1992
2066
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1993
2067
|
function defaultsFor(type) {
|
|
@@ -2001,21 +2075,6 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
2001
2075
|
const [input, setInput] = useState5(initial);
|
|
2002
2076
|
const [error, setError] = useState5(null);
|
|
2003
2077
|
const [busy, setBusy] = useState5(false);
|
|
2004
|
-
const type = types.find((x) => x.type === input.type);
|
|
2005
|
-
const definitions = type?.settings ?? fallbackSettings ?? [];
|
|
2006
|
-
function set(key, value) {
|
|
2007
|
-
setInput((prev) => ({ ...prev, [key]: value }));
|
|
2008
|
-
}
|
|
2009
|
-
function setSetting(name, value) {
|
|
2010
|
-
setInput((prev) => ({ ...prev, settings: { ...prev.settings, [name]: value } }));
|
|
2011
|
-
}
|
|
2012
|
-
function changeType(next) {
|
|
2013
|
-
const nextType = types.find((x) => x.type === next);
|
|
2014
|
-
setInput((prev) => ({ ...prev, type: next, settings: defaultsFor(nextType) }));
|
|
2015
|
-
}
|
|
2016
|
-
function applyPreset(settings) {
|
|
2017
|
-
setInput((prev) => ({ ...prev, settings: { ...prev.settings, ...settings } }));
|
|
2018
|
-
}
|
|
2019
2078
|
async function submit(e) {
|
|
2020
2079
|
e.preventDefault();
|
|
2021
2080
|
setBusy(true);
|
|
@@ -2029,15 +2088,43 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
2029
2088
|
}
|
|
2030
2089
|
}
|
|
2031
2090
|
return /* @__PURE__ */ jsx10("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs10(Stack8, { gap: "field", children: [
|
|
2032
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ jsx10(DirectoryFields, { mode, types, input, onChange: setInput, fallbackSettings }),
|
|
2092
|
+
/* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: error }),
|
|
2093
|
+
/* @__PURE__ */ jsxs10(HStack9, { gap: "2", children: [
|
|
2094
|
+
/* @__PURE__ */ jsx10(Button8, { type: "submit", variant: "primary", loading: busy, disabled: !input.type, children: mode === "create" ? t("create") : t("save") }),
|
|
2095
|
+
onCancel && /* @__PURE__ */ jsx10(Button8, { variant: "cancel", onClick: onCancel, children: tc("cancel") })
|
|
2096
|
+
] })
|
|
2097
|
+
] }) });
|
|
2098
|
+
}
|
|
2099
|
+
function DirectoryFields({ mode, types, input, onChange, fallbackSettings, compact }) {
|
|
2100
|
+
const t = useGuardNs("directoryForm");
|
|
2101
|
+
const type = types.find((x) => x.type === input.type);
|
|
2102
|
+
const definitions = type?.settings ?? fallbackSettings ?? [];
|
|
2103
|
+
const columns = compact ? 1 : { base: 1, md: 2 };
|
|
2104
|
+
function set(key, value) {
|
|
2105
|
+
onChange((prev) => ({ ...prev, [key]: value }));
|
|
2106
|
+
}
|
|
2107
|
+
function setSetting(name, value) {
|
|
2108
|
+
onChange((prev) => ({ ...prev, settings: { ...prev.settings, [name]: value } }));
|
|
2109
|
+
}
|
|
2110
|
+
function changeType(next) {
|
|
2111
|
+
const nextType = types.find((x) => x.type === next);
|
|
2112
|
+
onChange((prev) => forType({ ...prev, type: next, settings: defaultsFor(nextType) }, nextType?.capabilities ?? ["Sync"]));
|
|
2113
|
+
}
|
|
2114
|
+
function applyPreset(settings) {
|
|
2115
|
+
onChange((prev) => ({ ...prev, settings: { ...prev.settings, ...settings } }));
|
|
2116
|
+
}
|
|
2117
|
+
return /* @__PURE__ */ jsxs10(Stack8, { gap: "field", children: [
|
|
2118
|
+
/* @__PURE__ */ jsxs10(SimpleGrid2, { columns, gap: "field", children: [
|
|
2033
2119
|
/* @__PURE__ */ jsx10(Field3, { label: t("name"), required: true, children: /* @__PURE__ */ jsx10(
|
|
2034
2120
|
TranslatedInput2,
|
|
2035
2121
|
{
|
|
2036
2122
|
value: toNamesValue(input.name, input.names),
|
|
2037
2123
|
"aria-label": t("name"),
|
|
2124
|
+
placeholder: t("namePlaceholder"),
|
|
2038
2125
|
onChange: (v) => {
|
|
2039
2126
|
const { name, names } = fromNamesValue(v);
|
|
2040
|
-
|
|
2127
|
+
onChange((prev) => ({ ...prev, name, names }));
|
|
2041
2128
|
}
|
|
2042
2129
|
}
|
|
2043
2130
|
) }),
|
|
@@ -2047,7 +2134,7 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
2047
2134
|
value: input.type,
|
|
2048
2135
|
onChange: (e) => changeType(e.target.value),
|
|
2049
2136
|
options: [
|
|
2050
|
-
{ value: "", label: t("selectType")
|
|
2137
|
+
{ value: "", label: t("selectType") },
|
|
2051
2138
|
...types.map((x) => ({
|
|
2052
2139
|
value: x.type,
|
|
2053
2140
|
label: x.pluginKey ? t("typeFromPlugin", { name: x.displayName, plugin: x.pluginKey }) : x.displayName
|
|
@@ -2055,26 +2142,27 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
2055
2142
|
]
|
|
2056
2143
|
}
|
|
2057
2144
|
) : /* @__PURE__ */ jsx10(Input3, { value: type?.displayName ?? input.type, readOnly: true }) }),
|
|
2058
|
-
/* @__PURE__ */ jsx10(Field3, { label: t("syncInterval"),
|
|
2145
|
+
(!type || syncs(type.capabilities)) && /* @__PURE__ */ jsx10(Field3, { label: t("syncInterval"), children: /* @__PURE__ */ jsx10(InputGroup, { endAddon: t("minutes"), children: /* @__PURE__ */ jsx10(
|
|
2059
2146
|
Input3,
|
|
2060
2147
|
{
|
|
2061
2148
|
type: "number",
|
|
2062
2149
|
min: 1,
|
|
2063
2150
|
value: input.syncIntervalMinutes ?? "",
|
|
2151
|
+
placeholder: t("syncIntervalHint"),
|
|
2064
2152
|
onChange: (e) => set("syncIntervalMinutes", e.target.value === "" ? null : Number(e.target.value))
|
|
2065
2153
|
}
|
|
2066
|
-
) }),
|
|
2067
|
-
/* @__PURE__ */ jsxs10(Stack8, { gap: "
|
|
2068
|
-
/* @__PURE__ */ jsx10(
|
|
2069
|
-
/* @__PURE__ */ jsx10(
|
|
2154
|
+
) }) }),
|
|
2155
|
+
/* @__PURE__ */ jsxs10(Stack8, { gap: "3", justify: "flex-end", pb: "1", children: [
|
|
2156
|
+
/* @__PURE__ */ jsx10(SwitchField, { label: t("active"), checked: input.isActive, onCheckedChange: (v) => set("isActive", v) }),
|
|
2157
|
+
/* @__PURE__ */ jsx10(SwitchField, { label: t("signInEnabled"), checked: input.authenticationEnabled, onCheckedChange: (v) => set("authenticationEnabled", v) })
|
|
2070
2158
|
] })
|
|
2071
2159
|
] }),
|
|
2072
|
-
type && type.capabilities.length > 0 && /* @__PURE__ */ jsx10(Text10, { textStyle: "caption", color: "fg.muted", children: t("capabilities", { list: type.capabilities.join(", ") }) }),
|
|
2160
|
+
!compact && type && type.capabilities.length > 0 && /* @__PURE__ */ jsx10(Text10, { textStyle: "caption", color: "fg.muted", children: t("capabilities", { list: type.capabilities.join(", ") }) }),
|
|
2073
2161
|
definitions.length > 0 && /* @__PURE__ */ jsxs10(Fieldset.Root, { layerStyle: "sunken", p: "panel", children: [
|
|
2074
2162
|
/* @__PURE__ */ jsx10(Fieldset.Legend, { textStyle: "label", px: "1", children: t("connectionSettings") }),
|
|
2075
2163
|
/* @__PURE__ */ jsxs10(Fieldset.Content, { gap: "field", children: [
|
|
2076
2164
|
input.type && /* @__PURE__ */ jsx10(HostSlot2, { name: "guard.directory.presets", context: { type: input.type, apply: applyPreset } }),
|
|
2077
|
-
/* @__PURE__ */ jsx10(SimpleGrid2, { columns
|
|
2165
|
+
/* @__PURE__ */ jsx10(SimpleGrid2, { columns, 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(
|
|
2078
2166
|
Input3,
|
|
2079
2167
|
{
|
|
2080
2168
|
type: d.secret ? "password" : "text",
|
|
@@ -2086,13 +2174,8 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
2086
2174
|
}
|
|
2087
2175
|
) }, d.name)) })
|
|
2088
2176
|
] })
|
|
2089
|
-
] }),
|
|
2090
|
-
/* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: error }),
|
|
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") })
|
|
2094
2177
|
] })
|
|
2095
|
-
] })
|
|
2178
|
+
] });
|
|
2096
2179
|
}
|
|
2097
2180
|
function DirectoryWarnings({ title, warnings }) {
|
|
2098
2181
|
if (!warnings || warnings.length === 0) return null;
|
|
@@ -2111,21 +2194,67 @@ var EMPTY_INPUT = {
|
|
|
2111
2194
|
};
|
|
2112
2195
|
function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
2113
2196
|
const t = useGuardNs("directories");
|
|
2197
|
+
const tf = useGuardNs("directoryForm");
|
|
2198
|
+
const td = useGuardNs("directoryDetail");
|
|
2114
2199
|
const tc = useGuardNs("common");
|
|
2115
2200
|
const request = useAreaRequest8("guard");
|
|
2201
|
+
const navigate = useNavigate2();
|
|
2202
|
+
const confirm = useConfirm3();
|
|
2116
2203
|
const dirs = useApiQuery6("guard", "/directories");
|
|
2117
2204
|
const types = useApiQuery6("guard", "/directory-types");
|
|
2118
2205
|
const action = useApiAction7();
|
|
2119
|
-
const
|
|
2206
|
+
const dialog = useApiAction7();
|
|
2207
|
+
const [editing, setEditing] = useState6(null);
|
|
2208
|
+
const [shown, setShown] = useState6({ mode: "create" });
|
|
2209
|
+
const [input, setInput] = useState6(EMPTY_INPUT);
|
|
2120
2210
|
const [notice, setNotice] = useState6(null);
|
|
2121
2211
|
const [syncing, setSyncing] = useState6(null);
|
|
2122
|
-
const [
|
|
2212
|
+
const [warned, setWarned] = useState6(null);
|
|
2123
2213
|
const list = dirs.data ?? [];
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2214
|
+
const allTypes = useMemo2(
|
|
2215
|
+
() => [{ type: "internal", displayName: t("internalType"), capabilities: ["Authenticate"], settings: [], pluginKey: null }, ...types.data ?? []],
|
|
2216
|
+
[types.data, t]
|
|
2217
|
+
);
|
|
2218
|
+
const typeOf = (type2) => allTypes.find((x) => x.type === type2);
|
|
2219
|
+
const typeName = (type2, displayName) => type2 === "internal" ? t("internal") : displayName || typeOf(type2)?.displayName || type2;
|
|
2220
|
+
const secretsOf = (type2) => new Set((typeOf(type2)?.settings ?? []).filter((s) => s.secret).map((s) => s.name));
|
|
2221
|
+
const typesReady = types.data !== void 0;
|
|
2222
|
+
function open(next) {
|
|
2223
|
+
setEditing(next);
|
|
2224
|
+
setShown(next);
|
|
2225
|
+
setInput(next.mode === "edit" ? editInput(next.dir, secretsOf(next.dir.type)) : EMPTY_INPUT);
|
|
2226
|
+
dialog.setError(null);
|
|
2227
|
+
}
|
|
2228
|
+
async function save() {
|
|
2229
|
+
if (!editing) return;
|
|
2230
|
+
const body = forType(input, typeOf(input.type)?.capabilities);
|
|
2231
|
+
const saved = await dialog.run(
|
|
2232
|
+
() => editing.mode === "create" ? request("/directories", { method: "POST", body }) : request(`/directories/${editing.dir.id}`, { method: "PUT", body })
|
|
2233
|
+
);
|
|
2234
|
+
if (!saved) return;
|
|
2235
|
+
setWarned((saved.warnings ?? []).length > 0 ? saved : null);
|
|
2236
|
+
setEditing(null);
|
|
2237
|
+
await dirs.reload();
|
|
2238
|
+
}
|
|
2239
|
+
async function remove(d, from) {
|
|
2240
|
+
if (!await confirm({ title: td("deleteTitle", { name: d.name }), description: td("deleteDescription"), confirmLabel: tc("delete"), danger: true })) return;
|
|
2241
|
+
const run = from === "dialog" ? dialog : action;
|
|
2242
|
+
const done = await run.run(async () => {
|
|
2243
|
+
await request(`/directories/${d.id}`, { method: "DELETE" });
|
|
2244
|
+
return true;
|
|
2245
|
+
});
|
|
2246
|
+
if (done) {
|
|
2247
|
+
setEditing(null);
|
|
2248
|
+
await dirs.reload();
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
async function setActive(d, isActive) {
|
|
2252
|
+
const body = { ...editInput(d, secretsOf(d.type)), isActive };
|
|
2253
|
+
const saved = await action.run(() => request(`/directories/${d.id}`, { method: "PUT", body }));
|
|
2254
|
+
if (saved) await dirs.reload();
|
|
2255
|
+
}
|
|
2256
|
+
async function move(d, delta) {
|
|
2257
|
+
const ids = moved(list.map((x) => x.id), d.id, delta);
|
|
2129
2258
|
const result = await action.run(() => request("/directories/reorder", { method: "POST", body: { directoryIds: ids } }));
|
|
2130
2259
|
if (result) dirs.setData(result);
|
|
2131
2260
|
}
|
|
@@ -2151,88 +2280,78 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
2151
2280
|
}
|
|
2152
2281
|
await dirs.reload();
|
|
2153
2282
|
}
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2283
|
+
function menu(d) {
|
|
2284
|
+
const i = list.indexOf(d);
|
|
2285
|
+
const canSync = d.connectorAvailable && syncs(typeOf(d.type)?.capabilities);
|
|
2286
|
+
return [
|
|
2287
|
+
{ id: "edit", label: t("edit"), icon: /* @__PURE__ */ jsx11(Pencil2, {}), disabled: !typesReady, onSelect: () => open({ mode: "edit", dir: d }) },
|
|
2288
|
+
{ id: "open", label: t("openPage"), icon: /* @__PURE__ */ jsx11(ExternalLink, {}), onSelect: () => navigate(routes.directory(d.id)) },
|
|
2289
|
+
{ id: "sync", label: t("syncNow"), icon: /* @__PURE__ */ jsx11(RefreshCw, {}), disabled: !canSync || syncing != null, onSelect: () => void sync(d) },
|
|
2290
|
+
...!d.connectorAvailable ? [{ note: t("connectorDisabled") }] : [],
|
|
2291
|
+
{ separator: true },
|
|
2292
|
+
{ id: "up", label: t("moveUp", { name: d.name }), icon: /* @__PURE__ */ jsx11(ArrowUp, {}), disabled: i <= 0 || action.busy, onSelect: () => void move(d, -1) },
|
|
2293
|
+
{ id: "down", label: t("moveDown", { name: d.name }), icon: /* @__PURE__ */ jsx11(ArrowDown, {}), disabled: i === list.length - 1 || action.busy, onSelect: () => void move(d, 1) },
|
|
2294
|
+
{ separator: true },
|
|
2295
|
+
// One write at a time: these wait, as moving does, while another is running.
|
|
2296
|
+
d.isActive ? { id: "deactivate", label: t("deactivate"), icon: /* @__PURE__ */ jsx11(PowerOff, {}), disabled: !typesReady || action.busy, onSelect: () => void setActive(d, false) } : { id: "activate", label: t("activate"), icon: /* @__PURE__ */ jsx11(Power, {}), disabled: !typesReady || action.busy, onSelect: () => void setActive(d, true) },
|
|
2297
|
+
{ id: "delete", label: tc("delete"), icon: /* @__PURE__ */ jsx11(Trash22, {}), danger: true, disabled: action.busy, onSelect: () => void remove(d, "list") }
|
|
2298
|
+
];
|
|
2159
2299
|
}
|
|
2160
2300
|
const columns = [
|
|
2161
|
-
|
|
2301
|
+
// The order sign-in tries them, counted from 1 (the server's is from 0).
|
|
2302
|
+
{ id: "order", header: t("priority"), numeric: true, width: "16", cell: (d) => list.indexOf(d) + 1 },
|
|
2162
2303
|
{
|
|
2163
2304
|
id: "name",
|
|
2164
2305
|
header: tc("name"),
|
|
2165
2306
|
cell: (d) => /* @__PURE__ */ jsxs11(Stack9, { gap: "1", align: "flex-start", children: [
|
|
2166
|
-
/* @__PURE__ */ jsx11(
|
|
2307
|
+
/* @__PURE__ */ jsx11(
|
|
2308
|
+
chakra.button,
|
|
2309
|
+
{
|
|
2310
|
+
type: "button",
|
|
2311
|
+
fontWeight: "semibold",
|
|
2312
|
+
textAlign: "start",
|
|
2313
|
+
color: "fg",
|
|
2314
|
+
_hover: { textDecoration: "underline" },
|
|
2315
|
+
disabled: !typesReady,
|
|
2316
|
+
onClick: () => open({ mode: "edit", dir: d }),
|
|
2317
|
+
children: d.name
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2167
2320
|
!d.connectorAvailable && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.pluginKey ? t("pluginDisabledHint", { plugin: d.pluginKey }) : void 0, children: t("connectorDisabled") }),
|
|
2168
2321
|
d.warnings && d.warnings.length > 0 && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.warnings.join("\n"), children: t("warnings", { count: d.warnings.length }) })
|
|
2169
2322
|
] })
|
|
2170
2323
|
},
|
|
2171
|
-
{ id: "type", header: tc("type"), cell: (d) => d.
|
|
2172
|
-
{ id: "active", header: tc("
|
|
2173
|
-
{ id: "signIn", header: t("signIn"), cell: (d) => /* @__PURE__ */ jsx11(FlagPill, { value: d.authenticationEnabled, yes:
|
|
2324
|
+
{ id: "type", header: tc("type"), cell: (d) => typeName(d.type, d.typeDisplayName) },
|
|
2325
|
+
{ id: "active", header: tc("status"), cell: (d) => /* @__PURE__ */ jsx11(FlagPill, { value: d.isActive, yes: tc("active"), no: tc("inactive") }), skeleton: "pill" },
|
|
2326
|
+
{ id: "signIn", header: t("signIn"), cell: (d) => /* @__PURE__ */ jsx11(FlagPill, { value: d.authenticationEnabled, yes: t("on"), no: t("off") }), skeleton: "pill" },
|
|
2174
2327
|
{ id: "users", header: tc("users"), numeric: true, cell: (d) => d.userCount },
|
|
2175
2328
|
{ id: "groups", header: tc("groups"), numeric: true, cell: (d) => d.groupCount },
|
|
2176
2329
|
{ id: "lastSync", header: t("lastSync"), cell: (d) => /* @__PURE__ */ jsx11(SyncStatus, { d }), skeleton: "pill" },
|
|
2177
2330
|
{
|
|
2178
2331
|
id: "actions",
|
|
2179
|
-
header: tc("actions"),
|
|
2332
|
+
header: /* @__PURE__ */ jsx11(Text11, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2180
2333
|
align: "end",
|
|
2181
|
-
|
|
2182
|
-
// Its buttons as their ghosts while the list loads, so a placeholder row is as tall as a real one.
|
|
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: [
|
|
2187
|
-
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
2188
|
-
t("syncNow")
|
|
2189
|
-
] })
|
|
2190
|
-
] }) }),
|
|
2191
|
-
cell: (d) => {
|
|
2192
|
-
const i = list.indexOf(d);
|
|
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: [
|
|
2197
|
-
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
2198
|
-
t("syncNow")
|
|
2199
|
-
] }) })
|
|
2200
|
-
] });
|
|
2201
|
-
}
|
|
2334
|
+
cell: (d) => /* @__PURE__ */ jsx11(RowMenu2, { label: t("menuLabel", { name: d.name }), items: menu(d) })
|
|
2202
2335
|
}
|
|
2203
2336
|
];
|
|
2337
|
+
const type = typeOf(input.type);
|
|
2338
|
+
const synced = !!type && syncs(type.capabilities);
|
|
2339
|
+
const minutes = input.syncIntervalMinutes;
|
|
2204
2340
|
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
2205
2341
|
/* @__PURE__ */ jsx11(
|
|
2206
2342
|
PageHeader4,
|
|
2207
2343
|
{
|
|
2208
2344
|
title: t("title"),
|
|
2209
2345
|
description: t("subtitle"),
|
|
2210
|
-
actions:
|
|
2211
|
-
|
|
2212
|
-
|
|
2346
|
+
actions: /* @__PURE__ */ jsx11(Button9, { variant: "primary", onClick: () => {
|
|
2347
|
+
setWarned(null);
|
|
2348
|
+
open({ mode: "create" });
|
|
2213
2349
|
}, children: t("add") })
|
|
2214
2350
|
}
|
|
2215
2351
|
),
|
|
2216
2352
|
/* @__PURE__ */ jsxs11(Stack9, { gap: "section", children: [
|
|
2217
|
-
adding && /* @__PURE__ */ jsx11(Panel8, { title: t("add"), children: types.error ? /* @__PURE__ */ jsx11(InlineAlert8, { tone: "danger", children: types.error }) : (
|
|
2218
|
-
// The form is there while the types load, its fields as their ghosts.
|
|
2219
|
-
/* @__PURE__ */ jsx11(Loading2, { when: !types.data, children: /* @__PURE__ */ jsx11(
|
|
2220
|
-
DirectoryForm,
|
|
2221
|
-
{
|
|
2222
|
-
mode: "create",
|
|
2223
|
-
types: [
|
|
2224
|
-
// An internal directory, kept by the site itself: the accounts people make by signing up.
|
|
2225
|
-
{ type: "internal", displayName: t("internalType"), capabilities: ["Authenticate"], settings: [], pluginKey: null },
|
|
2226
|
-
...types.data ?? []
|
|
2227
|
-
],
|
|
2228
|
-
initial: EMPTY_INPUT,
|
|
2229
|
-
onSubmit: create,
|
|
2230
|
-
onCancel: () => setAdding(false)
|
|
2231
|
-
}
|
|
2232
|
-
) })
|
|
2233
|
-
) }),
|
|
2234
2353
|
/* @__PURE__ */ jsx11(InlineAlert8, { tone: "danger", children: action.error }),
|
|
2235
|
-
|
|
2354
|
+
warned && /* @__PURE__ */ jsx11(DirectoryWarnings, { title: t("savedWithWarnings", { name: warned.name }), warnings: warned.warnings }),
|
|
2236
2355
|
notice && /* @__PURE__ */ jsx11(InlineAlert8, { tone: notice.ok ? "success" : "warning", children: notice.text }),
|
|
2237
2356
|
/* @__PURE__ */ jsx11(Panel8, { flush: true, children: /* @__PURE__ */ jsx11(
|
|
2238
2357
|
DataTable7,
|
|
@@ -2247,18 +2366,47 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
2247
2366
|
empty: t("empty")
|
|
2248
2367
|
}
|
|
2249
2368
|
) })
|
|
2250
|
-
] })
|
|
2369
|
+
] }),
|
|
2370
|
+
/* @__PURE__ */ jsx11(
|
|
2371
|
+
FormDialog2,
|
|
2372
|
+
{
|
|
2373
|
+
open: editing !== null,
|
|
2374
|
+
onOpenChange: (o) => {
|
|
2375
|
+
if (!o) setEditing(null);
|
|
2376
|
+
},
|
|
2377
|
+
title: shown.mode === "edit" ? t("editTitle") : t("newTitle"),
|
|
2378
|
+
submitLabel: shown.mode === "edit" ? tf("save") : tf("create"),
|
|
2379
|
+
onSubmit: save,
|
|
2380
|
+
busy: dialog.busy,
|
|
2381
|
+
error: dialog.error ?? (types.error ? errorText4(types.error) : null),
|
|
2382
|
+
dangerAction: shown.mode === "edit" ? { label: t("deleteDirectory"), disabled: dialog.busy, onClick: () => shown.mode === "edit" && void remove(shown.dir, "dialog") } : void 0,
|
|
2383
|
+
preview: /* @__PURE__ */ jsx11(
|
|
2384
|
+
PreviewCard2,
|
|
2385
|
+
{
|
|
2386
|
+
media: /* @__PURE__ */ jsx11(IconTile2, { size: "md", children: /* @__PURE__ */ jsx11(FolderTree, {}) }),
|
|
2387
|
+
title: input.name || /* @__PURE__ */ jsx11(Text11, { as: "span", color: "fg.muted", children: t("namePreview") }),
|
|
2388
|
+
subtitle: type ? typeName(type.type, type.displayName) : void 0,
|
|
2389
|
+
items: [
|
|
2390
|
+
...type && !synced ? [] : [{ label: t("sync"), value: minutes ? t("syncEvery", { count: minutes }) : t("onRequest") }],
|
|
2391
|
+
{ label: tc("status"), value: input.isActive ? tc("active") : tc("inactive") },
|
|
2392
|
+
{ label: t("signIn"), value: input.authenticationEnabled ? t("on") : t("off") }
|
|
2393
|
+
]
|
|
2394
|
+
}
|
|
2395
|
+
),
|
|
2396
|
+
children: /* @__PURE__ */ jsx11(Loading2, { when: !types.data && !types.error, children: /* @__PURE__ */ jsx11(DirectoryFields, { compact: true, mode: shown.mode, types: allTypes, input, onChange: setInput }) })
|
|
2397
|
+
}
|
|
2398
|
+
)
|
|
2251
2399
|
] });
|
|
2252
2400
|
}
|
|
2253
2401
|
|
|
2254
2402
|
// src/areas/guard/DirectoryScreen.tsx
|
|
2255
|
-
import { useMemo as
|
|
2256
|
-
import { Box, Grid, HStack as
|
|
2403
|
+
import { useMemo as useMemo3, useState as useState7 } from "react";
|
|
2404
|
+
import { Box, Grid, HStack as HStack10, Input as Input4, List, Stack as Stack10, Text as Text12 } from "@chakra-ui/react";
|
|
2257
2405
|
import {
|
|
2258
|
-
AppLink as
|
|
2406
|
+
AppLink as AppLink5,
|
|
2259
2407
|
Button as Button10,
|
|
2260
2408
|
DataTable as DataTable8,
|
|
2261
|
-
errorText as
|
|
2409
|
+
errorText as errorText5,
|
|
2262
2410
|
Field as Field4,
|
|
2263
2411
|
HostSlot as HostSlot3,
|
|
2264
2412
|
InlineAlert as InlineAlert9,
|
|
@@ -2271,9 +2419,9 @@ import {
|
|
|
2271
2419
|
useApiAction as useApiAction8,
|
|
2272
2420
|
useApiQuery as useApiQuery7,
|
|
2273
2421
|
useAreaRequest as useAreaRequest9,
|
|
2274
|
-
useConfirm as
|
|
2422
|
+
useConfirm as useConfirm4,
|
|
2275
2423
|
useFormatters as useFormatters7,
|
|
2276
|
-
useNavigate as
|
|
2424
|
+
useNavigate as useNavigate3
|
|
2277
2425
|
} from "@abpjs/ui";
|
|
2278
2426
|
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2279
2427
|
var STEPS = ["Connection", "FindUser", "Authenticate", "Precedence"];
|
|
@@ -2283,8 +2431,8 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2283
2431
|
const tc = useGuardNs("common");
|
|
2284
2432
|
const tn = useGuardNs("nav");
|
|
2285
2433
|
const fmt = useFormatters7();
|
|
2286
|
-
const confirm =
|
|
2287
|
-
const navigate =
|
|
2434
|
+
const confirm = useConfirm4();
|
|
2435
|
+
const navigate = useNavigate3();
|
|
2288
2436
|
const request = useAreaRequest9("guard");
|
|
2289
2437
|
const dirs = useApiQuery7("guard", "/directories");
|
|
2290
2438
|
const types = useApiQuery7("guard", "/directory-types");
|
|
@@ -2296,27 +2444,14 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2296
2444
|
const [syncMsg, setSyncMsg] = useState7(null);
|
|
2297
2445
|
const dir = dirs.data?.find((d) => d.id === id);
|
|
2298
2446
|
const type = types.data?.find((x) => x.type === dir?.type);
|
|
2299
|
-
const secretNames =
|
|
2300
|
-
const initial =
|
|
2301
|
-
|
|
2302
|
-
const settings = {};
|
|
2303
|
-
for (const [k, v] of Object.entries(dir.settings)) settings[k] = secretNames.has(k) || v === "********" ? "" : v;
|
|
2304
|
-
return {
|
|
2305
|
-
name: dir.name,
|
|
2306
|
-
names: dir.names,
|
|
2307
|
-
type: dir.type,
|
|
2308
|
-
isActive: dir.isActive,
|
|
2309
|
-
authenticationEnabled: dir.authenticationEnabled,
|
|
2310
|
-
syncIntervalMinutes: dir.syncIntervalMinutes,
|
|
2311
|
-
settings
|
|
2312
|
-
};
|
|
2313
|
-
}, [dir, secretNames]);
|
|
2314
|
-
const fallbackSettings = useMemo2(
|
|
2447
|
+
const secretNames = useMemo3(() => new Set((type?.settings ?? []).filter((s) => s.secret).map((s) => s.name)), [type]);
|
|
2448
|
+
const initial = useMemo3(() => dir ? editInput(dir, secretNames) : null, [dir, secretNames]);
|
|
2449
|
+
const fallbackSettings = useMemo3(
|
|
2315
2450
|
() => Object.keys(dir?.settings ?? {}).map((name) => ({
|
|
2316
2451
|
name,
|
|
2317
2452
|
label: name,
|
|
2318
2453
|
required: false,
|
|
2319
|
-
secret: dir?.settings[name] ===
|
|
2454
|
+
secret: dir?.settings[name] === MASKED_SECRET,
|
|
2320
2455
|
defaultValue: null,
|
|
2321
2456
|
help: null
|
|
2322
2457
|
})),
|
|
@@ -2359,7 +2494,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2359
2494
|
if (!loading && (!dir || !initial))
|
|
2360
2495
|
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2361
2496
|
/* @__PURE__ */ jsx12(PageHeader5, { breadcrumbs: [{ label: tn("directories"), href: routes.directories }], title: t("notFound") }),
|
|
2362
|
-
/* @__PURE__ */ jsx12(
|
|
2497
|
+
/* @__PURE__ */ jsx12(AppLink5, { href: routes.directories, children: t("back") })
|
|
2363
2498
|
] });
|
|
2364
2499
|
const runColumns = [
|
|
2365
2500
|
{ id: "started", header: t("started"), nowrap: true, cell: (r) => fmt.dateTime(r.startedAt), skeleton: "date", skeletonWidth: 17 },
|
|
@@ -2373,7 +2508,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2373
2508
|
{
|
|
2374
2509
|
id: "error",
|
|
2375
2510
|
header: t("error"),
|
|
2376
|
-
cell: (r) => r.error && /* @__PURE__ */ jsx12(
|
|
2511
|
+
cell: (r) => r.error && /* @__PURE__ */ jsx12(Text12, { as: "span", textStyle: "caption", color: "fg.danger", wordBreak: "break-word", maxW: "xs", display: "block", children: r.error })
|
|
2377
2512
|
}
|
|
2378
2513
|
];
|
|
2379
2514
|
return /* @__PURE__ */ jsxs12(Loading3, { when: loading, children: [
|
|
@@ -2383,8 +2518,8 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2383
2518
|
breadcrumbs: [{ label: tn("directories"), href: routes.directories }, { label: dir?.name }],
|
|
2384
2519
|
title: dir?.name,
|
|
2385
2520
|
meta: /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2386
|
-
/* @__PURE__ */ jsx12(
|
|
2387
|
-
/* @__PURE__ */ jsx12(
|
|
2521
|
+
/* @__PURE__ */ jsx12(Text12, { as: "span", children: /* @__PURE__ */ jsx12(TextSlot2, { width: 8, children: dir && (dir.typeDisplayName || dir.type) }) }),
|
|
2522
|
+
/* @__PURE__ */ jsx12(Text12, { as: "span", children: /* @__PURE__ */ jsx12(TextSlot2, { width: 8, children: dir && t("order", { order: dir.order }) }) }),
|
|
2388
2523
|
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.isActive, yes: tc("active"), no: tc("inactive") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2389
2524
|
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.authenticationEnabled, yes: t("signInEnabled"), no: t("signInDisabled") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2390
2525
|
dir && !dir.connectorAvailable && /* @__PURE__ */ jsx12(StatusPill8, { tone: "warning", children: t("connectorDisabled") })
|
|
@@ -2476,7 +2611,7 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2476
2611
|
try {
|
|
2477
2612
|
setResult(await request(`/directories/${directoryId}/test-login`, { method: "POST", body: { username, password } }));
|
|
2478
2613
|
} catch (err) {
|
|
2479
|
-
setError(
|
|
2614
|
+
setError(errorText5(err));
|
|
2480
2615
|
} finally {
|
|
2481
2616
|
setBusy(false);
|
|
2482
2617
|
}
|
|
@@ -2494,23 +2629,23 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2494
2629
|
] }) }),
|
|
2495
2630
|
/* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", size: "sm", children: error }),
|
|
2496
2631
|
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: [
|
|
2497
|
-
/* @__PURE__ */ jsxs12(
|
|
2498
|
-
/* @__PURE__ */ jsx12(
|
|
2632
|
+
/* @__PURE__ */ jsxs12(HStack10, { justify: "space-between", gap: "2", children: [
|
|
2633
|
+
/* @__PURE__ */ jsx12(Text12, { textStyle: "label", children: label }),
|
|
2499
2634
|
/* @__PURE__ */ jsx12(PassFail, { ok: r ? r.succeeded : null })
|
|
2500
2635
|
] }),
|
|
2501
|
-
r?.message && /* @__PURE__ */ jsx12(
|
|
2636
|
+
r?.message && /* @__PURE__ */ jsx12(Text12, { textStyle: "caption", color: "fg.muted", mt: "1", children: r.message })
|
|
2502
2637
|
] }) }, step)) })
|
|
2503
2638
|
] }) });
|
|
2504
2639
|
}
|
|
2505
2640
|
|
|
2506
2641
|
// src/areas/guard/GroupScreen.tsx
|
|
2507
2642
|
import { useEffect, useState as useState10 } from "react";
|
|
2508
|
-
import { Grid as Grid2, HStack as
|
|
2643
|
+
import { Grid as Grid2, HStack as HStack13, Input as Input5, List as List3, Stack as Stack12, Text as Text15, Textarea } from "@chakra-ui/react";
|
|
2509
2644
|
import {
|
|
2510
|
-
AppLink as
|
|
2645
|
+
AppLink as AppLink7,
|
|
2511
2646
|
Button as Button11,
|
|
2512
2647
|
DataTable as DataTable9,
|
|
2513
|
-
errorText as
|
|
2648
|
+
errorText as errorText8,
|
|
2514
2649
|
Field as Field5,
|
|
2515
2650
|
InlineAlert as InlineAlert11,
|
|
2516
2651
|
Loading as Loading4,
|
|
@@ -2527,21 +2662,21 @@ import {
|
|
|
2527
2662
|
useApiAction as useApiAction9,
|
|
2528
2663
|
useApiQuery as useApiQuery8,
|
|
2529
2664
|
useAreaRequest as useAreaRequest12,
|
|
2530
|
-
useConfirm as
|
|
2531
|
-
useNavigate as
|
|
2665
|
+
useConfirm as useConfirm5,
|
|
2666
|
+
useNavigate as useNavigate4,
|
|
2532
2667
|
useSettledValue
|
|
2533
2668
|
} from "@abpjs/ui";
|
|
2534
2669
|
import { fromNamesValue as fromNamesValue2, splitList, toNamesValue as toNamesValue2 } from "@abpjs/ui/rules";
|
|
2535
2670
|
|
|
2536
2671
|
// src/areas/guard/GroupTree.tsx
|
|
2537
2672
|
import { useState as useState8 } from "react";
|
|
2538
|
-
import { Box as Box2, HStack as
|
|
2673
|
+
import { Box as Box2, HStack as HStack11, List as List2, Text as Text13 } from "@chakra-ui/react";
|
|
2539
2674
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
2540
|
-
import { AppLink as
|
|
2675
|
+
import { AppLink as AppLink6, DirectionalIcon, errorText as errorText6, IconButton, StatusPill as StatusPill9, useAreaRequest as useAreaRequest10 } from "@abpjs/ui";
|
|
2541
2676
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2542
2677
|
function GroupTree({ rootId, rootName, rootMembers, routes = guardRoutes() }) {
|
|
2543
2678
|
return /* @__PURE__ */ jsxs13(Box2, { textStyle: "md", role: "tree", "aria-label": rootName, children: [
|
|
2544
|
-
/* @__PURE__ */ jsx13(
|
|
2679
|
+
/* @__PURE__ */ jsx13(Text13, { fontWeight: "medium", children: rootName }),
|
|
2545
2680
|
/* @__PURE__ */ jsx13(Children, { members: rootMembers, ancestors: [rootId], routes })
|
|
2546
2681
|
] });
|
|
2547
2682
|
}
|
|
@@ -2569,14 +2704,14 @@ function Node({ member, ancestors, routes }) {
|
|
|
2569
2704
|
setError(null);
|
|
2570
2705
|
setDetail(await request(`/groups/${member.memberId}`));
|
|
2571
2706
|
} catch (e) {
|
|
2572
|
-
setError(
|
|
2707
|
+
setError(errorText6(e));
|
|
2573
2708
|
}
|
|
2574
2709
|
}
|
|
2575
2710
|
}
|
|
2576
2711
|
return /* @__PURE__ */ jsxs13(List2.Item, { role: "treeitem", "aria-expanded": cyclic ? void 0 : open, display: "block", children: [
|
|
2577
|
-
/* @__PURE__ */ jsxs13(
|
|
2712
|
+
/* @__PURE__ */ jsxs13(HStack11, { gap: "1", children: [
|
|
2578
2713
|
cyclic ? /* @__PURE__ */ jsx13(Box2, { boxSize: "control.xs", flexShrink: "0" }) : /* @__PURE__ */ jsx13(
|
|
2579
|
-
|
|
2714
|
+
IconButton,
|
|
2580
2715
|
{
|
|
2581
2716
|
size: "xs",
|
|
2582
2717
|
"aria-label": open ? t("collapse", { name: member.name }) : t("expand", { name: member.name }),
|
|
@@ -2584,12 +2719,12 @@ function Node({ member, ancestors, routes }) {
|
|
|
2584
2719
|
children: open ? /* @__PURE__ */ jsx13(ChevronDown, {}) : /* @__PURE__ */ jsx13(DirectionalIcon, { children: /* @__PURE__ */ jsx13(ChevronRight, {}) })
|
|
2585
2720
|
}
|
|
2586
2721
|
),
|
|
2587
|
-
/* @__PURE__ */ jsx13(
|
|
2722
|
+
/* @__PURE__ */ jsx13(AppLink6, { href: routes.group(member.memberId), children: member.name }),
|
|
2588
2723
|
cyclic && /* @__PURE__ */ jsx13(StatusPill9, { tone: "warning", children: t("cycle") })
|
|
2589
2724
|
] }),
|
|
2590
2725
|
open && !cyclic && /* @__PURE__ */ jsxs13(Box2, { children: [
|
|
2591
|
-
error && /* @__PURE__ */ jsx13(
|
|
2592
|
-
!detail && !error && /* @__PURE__ */ jsx13(
|
|
2726
|
+
error && /* @__PURE__ */ jsx13(Text13, { textStyle: "caption", color: "fg.danger", ms: "7", children: error }),
|
|
2727
|
+
!detail && !error && /* @__PURE__ */ jsx13(Text13, { textStyle: "caption", color: "fg.muted", ms: "7", children: t("loadingTree") }),
|
|
2593
2728
|
detail && /* @__PURE__ */ jsx13(Children, { members: detail.members, ancestors: [...ancestors, member.memberId], routes })
|
|
2594
2729
|
] })
|
|
2595
2730
|
] });
|
|
@@ -2597,8 +2732,8 @@ function Node({ member, ancestors, routes }) {
|
|
|
2597
2732
|
|
|
2598
2733
|
// src/areas/guard/GroupTwoFactorPanel.tsx
|
|
2599
2734
|
import { useState as useState9 } from "react";
|
|
2600
|
-
import { Box as Box3, chakra, HStack as
|
|
2601
|
-
import { errorText as
|
|
2735
|
+
import { Box as Box3, chakra as chakra2, HStack as HStack12, Stack as Stack11, Text as Text14 } from "@chakra-ui/react";
|
|
2736
|
+
import { errorText as errorText7, Indicator, InlineAlert as InlineAlert10, notify as notify6, Panel as Panel10, useAreaRequest as useAreaRequest11 } from "@abpjs/ui";
|
|
2602
2737
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2603
2738
|
var TWO_FACTOR_MODES = ["off", "optional", "required", "strong"];
|
|
2604
2739
|
function GroupTwoFactorPanel({ group, onSaved }) {
|
|
@@ -2617,13 +2752,13 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2617
2752
|
onSaved(updated);
|
|
2618
2753
|
} catch (e) {
|
|
2619
2754
|
setMode(before);
|
|
2620
|
-
setError(
|
|
2755
|
+
setError(errorText7(e));
|
|
2621
2756
|
}
|
|
2622
2757
|
}
|
|
2623
2758
|
return /* @__PURE__ */ jsx14(Panel10, { title: t("title"), description: t("hint"), "data-testid": "group-two-factor", children: /* @__PURE__ */ jsxs14(Stack11, { gap: "2", children: [
|
|
2624
2759
|
/* @__PURE__ */ jsx14(InlineAlert10, { tone: "danger", children: error }),
|
|
2625
|
-
/* @__PURE__ */ jsx14(
|
|
2626
|
-
|
|
2760
|
+
/* @__PURE__ */ jsx14(HStack12, { 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(
|
|
2761
|
+
chakra2.button,
|
|
2627
2762
|
{
|
|
2628
2763
|
type: "button",
|
|
2629
2764
|
role: "radio",
|
|
@@ -2646,7 +2781,7 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2646
2781
|
},
|
|
2647
2782
|
choice
|
|
2648
2783
|
)) }),
|
|
2649
|
-
/* @__PURE__ */ jsx14(
|
|
2784
|
+
/* @__PURE__ */ jsx14(Text14, { textStyle: "body.sm", color: "fg.muted", "aria-live": "polite", children: t(`modeHints.${mode}`) })
|
|
2650
2785
|
] }) });
|
|
2651
2786
|
}
|
|
2652
2787
|
|
|
@@ -2662,8 +2797,8 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2662
2797
|
const tn = useGuardNs("nav");
|
|
2663
2798
|
const tf = useGuardNs("groupDetail.twoFactor");
|
|
2664
2799
|
const written = useWrittenName();
|
|
2665
|
-
const confirm =
|
|
2666
|
-
const navigate =
|
|
2800
|
+
const confirm = useConfirm5();
|
|
2801
|
+
const navigate = useNavigate4();
|
|
2667
2802
|
const request = useAreaRequest12("guard");
|
|
2668
2803
|
const detail = useApiQuery8("guard", `/groups/${id}`);
|
|
2669
2804
|
const action = useApiAction9();
|
|
@@ -2707,9 +2842,9 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2707
2842
|
id: "name",
|
|
2708
2843
|
header: tc("name"),
|
|
2709
2844
|
sortValue: (m) => m.name,
|
|
2710
|
-
cell: (m) => /* @__PURE__ */ jsxs15(
|
|
2711
|
-
m.memberType === "Group" ? /* @__PURE__ */ jsx15(
|
|
2712
|
-
m.displayName && m.displayName !== m.name && /* @__PURE__ */ jsx15(
|
|
2845
|
+
cell: (m) => /* @__PURE__ */ jsxs15(HStack13, { gap: "2", wrap: "wrap", children: [
|
|
2846
|
+
m.memberType === "Group" ? /* @__PURE__ */ jsx15(AppLink7, { href: routes.group(m.memberId), fontWeight: "medium", children: m.name }) : /* @__PURE__ */ jsx15(RecordKey5, { value: m.name, href: routes.account(m.memberId) }),
|
|
2847
|
+
m.displayName && m.displayName !== m.name && /* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: m.displayName })
|
|
2713
2848
|
] }),
|
|
2714
2849
|
skeleton: "key"
|
|
2715
2850
|
},
|
|
@@ -2723,7 +2858,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2723
2858
|
},
|
|
2724
2859
|
{
|
|
2725
2860
|
id: "actions",
|
|
2726
|
-
header: /* @__PURE__ */ jsx15(
|
|
2861
|
+
header: /* @__PURE__ */ jsx15(Text15, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2727
2862
|
align: "end",
|
|
2728
2863
|
cell: (m) => m.removable && /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, onClick: () => removeMember(m), disabled: action.busy, children: t("remove") }),
|
|
2729
2864
|
skeleton: () => /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, children: t("remove") })
|
|
@@ -2748,7 +2883,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2748
2883
|
title: group && written(group.name, group.names),
|
|
2749
2884
|
description: group?.description ?? void 0,
|
|
2750
2885
|
meta: /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2751
|
-
/* @__PURE__ */ jsx15(
|
|
2886
|
+
/* @__PURE__ */ jsx15(Text15, { as: "span", children: /* @__PURE__ */ jsx15(TextSlot3, { width: 10, children: group?.directoryName }) }),
|
|
2752
2887
|
/* @__PURE__ */ jsx15(StatusPill10, { dot: false, children: group && tg(`kinds.${group.kind}`) }),
|
|
2753
2888
|
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.isLocal ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "accent", children: tg("local") }) : /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tg("synced") }),
|
|
2754
2889
|
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.writable ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "success", children: t("writable") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tg("readOnly") }),
|
|
@@ -2773,9 +2908,9 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2773
2908
|
}
|
|
2774
2909
|
) }),
|
|
2775
2910
|
/* @__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(
|
|
2777
|
-
/* @__PURE__ */ jsx15(
|
|
2778
|
-
/* @__PURE__ */ jsx15(
|
|
2911
|
+
/* @__PURE__ */ jsx15(Panel11, { title: /* @__PURE__ */ jsx15(TextSlot3, { width: 14, children: t("memberOf", { count: parents?.length ?? 0 }) }), children: !parents ? /* @__PURE__ */ jsx15(Text15, { textStyle: "body", children: /* @__PURE__ */ jsx15(TextBone, { width: t("notNested").length }) }) : parents.length === 0 ? /* @__PURE__ */ jsx15(Text15, { 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(HStack13, { justify: "space-between", gap: "2", w: "full", children: [
|
|
2912
|
+
/* @__PURE__ */ jsx15(AppLink7, { href: routes.group(p.id), children: written(p.name, p.names) }),
|
|
2913
|
+
/* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: p.directoryName })
|
|
2779
2914
|
] }) }, p.id)) }) }),
|
|
2780
2915
|
group && detail.data && /* @__PURE__ */ jsx15(GroupTwoFactorPanel, { group, onSaved: (updated) => detail.data && detail.setData({ ...detail.data, group: updated }) }, group.id),
|
|
2781
2916
|
group && members && hasGroupMembers && /* @__PURE__ */ jsx15(Panel11, { title: t("nestedGroups"), children: /* @__PURE__ */ jsx15(GroupTree, { rootId: group.id, rootName: group.name, rootMembers: members, routes }, treeKey) })
|
|
@@ -2828,7 +2963,7 @@ function OrganizationPanel({ group, onSaved }) {
|
|
|
2828
2963
|
/* @__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
2964
|
/* @__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" }) }),
|
|
2830
2965
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error }),
|
|
2831
|
-
/* @__PURE__ */ jsx15(
|
|
2966
|
+
/* @__PURE__ */ jsx15(HStack13, { children: /* @__PURE__ */ jsx15(Button11, { onClick: () => void save(), loading: action.busy, children: t("saveOrganization") }) })
|
|
2832
2967
|
] }) });
|
|
2833
2968
|
}
|
|
2834
2969
|
function AddMember({ groupId, existing, onAdded }) {
|
|
@@ -2855,7 +2990,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2855
2990
|
setAccounts(a.slice(0, 10));
|
|
2856
2991
|
setGroups(g.filter((x) => x.id !== groupId).slice(0, 10));
|
|
2857
2992
|
setSearchError(null);
|
|
2858
|
-
}).catch((e) => !cancelled && setSearchError(
|
|
2993
|
+
}).catch((e) => !cancelled && setSearchError(errorText8(e)));
|
|
2859
2994
|
return () => {
|
|
2860
2995
|
cancelled = true;
|
|
2861
2996
|
};
|
|
@@ -2868,7 +3003,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2868
3003
|
await request(`/groups/${groupId}/members`, { method: "POST", body });
|
|
2869
3004
|
await onAdded();
|
|
2870
3005
|
} catch (e) {
|
|
2871
|
-
setError(
|
|
3006
|
+
setError(errorText8(e));
|
|
2872
3007
|
} finally {
|
|
2873
3008
|
setBusyId(null);
|
|
2874
3009
|
}
|
|
@@ -2888,20 +3023,20 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2888
3023
|
{
|
|
2889
3024
|
id: "name",
|
|
2890
3025
|
header: tc("name"),
|
|
2891
|
-
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(
|
|
3026
|
+
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(Text15, { as: "span", fontWeight: "medium", children: c.group.name }) : /* @__PURE__ */ jsxs15(HStack13, { gap: "2", children: [
|
|
2892
3027
|
/* @__PURE__ */ jsx15(RecordKey5, { value: c.account.username }),
|
|
2893
|
-
/* @__PURE__ */ jsx15(
|
|
3028
|
+
/* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: c.account.displayName })
|
|
2894
3029
|
] })
|
|
2895
3030
|
},
|
|
2896
3031
|
{ id: "directory", header: tc("directory"), cell: (c) => c.kind === "Group" ? c.group.directoryName : c.account.directoryName },
|
|
2897
3032
|
{
|
|
2898
3033
|
id: "add",
|
|
2899
|
-
header: /* @__PURE__ */ jsx15(
|
|
3034
|
+
header: /* @__PURE__ */ jsx15(Text15, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2900
3035
|
align: "end",
|
|
2901
3036
|
cell: (c) => {
|
|
2902
3037
|
const member = c.kind === "Group" ? isMember("Group", c.group.id) : isMember("Account", c.account.id);
|
|
2903
3038
|
if (member)
|
|
2904
|
-
return /* @__PURE__ */ jsx15(
|
|
3039
|
+
return /* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: t("alreadyMember") });
|
|
2905
3040
|
const key = keyOf(c);
|
|
2906
3041
|
return /* @__PURE__ */ jsx15(
|
|
2907
3042
|
Button11,
|
|
@@ -2920,7 +3055,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2920
3055
|
/* @__PURE__ */ jsx15(SearchInput2, { maxW: "md", placeholder: t("searchMembers"), value: query, onChange: (e) => setQuery(e.target.value), "aria-label": t("searchMembers") }),
|
|
2921
3056
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: error }),
|
|
2922
3057
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: searchError }),
|
|
2923
|
-
settled && candidates.length === 0 && !searchError && /* @__PURE__ */ jsx15(
|
|
3058
|
+
settled && candidates.length === 0 && !searchError && /* @__PURE__ */ jsx15(Text15, { textStyle: "body", color: "fg.muted", children: t("noMatches") }),
|
|
2924
3059
|
candidates.length > 0 && /* @__PURE__ */ jsx15(Panel11, { flush: true, children: /* @__PURE__ */ jsx15(DataTable9, { size: "sm", "aria-label": t("addMember"), columns, rows: candidates, getRowId: keyOf }) })
|
|
2925
3060
|
] }) });
|
|
2926
3061
|
}
|
|
@@ -2944,7 +3079,7 @@ function GroupNames({ group, onSaved }) {
|
|
|
2944
3079
|
if (ok) await onSaved();
|
|
2945
3080
|
}
|
|
2946
3081
|
return /* @__PURE__ */ jsx15(Panel11, { title: t("names"), description: t("namesHint"), children: /* @__PURE__ */ jsxs15("form", { onSubmit: save, children: [
|
|
2947
|
-
/* @__PURE__ */ jsxs15(
|
|
3082
|
+
/* @__PURE__ */ jsxs15(HStack13, { gap: "2", align: "start", wrap: "wrap", children: [
|
|
2948
3083
|
/* @__PURE__ */ jsx15(TranslatedInput3, { value, onChange: setValue, "aria-label": tc("name"), suggest: false }),
|
|
2949
3084
|
/* @__PURE__ */ jsx15(Button11, { type: "submit", loading: action.busy, disabled: !name || unchanged, children: t("saveNames") })
|
|
2950
3085
|
] }),
|
|
@@ -2954,13 +3089,13 @@ function GroupNames({ group, onSaved }) {
|
|
|
2954
3089
|
|
|
2955
3090
|
// src/areas/guard/GroupsScreen.tsx
|
|
2956
3091
|
import { useState as useState11 } from "react";
|
|
2957
|
-
import { HStack as
|
|
3092
|
+
import { HStack as HStack14, Input as Input6, SimpleGrid as SimpleGrid3, Stack as Stack13, Text as Text16 } from "@chakra-ui/react";
|
|
2958
3093
|
import {
|
|
2959
|
-
AppLink as
|
|
3094
|
+
AppLink as AppLink8,
|
|
2960
3095
|
Button as Button12,
|
|
2961
3096
|
DataTable as DataTable10,
|
|
2962
3097
|
EMPTY_VALUE as EMPTY_VALUE4,
|
|
2963
|
-
errorText as
|
|
3098
|
+
errorText as errorText9,
|
|
2964
3099
|
Field as Field6,
|
|
2965
3100
|
InlineAlert as InlineAlert12,
|
|
2966
3101
|
ListFooter as ListFooter2,
|
|
@@ -2995,13 +3130,13 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2995
3130
|
id: "name",
|
|
2996
3131
|
header: tc("name"),
|
|
2997
3132
|
sortValue: (g) => g.name,
|
|
2998
|
-
cell: (g) => /* @__PURE__ */ jsx16(
|
|
3133
|
+
cell: (g) => /* @__PURE__ */ jsx16(AppLink8, { href: routes.group(g.id), fontWeight: "medium", children: written(g.name, g.names) })
|
|
2999
3134
|
},
|
|
3000
3135
|
{ id: "kind", header: t("kind"), sortValue: (g) => g.kind, cell: (g) => /* @__PURE__ */ jsx16(StatusPill11, { dot: false, children: t(`kinds.${g.kind}`) }), skeleton: "pill" },
|
|
3001
3136
|
{
|
|
3002
3137
|
id: "description",
|
|
3003
3138
|
header: tc("description"),
|
|
3004
|
-
cell: (g) => g.description ? /* @__PURE__ */ jsx16(
|
|
3139
|
+
cell: (g) => g.description ? /* @__PURE__ */ jsx16(Text16, { as: "span", color: "fg.muted", children: g.description }) : EMPTY_VALUE4
|
|
3005
3140
|
},
|
|
3006
3141
|
{ id: "directory", header: tc("directory"), sortValue: (g) => g.directoryName, cell: (g) => g.directoryName },
|
|
3007
3142
|
{
|
|
@@ -3036,7 +3171,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
3036
3171
|
}
|
|
3037
3172
|
),
|
|
3038
3173
|
/* @__PURE__ */ jsxs16(Stack13, { gap: "field", children: [
|
|
3039
|
-
/* @__PURE__ */ jsxs16(
|
|
3174
|
+
/* @__PURE__ */ jsxs16(HStack14, { gap: "2", wrap: "wrap", children: [
|
|
3040
3175
|
/* @__PURE__ */ jsx16(
|
|
3041
3176
|
SearchInput3,
|
|
3042
3177
|
{
|
|
@@ -3107,7 +3242,7 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
3107
3242
|
});
|
|
3108
3243
|
onDone(created);
|
|
3109
3244
|
} catch (err) {
|
|
3110
|
-
setError(
|
|
3245
|
+
setError(errorText9(err));
|
|
3111
3246
|
} finally {
|
|
3112
3247
|
setBusy(false);
|
|
3113
3248
|
}
|
|
@@ -3138,7 +3273,7 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
3138
3273
|
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" }) })
|
|
3139
3274
|
] }),
|
|
3140
3275
|
/* @__PURE__ */ jsx16(InlineAlert12, { tone: "danger", children: error }),
|
|
3141
|
-
/* @__PURE__ */ jsxs16(
|
|
3276
|
+
/* @__PURE__ */ jsxs16(HStack14, { gap: "2", children: [
|
|
3142
3277
|
/* @__PURE__ */ jsx16(Button12, { type: "submit", variant: "primary", loading: busy, children: t("create") }),
|
|
3143
3278
|
/* @__PURE__ */ jsx16(Button12, { onClick: onCancel, children: tc("cancel") })
|
|
3144
3279
|
] })
|
|
@@ -3147,7 +3282,7 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
3147
3282
|
|
|
3148
3283
|
// src/areas/guard/MergeScreen.tsx
|
|
3149
3284
|
import { useEffect as useEffect2, useRef, useState as useState12 } from "react";
|
|
3150
|
-
import { HStack as
|
|
3285
|
+
import { HStack as HStack15, Input as Input7, SimpleGrid as SimpleGrid4, Stack as Stack14, Text as Text17 } from "@chakra-ui/react";
|
|
3151
3286
|
import {
|
|
3152
3287
|
boneWidth,
|
|
3153
3288
|
Button as Button13,
|
|
@@ -3168,14 +3303,14 @@ import {
|
|
|
3168
3303
|
useApiQuery as useApiQuery10,
|
|
3169
3304
|
useAreaRequest as useAreaRequest14,
|
|
3170
3305
|
useFormatters as useFormatters8,
|
|
3171
|
-
useNavigate as
|
|
3306
|
+
useNavigate as useNavigate5
|
|
3172
3307
|
} from "@abpjs/ui";
|
|
3173
3308
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3174
3309
|
function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
3175
3310
|
const t = useGuardNs("merge");
|
|
3176
3311
|
const tn = useGuardNs("nav");
|
|
3177
3312
|
const tc = useGuardNs("common");
|
|
3178
|
-
const navigate =
|
|
3313
|
+
const navigate = useNavigate5();
|
|
3179
3314
|
const request = useAreaRequest14("guard");
|
|
3180
3315
|
const source = useApiQuery10("guard", `/accounts/${id}`);
|
|
3181
3316
|
const [survivor, setSurvivor] = useState12(null);
|
|
@@ -3251,9 +3386,9 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3251
3386
|
getId: (a) => a.id,
|
|
3252
3387
|
label: (a) => `${a.displayName} (@${a.username})`,
|
|
3253
3388
|
renderOption: (a) => /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3254
|
-
/* @__PURE__ */ jsx17(
|
|
3389
|
+
/* @__PURE__ */ jsx17(Text17, { as: "span", textStyle: "body.sm", fontWeight: "medium", children: a.displayName }),
|
|
3255
3390
|
" ",
|
|
3256
|
-
/* @__PURE__ */ jsxs17(
|
|
3391
|
+
/* @__PURE__ */ jsxs17(Text17, { as: "span", textStyle: "caption", color: "fg.muted", dir: "ltr", children: [
|
|
3257
3392
|
"@",
|
|
3258
3393
|
a.username,
|
|
3259
3394
|
" \xB7 ",
|
|
@@ -3277,9 +3412,9 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3277
3412
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: preview.sameDirectory ? t("activeWarning", { username: account?.username ?? "" }) : t("activeOtherDirectory", { username: account?.username ?? "" }) }),
|
|
3278
3413
|
/* @__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" }) })
|
|
3279
3414
|
] }),
|
|
3280
|
-
/* @__PURE__ */ jsx17(
|
|
3415
|
+
/* @__PURE__ */ jsx17(Text17, { textStyle: "body.sm", color: "fg.muted", children: t("noUndo") }),
|
|
3281
3416
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "danger", children: merging.error }),
|
|
3282
|
-
/* @__PURE__ */ jsxs17(
|
|
3417
|
+
/* @__PURE__ */ jsxs17(HStack15, { gap: "2", children: [
|
|
3283
3418
|
/* @__PURE__ */ jsx17(Button13, { variant: "primary", danger: true, onClick: merge, loading: merging.busy, disabled: !confirmed, children: t("mergeButton", {
|
|
3284
3419
|
source: preview?.source.username ?? account?.username ?? "",
|
|
3285
3420
|
survivor: preview?.survivor.username ?? survivor.username
|
|
@@ -3310,32 +3445,32 @@ function Side({ title, hint, account, routes }) {
|
|
|
3310
3445
|
}
|
|
3311
3446
|
function PartsComing() {
|
|
3312
3447
|
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
3313
|
-
/* @__PURE__ */ jsx17(
|
|
3314
|
-
/* @__PURE__ */ jsx17(
|
|
3448
|
+
/* @__PURE__ */ jsx17(Text17, { fontWeight: "medium", children: /* @__PURE__ */ jsx17(TextBone2, { width: boneWidth(i, 8, 14) }) }),
|
|
3449
|
+
/* @__PURE__ */ jsx17(Text17, { textStyle: "body.sm", children: /* @__PURE__ */ jsx17(TextBone2, { width: boneWidth(i + 3, 12, 22) }) })
|
|
3315
3450
|
] }, i)) });
|
|
3316
3451
|
}
|
|
3317
3452
|
function Parts({ preview }) {
|
|
3318
3453
|
const t = useGuardNs("merge");
|
|
3319
3454
|
const partLabel = usePartLabel();
|
|
3320
3455
|
const moving = preview.parts.filter((p) => p.counts.length > 0 || p.error);
|
|
3321
|
-
if (moving.length === 0) return /* @__PURE__ */ jsx17(
|
|
3456
|
+
if (moving.length === 0) return /* @__PURE__ */ jsx17(Text17, { color: "fg.muted", children: t("nothing") });
|
|
3322
3457
|
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: moving.map((p) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
3323
|
-
/* @__PURE__ */ jsx17(
|
|
3458
|
+
/* @__PURE__ */ jsx17(Text17, { fontWeight: "medium", children: partLabel(p.key, p.plugin) }),
|
|
3324
3459
|
p.error ? /* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: t("pluginError", { error: p.error }) }) : /* @__PURE__ */ jsx17(CountList, { counts: p.counts })
|
|
3325
3460
|
] }, p.key)) });
|
|
3326
3461
|
}
|
|
3327
3462
|
|
|
3328
3463
|
// src/areas/guard/MySecondFactorsPanel.tsx
|
|
3329
3464
|
import { useEffect as useEffect4, useState as useState14 } from "react";
|
|
3330
|
-
import { HStack as
|
|
3465
|
+
import { HStack as HStack17, Input as Input9, Stack as Stack16, Text as Text19 } from "@chakra-ui/react";
|
|
3331
3466
|
import {
|
|
3332
3467
|
AbpApiError,
|
|
3333
3468
|
Button as Button15,
|
|
3334
3469
|
createPasskey,
|
|
3335
3470
|
DataTable as DataTable11,
|
|
3336
|
-
errorText as
|
|
3471
|
+
errorText as errorText11,
|
|
3337
3472
|
Field as Field9,
|
|
3338
|
-
FormDialog as
|
|
3473
|
+
FormDialog as FormDialog3,
|
|
3339
3474
|
InlineAlert as InlineAlert15,
|
|
3340
3475
|
notify as notify11,
|
|
3341
3476
|
Panel as Panel14,
|
|
@@ -3343,14 +3478,14 @@ import {
|
|
|
3343
3478
|
StatusPill as StatusPill13,
|
|
3344
3479
|
useApiQuery as useApiQuery11,
|
|
3345
3480
|
useAreaRequest as useAreaRequest15,
|
|
3346
|
-
useConfirm as
|
|
3481
|
+
useConfirm as useConfirm6,
|
|
3347
3482
|
useFormatters as useFormatters9
|
|
3348
3483
|
} from "@abpjs/ui";
|
|
3349
3484
|
|
|
3350
3485
|
// src/areas/guard/SecondFactorParts.tsx
|
|
3351
3486
|
import { useEffect as useEffect3, useState as useState13 } from "react";
|
|
3352
|
-
import { Box as Box4, chakra as
|
|
3353
|
-
import { AppLink as
|
|
3487
|
+
import { Box as Box4, chakra as chakra3, Grid as Grid3, HStack as HStack16, Image, Input as Input8, Stack as Stack15, Text as Text18 } from "@chakra-ui/react";
|
|
3488
|
+
import { AppLink as AppLink9, Button as Button14, errorText as errorText10, Field as Field8, InlineAlert as InlineAlert14, looksLikeCode, notify as notify10 } from "@abpjs/ui";
|
|
3354
3489
|
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3355
3490
|
function groupedKey(secret) {
|
|
3356
3491
|
return secret.replace(/(.{4})/g, "$1 ").trim();
|
|
@@ -3398,7 +3533,7 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3398
3533
|
let live = true;
|
|
3399
3534
|
start().then(
|
|
3400
3535
|
(e) => live && setEnrolment(e),
|
|
3401
|
-
(e) => live && setError(
|
|
3536
|
+
(e) => live && setError(errorText10(e))
|
|
3402
3537
|
);
|
|
3403
3538
|
return () => {
|
|
3404
3539
|
live = false;
|
|
@@ -3417,17 +3552,17 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3417
3552
|
}
|
|
3418
3553
|
onDone(result);
|
|
3419
3554
|
} catch (e2) {
|
|
3420
|
-
setError(
|
|
3555
|
+
setError(errorText10(e2));
|
|
3421
3556
|
} finally {
|
|
3422
3557
|
setBusy(false);
|
|
3423
3558
|
}
|
|
3424
3559
|
}
|
|
3425
3560
|
return /* @__PURE__ */ jsx18("form", { onSubmit: (e) => void verify(e), "data-testid": "app-setup", children: /* @__PURE__ */ jsxs18(Stack15, { gap: "field", children: [
|
|
3426
|
-
/* @__PURE__ */ jsx18(
|
|
3561
|
+
/* @__PURE__ */ jsx18(Text18, { color: "fg.muted", children: t("scan") }),
|
|
3427
3562
|
/* @__PURE__ */ jsxs18(Grid3, { templateColumns: { base: "1fr", sm: "auto minmax(0, 1fr)" }, gap: "5", alignItems: "center", children: [
|
|
3428
3563
|
/* @__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" }) }),
|
|
3429
3564
|
/* @__PURE__ */ jsxs18(Stack15, { gap: "2", minW: "0", children: [
|
|
3430
|
-
/* @__PURE__ */ jsx18(
|
|
3565
|
+
/* @__PURE__ */ jsx18(Text18, { textStyle: "body.sm", color: "fg.muted", children: t("cantScan") }),
|
|
3431
3566
|
/* @__PURE__ */ jsx18(
|
|
3432
3567
|
Box4,
|
|
3433
3568
|
{
|
|
@@ -3444,12 +3579,12 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3444
3579
|
children: enrolment ? groupedKey(enrolment.secret) : " "
|
|
3445
3580
|
}
|
|
3446
3581
|
),
|
|
3447
|
-
enrolment && /* @__PURE__ */ jsx18(
|
|
3582
|
+
enrolment && /* @__PURE__ */ jsx18(AppLink9, { href: enrolment.address, textStyle: "body.sm", children: t("onThisDevice") })
|
|
3448
3583
|
] })
|
|
3449
3584
|
] }),
|
|
3450
3585
|
/* @__PURE__ */ jsx18(Field8, { label: t("code"), helperText: t("codeHint"), children: /* @__PURE__ */ jsx18(CodeInput, { value: code, onChange: setCode, autoFocus: false }) }),
|
|
3451
3586
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "danger", children: error }),
|
|
3452
|
-
/* @__PURE__ */ jsxs18(
|
|
3587
|
+
/* @__PURE__ */ jsxs18(HStack16, { children: [
|
|
3453
3588
|
/* @__PURE__ */ jsx18(Button14, { type: "submit", loading: busy, disabled: !enrolment || !looksLikeCode(code, false), children: t("verify") }),
|
|
3454
3589
|
onCancel && /* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: onCancel, disabled: busy, children: t("cancel") })
|
|
3455
3590
|
] })
|
|
@@ -3482,8 +3617,8 @@ ${codes.join("\n")}
|
|
|
3482
3617
|
}
|
|
3483
3618
|
return /* @__PURE__ */ jsxs18(Stack15, { gap: "field", "data-testid": "recovery-codes", children: [
|
|
3484
3619
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "warning", children: t("hint") }),
|
|
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(
|
|
3486
|
-
/* @__PURE__ */ jsxs18(
|
|
3620
|
+
/* @__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(chakra3.code, { fontFamily: "mono", fontSize: "sm", children: c }, c)) }),
|
|
3621
|
+
/* @__PURE__ */ jsxs18(HStack16, { wrap: "wrap", children: [
|
|
3487
3622
|
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: () => void copy(), children: t("copy") }),
|
|
3488
3623
|
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: download, children: t("download") }),
|
|
3489
3624
|
/* @__PURE__ */ jsx18(Button14, { onClick: onSaved, "data-testid": "recovery-codes-saved", children: savedLabel ?? t("saved") })
|
|
@@ -3496,7 +3631,7 @@ import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-r
|
|
|
3496
3631
|
function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
3497
3632
|
const t = useGuardNs("secondFactor");
|
|
3498
3633
|
const fmt = useFormatters9();
|
|
3499
|
-
const confirm =
|
|
3634
|
+
const confirm = useConfirm6();
|
|
3500
3635
|
const request = useAreaRequest15("guard");
|
|
3501
3636
|
const mine = useApiQuery11("guard", "/me/second-factors");
|
|
3502
3637
|
const nameOf = useSenderName();
|
|
@@ -3535,7 +3670,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3535
3670
|
await mine.reload();
|
|
3536
3671
|
onChange?.();
|
|
3537
3672
|
} catch (e) {
|
|
3538
|
-
setError(
|
|
3673
|
+
setError(errorText11(e));
|
|
3539
3674
|
}
|
|
3540
3675
|
}
|
|
3541
3676
|
async function renew() {
|
|
@@ -3545,7 +3680,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3545
3680
|
setCodes((await request("/me/second-factors/recovery-codes", { method: "POST" })).recoveryCodes);
|
|
3546
3681
|
await mine.reload();
|
|
3547
3682
|
} catch (e) {
|
|
3548
|
-
setError(
|
|
3683
|
+
setError(errorText11(e));
|
|
3549
3684
|
}
|
|
3550
3685
|
}
|
|
3551
3686
|
async function addPasskey() {
|
|
@@ -3568,7 +3703,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3568
3703
|
await mine.reload();
|
|
3569
3704
|
onChange?.();
|
|
3570
3705
|
} catch (e) {
|
|
3571
|
-
setError(
|
|
3706
|
+
setError(errorText11(e));
|
|
3572
3707
|
} finally {
|
|
3573
3708
|
setBusy(false);
|
|
3574
3709
|
}
|
|
@@ -3588,7 +3723,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3588
3723
|
}
|
|
3589
3724
|
}
|
|
3590
3725
|
const hasApp = factors.some((f) => f.kind === "app");
|
|
3591
|
-
const actions = !settingUp && !addingPasskey && !codes && data && !data.disabled && /* @__PURE__ */ jsxs19(
|
|
3726
|
+
const actions = !settingUp && !addingPasskey && !codes && data && !data.disabled && /* @__PURE__ */ jsxs19(HStack17, { gap: "2", wrap: "wrap", children: [
|
|
3592
3727
|
canPasskey && /* @__PURE__ */ jsx19(
|
|
3593
3728
|
Button15,
|
|
3594
3729
|
{
|
|
@@ -3609,11 +3744,11 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3609
3744
|
/* @__PURE__ */ jsxs19(Stack16, { gap: "field", children: [
|
|
3610
3745
|
/* @__PURE__ */ jsx19(InlineAlert15, { tone: "danger", children: mine.error ?? error }),
|
|
3611
3746
|
data?.disabled && /* @__PURE__ */ jsx19(InlineAlert15, { tone: "neutral", children: t("disabled") }),
|
|
3612
|
-
data && /* @__PURE__ */ jsxs19(
|
|
3747
|
+
data && /* @__PURE__ */ jsxs19(HStack17, { gap: "2", wrap: "wrap", children: [
|
|
3613
3748
|
factors.length > 0 && !data.disabled ? /* @__PURE__ */ jsx19(StatusPill13, { tone: "success", children: t("on") }) : /* @__PURE__ */ jsx19(StatusPill13, { children: t("off") }),
|
|
3614
|
-
/* @__PURE__ */ jsx19(
|
|
3749
|
+
/* @__PURE__ */ jsx19(Text19, { color: "fg.muted", textStyle: "body.sm", "data-testid": "second-factor-mode", children: t(`modeHint.${data.mode}`) })
|
|
3615
3750
|
] }),
|
|
3616
|
-
data?.senders && data.senders.length > 0 && /* @__PURE__ */ jsx19(
|
|
3751
|
+
data?.senders && data.senders.length > 0 && /* @__PURE__ */ jsx19(Text19, { color: "fg.muted", textStyle: "body.sm", "data-testid": "second-factor-senders", children: t("alsoBy", { list: data.senders.map((s) => `${nameOf(s)} (${s.to})`).join(", ") }) }),
|
|
3617
3752
|
settingUp && /* @__PURE__ */ jsx19(
|
|
3618
3753
|
AppSetup,
|
|
3619
3754
|
{
|
|
@@ -3638,9 +3773,9 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3638
3773
|
},
|
|
3639
3774
|
"data-testid": "passkey-add-form",
|
|
3640
3775
|
children: /* @__PURE__ */ jsxs19(Stack16, { gap: "field", maxW: "md", children: [
|
|
3641
|
-
/* @__PURE__ */ jsx19(
|
|
3776
|
+
/* @__PURE__ */ jsx19(Text19, { color: "fg.muted", textStyle: "body.sm", children: t("passkeyHint") }),
|
|
3642
3777
|
/* @__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(
|
|
3778
|
+
/* @__PURE__ */ jsxs19(HStack17, { children: [
|
|
3644
3779
|
/* @__PURE__ */ jsx19(Button15, { type: "submit", loading: busy, "data-testid": "passkey-create", children: t("passkeyCreate") }),
|
|
3645
3780
|
/* @__PURE__ */ jsx19(Button15, { variant: "secondary", onClick: () => setAddingPasskey(false), disabled: busy, children: t("cancel") })
|
|
3646
3781
|
] })
|
|
@@ -3664,16 +3799,16 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3664
3799
|
id: "kind",
|
|
3665
3800
|
header: t("title"),
|
|
3666
3801
|
cell: (f) => f.kind === "passkey" ? /* @__PURE__ */ jsxs19(Stack16, { gap: "0", children: [
|
|
3667
|
-
/* @__PURE__ */ jsx19(
|
|
3668
|
-
/* @__PURE__ */ jsx19(
|
|
3669
|
-
] }) : /* @__PURE__ */ jsx19(
|
|
3802
|
+
/* @__PURE__ */ jsx19(Text19, { fontWeight: "medium", children: f.name || t("kinds.passkey") }),
|
|
3803
|
+
/* @__PURE__ */ jsx19(Text19, { textStyle: "caption", color: "fg.muted", children: f.provider ? `${t("kinds.passkey")} \xB7 ${f.provider}` : t("kinds.passkey") })
|
|
3804
|
+
] }) : /* @__PURE__ */ jsx19(Text19, { fontWeight: "medium", children: t(`kinds.${f.kind}`) })
|
|
3670
3805
|
},
|
|
3671
3806
|
{ id: "added", header: t("added"), nowrap: true, cell: (f) => fmt.dateTime(f.createdAt) },
|
|
3672
3807
|
{ id: "used", header: t("lastUsed"), nowrap: true, cell: (f) => f.lastUsedAt ? fmt.dateTime(f.lastUsedAt) : t("never") },
|
|
3673
3808
|
{
|
|
3674
3809
|
id: "remove",
|
|
3675
3810
|
header: "",
|
|
3676
|
-
cell: (f) => /* @__PURE__ */ jsxs19(
|
|
3811
|
+
cell: (f) => /* @__PURE__ */ jsxs19(HStack17, { gap: "2", justify: "flex-end", children: [
|
|
3677
3812
|
f.kind === "passkey" && /* @__PURE__ */ jsx19(
|
|
3678
3813
|
Button15,
|
|
3679
3814
|
{
|
|
@@ -3692,14 +3827,14 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3692
3827
|
]
|
|
3693
3828
|
}
|
|
3694
3829
|
),
|
|
3695
|
-
factors.length > 0 && /* @__PURE__ */ jsxs19(
|
|
3696
|
-
/* @__PURE__ */ jsx19(
|
|
3830
|
+
factors.length > 0 && /* @__PURE__ */ jsxs19(HStack17, { justify: "space-between", wrap: "wrap", gap: "2", children: [
|
|
3831
|
+
/* @__PURE__ */ jsx19(Text19, { textStyle: "body.sm", color: "fg.muted", "data-testid": "recovery-left", children: t("recoveryLeft", { count: num(data?.recoveryCodesLeft ?? 0) }) }),
|
|
3697
3832
|
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: "secondary", onClick: () => void renew(), children: t("renew") })
|
|
3698
3833
|
] })
|
|
3699
3834
|
] })
|
|
3700
3835
|
] }),
|
|
3701
3836
|
/* @__PURE__ */ jsx19(
|
|
3702
|
-
|
|
3837
|
+
FormDialog3,
|
|
3703
3838
|
{
|
|
3704
3839
|
open: renaming != null,
|
|
3705
3840
|
onOpenChange: (open) => !open && setRenaming(null),
|
|
@@ -3717,22 +3852,22 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3717
3852
|
import { useSyncExternalStore } from "react";
|
|
3718
3853
|
|
|
3719
3854
|
// src/areas/guard/SignUpScreen.tsx
|
|
3720
|
-
import { useEffect as useEffect5, useMemo as
|
|
3721
|
-
import { Grid as Grid4, HStack as
|
|
3722
|
-
import { Trash2 as
|
|
3855
|
+
import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef2, useState as useState15 } from "react";
|
|
3856
|
+
import { Grid as Grid4, HStack as HStack18, Input as Input10, Stack as Stack17, Text as Text20 } from "@chakra-ui/react";
|
|
3857
|
+
import { Trash2 as Trash23 } from "lucide-react";
|
|
3723
3858
|
import {
|
|
3724
3859
|
AddButton,
|
|
3725
3860
|
Button as Button16,
|
|
3726
3861
|
EmptyState as EmptyState2,
|
|
3727
3862
|
Field as Field10,
|
|
3728
|
-
IconButton as
|
|
3863
|
+
IconButton as IconButton2,
|
|
3729
3864
|
InlineAlert as InlineAlert16,
|
|
3730
3865
|
notify as notify12,
|
|
3731
3866
|
PageHeader as PageHeader9,
|
|
3732
3867
|
Panel as Panel15,
|
|
3733
3868
|
SaveBar,
|
|
3734
3869
|
SelectField as SelectField5,
|
|
3735
|
-
SwitchField,
|
|
3870
|
+
SwitchField as SwitchField2,
|
|
3736
3871
|
useApiAction as useApiAction11,
|
|
3737
3872
|
useApiQuery as useApiQuery12,
|
|
3738
3873
|
useAreaRequest as useAreaRequest16
|
|
@@ -3771,7 +3906,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3771
3906
|
useEffect5(() => {
|
|
3772
3907
|
if (settings.data) setForm(fromSettings(settings.data));
|
|
3773
3908
|
}, [settings.data]);
|
|
3774
|
-
const saved =
|
|
3909
|
+
const saved = useMemo4(() => settings.data ? fromSettings(settings.data) : form, [settings.data, form]);
|
|
3775
3910
|
const changes = settings.data ? signUpChanges(saved, form) + Number(draft.trim() !== "") : 0;
|
|
3776
3911
|
if (settings.error) return /* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: settings.error });
|
|
3777
3912
|
const listed = settings.data?.directories ?? [];
|
|
@@ -3872,7 +4007,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3872
4007
|
return /* @__PURE__ */ jsxs20(Stack17, { gap: "section", children: [
|
|
3873
4008
|
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3874
4009
|
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(Stack17, { gap: "5", children: [
|
|
3875
|
-
/* @__PURE__ */ jsx20(
|
|
4010
|
+
/* @__PURE__ */ jsx20(SwitchField2, { label: t("enabled"), checked: form.enabled, onCheckedChange: (c) => {
|
|
3876
4011
|
change({ enabled: c });
|
|
3877
4012
|
if (!c) setDirectoryError("");
|
|
3878
4013
|
} }),
|
|
@@ -3899,24 +4034,24 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3899
4034
|
}
|
|
3900
4035
|
),
|
|
3901
4036
|
/* @__PURE__ */ jsxs20(Stack17, { gap: "2", minW: "0", role: "group", "aria-labelledby": "signup-domains", children: [
|
|
3902
|
-
/* @__PURE__ */ jsx20(
|
|
4037
|
+
/* @__PURE__ */ jsx20(Text20, { id: "signup-domains", textStyle: "label", children: t("domains") }),
|
|
3903
4038
|
/* @__PURE__ */ jsxs20(Stack17, { gap: "1", children: [
|
|
3904
|
-
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(
|
|
3905
|
-
form.domains.map((d) => /* @__PURE__ */ jsxs20(
|
|
3906
|
-
/* @__PURE__ */ jsx20(
|
|
4039
|
+
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(Text20, { textStyle: "body.sm", color: "fg.muted", py: "1.5", children: t("anyDomain") }),
|
|
4040
|
+
form.domains.map((d) => /* @__PURE__ */ jsxs20(HStack18, { gap: "2", minH: "11", ps: "3", pe: "1", borderRadius: "l2", bg: "bg.subtle", textStyle: "body.sm", children: [
|
|
4041
|
+
/* @__PURE__ */ jsx20(Text20, { flex: "1", minW: "0", fontWeight: "bold", dir: "ltr", textAlign: "start", truncate: true, children: d }),
|
|
3907
4042
|
/* @__PURE__ */ jsx20(
|
|
3908
|
-
|
|
4043
|
+
IconButton2,
|
|
3909
4044
|
{
|
|
3910
4045
|
remove: true,
|
|
3911
4046
|
size: "sm",
|
|
3912
4047
|
"aria-label": t("removeDomain", { domain: d }),
|
|
3913
4048
|
onClick: () => change({ domains: form.domains.filter((x) => x !== d) }),
|
|
3914
|
-
children: /* @__PURE__ */ jsx20(
|
|
4049
|
+
children: /* @__PURE__ */ jsx20(Trash23, {})
|
|
3915
4050
|
}
|
|
3916
4051
|
)
|
|
3917
4052
|
] }, d))
|
|
3918
4053
|
] }),
|
|
3919
|
-
adding ? /* @__PURE__ */ jsx20(Field10, { invalid: !!draftError, errorText: draftError, children: /* @__PURE__ */ jsxs20(
|
|
4054
|
+
adding ? /* @__PURE__ */ jsx20(Field10, { invalid: !!draftError, errorText: draftError, children: /* @__PURE__ */ jsxs20(HStack18, { gap: "3", align: "center", w: "full", children: [
|
|
3920
4055
|
/* @__PURE__ */ jsx20(
|
|
3921
4056
|
Input10,
|
|
3922
4057
|
{
|
|
@@ -3941,7 +4076,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3941
4076
|
/* @__PURE__ */ jsx20(AddButton, { onMouseDown: (e) => e.preventDefault(), onClick: addDraft, children: t("add") })
|
|
3942
4077
|
] }) }) : /* @__PURE__ */ jsx20(AddButton, { ref: addButton, alignSelf: "flex-start", onClick: () => setAdding(true), children: t("addDomain") })
|
|
3943
4078
|
] })
|
|
3944
|
-
] }) : /* @__PURE__ */ jsx20(
|
|
4079
|
+
] }) : /* @__PURE__ */ jsx20(Text20, { textStyle: "body.sm", color: "fg.muted", children: t("off") }),
|
|
3945
4080
|
/* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: action.error })
|
|
3946
4081
|
] }) }),
|
|
3947
4082
|
saveBar
|
|
@@ -3996,7 +4131,7 @@ function guardPages(options) {
|
|
|
3996
4131
|
|
|
3997
4132
|
// src/areas/guard/StrongFactorBanner.tsx
|
|
3998
4133
|
import { Box as Box5 } from "@chakra-ui/react";
|
|
3999
|
-
import { AppLink as
|
|
4134
|
+
import { AppLink as AppLink10, InlineAlert as InlineAlert17, useFormatters as useFormatters10 } from "@abpjs/ui";
|
|
4000
4135
|
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4001
4136
|
function StrongFactorBanner({ strongFactor, setUpHref }) {
|
|
4002
4137
|
const t = useGuardTexts();
|
|
@@ -4005,7 +4140,7 @@ function StrongFactorBanner({ strongFactor, setUpHref }) {
|
|
|
4005
4140
|
return /* @__PURE__ */ jsx22(Box5, { mb: "section", "data-testid": "strong-factor-banner", children: /* @__PURE__ */ jsxs21(InlineAlert17, { tone: strongFactor.overdue ? "danger" : "warning", title: t("secondFactor.required.title"), children: [
|
|
4006
4141
|
t(strongFactor.overdue ? "secondFactor.required.overdue" : "secondFactor.required.by", { date: fmt.dateTime(strongFactor.requiredBy) }),
|
|
4007
4142
|
" ",
|
|
4008
|
-
/* @__PURE__ */ jsx22(
|
|
4143
|
+
/* @__PURE__ */ jsx22(AppLink10, { href: setUpHref, children: t("secondFactor.required.setUp") })
|
|
4009
4144
|
] }) });
|
|
4010
4145
|
}
|
|
4011
4146
|
export {
|