@abpjs/ui 0.2.0-next.33 → 0.2.0-next.35
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/guard.d.ts +15 -7
- package/dist/guard.js +848 -485
- 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/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",
|
|
@@ -215,10 +214,9 @@ var ar_default = {
|
|
|
215
214
|
"anonymousAccess.role": "\u0627\u0644\u062F\u0648\u0631",
|
|
216
215
|
"anonymousAccess.scope": "\u0623\u064A\u0646",
|
|
217
216
|
"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.",
|
|
217
|
+
"anonymousAccess.revoke": "\u0633\u062D\u0628 \u0627\u0644\u062F\u0648\u0631",
|
|
218
|
+
"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",
|
|
219
|
+
"anonymousAccess.revoked": "\u0633\u064F\u062D\u0628 \u0627\u0644\u062F\u0648\u0631.",
|
|
222
220
|
"merge.mergeInto": "\u062F\u0645\u062C \u0641\u064A \u062D\u0633\u0627\u0628 \u0622\u062E\u0631",
|
|
223
221
|
"merge.pageTitle": "\u062F\u0645\u062C \u0641\u064A \u062D\u0633\u0627\u0628 \u0622\u062E\u0631",
|
|
224
222
|
"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,14 +438,53 @@ var ar_default = {
|
|
|
440
438
|
"signUpSettings.domainTwice": "{domain} \u0645\u0648\u062C\u0648\u062F \u0641\u064A \u0627\u0644\u0642\u0627\u0626\u0645\u0629.",
|
|
441
439
|
"signUpSettings.emptyTitle": "\u0627\u0644\u062A\u0633\u062C\u064A\u0644 \u0645\u062A\u0648\u0642\u0641",
|
|
442
440
|
"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"
|
|
441
|
+
"signUpSettings.turnOn": "\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u062A\u0633\u062C\u064A\u0644",
|
|
442
|
+
"anonymousAccess.giveRole": "\u0645\u0646\u062D \u062F\u0648\u0631",
|
|
443
|
+
"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",
|
|
444
|
+
"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}",
|
|
445
|
+
"anonymousAccess.chooseRole": "\u0627\u062E\u062A\u0631 \u062F\u0648\u0631\u064B\u0627",
|
|
446
|
+
"anonymousAccess.chooseWhere": "\u0627\u062E\u062A\u0631 \u0645\u0643\u0627\u0646\u064B\u0627",
|
|
447
|
+
"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.",
|
|
448
|
+
"anonymousAccess.who": "\u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u0648\u0646",
|
|
449
|
+
"anonymousAccess.can": "\u064A\u0645\u0643\u0646\u0647\u0645",
|
|
450
|
+
"anonymousAccess.give": "\u0645\u0646\u062D \u0627\u0644\u062F\u0648\u0631",
|
|
451
|
+
"anonymousAccess.change": "\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062F\u0648\u0631",
|
|
452
|
+
"anonymousAccess.given": "\u0645\u064F\u0646\u062D \u0627\u0644\u062F\u0648\u0631.",
|
|
453
|
+
"anonymousAccess.changed": "\u062A\u063A\u064A\u0651\u0631 \u0627\u0644\u062F\u0648\u0631.",
|
|
454
|
+
"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",
|
|
455
|
+
"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.",
|
|
456
|
+
"anonymousAccess.tableLabel": "\u0623\u062F\u0648\u0627\u0631 \u0627\u0644\u0632\u0648\u0627\u0631 \u0627\u0644\u0645\u062C\u0647\u0648\u0644\u064A\u0646",
|
|
457
|
+
"anonymousAccess.actions": "\u0627\u0644\u0625\u062C\u0631\u0627\u0621\u0627\u062A",
|
|
458
|
+
"anonymousAccess.menuLabel": "\u0625\u062C\u0631\u0627\u0621\u0627\u062A {role} \u0641\u064A {scope}",
|
|
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.",
|
|
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.",
|
|
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"
|
|
444
481
|
};
|
|
445
482
|
|
|
446
483
|
// src/areas/guard/texts/en.json
|
|
447
484
|
var en_default = {
|
|
448
485
|
"directories.title": "Directories",
|
|
449
486
|
"directories.subtitle": "User directories in precedence order. When two directories know the same username, the first active one owns it.",
|
|
450
|
-
"directories.add": "
|
|
487
|
+
"directories.add": "New directory",
|
|
451
488
|
"directories.empty": "No directories.",
|
|
452
489
|
"directories.signIn": "Sign-in",
|
|
453
490
|
"directories.lastSync": "Last sync",
|
|
@@ -460,7 +497,6 @@ var en_default = {
|
|
|
460
497
|
"directories.syncFailed": "Sync of {name} failed: {error}",
|
|
461
498
|
"directories.internalType": "Internal (kept by {product})",
|
|
462
499
|
"directories.warnings": "{count, plural, one {A warning} other {# warnings}}",
|
|
463
|
-
"directories.addedWithWarnings": "{name} is added. Its settings have warnings:",
|
|
464
500
|
"directoryDetail.notFound": "Directory not found",
|
|
465
501
|
"directoryDetail.back": "Back to directories",
|
|
466
502
|
"directoryDetail.order": "Order {order}",
|
|
@@ -508,10 +544,10 @@ var en_default = {
|
|
|
508
544
|
"directoryForm.type": "Type",
|
|
509
545
|
"directoryForm.selectType": "Select a type",
|
|
510
546
|
"directoryForm.typeFromPlugin": "{name} (plugin {plugin})",
|
|
511
|
-
"directoryForm.syncInterval": "Sync
|
|
512
|
-
"directoryForm.syncIntervalHint": "
|
|
547
|
+
"directoryForm.syncInterval": "Sync every",
|
|
548
|
+
"directoryForm.syncIntervalHint": "Empty = on request only",
|
|
513
549
|
"directoryForm.active": "Active",
|
|
514
|
-
"directoryForm.signInEnabled": "
|
|
550
|
+
"directoryForm.signInEnabled": "Allow sign-in",
|
|
515
551
|
"directoryForm.capabilities": "Capabilities: {list}",
|
|
516
552
|
"directoryForm.connectionSettings": "Connection settings",
|
|
517
553
|
"directoryForm.fillFromPreset": "Fill from preset",
|
|
@@ -649,10 +685,9 @@ var en_default = {
|
|
|
649
685
|
"anonymousAccess.role": "Role",
|
|
650
686
|
"anonymousAccess.scope": "Where",
|
|
651
687
|
"anonymousAccess.since": "Since",
|
|
652
|
-
"anonymousAccess.revoke": "
|
|
653
|
-
"anonymousAccess.revokeTitle": "
|
|
654
|
-
"anonymousAccess.revoked": "
|
|
655
|
-
"anonymousAccess.empty": "Anonymous visitors have no roles anywhere.",
|
|
688
|
+
"anonymousAccess.revoke": "Remove role",
|
|
689
|
+
"anonymousAccess.revokeTitle": "Remove {role} in {scope} from anonymous visitors?",
|
|
690
|
+
"anonymousAccess.revoked": "Role removed.",
|
|
656
691
|
"merge.mergeInto": "Merge into another account",
|
|
657
692
|
"merge.pageTitle": "Merge into another account",
|
|
658
693
|
"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 +909,46 @@ var en_default = {
|
|
|
874
909
|
"signUpSettings.domainTwice": "{domain} is in the list already.",
|
|
875
910
|
"signUpSettings.emptyTitle": "Sign-up is off",
|
|
876
911
|
"signUpSettings.emptyText": "Only admins can add people now. You can let people sign themselves up.",
|
|
877
|
-
"signUpSettings.turnOn": "Turn on sign-up"
|
|
912
|
+
"signUpSettings.turnOn": "Turn on sign-up",
|
|
913
|
+
"anonymousAccess.giveRole": "Give a role",
|
|
914
|
+
"anonymousAccess.dialogTitle": "Give anonymous visitors a role",
|
|
915
|
+
"anonymousAccess.changeTitle": "Change the role anonymous visitors have in {scope}",
|
|
916
|
+
"anonymousAccess.chooseRole": "Choose a role",
|
|
917
|
+
"anonymousAccess.chooseWhere": "Choose where",
|
|
918
|
+
"anonymousAccess.warning": "Anyone on the internet gets this role, without signing in.",
|
|
919
|
+
"anonymousAccess.who": "Anonymous visitors",
|
|
920
|
+
"anonymousAccess.can": "Can",
|
|
921
|
+
"anonymousAccess.give": "Give role",
|
|
922
|
+
"anonymousAccess.change": "Change role",
|
|
923
|
+
"anonymousAccess.given": "Role given.",
|
|
924
|
+
"anonymousAccess.changed": "Role changed.",
|
|
925
|
+
"anonymousAccess.emptyTitle": "Anonymous visitors have no roles",
|
|
926
|
+
"anonymousAccess.emptyText": "People must sign in to see anything.",
|
|
927
|
+
"anonymousAccess.tableLabel": "Roles for anonymous visitors",
|
|
928
|
+
"anonymousAccess.actions": "Actions",
|
|
929
|
+
"anonymousAccess.menuLabel": "Actions for {role} in {scope}",
|
|
930
|
+
"anonymousAccess.notListed": "This place doesn't offer roles to anonymous visitors now. Remove the role instead.",
|
|
931
|
+
"anonymousAccess.emptyTextNoPlaces": "People must sign in to see anything. Nothing on this site can be opened to anonymous visitors yet.",
|
|
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"
|
|
878
952
|
};
|
|
879
953
|
|
|
880
954
|
// src/areas/guard/texts.ts
|
|
@@ -1688,19 +1762,110 @@ function CreateAccountPanel({ onDone, onCancel }) {
|
|
|
1688
1762
|
}
|
|
1689
1763
|
|
|
1690
1764
|
// src/areas/guard/AnonymousScreen.tsx
|
|
1691
|
-
import {
|
|
1692
|
-
import {
|
|
1693
|
-
import {
|
|
1694
|
-
import {
|
|
1695
|
-
|
|
1765
|
+
import { useMemo, useState as useState4 } from "react";
|
|
1766
|
+
import { HStack as HStack8, Stack as Stack7, Text as Text9 } from "@chakra-ui/react";
|
|
1767
|
+
import { Globe, Pencil, Trash2 } from "lucide-react";
|
|
1768
|
+
import {
|
|
1769
|
+
AppLink as AppLink4,
|
|
1770
|
+
Button as Button7,
|
|
1771
|
+
DataTable as DataTable6,
|
|
1772
|
+
EmptyState,
|
|
1773
|
+
Field as Field2,
|
|
1774
|
+
FormDialog,
|
|
1775
|
+
IconTile,
|
|
1776
|
+
InlineAlert as InlineAlert6,
|
|
1777
|
+
notify as notify5,
|
|
1778
|
+
PageHeader as PageHeader3,
|
|
1779
|
+
Panel as Panel7,
|
|
1780
|
+
PreviewCard,
|
|
1781
|
+
RecordKey as RecordKey4,
|
|
1782
|
+
RowMenu,
|
|
1783
|
+
SelectField as SelectField2,
|
|
1784
|
+
StatusPill as StatusPill6,
|
|
1785
|
+
errorText as errorText2,
|
|
1786
|
+
useApiAction as useApiAction6,
|
|
1787
|
+
useApiQuery as useApiQuery5,
|
|
1788
|
+
useAreaRequest as useAreaRequest7,
|
|
1789
|
+
useConfirm as useConfirm2,
|
|
1790
|
+
useFormatters as useFormatters6
|
|
1791
|
+
} from "@abpjs/ui";
|
|
1792
|
+
|
|
1793
|
+
// src/areas/guard/anonymousRules.ts
|
|
1794
|
+
function takenKey(roleId, scopeKey) {
|
|
1795
|
+
return `${roleId}\0${scopeKey}`;
|
|
1796
|
+
}
|
|
1797
|
+
function takenBy(grants, except) {
|
|
1798
|
+
return new Set(grants.filter((g) => g.id !== except && g.roleId && g.scopeKey).map((g) => takenKey(g.roleId, g.scopeKey)));
|
|
1799
|
+
}
|
|
1800
|
+
function rolesOffered(places, place, taken = /* @__PURE__ */ new Set()) {
|
|
1801
|
+
const pairs = (place ? [place] : places).flatMap((p) => p.roles.map((r) => [r, p.scopeKey]));
|
|
1802
|
+
const free = pairs.filter(([r, scopeKey]) => !taken.has(takenKey(r.id, scopeKey))).map(([r]) => r);
|
|
1803
|
+
return [...new Map(free.map((r) => [r.id, r])).values()];
|
|
1804
|
+
}
|
|
1805
|
+
function placesOffering(places, roleId, taken = /* @__PURE__ */ new Set()) {
|
|
1806
|
+
return places.filter((p) => p.roles.some((r) => (!roleId || r.id === roleId) && !taken.has(takenKey(r.id, p.scopeKey))));
|
|
1807
|
+
}
|
|
1808
|
+
function placeKept(places, scopeKey, roleId, taken = /* @__PURE__ */ new Set()) {
|
|
1809
|
+
if (!scopeKey) return "";
|
|
1810
|
+
const place = places.find((p) => p.scopeKey === scopeKey);
|
|
1811
|
+
if (!place) return "";
|
|
1812
|
+
if (!roleId) return scopeKey;
|
|
1813
|
+
return place.roles.some((r) => r.id === roleId) && !taken.has(takenKey(roleId, scopeKey)) ? scopeKey : "";
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// src/areas/guard/AnonymousScreen.tsx
|
|
1817
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1818
|
+
function AnonymousScreen({ roleName, roleDescription } = {}) {
|
|
1696
1819
|
const t = useGuardNs("anonymousAccess");
|
|
1697
1820
|
const fmt = useFormatters6();
|
|
1821
|
+
const written = useWrittenName();
|
|
1698
1822
|
const confirm = useConfirm2();
|
|
1699
1823
|
const request = useAreaRequest7("guard");
|
|
1824
|
+
const action = useApiAction6();
|
|
1700
1825
|
const grants = useApiQuery5("guard", "/anonymous");
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1826
|
+
const places = useApiQuery5("guard", "/anonymous/places");
|
|
1827
|
+
const [editing, setEditing] = useState4(null);
|
|
1828
|
+
const [shown, setShown] = useState4({ mode: "give" });
|
|
1829
|
+
const [roleId, setRoleId] = useState4("");
|
|
1830
|
+
const [scopeKey, setScopeKey] = useState4("");
|
|
1831
|
+
const placeOf = useMemo(() => new Map((places.data ?? []).map((p) => [p.scopeKey, p])), [places.data]);
|
|
1832
|
+
const roleOf = useMemo(() => new Map((places.data ?? []).flatMap((p) => p.roles).map((r) => [r.id, r])), [places.data]);
|
|
1833
|
+
const nameOf = (r) => written(roleName?.(r.key, r.name) ?? r.name, r.names);
|
|
1834
|
+
const describe = (r) => written(roleDescription?.(r.key, r.description) ?? r.description ?? "", r.descriptions) || void 0;
|
|
1835
|
+
const grantRole = (g) => {
|
|
1836
|
+
const known = g.roleId ? roleOf.get(g.roleId) : void 0;
|
|
1837
|
+
return known ? nameOf(known) : written(roleName?.(g.roleKey, g.roleName) ?? g.roleName);
|
|
1838
|
+
};
|
|
1839
|
+
const whereOf = (g) => {
|
|
1840
|
+
const place = g.scopeKey ? placeOf.get(g.scopeKey) : void 0;
|
|
1841
|
+
return { label: place?.label ?? g.scope ?? g.scopeKey ?? "", code: place?.code ?? g.code ?? null, href: place?.href ?? g.href };
|
|
1842
|
+
};
|
|
1843
|
+
const taken = useMemo(() => takenBy(grants.data ?? [], shown.mode === "change" ? shown.grant.id : void 0), [grants.data, shown]);
|
|
1844
|
+
const chosenPlace = shown.mode === "change" ? shown.place : placeOf.get(scopeKey);
|
|
1845
|
+
const roleOptions = useMemo(() => rolesOffered(places.data ?? [], chosenPlace, taken), [chosenPlace, places.data, taken]);
|
|
1846
|
+
const chosenRole = roleOptions.find((r) => r.id === roleId);
|
|
1847
|
+
const placeOptions = placesOffering(places.data ?? [], roleId, taken);
|
|
1848
|
+
const unchanged = shown.mode === "change" && roleId === (shown.grant.roleId ?? "");
|
|
1849
|
+
function open(next) {
|
|
1850
|
+
setEditing(next);
|
|
1851
|
+
setShown(next);
|
|
1852
|
+
setRoleId(next.mode === "change" ? next.grant.roleId ?? "" : "");
|
|
1853
|
+
setScopeKey(next.mode === "change" ? next.place.scopeKey : "");
|
|
1854
|
+
action.setError(null);
|
|
1855
|
+
}
|
|
1856
|
+
async function save() {
|
|
1857
|
+
if (!editing) return;
|
|
1858
|
+
const done = await action.run(
|
|
1859
|
+
() => editing.mode === "give" ? request("/anonymous", { method: "POST", body: { roleId, scopeKey } }) : request(`/anonymous/${editing.grant.id}`, { method: "PUT", body: { roleId } })
|
|
1860
|
+
);
|
|
1861
|
+
if (done === void 0) return;
|
|
1862
|
+
notify5.success(editing.mode === "give" ? t("given") : t("changed"));
|
|
1863
|
+
setEditing(null);
|
|
1864
|
+
await grants.reload();
|
|
1865
|
+
}
|
|
1866
|
+
async function remove(g) {
|
|
1867
|
+
const where = whereOf(g);
|
|
1868
|
+
if (!await confirm({ title: t("revokeTitle", { role: grantRole(g), scope: where.label }), confirmLabel: t("revoke"), danger: true })) return;
|
|
1704
1869
|
try {
|
|
1705
1870
|
await request(`/anonymous/${g.id}`, { method: "DELETE" });
|
|
1706
1871
|
notify5.success(t("revoked"));
|
|
@@ -1709,57 +1874,194 @@ function AnonymousScreen({ roleName }) {
|
|
|
1709
1874
|
notify5.error(errorText2(e));
|
|
1710
1875
|
}
|
|
1711
1876
|
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1877
|
+
const canGive = placesOffering(places.data ?? [], "", takenBy(grants.data ?? [])).length > 0;
|
|
1878
|
+
const giveButton = canGive && /* @__PURE__ */ jsx9(Button7, { variant: "primary", onClick: () => open({ mode: "give" }), children: t("giveRole") });
|
|
1879
|
+
const empty = grants.data !== void 0 && grants.data.length === 0;
|
|
1880
|
+
const whereLabel = (p) => p.code ? t("placeWithCode", { place: p.label, code: p.code }) : p.label;
|
|
1881
|
+
const previewWhere = chosenPlace ? whereLabel(chosenPlace) : void 0;
|
|
1882
|
+
return /* @__PURE__ */ jsxs9(Stack7, { gap: "section", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx9(PageHeader3, { title: t("title"), description: t("subtitle"), actions: !empty ? giveButton : void 0 }),
|
|
1884
|
+
/* @__PURE__ */ jsx9(InlineAlert6, { tone: "danger", children: grants.error ?? places.error }),
|
|
1885
|
+
empty ? /* @__PURE__ */ jsx9(
|
|
1886
|
+
EmptyState,
|
|
1887
|
+
{
|
|
1888
|
+
variant: "page",
|
|
1889
|
+
size: "md",
|
|
1890
|
+
kind: "first-use",
|
|
1891
|
+
illustration: "views",
|
|
1892
|
+
title: t("emptyTitle"),
|
|
1893
|
+
description: canGive || places.data === void 0 ? t("emptyText") : t("emptyTextNoPlaces"),
|
|
1894
|
+
action: giveButton || void 0
|
|
1895
|
+
}
|
|
1896
|
+
) : /* @__PURE__ */ jsx9(Panel7, { flush: true, children: /* @__PURE__ */ jsx9(
|
|
1716
1897
|
DataTable6,
|
|
1717
1898
|
{
|
|
1718
|
-
"aria-label": t("
|
|
1899
|
+
"aria-label": t("tableLabel"),
|
|
1719
1900
|
rows: grants.data,
|
|
1720
1901
|
loading: grants.loading,
|
|
1721
1902
|
getRowId: (g) => g.id,
|
|
1722
|
-
empty: /* @__PURE__ */ jsx9(Text9, { color: "fg.muted", children: t("empty") }),
|
|
1723
1903
|
columns: [
|
|
1724
|
-
{
|
|
1725
|
-
|
|
1726
|
-
|
|
1904
|
+
{
|
|
1905
|
+
id: "role",
|
|
1906
|
+
header: t("role"),
|
|
1907
|
+
cell: (g) => /* @__PURE__ */ jsx9(StatusPill6, { tone: "info", dot: false, children: grantRole(g) })
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
id: "scope",
|
|
1911
|
+
header: t("scope"),
|
|
1912
|
+
cell: (g) => {
|
|
1913
|
+
const where = whereOf(g);
|
|
1914
|
+
return /* @__PURE__ */ jsxs9(HStack8, { gap: "2", minW: "0", children: [
|
|
1915
|
+
/* @__PURE__ */ jsx9(Text9, { as: "span", fontWeight: "semibold", truncate: true, children: where.href ? /* @__PURE__ */ jsx9(AppLink4, { href: where.href, children: where.label }) : where.label }),
|
|
1916
|
+
where.code && /* @__PURE__ */ jsx9(RecordKey4, { value: where.code, variant: "muted" })
|
|
1917
|
+
] });
|
|
1918
|
+
}
|
|
1919
|
+
},
|
|
1920
|
+
{ 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
1921
|
{
|
|
1728
1922
|
id: "actions",
|
|
1729
|
-
header: /* @__PURE__ */ jsx9(Text9, { as: "span", srOnly: true, children: t("
|
|
1923
|
+
header: /* @__PURE__ */ jsx9(Text9, { as: "span", srOnly: true, children: t("actions") }),
|
|
1730
1924
|
align: "end",
|
|
1731
|
-
cell: (g) =>
|
|
1925
|
+
cell: (g) => {
|
|
1926
|
+
const place = g.scopeKey ? placeOf.get(g.scopeKey) : void 0;
|
|
1927
|
+
return /* @__PURE__ */ jsx9(
|
|
1928
|
+
RowMenu,
|
|
1929
|
+
{
|
|
1930
|
+
label: t("menuLabel", { role: grantRole(g), scope: whereOf(g).label }),
|
|
1931
|
+
items: [
|
|
1932
|
+
{ id: "change", label: t("change"), icon: /* @__PURE__ */ jsx9(Pencil, {}), disabled: !place, onSelect: () => place && open({ mode: "change", grant: g, place }) },
|
|
1933
|
+
...place ? [] : [{ note: t("notListed") }],
|
|
1934
|
+
{ separator: true },
|
|
1935
|
+
{ id: "remove", label: t("revoke"), icon: /* @__PURE__ */ jsx9(Trash2, {}), danger: true, onSelect: () => void remove(g) }
|
|
1936
|
+
]
|
|
1937
|
+
}
|
|
1938
|
+
);
|
|
1939
|
+
}
|
|
1732
1940
|
}
|
|
1733
1941
|
]
|
|
1734
1942
|
}
|
|
1735
|
-
) })
|
|
1943
|
+
) }),
|
|
1944
|
+
/* @__PURE__ */ jsxs9(
|
|
1945
|
+
FormDialog,
|
|
1946
|
+
{
|
|
1947
|
+
open: editing !== null,
|
|
1948
|
+
onOpenChange: (o) => {
|
|
1949
|
+
if (!o) setEditing(null);
|
|
1950
|
+
},
|
|
1951
|
+
title: shown.mode === "change" ? t("changeTitle", { scope: shown.place.label }) : t("dialogTitle"),
|
|
1952
|
+
submitLabel: shown.mode === "change" ? t("change") : t("give"),
|
|
1953
|
+
submitDisabled: unchanged,
|
|
1954
|
+
onSubmit: save,
|
|
1955
|
+
busy: action.busy,
|
|
1956
|
+
error: action.error,
|
|
1957
|
+
preview: /* @__PURE__ */ jsx9(
|
|
1958
|
+
PreviewCard,
|
|
1959
|
+
{
|
|
1960
|
+
media: /* @__PURE__ */ jsx9(IconTile, { size: "md", children: /* @__PURE__ */ jsx9(Globe, {}) }),
|
|
1961
|
+
title: t("who"),
|
|
1962
|
+
subtitle: chosenRole ? nameOf(chosenRole) : void 0,
|
|
1963
|
+
items: [
|
|
1964
|
+
{ label: t("scope"), value: previewWhere },
|
|
1965
|
+
{ label: t("can"), wrap: true, value: chosenRole ? describe(chosenRole) : void 0 }
|
|
1966
|
+
]
|
|
1967
|
+
}
|
|
1968
|
+
),
|
|
1969
|
+
children: [
|
|
1970
|
+
/* @__PURE__ */ jsx9(Field2, { label: t("role"), required: true, children: /* @__PURE__ */ jsx9(
|
|
1971
|
+
SelectField2,
|
|
1972
|
+
{
|
|
1973
|
+
value: roleId,
|
|
1974
|
+
onChange: (e) => {
|
|
1975
|
+
const next = e.target.value;
|
|
1976
|
+
setRoleId(next);
|
|
1977
|
+
if (shown.mode === "give") setScopeKey(placeKept(places.data ?? [], scopeKey, next, taken));
|
|
1978
|
+
},
|
|
1979
|
+
options: [{ value: "", label: t("chooseRole") }, ...roleOptions.map((r) => ({ value: r.id, label: nameOf(r) }))]
|
|
1980
|
+
}
|
|
1981
|
+
) }),
|
|
1982
|
+
shown.mode === "change" ? (
|
|
1983
|
+
// The place a change keeps: a label and its value, not a field (there's nothing to fill in).
|
|
1984
|
+
/* @__PURE__ */ jsxs9(Stack7, { gap: "1.5", children: [
|
|
1985
|
+
/* @__PURE__ */ jsx9(Text9, { id: "anonymous-change-where", textStyle: "label", children: t("scope") }),
|
|
1986
|
+
/* @__PURE__ */ jsx9(Text9, { textStyle: "body.sm", "aria-labelledby": "anonymous-change-where", children: whereLabel(shown.place) })
|
|
1987
|
+
] })
|
|
1988
|
+
) : /* @__PURE__ */ jsx9(Field2, { label: t("scope"), required: true, children: /* @__PURE__ */ jsx9(
|
|
1989
|
+
SelectField2,
|
|
1990
|
+
{
|
|
1991
|
+
value: scopeKey,
|
|
1992
|
+
onChange: (e) => setScopeKey(e.target.value),
|
|
1993
|
+
options: [{ value: "", label: t("chooseWhere") }, ...placeOptions.map((p) => ({ value: p.scopeKey, label: whereLabel(p) }))]
|
|
1994
|
+
}
|
|
1995
|
+
) }),
|
|
1996
|
+
/* @__PURE__ */ jsx9(InlineAlert6, { tone: "warning", children: t("warning") })
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
)
|
|
1736
2000
|
] });
|
|
1737
2001
|
}
|
|
1738
2002
|
|
|
1739
2003
|
// src/areas/guard/DirectoriesScreen.tsx
|
|
1740
|
-
import { useState as
|
|
1741
|
-
import {
|
|
1742
|
-
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";
|
|
1743
2007
|
import {
|
|
1744
|
-
|
|
1745
|
-
Button as Button8,
|
|
2008
|
+
Button as Button9,
|
|
1746
2009
|
DataTable as DataTable7,
|
|
1747
|
-
|
|
2010
|
+
FormDialog as FormDialog2,
|
|
2011
|
+
IconTile as IconTile2,
|
|
1748
2012
|
InlineAlert as InlineAlert8,
|
|
1749
2013
|
Loading as Loading2,
|
|
1750
2014
|
PageHeader as PageHeader4,
|
|
1751
2015
|
Panel as Panel8,
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
2016
|
+
PreviewCard as PreviewCard2,
|
|
2017
|
+
RowMenu as RowMenu2,
|
|
2018
|
+
StatusPill as StatusPill7,
|
|
2019
|
+
errorText as errorText4,
|
|
2020
|
+
useApiAction as useApiAction7,
|
|
1755
2021
|
useApiQuery as useApiQuery6,
|
|
1756
|
-
useAreaRequest as useAreaRequest8
|
|
2022
|
+
useAreaRequest as useAreaRequest8,
|
|
2023
|
+
useConfirm as useConfirm3,
|
|
2024
|
+
useNavigate as useNavigate2
|
|
1757
2025
|
} from "@abpjs/ui";
|
|
1758
2026
|
|
|
1759
2027
|
// src/areas/guard/DirectoryForm.tsx
|
|
1760
|
-
import { useState as
|
|
1761
|
-
import { Fieldset, HStack as
|
|
1762
|
-
import { Button as
|
|
2028
|
+
import { useState as useState5 } from "react";
|
|
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
|
|
1763
2065
|
import { fromNamesValue, toNamesValue } from "@abpjs/ui/rules";
|
|
1764
2066
|
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1765
2067
|
function defaultsFor(type) {
|
|
@@ -1770,24 +2072,9 @@ function defaultsFor(type) {
|
|
|
1770
2072
|
function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSettings }) {
|
|
1771
2073
|
const t = useGuardNs("directoryForm");
|
|
1772
2074
|
const tc = useGuardNs("common");
|
|
1773
|
-
const [input, setInput] =
|
|
1774
|
-
const [error, setError] =
|
|
1775
|
-
const [busy, setBusy] =
|
|
1776
|
-
const type = types.find((x) => x.type === input.type);
|
|
1777
|
-
const definitions = type?.settings ?? fallbackSettings ?? [];
|
|
1778
|
-
function set(key, value) {
|
|
1779
|
-
setInput((prev) => ({ ...prev, [key]: value }));
|
|
1780
|
-
}
|
|
1781
|
-
function setSetting(name, value) {
|
|
1782
|
-
setInput((prev) => ({ ...prev, settings: { ...prev.settings, [name]: value } }));
|
|
1783
|
-
}
|
|
1784
|
-
function changeType(next) {
|
|
1785
|
-
const nextType = types.find((x) => x.type === next);
|
|
1786
|
-
setInput((prev) => ({ ...prev, type: next, settings: defaultsFor(nextType) }));
|
|
1787
|
-
}
|
|
1788
|
-
function applyPreset(settings) {
|
|
1789
|
-
setInput((prev) => ({ ...prev, settings: { ...prev.settings, ...settings } }));
|
|
1790
|
-
}
|
|
2075
|
+
const [input, setInput] = useState5(initial);
|
|
2076
|
+
const [error, setError] = useState5(null);
|
|
2077
|
+
const [busy, setBusy] = useState5(false);
|
|
1791
2078
|
async function submit(e) {
|
|
1792
2079
|
e.preventDefault();
|
|
1793
2080
|
setBusy(true);
|
|
@@ -1800,26 +2087,54 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1800
2087
|
setBusy(false);
|
|
1801
2088
|
}
|
|
1802
2089
|
}
|
|
1803
|
-
return /* @__PURE__ */ jsx10("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs10(
|
|
1804
|
-
/* @__PURE__ */
|
|
1805
|
-
|
|
2090
|
+
return /* @__PURE__ */ jsx10("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs10(Stack8, { gap: "field", children: [
|
|
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: [
|
|
2119
|
+
/* @__PURE__ */ jsx10(Field3, { label: t("name"), required: true, children: /* @__PURE__ */ jsx10(
|
|
1806
2120
|
TranslatedInput2,
|
|
1807
2121
|
{
|
|
1808
2122
|
value: toNamesValue(input.name, input.names),
|
|
1809
2123
|
"aria-label": t("name"),
|
|
2124
|
+
placeholder: t("namePlaceholder"),
|
|
1810
2125
|
onChange: (v) => {
|
|
1811
2126
|
const { name, names } = fromNamesValue(v);
|
|
1812
|
-
|
|
2127
|
+
onChange((prev) => ({ ...prev, name, names }));
|
|
1813
2128
|
}
|
|
1814
2129
|
}
|
|
1815
2130
|
) }),
|
|
1816
|
-
/* @__PURE__ */ jsx10(
|
|
1817
|
-
|
|
2131
|
+
/* @__PURE__ */ jsx10(Field3, { label: t("type"), required: true, children: mode === "create" ? /* @__PURE__ */ jsx10(
|
|
2132
|
+
SelectField3,
|
|
1818
2133
|
{
|
|
1819
2134
|
value: input.type,
|
|
1820
2135
|
onChange: (e) => changeType(e.target.value),
|
|
1821
2136
|
options: [
|
|
1822
|
-
{ value: "", label: t("selectType")
|
|
2137
|
+
{ value: "", label: t("selectType") },
|
|
1823
2138
|
...types.map((x) => ({
|
|
1824
2139
|
value: x.type,
|
|
1825
2140
|
label: x.pluginKey ? t("typeFromPlugin", { name: x.displayName, plugin: x.pluginKey }) : x.displayName
|
|
@@ -1827,26 +2142,27 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1827
2142
|
]
|
|
1828
2143
|
}
|
|
1829
2144
|
) : /* @__PURE__ */ jsx10(Input3, { value: type?.displayName ?? input.type, readOnly: true }) }),
|
|
1830
|
-
/* @__PURE__ */ jsx10(
|
|
2145
|
+
(!type || syncs(type.capabilities)) && /* @__PURE__ */ jsx10(Field3, { label: t("syncInterval"), children: /* @__PURE__ */ jsx10(InputGroup, { endAddon: t("minutes"), children: /* @__PURE__ */ jsx10(
|
|
1831
2146
|
Input3,
|
|
1832
2147
|
{
|
|
1833
2148
|
type: "number",
|
|
1834
2149
|
min: 1,
|
|
1835
2150
|
value: input.syncIntervalMinutes ?? "",
|
|
2151
|
+
placeholder: t("syncIntervalHint"),
|
|
1836
2152
|
onChange: (e) => set("syncIntervalMinutes", e.target.value === "" ? null : Number(e.target.value))
|
|
1837
2153
|
}
|
|
1838
|
-
) }),
|
|
1839
|
-
/* @__PURE__ */ jsxs10(
|
|
1840
|
-
/* @__PURE__ */ jsx10(
|
|
1841
|
-
/* @__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) })
|
|
1842
2158
|
] })
|
|
1843
2159
|
] }),
|
|
1844
|
-
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(", ") }) }),
|
|
1845
2161
|
definitions.length > 0 && /* @__PURE__ */ jsxs10(Fieldset.Root, { layerStyle: "sunken", p: "panel", children: [
|
|
1846
2162
|
/* @__PURE__ */ jsx10(Fieldset.Legend, { textStyle: "label", px: "1", children: t("connectionSettings") }),
|
|
1847
2163
|
/* @__PURE__ */ jsxs10(Fieldset.Content, { gap: "field", children: [
|
|
1848
2164
|
input.type && /* @__PURE__ */ jsx10(HostSlot2, { name: "guard.directory.presets", context: { type: input.type, apply: applyPreset } }),
|
|
1849
|
-
/* @__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(
|
|
1850
2166
|
Input3,
|
|
1851
2167
|
{
|
|
1852
2168
|
type: d.secret ? "password" : "text",
|
|
@@ -1858,21 +2174,16 @@ function DirectoryForm({ mode, types, initial, onSubmit, onCancel, fallbackSetti
|
|
|
1858
2174
|
}
|
|
1859
2175
|
) }, d.name)) })
|
|
1860
2176
|
] })
|
|
1861
|
-
] }),
|
|
1862
|
-
/* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: error }),
|
|
1863
|
-
/* @__PURE__ */ jsxs10(HStack8, { gap: "2", children: [
|
|
1864
|
-
/* @__PURE__ */ jsx10(Button7, { type: "submit", variant: "primary", loading: busy, disabled: !input.type, children: mode === "create" ? t("create") : t("save") }),
|
|
1865
|
-
onCancel && /* @__PURE__ */ jsx10(Button7, { onClick: onCancel, children: tc("cancel") })
|
|
1866
2177
|
] })
|
|
1867
|
-
] })
|
|
2178
|
+
] });
|
|
1868
2179
|
}
|
|
1869
2180
|
function DirectoryWarnings({ title, warnings }) {
|
|
1870
2181
|
if (!warnings || warnings.length === 0) return null;
|
|
1871
|
-
return /* @__PURE__ */ jsx10(InlineAlert7, { tone: "warning", title, "data-testid": "directory-warnings", children: /* @__PURE__ */ jsx10(
|
|
2182
|
+
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
2183
|
}
|
|
1873
2184
|
|
|
1874
2185
|
// src/areas/guard/DirectoriesScreen.tsx
|
|
1875
|
-
import { Fragment as
|
|
2186
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1876
2187
|
var EMPTY_INPUT = {
|
|
1877
2188
|
name: "",
|
|
1878
2189
|
type: "",
|
|
@@ -1883,21 +2194,67 @@ var EMPTY_INPUT = {
|
|
|
1883
2194
|
};
|
|
1884
2195
|
function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
1885
2196
|
const t = useGuardNs("directories");
|
|
2197
|
+
const tf = useGuardNs("directoryForm");
|
|
2198
|
+
const td = useGuardNs("directoryDetail");
|
|
1886
2199
|
const tc = useGuardNs("common");
|
|
1887
2200
|
const request = useAreaRequest8("guard");
|
|
2201
|
+
const navigate = useNavigate2();
|
|
2202
|
+
const confirm = useConfirm3();
|
|
1888
2203
|
const dirs = useApiQuery6("guard", "/directories");
|
|
1889
2204
|
const types = useApiQuery6("guard", "/directory-types");
|
|
1890
|
-
const action =
|
|
1891
|
-
const
|
|
1892
|
-
const [
|
|
1893
|
-
const [
|
|
1894
|
-
const [
|
|
2205
|
+
const action = useApiAction7();
|
|
2206
|
+
const dialog = useApiAction7();
|
|
2207
|
+
const [editing, setEditing] = useState6(null);
|
|
2208
|
+
const [shown, setShown] = useState6({ mode: "create" });
|
|
2209
|
+
const [input, setInput] = useState6(EMPTY_INPUT);
|
|
2210
|
+
const [notice, setNotice] = useState6(null);
|
|
2211
|
+
const [syncing, setSyncing] = useState6(null);
|
|
2212
|
+
const [warned, setWarned] = useState6(null);
|
|
1895
2213
|
const list = dirs.data ?? [];
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
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);
|
|
1901
2258
|
const result = await action.run(() => request("/directories/reorder", { method: "POST", body: { directoryIds: ids } }));
|
|
1902
2259
|
if (result) dirs.setData(result);
|
|
1903
2260
|
}
|
|
@@ -1923,88 +2280,78 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
1923
2280
|
}
|
|
1924
2281
|
await dirs.reload();
|
|
1925
2282
|
}
|
|
1926
|
-
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
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
|
+
];
|
|
1931
2299
|
}
|
|
1932
2300
|
const columns = [
|
|
1933
|
-
|
|
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 },
|
|
1934
2303
|
{
|
|
1935
2304
|
id: "name",
|
|
1936
2305
|
header: tc("name"),
|
|
1937
|
-
cell: (d) => /* @__PURE__ */ jsxs11(
|
|
1938
|
-
/* @__PURE__ */ jsx11(
|
|
1939
|
-
|
|
1940
|
-
|
|
2306
|
+
cell: (d) => /* @__PURE__ */ jsxs11(Stack9, { gap: "1", align: "flex-start", children: [
|
|
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
|
+
),
|
|
2320
|
+
!d.connectorAvailable && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.pluginKey ? t("pluginDisabledHint", { plugin: d.pluginKey }) : void 0, children: t("connectorDisabled") }),
|
|
2321
|
+
d.warnings && d.warnings.length > 0 && /* @__PURE__ */ jsx11(StatusPill7, { tone: "warning", title: d.warnings.join("\n"), children: t("warnings", { count: d.warnings.length }) })
|
|
1941
2322
|
] })
|
|
1942
2323
|
},
|
|
1943
|
-
{ id: "type", header: tc("type"), cell: (d) => d.
|
|
1944
|
-
{ id: "active", header: tc("
|
|
1945
|
-
{ 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" },
|
|
1946
2327
|
{ id: "users", header: tc("users"), numeric: true, cell: (d) => d.userCount },
|
|
1947
2328
|
{ id: "groups", header: tc("groups"), numeric: true, cell: (d) => d.groupCount },
|
|
1948
2329
|
{ id: "lastSync", header: t("lastSync"), cell: (d) => /* @__PURE__ */ jsx11(SyncStatus, { d }), skeleton: "pill" },
|
|
1949
2330
|
{
|
|
1950
2331
|
id: "actions",
|
|
1951
|
-
header: tc("actions"),
|
|
2332
|
+
header: /* @__PURE__ */ jsx11(Text11, { as: "span", srOnly: true, children: tc("actions") }),
|
|
1952
2333
|
align: "end",
|
|
1953
|
-
|
|
1954
|
-
// 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(HStack9, { gap: "1", justify: "flex-end", children: [
|
|
1956
|
-
/* @__PURE__ */ jsx11(IconButton2, { size: "sm", "aria-label": t("moveUp", { name: "" }), children: /* @__PURE__ */ jsx11(ArrowUp, {}) }),
|
|
1957
|
-
/* @__PURE__ */ jsx11(IconButton2, { size: "sm", "aria-label": t("moveDown", { name: "" }), children: /* @__PURE__ */ jsx11(ArrowDown, {}) }),
|
|
1958
|
-
/* @__PURE__ */ jsxs11(Button8, { size: "sm", children: [
|
|
1959
|
-
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
1960
|
-
t("syncNow")
|
|
1961
|
-
] })
|
|
1962
|
-
] }) }),
|
|
1963
|
-
cell: (d) => {
|
|
1964
|
-
const i = list.indexOf(d);
|
|
1965
|
-
return /* @__PURE__ */ jsxs11(HStack9, { gap: "1", justify: "flex-end", children: [
|
|
1966
|
-
/* @__PURE__ */ jsx11(IconButton2, { size: "sm", "aria-label": t("moveUp", { name: d.name }), disabled: i === 0 || action.busy, onClick: () => move(i, -1), children: /* @__PURE__ */ jsx11(ArrowUp, {}) }),
|
|
1967
|
-
/* @__PURE__ */ jsx11(IconButton2, { size: "sm", "aria-label": t("moveDown", { name: d.name }), disabled: i === list.length - 1 || action.busy, onClick: () => move(i, 1), children: /* @__PURE__ */ jsx11(ArrowDown, {}) }),
|
|
1968
|
-
/* @__PURE__ */ jsx11(Tooltip, { content: t("connectorDisabled"), disabled: d.connectorAvailable, children: /* @__PURE__ */ jsxs11(Button8, { size: "sm", disabled: syncing != null || !d.connectorAvailable, loading: syncing === d.id, onClick: () => sync(d), children: [
|
|
1969
|
-
/* @__PURE__ */ jsx11(RefreshCw, {}),
|
|
1970
|
-
t("syncNow")
|
|
1971
|
-
] }) })
|
|
1972
|
-
] });
|
|
1973
|
-
}
|
|
2334
|
+
cell: (d) => /* @__PURE__ */ jsx11(RowMenu2, { label: t("menuLabel", { name: d.name }), items: menu(d) })
|
|
1974
2335
|
}
|
|
1975
2336
|
];
|
|
1976
|
-
|
|
2337
|
+
const type = typeOf(input.type);
|
|
2338
|
+
const synced = !!type && syncs(type.capabilities);
|
|
2339
|
+
const minutes = input.syncIntervalMinutes;
|
|
2340
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
1977
2341
|
/* @__PURE__ */ jsx11(
|
|
1978
2342
|
PageHeader4,
|
|
1979
2343
|
{
|
|
1980
2344
|
title: t("title"),
|
|
1981
2345
|
description: t("subtitle"),
|
|
1982
|
-
actions:
|
|
1983
|
-
|
|
1984
|
-
|
|
2346
|
+
actions: /* @__PURE__ */ jsx11(Button9, { variant: "primary", onClick: () => {
|
|
2347
|
+
setWarned(null);
|
|
2348
|
+
open({ mode: "create" });
|
|
1985
2349
|
}, children: t("add") })
|
|
1986
2350
|
}
|
|
1987
2351
|
),
|
|
1988
|
-
/* @__PURE__ */ jsxs11(
|
|
1989
|
-
adding && /* @__PURE__ */ jsx11(Panel8, { title: t("add"), children: types.error ? /* @__PURE__ */ jsx11(InlineAlert8, { tone: "danger", children: types.error }) : (
|
|
1990
|
-
// The form is there while the types load, its fields as their ghosts.
|
|
1991
|
-
/* @__PURE__ */ jsx11(Loading2, { when: !types.data, children: /* @__PURE__ */ jsx11(
|
|
1992
|
-
DirectoryForm,
|
|
1993
|
-
{
|
|
1994
|
-
mode: "create",
|
|
1995
|
-
types: [
|
|
1996
|
-
// An internal directory, kept by the site itself: the accounts people make by signing up.
|
|
1997
|
-
{ type: "internal", displayName: t("internalType"), capabilities: ["Authenticate"], settings: [], pluginKey: null },
|
|
1998
|
-
...types.data ?? []
|
|
1999
|
-
],
|
|
2000
|
-
initial: EMPTY_INPUT,
|
|
2001
|
-
onSubmit: create,
|
|
2002
|
-
onCancel: () => setAdding(false)
|
|
2003
|
-
}
|
|
2004
|
-
) })
|
|
2005
|
-
) }),
|
|
2352
|
+
/* @__PURE__ */ jsxs11(Stack9, { gap: "section", children: [
|
|
2006
2353
|
/* @__PURE__ */ jsx11(InlineAlert8, { tone: "danger", children: action.error }),
|
|
2007
|
-
|
|
2354
|
+
warned && /* @__PURE__ */ jsx11(DirectoryWarnings, { title: t("savedWithWarnings", { name: warned.name }), warnings: warned.warnings }),
|
|
2008
2355
|
notice && /* @__PURE__ */ jsx11(InlineAlert8, { tone: notice.ok ? "success" : "warning", children: notice.text }),
|
|
2009
2356
|
/* @__PURE__ */ jsx11(Panel8, { flush: true, children: /* @__PURE__ */ jsx11(
|
|
2010
2357
|
DataTable7,
|
|
@@ -2019,35 +2366,64 @@ function DirectoriesScreen({ routes = guardRoutes() }) {
|
|
|
2019
2366
|
empty: t("empty")
|
|
2020
2367
|
}
|
|
2021
2368
|
) })
|
|
2022
|
-
] })
|
|
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
|
+
)
|
|
2023
2399
|
] });
|
|
2024
2400
|
}
|
|
2025
2401
|
|
|
2026
2402
|
// src/areas/guard/DirectoryScreen.tsx
|
|
2027
|
-
import { useMemo, useState as
|
|
2028
|
-
import { Box, Grid, HStack as HStack10, Input as Input4, List, Stack 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";
|
|
2029
2405
|
import {
|
|
2030
|
-
AppLink as
|
|
2031
|
-
Button as
|
|
2406
|
+
AppLink as AppLink5,
|
|
2407
|
+
Button as Button10,
|
|
2032
2408
|
DataTable as DataTable8,
|
|
2033
|
-
errorText as
|
|
2034
|
-
Field as
|
|
2409
|
+
errorText as errorText5,
|
|
2410
|
+
Field as Field4,
|
|
2035
2411
|
HostSlot as HostSlot3,
|
|
2036
2412
|
InlineAlert as InlineAlert9,
|
|
2037
2413
|
Loading as Loading3,
|
|
2038
2414
|
PageHeader as PageHeader5,
|
|
2039
2415
|
Panel as Panel9,
|
|
2040
2416
|
PropertyList as PropertyList3,
|
|
2041
|
-
StatusPill as
|
|
2417
|
+
StatusPill as StatusPill8,
|
|
2042
2418
|
TextSlot as TextSlot2,
|
|
2043
|
-
useApiAction as
|
|
2419
|
+
useApiAction as useApiAction8,
|
|
2044
2420
|
useApiQuery as useApiQuery7,
|
|
2045
2421
|
useAreaRequest as useAreaRequest9,
|
|
2046
|
-
useConfirm as
|
|
2422
|
+
useConfirm as useConfirm4,
|
|
2047
2423
|
useFormatters as useFormatters7,
|
|
2048
|
-
useNavigate as
|
|
2424
|
+
useNavigate as useNavigate3
|
|
2049
2425
|
} from "@abpjs/ui";
|
|
2050
|
-
import { Fragment as
|
|
2426
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2051
2427
|
var STEPS = ["Connection", "FindUser", "Authenticate", "Precedence"];
|
|
2052
2428
|
var PLACEHOLDER = { name: "", type: "", isActive: true, authenticationEnabled: true, syncIntervalMinutes: 60, settings: {} };
|
|
2053
2429
|
function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
@@ -2055,40 +2431,27 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2055
2431
|
const tc = useGuardNs("common");
|
|
2056
2432
|
const tn = useGuardNs("nav");
|
|
2057
2433
|
const fmt = useFormatters7();
|
|
2058
|
-
const confirm =
|
|
2059
|
-
const navigate =
|
|
2434
|
+
const confirm = useConfirm4();
|
|
2435
|
+
const navigate = useNavigate3();
|
|
2060
2436
|
const request = useAreaRequest9("guard");
|
|
2061
2437
|
const dirs = useApiQuery7("guard", "/directories");
|
|
2062
2438
|
const types = useApiQuery7("guard", "/directory-types");
|
|
2063
2439
|
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] =
|
|
2440
|
+
const action = useApiAction8();
|
|
2441
|
+
const [saved, setSaved] = useState7(false);
|
|
2442
|
+
const [formKey, setFormKey] = useState7(0);
|
|
2443
|
+
const [test, setTest] = useState7(null);
|
|
2444
|
+
const [syncMsg, setSyncMsg] = useState7(null);
|
|
2069
2445
|
const dir = dirs.data?.find((d) => d.id === id);
|
|
2070
2446
|
const type = types.data?.find((x) => x.type === dir?.type);
|
|
2071
|
-
const secretNames =
|
|
2072
|
-
const initial =
|
|
2073
|
-
|
|
2074
|
-
const settings = {};
|
|
2075
|
-
for (const [k, v] of Object.entries(dir.settings)) settings[k] = secretNames.has(k) || v === "********" ? "" : v;
|
|
2076
|
-
return {
|
|
2077
|
-
name: dir.name,
|
|
2078
|
-
names: dir.names,
|
|
2079
|
-
type: dir.type,
|
|
2080
|
-
isActive: dir.isActive,
|
|
2081
|
-
authenticationEnabled: dir.authenticationEnabled,
|
|
2082
|
-
syncIntervalMinutes: dir.syncIntervalMinutes,
|
|
2083
|
-
settings
|
|
2084
|
-
};
|
|
2085
|
-
}, [dir, secretNames]);
|
|
2086
|
-
const fallbackSettings = useMemo(
|
|
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(
|
|
2087
2450
|
() => Object.keys(dir?.settings ?? {}).map((name) => ({
|
|
2088
2451
|
name,
|
|
2089
2452
|
label: name,
|
|
2090
2453
|
required: false,
|
|
2091
|
-
secret: dir?.settings[name] ===
|
|
2454
|
+
secret: dir?.settings[name] === MASKED_SECRET,
|
|
2092
2455
|
defaultValue: null,
|
|
2093
2456
|
help: null
|
|
2094
2457
|
})),
|
|
@@ -2129,9 +2492,9 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2129
2492
|
if (dirs.error) return /* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", children: dirs.error });
|
|
2130
2493
|
const loading = !dirs.data || !types.data;
|
|
2131
2494
|
if (!loading && (!dir || !initial))
|
|
2132
|
-
return /* @__PURE__ */ jsxs12(
|
|
2495
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2133
2496
|
/* @__PURE__ */ jsx12(PageHeader5, { breadcrumbs: [{ label: tn("directories"), href: routes.directories }], title: t("notFound") }),
|
|
2134
|
-
/* @__PURE__ */ jsx12(
|
|
2497
|
+
/* @__PURE__ */ jsx12(AppLink5, { href: routes.directories, children: t("back") })
|
|
2135
2498
|
] });
|
|
2136
2499
|
const runColumns = [
|
|
2137
2500
|
{ id: "started", header: t("started"), nowrap: true, cell: (r) => fmt.dateTime(r.startedAt), skeleton: "date", skeletonWidth: 17 },
|
|
@@ -2145,7 +2508,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2145
2508
|
{
|
|
2146
2509
|
id: "error",
|
|
2147
2510
|
header: t("error"),
|
|
2148
|
-
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 })
|
|
2149
2512
|
}
|
|
2150
2513
|
];
|
|
2151
2514
|
return /* @__PURE__ */ jsxs12(Loading3, { when: loading, children: [
|
|
@@ -2154,21 +2517,21 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2154
2517
|
{
|
|
2155
2518
|
breadcrumbs: [{ label: tn("directories"), href: routes.directories }, { label: dir?.name }],
|
|
2156
2519
|
title: dir?.name,
|
|
2157
|
-
meta: /* @__PURE__ */ jsxs12(
|
|
2158
|
-
/* @__PURE__ */ jsx12(
|
|
2159
|
-
/* @__PURE__ */ jsx12(
|
|
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(
|
|
2520
|
+
meta: /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
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 }) }) }),
|
|
2523
|
+
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.isActive, yes: tc("active"), no: tc("inactive") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2524
|
+
dir ? /* @__PURE__ */ jsx12(FlagPill, { value: dir.authenticationEnabled, yes: t("signInEnabled"), no: t("signInDisabled") }) : /* @__PURE__ */ jsx12(StatusPill8, {}),
|
|
2525
|
+
dir && !dir.connectorAvailable && /* @__PURE__ */ jsx12(StatusPill8, { tone: "warning", children: t("connectorDisabled") })
|
|
2163
2526
|
] }),
|
|
2164
|
-
actions: /* @__PURE__ */ jsxs12(
|
|
2165
|
-
/* @__PURE__ */ jsx12(
|
|
2166
|
-
/* @__PURE__ */ jsx12(
|
|
2167
|
-
dir?.type !== "internal" && /* @__PURE__ */ jsx12(
|
|
2527
|
+
actions: /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
2528
|
+
/* @__PURE__ */ jsx12(Button10, { onClick: testConnection, disabled: action.busy || dir?.connectorAvailable === false, children: t("testConnection") }),
|
|
2529
|
+
/* @__PURE__ */ jsx12(Button10, { onClick: syncNow, disabled: action.busy || dir?.connectorAvailable === false, children: t("syncNow") }),
|
|
2530
|
+
dir?.type !== "internal" && /* @__PURE__ */ jsx12(Button10, { danger: true, onClick: remove, disabled: action.busy, children: tc("delete") })
|
|
2168
2531
|
] })
|
|
2169
2532
|
}
|
|
2170
2533
|
),
|
|
2171
|
-
/* @__PURE__ */ jsxs12(
|
|
2534
|
+
/* @__PURE__ */ jsxs12(Stack10, { gap: "section", children: [
|
|
2172
2535
|
/* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", children: action.error }),
|
|
2173
2536
|
dir && /* @__PURE__ */ jsx12(DirectoryWarnings, { title: t("warningsTitle"), warnings: dir.warnings }),
|
|
2174
2537
|
test && /* @__PURE__ */ jsxs12(InlineAlert9, { tone: test.succeeded ? "success" : "warning", title: test.succeeded ? t("connectionSucceeded") : t("connectionFailed"), children: [
|
|
@@ -2177,7 +2540,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2177
2540
|
] }),
|
|
2178
2541
|
syncMsg && /* @__PURE__ */ jsx12(InlineAlert9, { tone: syncMsg.ok ? "success" : "warning", children: syncMsg.text }),
|
|
2179
2542
|
/* @__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(
|
|
2543
|
+
/* @__PURE__ */ jsx12(Panel9, { title: t("settings"), children: /* @__PURE__ */ jsxs12(Stack10, { gap: "field", children: [
|
|
2181
2544
|
saved && /* @__PURE__ */ jsx12(InlineAlert9, { tone: "success", children: t("saved") }),
|
|
2182
2545
|
/* @__PURE__ */ jsx12(
|
|
2183
2546
|
DirectoryForm,
|
|
@@ -2191,7 +2554,7 @@ function DirectoryScreen({ id, routes = guardRoutes() }) {
|
|
|
2191
2554
|
loading ? "loading" : formKey
|
|
2192
2555
|
)
|
|
2193
2556
|
] }) }),
|
|
2194
|
-
/* @__PURE__ */ jsxs12(
|
|
2557
|
+
/* @__PURE__ */ jsxs12(Stack10, { gap: "section", children: [
|
|
2195
2558
|
/* @__PURE__ */ jsx12(Panel9, { title: t("summary"), children: /* @__PURE__ */ jsx12(
|
|
2196
2559
|
PropertyList3,
|
|
2197
2560
|
{
|
|
@@ -2235,11 +2598,11 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2235
2598
|
const tc = useGuardNs("common");
|
|
2236
2599
|
const ts = useGuardNs("directoryDetail.steps");
|
|
2237
2600
|
const request = useAreaRequest9("guard");
|
|
2238
|
-
const [username, setUsername] =
|
|
2239
|
-
const [password, setPassword] =
|
|
2240
|
-
const [result, setResult] =
|
|
2241
|
-
const [error, setError] =
|
|
2242
|
-
const [busy, setBusy] =
|
|
2601
|
+
const [username, setUsername] = useState7("");
|
|
2602
|
+
const [password, setPassword] = useState7("");
|
|
2603
|
+
const [result, setResult] = useState7(null);
|
|
2604
|
+
const [error, setError] = useState7(null);
|
|
2605
|
+
const [busy, setBusy] = useState7(false);
|
|
2243
2606
|
async function submit(e) {
|
|
2244
2607
|
e.preventDefault();
|
|
2245
2608
|
setBusy(true);
|
|
@@ -2248,7 +2611,7 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2248
2611
|
try {
|
|
2249
2612
|
setResult(await request(`/directories/${directoryId}/test-login`, { method: "POST", body: { username, password } }));
|
|
2250
2613
|
} catch (err) {
|
|
2251
|
-
setError(
|
|
2614
|
+
setError(errorText5(err));
|
|
2252
2615
|
} finally {
|
|
2253
2616
|
setBusy(false);
|
|
2254
2617
|
}
|
|
@@ -2258,62 +2621,62 @@ function TestLoginPanel({ directoryId, disabled }) {
|
|
|
2258
2621
|
...STEPS.map((step) => ({ step, label: ts(step), r: result.steps.find((s) => s.step === step) })),
|
|
2259
2622
|
...result.steps.filter((s) => !known.has(s.step)).map((s) => ({ step: s.step, label: s.step, r: s }))
|
|
2260
2623
|
] : [];
|
|
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(
|
|
2624
|
+
return /* @__PURE__ */ jsx12(Panel9, { title: t("testLogin"), description: t("testLoginHint"), children: /* @__PURE__ */ jsxs12(Stack10, { gap: "stack", children: [
|
|
2625
|
+
/* @__PURE__ */ jsx12("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs12(Stack10, { gap: "stack", children: [
|
|
2626
|
+
/* @__PURE__ */ jsx12(Field4, { label: tc("username"), required: true, children: /* @__PURE__ */ jsx12(Input4, { size: "sm", value: username, onChange: (e) => setUsername(e.target.value), autoComplete: "off" }) }),
|
|
2627
|
+
/* @__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" }) }),
|
|
2628
|
+
/* @__PURE__ */ jsx12(Button10, { type: "submit", size: "sm", w: "full", loading: busy, disabled, children: t("runTest") })
|
|
2266
2629
|
] }) }),
|
|
2267
2630
|
/* @__PURE__ */ jsx12(InlineAlert9, { tone: "danger", size: "sm", children: error }),
|
|
2268
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: [
|
|
2269
2632
|
/* @__PURE__ */ jsxs12(HStack10, { justify: "space-between", gap: "2", children: [
|
|
2270
|
-
/* @__PURE__ */ jsx12(
|
|
2633
|
+
/* @__PURE__ */ jsx12(Text12, { textStyle: "label", children: label }),
|
|
2271
2634
|
/* @__PURE__ */ jsx12(PassFail, { ok: r ? r.succeeded : null })
|
|
2272
2635
|
] }),
|
|
2273
|
-
r?.message && /* @__PURE__ */ jsx12(
|
|
2636
|
+
r?.message && /* @__PURE__ */ jsx12(Text12, { textStyle: "caption", color: "fg.muted", mt: "1", children: r.message })
|
|
2274
2637
|
] }) }, step)) })
|
|
2275
2638
|
] }) });
|
|
2276
2639
|
}
|
|
2277
2640
|
|
|
2278
2641
|
// src/areas/guard/GroupScreen.tsx
|
|
2279
|
-
import { useEffect, useState as
|
|
2280
|
-
import { Grid as Grid2, HStack as HStack13, Input as Input5, List as List3, Stack as
|
|
2642
|
+
import { useEffect, useState as useState10 } from "react";
|
|
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";
|
|
2281
2644
|
import {
|
|
2282
|
-
AppLink as
|
|
2283
|
-
Button as
|
|
2645
|
+
AppLink as AppLink7,
|
|
2646
|
+
Button as Button11,
|
|
2284
2647
|
DataTable as DataTable9,
|
|
2285
|
-
errorText as
|
|
2286
|
-
Field as
|
|
2648
|
+
errorText as errorText8,
|
|
2649
|
+
Field as Field5,
|
|
2287
2650
|
InlineAlert as InlineAlert11,
|
|
2288
2651
|
Loading as Loading4,
|
|
2289
2652
|
notify as notify7,
|
|
2290
2653
|
PageHeader as PageHeader6,
|
|
2291
2654
|
Panel as Panel11,
|
|
2292
2655
|
PathChips as PathChips2,
|
|
2293
|
-
RecordKey as
|
|
2656
|
+
RecordKey as RecordKey5,
|
|
2294
2657
|
SearchInput as SearchInput2,
|
|
2295
|
-
StatusPill as
|
|
2658
|
+
StatusPill as StatusPill10,
|
|
2296
2659
|
TextBone,
|
|
2297
2660
|
TextSlot as TextSlot3,
|
|
2298
2661
|
TranslatedInput as TranslatedInput3,
|
|
2299
|
-
useApiAction as
|
|
2662
|
+
useApiAction as useApiAction9,
|
|
2300
2663
|
useApiQuery as useApiQuery8,
|
|
2301
2664
|
useAreaRequest as useAreaRequest12,
|
|
2302
|
-
useConfirm as
|
|
2303
|
-
useNavigate as
|
|
2665
|
+
useConfirm as useConfirm5,
|
|
2666
|
+
useNavigate as useNavigate4,
|
|
2304
2667
|
useSettledValue
|
|
2305
2668
|
} from "@abpjs/ui";
|
|
2306
2669
|
import { fromNamesValue as fromNamesValue2, splitList, toNamesValue as toNamesValue2 } from "@abpjs/ui/rules";
|
|
2307
2670
|
|
|
2308
2671
|
// src/areas/guard/GroupTree.tsx
|
|
2309
|
-
import { useState as
|
|
2310
|
-
import { Box as Box2, HStack as HStack11, List as List2, Text as
|
|
2672
|
+
import { useState as useState8 } from "react";
|
|
2673
|
+
import { Box as Box2, HStack as HStack11, List as List2, Text as Text13 } from "@chakra-ui/react";
|
|
2311
2674
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
2312
|
-
import { AppLink as
|
|
2675
|
+
import { AppLink as AppLink6, DirectionalIcon, errorText as errorText6, IconButton, StatusPill as StatusPill9, useAreaRequest as useAreaRequest10 } from "@abpjs/ui";
|
|
2313
2676
|
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2314
2677
|
function GroupTree({ rootId, rootName, rootMembers, routes = guardRoutes() }) {
|
|
2315
2678
|
return /* @__PURE__ */ jsxs13(Box2, { textStyle: "md", role: "tree", "aria-label": rootName, children: [
|
|
2316
|
-
/* @__PURE__ */ jsx13(
|
|
2679
|
+
/* @__PURE__ */ jsx13(Text13, { fontWeight: "medium", children: rootName }),
|
|
2317
2680
|
/* @__PURE__ */ jsx13(Children, { members: rootMembers, ancestors: [rootId], routes })
|
|
2318
2681
|
] });
|
|
2319
2682
|
}
|
|
@@ -2329,9 +2692,9 @@ function Children({ members, ancestors, routes }) {
|
|
|
2329
2692
|
function Node({ member, ancestors, routes }) {
|
|
2330
2693
|
const t = useGuardNs("groupDetail");
|
|
2331
2694
|
const request = useAreaRequest10("guard");
|
|
2332
|
-
const [open, setOpen] =
|
|
2333
|
-
const [detail, setDetail] =
|
|
2334
|
-
const [error, setError] =
|
|
2695
|
+
const [open, setOpen] = useState8(false);
|
|
2696
|
+
const [detail, setDetail] = useState8(null);
|
|
2697
|
+
const [error, setError] = useState8(null);
|
|
2335
2698
|
const cyclic = ancestors.includes(member.memberId);
|
|
2336
2699
|
async function toggle() {
|
|
2337
2700
|
const next = !open;
|
|
@@ -2341,14 +2704,14 @@ function Node({ member, ancestors, routes }) {
|
|
|
2341
2704
|
setError(null);
|
|
2342
2705
|
setDetail(await request(`/groups/${member.memberId}`));
|
|
2343
2706
|
} catch (e) {
|
|
2344
|
-
setError(
|
|
2707
|
+
setError(errorText6(e));
|
|
2345
2708
|
}
|
|
2346
2709
|
}
|
|
2347
2710
|
}
|
|
2348
2711
|
return /* @__PURE__ */ jsxs13(List2.Item, { role: "treeitem", "aria-expanded": cyclic ? void 0 : open, display: "block", children: [
|
|
2349
2712
|
/* @__PURE__ */ jsxs13(HStack11, { gap: "1", children: [
|
|
2350
2713
|
cyclic ? /* @__PURE__ */ jsx13(Box2, { boxSize: "control.xs", flexShrink: "0" }) : /* @__PURE__ */ jsx13(
|
|
2351
|
-
|
|
2714
|
+
IconButton,
|
|
2352
2715
|
{
|
|
2353
2716
|
size: "xs",
|
|
2354
2717
|
"aria-label": open ? t("collapse", { name: member.name }) : t("expand", { name: member.name }),
|
|
@@ -2356,28 +2719,28 @@ function Node({ member, ancestors, routes }) {
|
|
|
2356
2719
|
children: open ? /* @__PURE__ */ jsx13(ChevronDown, {}) : /* @__PURE__ */ jsx13(DirectionalIcon, { children: /* @__PURE__ */ jsx13(ChevronRight, {}) })
|
|
2357
2720
|
}
|
|
2358
2721
|
),
|
|
2359
|
-
/* @__PURE__ */ jsx13(
|
|
2360
|
-
cyclic && /* @__PURE__ */ jsx13(
|
|
2722
|
+
/* @__PURE__ */ jsx13(AppLink6, { href: routes.group(member.memberId), children: member.name }),
|
|
2723
|
+
cyclic && /* @__PURE__ */ jsx13(StatusPill9, { tone: "warning", children: t("cycle") })
|
|
2361
2724
|
] }),
|
|
2362
2725
|
open && !cyclic && /* @__PURE__ */ jsxs13(Box2, { children: [
|
|
2363
|
-
error && /* @__PURE__ */ jsx13(
|
|
2364
|
-
!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") }),
|
|
2365
2728
|
detail && /* @__PURE__ */ jsx13(Children, { members: detail.members, ancestors: [...ancestors, member.memberId], routes })
|
|
2366
2729
|
] })
|
|
2367
2730
|
] });
|
|
2368
2731
|
}
|
|
2369
2732
|
|
|
2370
2733
|
// src/areas/guard/GroupTwoFactorPanel.tsx
|
|
2371
|
-
import { useState as
|
|
2372
|
-
import { Box as Box3, chakra, HStack as HStack12, Stack as
|
|
2373
|
-
import { errorText as
|
|
2734
|
+
import { useState as useState9 } from "react";
|
|
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";
|
|
2374
2737
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2375
2738
|
var TWO_FACTOR_MODES = ["off", "optional", "required", "strong"];
|
|
2376
2739
|
function GroupTwoFactorPanel({ group, onSaved }) {
|
|
2377
2740
|
const t = useGuardNs("groupDetail.twoFactor");
|
|
2378
2741
|
const request = useAreaRequest11("guard");
|
|
2379
|
-
const [mode, setMode] =
|
|
2380
|
-
const [error, setError] =
|
|
2742
|
+
const [mode, setMode] = useState9(group.twoFactor ?? "off");
|
|
2743
|
+
const [error, setError] = useState9(null);
|
|
2381
2744
|
async function choose(next) {
|
|
2382
2745
|
if (next === mode) return;
|
|
2383
2746
|
const before = mode;
|
|
@@ -2389,13 +2752,13 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2389
2752
|
onSaved(updated);
|
|
2390
2753
|
} catch (e) {
|
|
2391
2754
|
setMode(before);
|
|
2392
|
-
setError(
|
|
2755
|
+
setError(errorText7(e));
|
|
2393
2756
|
}
|
|
2394
2757
|
}
|
|
2395
|
-
return /* @__PURE__ */ jsx14(Panel10, { title: t("title"), description: t("hint"), "data-testid": "group-two-factor", children: /* @__PURE__ */ jsxs14(
|
|
2758
|
+
return /* @__PURE__ */ jsx14(Panel10, { title: t("title"), description: t("hint"), "data-testid": "group-two-factor", children: /* @__PURE__ */ jsxs14(Stack11, { gap: "2", children: [
|
|
2396
2759
|
/* @__PURE__ */ jsx14(InlineAlert10, { tone: "danger", children: error }),
|
|
2397
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(
|
|
2398
|
-
|
|
2761
|
+
chakra2.button,
|
|
2399
2762
|
{
|
|
2400
2763
|
type: "button",
|
|
2401
2764
|
role: "radio",
|
|
@@ -2418,12 +2781,12 @@ function GroupTwoFactorPanel({ group, onSaved }) {
|
|
|
2418
2781
|
},
|
|
2419
2782
|
choice
|
|
2420
2783
|
)) }),
|
|
2421
|
-
/* @__PURE__ */ jsx14(
|
|
2784
|
+
/* @__PURE__ */ jsx14(Text14, { textStyle: "body.sm", color: "fg.muted", "aria-live": "polite", children: t(`modeHints.${mode}`) })
|
|
2422
2785
|
] }) });
|
|
2423
2786
|
}
|
|
2424
2787
|
|
|
2425
2788
|
// src/areas/guard/GroupScreen.tsx
|
|
2426
|
-
import { Fragment as
|
|
2789
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2427
2790
|
function isSystemGroup(group) {
|
|
2428
2791
|
return group.system ?? false;
|
|
2429
2792
|
}
|
|
@@ -2434,12 +2797,12 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2434
2797
|
const tn = useGuardNs("nav");
|
|
2435
2798
|
const tf = useGuardNs("groupDetail.twoFactor");
|
|
2436
2799
|
const written = useWrittenName();
|
|
2437
|
-
const confirm =
|
|
2438
|
-
const navigate =
|
|
2800
|
+
const confirm = useConfirm5();
|
|
2801
|
+
const navigate = useNavigate4();
|
|
2439
2802
|
const request = useAreaRequest12("guard");
|
|
2440
2803
|
const detail = useApiQuery8("guard", `/groups/${id}`);
|
|
2441
|
-
const action =
|
|
2442
|
-
const [treeKey, setTreeKey] =
|
|
2804
|
+
const action = useApiAction9();
|
|
2805
|
+
const [treeKey, setTreeKey] = useState10(0);
|
|
2443
2806
|
async function reload() {
|
|
2444
2807
|
await detail.reload();
|
|
2445
2808
|
setTreeKey((k) => k + 1);
|
|
@@ -2472,7 +2835,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2472
2835
|
id: "type",
|
|
2473
2836
|
header: tc("type"),
|
|
2474
2837
|
sortValue: (m) => m.memberType === "Group" ? 0 : 1,
|
|
2475
|
-
cell: (m) => m.memberType === "Group" ? /* @__PURE__ */ jsx15(
|
|
2838
|
+
cell: (m) => m.memberType === "Group" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tc("group") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tc("account") }),
|
|
2476
2839
|
skeleton: "pill"
|
|
2477
2840
|
},
|
|
2478
2841
|
{
|
|
@@ -2480,8 +2843,8 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2480
2843
|
header: tc("name"),
|
|
2481
2844
|
sortValue: (m) => m.name,
|
|
2482
2845
|
cell: (m) => /* @__PURE__ */ jsxs15(HStack13, { gap: "2", wrap: "wrap", children: [
|
|
2483
|
-
m.memberType === "Group" ? /* @__PURE__ */ jsx15(
|
|
2484
|
-
m.displayName && m.displayName !== m.name && /* @__PURE__ */ jsx15(
|
|
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 })
|
|
2485
2848
|
] }),
|
|
2486
2849
|
skeleton: "key"
|
|
2487
2850
|
},
|
|
@@ -2490,15 +2853,15 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2490
2853
|
id: "source",
|
|
2491
2854
|
header: tc("source"),
|
|
2492
2855
|
sortValue: (m) => m.source,
|
|
2493
|
-
cell: (m) => m.source === "Directory" ? /* @__PURE__ */ jsx15(
|
|
2856
|
+
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
2857
|
skeleton: "pill"
|
|
2495
2858
|
},
|
|
2496
2859
|
{
|
|
2497
2860
|
id: "actions",
|
|
2498
|
-
header: /* @__PURE__ */ jsx15(
|
|
2861
|
+
header: /* @__PURE__ */ jsx15(Text15, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2499
2862
|
align: "end",
|
|
2500
|
-
cell: (m) => m.removable && /* @__PURE__ */ jsx15(
|
|
2501
|
-
skeleton: () => /* @__PURE__ */ jsx15(
|
|
2863
|
+
cell: (m) => m.removable && /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, onClick: () => removeMember(m), disabled: action.busy, children: t("remove") }),
|
|
2864
|
+
skeleton: () => /* @__PURE__ */ jsx15(Button11, { size: "sm", variant: "ghost", danger: true, children: t("remove") })
|
|
2502
2865
|
}
|
|
2503
2866
|
];
|
|
2504
2867
|
const effectiveColumns = [
|
|
@@ -2506,7 +2869,7 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2506
2869
|
id: "username",
|
|
2507
2870
|
header: tc("username"),
|
|
2508
2871
|
sortValue: (m) => m.username,
|
|
2509
|
-
cell: (m) => /* @__PURE__ */ jsx15(
|
|
2872
|
+
cell: (m) => /* @__PURE__ */ jsx15(RecordKey5, { value: m.username, href: routes.account(m.accountId) }),
|
|
2510
2873
|
skeleton: "key"
|
|
2511
2874
|
},
|
|
2512
2875
|
{ id: "displayName", header: tc("displayName"), sortValue: (m) => m.displayName, cell: (m) => m.displayName, skeleton: "person" },
|
|
@@ -2519,17 +2882,17 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2519
2882
|
breadcrumbs: [{ label: tn("groups"), href: routes.groups }, { label: group && written(group.name, group.names) }],
|
|
2520
2883
|
title: group && written(group.name, group.names),
|
|
2521
2884
|
description: group?.description ?? void 0,
|
|
2522
|
-
meta: /* @__PURE__ */ jsxs15(
|
|
2523
|
-
/* @__PURE__ */ jsx15(
|
|
2524
|
-
/* @__PURE__ */ jsx15(
|
|
2525
|
-
!group ? /* @__PURE__ */ jsx15(
|
|
2526
|
-
!group ? /* @__PURE__ */ jsx15(
|
|
2527
|
-
group && group.twoFactor && group.twoFactor !== "off" && /* @__PURE__ */ jsx15(
|
|
2885
|
+
meta: /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
2886
|
+
/* @__PURE__ */ jsx15(Text15, { as: "span", children: /* @__PURE__ */ jsx15(TextSlot3, { width: 10, children: group?.directoryName }) }),
|
|
2887
|
+
/* @__PURE__ */ jsx15(StatusPill10, { dot: false, children: group && tg(`kinds.${group.kind}`) }),
|
|
2888
|
+
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.isLocal ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "accent", children: tg("local") }) : /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tg("synced") }),
|
|
2889
|
+
!group ? /* @__PURE__ */ jsx15(StatusPill10, {}) : group.writable ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "success", children: t("writable") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tg("readOnly") }),
|
|
2890
|
+
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
2891
|
] }),
|
|
2529
|
-
actions: (!group || group.isLocal && !group.computed && !isSystemGroup(group)) && /* @__PURE__ */ jsx15(
|
|
2892
|
+
actions: (!group || group.isLocal && !group.computed && !isSystemGroup(group)) && /* @__PURE__ */ jsx15(Button11, { danger: true, onClick: deleteGroup, disabled: action.busy, children: t("delete") })
|
|
2530
2893
|
}
|
|
2531
2894
|
),
|
|
2532
|
-
/* @__PURE__ */ jsxs15(
|
|
2895
|
+
/* @__PURE__ */ jsxs15(Stack12, { gap: "section", children: [
|
|
2533
2896
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error }),
|
|
2534
2897
|
group && group.writable && group.isLocal && /* @__PURE__ */ jsx15(GroupNames, { group, onSaved: reload }),
|
|
2535
2898
|
/* @__PURE__ */ jsxs15(Grid2, { templateColumns: { base: "minmax(0, 1fr)", lg: "minmax(0, 1fr) {sizes.sidePanel}" }, gap: "section", alignItems: "start", children: [
|
|
@@ -2544,10 +2907,10 @@ function GroupScreen({ id, routes = guardRoutes() }) {
|
|
|
2544
2907
|
empty: t("noMembers")
|
|
2545
2908
|
}
|
|
2546
2909
|
) }),
|
|
2547
|
-
/* @__PURE__ */ jsxs15(
|
|
2548
|
-
/* @__PURE__ */ jsx15(Panel11, { title: /* @__PURE__ */ jsx15(TextSlot3, { width: 14, children: t("memberOf", { count: parents?.length ?? 0 }) }), children: !parents ? /* @__PURE__ */ jsx15(
|
|
2549
|
-
/* @__PURE__ */ jsx15(
|
|
2550
|
-
/* @__PURE__ */ jsx15(
|
|
2910
|
+
/* @__PURE__ */ jsxs15(Stack12, { gap: "section", children: [
|
|
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 })
|
|
2551
2914
|
] }) }, p.id)) }) }),
|
|
2552
2915
|
group && detail.data && /* @__PURE__ */ jsx15(GroupTwoFactorPanel, { group, onSaved: (updated) => detail.data && detail.setData({ ...detail.data, group: updated }) }, group.id),
|
|
2553
2916
|
group && members && hasGroupMembers && /* @__PURE__ */ jsx15(Panel11, { title: t("nestedGroups"), children: /* @__PURE__ */ jsx15(GroupTree, { rootId: group.id, rootName: group.name, rootMembers: members, routes }, treeKey) })
|
|
@@ -2573,11 +2936,11 @@ function OrganizationPanel({ group, onSaved }) {
|
|
|
2573
2936
|
const t = useGuardNs("groupDetail");
|
|
2574
2937
|
const tg = useGuardNs("groups");
|
|
2575
2938
|
const request = useAreaRequest12("guard");
|
|
2576
|
-
const [domains, setDomains] =
|
|
2577
|
-
const [attributes, setAttributes] =
|
|
2939
|
+
const [domains, setDomains] = useState10(group.emailDomains.join(", "));
|
|
2940
|
+
const [attributes, setAttributes] = useState10(
|
|
2578
2941
|
Object.entries(group.attributes).map(([k, v]) => `${k} = ${v}`).join("\n")
|
|
2579
2942
|
);
|
|
2580
|
-
const action =
|
|
2943
|
+
const action = useApiAction9();
|
|
2581
2944
|
async function save() {
|
|
2582
2945
|
const parsed = {};
|
|
2583
2946
|
for (const line of attributes.split("\n").map((l) => l.trim()).filter(Boolean)) {
|
|
@@ -2596,24 +2959,24 @@ function OrganizationPanel({ group, onSaved }) {
|
|
|
2596
2959
|
await onSaved();
|
|
2597
2960
|
}
|
|
2598
2961
|
}
|
|
2599
|
-
return /* @__PURE__ */ jsx15(Panel11, { title: t("organization"), description: t("organizationHint"), "data-testid": "organization", children: /* @__PURE__ */ jsxs15(
|
|
2600
|
-
/* @__PURE__ */ jsx15(
|
|
2601
|
-
/* @__PURE__ */ jsx15(
|
|
2962
|
+
return /* @__PURE__ */ jsx15(Panel11, { title: t("organization"), description: t("organizationHint"), "data-testid": "organization", children: /* @__PURE__ */ jsxs15(Stack12, { gap: "field", maxW: "2xl", children: [
|
|
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" }) }),
|
|
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" }) }),
|
|
2602
2965
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error }),
|
|
2603
|
-
/* @__PURE__ */ jsx15(HStack13, { children: /* @__PURE__ */ jsx15(
|
|
2966
|
+
/* @__PURE__ */ jsx15(HStack13, { children: /* @__PURE__ */ jsx15(Button11, { onClick: () => void save(), loading: action.busy, children: t("saveOrganization") }) })
|
|
2604
2967
|
] }) });
|
|
2605
2968
|
}
|
|
2606
2969
|
function AddMember({ groupId, existing, onAdded }) {
|
|
2607
2970
|
const t = useGuardNs("groupDetail");
|
|
2608
2971
|
const tc = useGuardNs("common");
|
|
2609
2972
|
const request = useAreaRequest12("guard");
|
|
2610
|
-
const [query, setQuery] =
|
|
2973
|
+
const [query, setQuery] = useState10("");
|
|
2611
2974
|
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] =
|
|
2975
|
+
const [accounts, setAccounts] = useState10([]);
|
|
2976
|
+
const [groups, setGroups] = useState10([]);
|
|
2977
|
+
const [searchError, setSearchError] = useState10(null);
|
|
2978
|
+
const [error, setError] = useState10(null);
|
|
2979
|
+
const [busyId, setBusyId] = useState10(null);
|
|
2617
2980
|
useEffect(() => {
|
|
2618
2981
|
if (!settled) {
|
|
2619
2982
|
setAccounts([]);
|
|
@@ -2627,7 +2990,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2627
2990
|
setAccounts(a.slice(0, 10));
|
|
2628
2991
|
setGroups(g.filter((x) => x.id !== groupId).slice(0, 10));
|
|
2629
2992
|
setSearchError(null);
|
|
2630
|
-
}).catch((e) => !cancelled && setSearchError(
|
|
2993
|
+
}).catch((e) => !cancelled && setSearchError(errorText8(e)));
|
|
2631
2994
|
return () => {
|
|
2632
2995
|
cancelled = true;
|
|
2633
2996
|
};
|
|
@@ -2640,7 +3003,7 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2640
3003
|
await request(`/groups/${groupId}/members`, { method: "POST", body });
|
|
2641
3004
|
await onAdded();
|
|
2642
3005
|
} catch (e) {
|
|
2643
|
-
setError(
|
|
3006
|
+
setError(errorText8(e));
|
|
2644
3007
|
} finally {
|
|
2645
3008
|
setBusyId(null);
|
|
2646
3009
|
}
|
|
@@ -2655,28 +3018,28 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2655
3018
|
id: "type",
|
|
2656
3019
|
header: tc("type"),
|
|
2657
3020
|
width: "24",
|
|
2658
|
-
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(
|
|
3021
|
+
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(StatusPill10, { tone: "info", children: tc("group") }) : /* @__PURE__ */ jsx15(StatusPill10, { children: tc("account") })
|
|
2659
3022
|
},
|
|
2660
3023
|
{
|
|
2661
3024
|
id: "name",
|
|
2662
3025
|
header: tc("name"),
|
|
2663
|
-
cell: (c) => c.kind === "Group" ? /* @__PURE__ */ jsx15(
|
|
2664
|
-
/* @__PURE__ */ jsx15(
|
|
2665
|
-
/* @__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: [
|
|
3027
|
+
/* @__PURE__ */ jsx15(RecordKey5, { value: c.account.username }),
|
|
3028
|
+
/* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: c.account.displayName })
|
|
2666
3029
|
] })
|
|
2667
3030
|
},
|
|
2668
3031
|
{ id: "directory", header: tc("directory"), cell: (c) => c.kind === "Group" ? c.group.directoryName : c.account.directoryName },
|
|
2669
3032
|
{
|
|
2670
3033
|
id: "add",
|
|
2671
|
-
header: /* @__PURE__ */ jsx15(
|
|
3034
|
+
header: /* @__PURE__ */ jsx15(Text15, { as: "span", srOnly: true, children: tc("actions") }),
|
|
2672
3035
|
align: "end",
|
|
2673
3036
|
cell: (c) => {
|
|
2674
3037
|
const member = c.kind === "Group" ? isMember("Group", c.group.id) : isMember("Account", c.account.id);
|
|
2675
3038
|
if (member)
|
|
2676
|
-
return /* @__PURE__ */ jsx15(
|
|
3039
|
+
return /* @__PURE__ */ jsx15(Text15, { as: "span", textStyle: "caption", color: "fg.muted", children: t("alreadyMember") });
|
|
2677
3040
|
const key = keyOf(c);
|
|
2678
3041
|
return /* @__PURE__ */ jsx15(
|
|
2679
|
-
|
|
3042
|
+
Button11,
|
|
2680
3043
|
{
|
|
2681
3044
|
size: "sm",
|
|
2682
3045
|
disabled: busyId != null,
|
|
@@ -2688,11 +3051,11 @@ function AddMember({ groupId, existing, onAdded }) {
|
|
|
2688
3051
|
}
|
|
2689
3052
|
}
|
|
2690
3053
|
];
|
|
2691
|
-
return /* @__PURE__ */ jsx15(Panel11, { title: t("addMember"), children: /* @__PURE__ */ jsxs15(
|
|
3054
|
+
return /* @__PURE__ */ jsx15(Panel11, { title: t("addMember"), children: /* @__PURE__ */ jsxs15(Stack12, { gap: "stack", children: [
|
|
2692
3055
|
/* @__PURE__ */ jsx15(SearchInput2, { maxW: "md", placeholder: t("searchMembers"), value: query, onChange: (e) => setQuery(e.target.value), "aria-label": t("searchMembers") }),
|
|
2693
3056
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: error }),
|
|
2694
3057
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: searchError }),
|
|
2695
|
-
settled && candidates.length === 0 && !searchError && /* @__PURE__ */ jsx15(
|
|
3058
|
+
settled && candidates.length === 0 && !searchError && /* @__PURE__ */ jsx15(Text15, { textStyle: "body", color: "fg.muted", children: t("noMatches") }),
|
|
2696
3059
|
candidates.length > 0 && /* @__PURE__ */ jsx15(Panel11, { flush: true, children: /* @__PURE__ */ jsx15(DataTable9, { size: "sm", "aria-label": t("addMember"), columns, rows: candidates, getRowId: keyOf }) })
|
|
2697
3060
|
] }) });
|
|
2698
3061
|
}
|
|
@@ -2700,8 +3063,8 @@ function GroupNames({ group, onSaved }) {
|
|
|
2700
3063
|
const t = useGuardNs("groupDetail");
|
|
2701
3064
|
const tc = useGuardNs("common");
|
|
2702
3065
|
const request = useAreaRequest12("guard");
|
|
2703
|
-
const action =
|
|
2704
|
-
const [value, setValue] =
|
|
3066
|
+
const action = useApiAction9();
|
|
3067
|
+
const [value, setValue] = useState10(() => toNamesValue2(group.name, group.names));
|
|
2705
3068
|
const { name, names } = fromNamesValue2(value);
|
|
2706
3069
|
const unchanged = name === group.name && JSON.stringify(names) === JSON.stringify(fromNamesValue2(toNamesValue2(group.name, group.names)).names);
|
|
2707
3070
|
async function save(e) {
|
|
@@ -2718,30 +3081,30 @@ function GroupNames({ group, onSaved }) {
|
|
|
2718
3081
|
return /* @__PURE__ */ jsx15(Panel11, { title: t("names"), description: t("namesHint"), children: /* @__PURE__ */ jsxs15("form", { onSubmit: save, children: [
|
|
2719
3082
|
/* @__PURE__ */ jsxs15(HStack13, { gap: "2", align: "start", wrap: "wrap", children: [
|
|
2720
3083
|
/* @__PURE__ */ jsx15(TranslatedInput3, { value, onChange: setValue, "aria-label": tc("name"), suggest: false }),
|
|
2721
|
-
/* @__PURE__ */ jsx15(
|
|
3084
|
+
/* @__PURE__ */ jsx15(Button11, { type: "submit", loading: action.busy, disabled: !name || unchanged, children: t("saveNames") })
|
|
2722
3085
|
] }),
|
|
2723
3086
|
/* @__PURE__ */ jsx15(InlineAlert11, { tone: "danger", children: action.error })
|
|
2724
3087
|
] }) });
|
|
2725
3088
|
}
|
|
2726
3089
|
|
|
2727
3090
|
// src/areas/guard/GroupsScreen.tsx
|
|
2728
|
-
import { useState as
|
|
2729
|
-
import { HStack as HStack14, Input as Input6, SimpleGrid as SimpleGrid3, Stack as
|
|
3091
|
+
import { useState as useState11 } from "react";
|
|
3092
|
+
import { HStack as HStack14, Input as Input6, SimpleGrid as SimpleGrid3, Stack as Stack13, Text as Text16 } from "@chakra-ui/react";
|
|
2730
3093
|
import {
|
|
2731
|
-
AppLink as
|
|
2732
|
-
Button as
|
|
3094
|
+
AppLink as AppLink8,
|
|
3095
|
+
Button as Button12,
|
|
2733
3096
|
DataTable as DataTable10,
|
|
2734
3097
|
EMPTY_VALUE as EMPTY_VALUE4,
|
|
2735
|
-
errorText as
|
|
2736
|
-
Field as
|
|
3098
|
+
errorText as errorText9,
|
|
3099
|
+
Field as Field6,
|
|
2737
3100
|
InlineAlert as InlineAlert12,
|
|
2738
3101
|
ListFooter as ListFooter2,
|
|
2739
3102
|
notify as notify8,
|
|
2740
3103
|
PageHeader as PageHeader7,
|
|
2741
3104
|
Panel as Panel12,
|
|
2742
3105
|
SearchInput as SearchInput3,
|
|
2743
|
-
SelectField as
|
|
2744
|
-
StatusPill as
|
|
3106
|
+
SelectField as SelectField4,
|
|
3107
|
+
StatusPill as StatusPill11,
|
|
2745
3108
|
TranslatedInput as TranslatedInput4,
|
|
2746
3109
|
useApiQuery as useApiQuery9,
|
|
2747
3110
|
useAreaListSource as useAreaListSource2,
|
|
@@ -2750,7 +3113,7 @@ import {
|
|
|
2750
3113
|
useListState as useListState2
|
|
2751
3114
|
} from "@abpjs/ui";
|
|
2752
3115
|
import { fromNamesValue as fromNamesValue3, splitList as splitList2 } from "@abpjs/ui/rules";
|
|
2753
|
-
import { Fragment as
|
|
3116
|
+
import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2754
3117
|
var KINDS = ["standard", "directory", "ou", "organization"];
|
|
2755
3118
|
function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
2756
3119
|
const t = useGuardNs("groups");
|
|
@@ -2761,40 +3124,40 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2761
3124
|
const dirs = useApiQuery9("guard", "/directories");
|
|
2762
3125
|
const served = useAreaListSource2("guard", "/groups/page");
|
|
2763
3126
|
const list = useListState2(source ?? served, { initial: { sort: { columnId: "name", direction: "asc" } } });
|
|
2764
|
-
const [creating, setCreating] =
|
|
3127
|
+
const [creating, setCreating] = useState11(false);
|
|
2765
3128
|
const columns = [
|
|
2766
3129
|
{
|
|
2767
3130
|
id: "name",
|
|
2768
3131
|
header: tc("name"),
|
|
2769
3132
|
sortValue: (g) => g.name,
|
|
2770
|
-
cell: (g) => /* @__PURE__ */ jsx16(
|
|
3133
|
+
cell: (g) => /* @__PURE__ */ jsx16(AppLink8, { href: routes.group(g.id), fontWeight: "medium", children: written(g.name, g.names) })
|
|
2771
3134
|
},
|
|
2772
|
-
{ id: "kind", header: t("kind"), sortValue: (g) => g.kind, cell: (g) => /* @__PURE__ */ jsx16(
|
|
3135
|
+
{ id: "kind", header: t("kind"), sortValue: (g) => g.kind, cell: (g) => /* @__PURE__ */ jsx16(StatusPill11, { dot: false, children: t(`kinds.${g.kind}`) }), skeleton: "pill" },
|
|
2773
3136
|
{
|
|
2774
3137
|
id: "description",
|
|
2775
3138
|
header: tc("description"),
|
|
2776
|
-
cell: (g) => g.description ? /* @__PURE__ */ jsx16(
|
|
3139
|
+
cell: (g) => g.description ? /* @__PURE__ */ jsx16(Text16, { as: "span", color: "fg.muted", children: g.description }) : EMPTY_VALUE4
|
|
2777
3140
|
},
|
|
2778
3141
|
{ id: "directory", header: tc("directory"), sortValue: (g) => g.directoryName, cell: (g) => g.directoryName },
|
|
2779
3142
|
{
|
|
2780
3143
|
id: "source",
|
|
2781
3144
|
header: tc("source"),
|
|
2782
|
-
cell: (g) => g.isLocal ? /* @__PURE__ */ jsx16(
|
|
3145
|
+
cell: (g) => g.isLocal ? /* @__PURE__ */ jsx16(StatusPill11, { tone: "accent", children: t("local") }) : /* @__PURE__ */ jsx16(StatusPill11, { tone: "info", children: t("synced") }),
|
|
2783
3146
|
skeleton: "pill"
|
|
2784
3147
|
},
|
|
2785
3148
|
{ id: "members", header: t("directMembers"), numeric: true, cell: (g) => num(g.directMemberCount) },
|
|
2786
3149
|
{ id: "memberGroups", header: t("memberGroups"), numeric: true, cell: (g) => num(g.memberGroupCount) }
|
|
2787
3150
|
];
|
|
2788
|
-
return /* @__PURE__ */ jsxs16(
|
|
3151
|
+
return /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2789
3152
|
/* @__PURE__ */ jsx16(
|
|
2790
3153
|
PageHeader7,
|
|
2791
3154
|
{
|
|
2792
3155
|
title: t("title"),
|
|
2793
3156
|
description: t("subtitle"),
|
|
2794
|
-
actions: !creating && admin && /* @__PURE__ */ jsx16(
|
|
3157
|
+
actions: !creating && admin && /* @__PURE__ */ jsx16(Button12, { variant: "primary", onClick: () => setCreating(true), children: t("create") })
|
|
2795
3158
|
}
|
|
2796
3159
|
),
|
|
2797
|
-
/* @__PURE__ */ jsxs16(
|
|
3160
|
+
/* @__PURE__ */ jsxs16(Stack13, { gap: "section", children: [
|
|
2798
3161
|
creating && /* @__PURE__ */ jsx16(
|
|
2799
3162
|
CreateGroupPanel,
|
|
2800
3163
|
{
|
|
@@ -2807,7 +3170,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2807
3170
|
}
|
|
2808
3171
|
}
|
|
2809
3172
|
),
|
|
2810
|
-
/* @__PURE__ */ jsxs16(
|
|
3173
|
+
/* @__PURE__ */ jsxs16(Stack13, { gap: "field", children: [
|
|
2811
3174
|
/* @__PURE__ */ jsxs16(HStack14, { gap: "2", wrap: "wrap", children: [
|
|
2812
3175
|
/* @__PURE__ */ jsx16(
|
|
2813
3176
|
SearchInput3,
|
|
@@ -2821,7 +3184,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2821
3184
|
}
|
|
2822
3185
|
),
|
|
2823
3186
|
/* @__PURE__ */ jsx16(
|
|
2824
|
-
|
|
3187
|
+
SelectField4,
|
|
2825
3188
|
{
|
|
2826
3189
|
size: "sm",
|
|
2827
3190
|
maxW: "14rem",
|
|
@@ -2832,7 +3195,7 @@ function GroupsScreen({ routes = guardRoutes(), source }) {
|
|
|
2832
3195
|
}
|
|
2833
3196
|
),
|
|
2834
3197
|
/* @__PURE__ */ jsx16(
|
|
2835
|
-
|
|
3198
|
+
SelectField4,
|
|
2836
3199
|
{
|
|
2837
3200
|
size: "sm",
|
|
2838
3201
|
maxW: "14rem",
|
|
@@ -2853,14 +3216,14 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2853
3216
|
const t = useGuardNs("groups");
|
|
2854
3217
|
const tc = useGuardNs("common");
|
|
2855
3218
|
const request = useAreaRequest13("guard");
|
|
2856
|
-
const [nameValue, setNameValue] =
|
|
3219
|
+
const [nameValue, setNameValue] = useState11({});
|
|
2857
3220
|
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] =
|
|
3221
|
+
const [description, setDescription] = useState11("");
|
|
3222
|
+
const [directoryId, setDirectoryId] = useState11("");
|
|
3223
|
+
const [kind, setKind] = useState11("standard");
|
|
3224
|
+
const [domains, setDomains] = useState11("");
|
|
3225
|
+
const [error, setError] = useState11(null);
|
|
3226
|
+
const [busy, setBusy] = useState11(false);
|
|
2864
3227
|
async function submit(e) {
|
|
2865
3228
|
e.preventDefault();
|
|
2866
3229
|
setBusy(true);
|
|
@@ -2879,17 +3242,17 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2879
3242
|
});
|
|
2880
3243
|
onDone(created);
|
|
2881
3244
|
} catch (err) {
|
|
2882
|
-
setError(
|
|
3245
|
+
setError(errorText9(err));
|
|
2883
3246
|
} finally {
|
|
2884
3247
|
setBusy(false);
|
|
2885
3248
|
}
|
|
2886
3249
|
}
|
|
2887
|
-
return /* @__PURE__ */ jsx16(Panel12, { title: t("create"), children: /* @__PURE__ */ jsx16("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs16(
|
|
3250
|
+
return /* @__PURE__ */ jsx16(Panel12, { title: t("create"), children: /* @__PURE__ */ jsx16("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs16(Stack13, { gap: "field", children: [
|
|
2888
3251
|
/* @__PURE__ */ jsxs16(SimpleGrid3, { columns: { base: 1, md: 3 }, gap: "field", children: [
|
|
2889
|
-
/* @__PURE__ */ jsx16(
|
|
2890
|
-
/* @__PURE__ */ jsx16(
|
|
2891
|
-
/* @__PURE__ */ jsx16(
|
|
2892
|
-
|
|
3252
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("name"), required: true, children: /* @__PURE__ */ jsx16(TranslatedInput4, { value: nameValue, onChange: setNameValue, "aria-label": tc("name") }) }),
|
|
3253
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("description"), children: /* @__PURE__ */ jsx16(Input6, { value: description, onChange: (e) => setDescription(e.target.value) }) }),
|
|
3254
|
+
/* @__PURE__ */ jsx16(Field6, { label: tc("directory"), helperText: t("directoryHint"), children: /* @__PURE__ */ jsx16(
|
|
3255
|
+
SelectField4,
|
|
2893
3256
|
{
|
|
2894
3257
|
value: directoryId,
|
|
2895
3258
|
onChange: (e) => setDirectoryId(e.target.value),
|
|
@@ -2899,63 +3262,63 @@ function CreateGroupPanel({ directories, onDone, onCancel }) {
|
|
|
2899
3262
|
]
|
|
2900
3263
|
}
|
|
2901
3264
|
) }),
|
|
2902
|
-
/* @__PURE__ */ jsx16(
|
|
2903
|
-
|
|
3265
|
+
/* @__PURE__ */ jsx16(Field6, { label: t("kind"), helperText: t("kindHint"), children: /* @__PURE__ */ jsx16(
|
|
3266
|
+
SelectField4,
|
|
2904
3267
|
{
|
|
2905
3268
|
value: kind,
|
|
2906
3269
|
onChange: (e) => setKind(e.target.value),
|
|
2907
3270
|
options: ["standard", "organization"].map((k) => ({ value: k, label: t(`kinds.${k}`) }))
|
|
2908
3271
|
}
|
|
2909
3272
|
) }),
|
|
2910
|
-
kind === "organization" && /* @__PURE__ */ jsx16(
|
|
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" }) })
|
|
2911
3274
|
] }),
|
|
2912
3275
|
/* @__PURE__ */ jsx16(InlineAlert12, { tone: "danger", children: error }),
|
|
2913
3276
|
/* @__PURE__ */ jsxs16(HStack14, { gap: "2", children: [
|
|
2914
|
-
/* @__PURE__ */ jsx16(
|
|
2915
|
-
/* @__PURE__ */ jsx16(
|
|
3277
|
+
/* @__PURE__ */ jsx16(Button12, { type: "submit", variant: "primary", loading: busy, children: t("create") }),
|
|
3278
|
+
/* @__PURE__ */ jsx16(Button12, { onClick: onCancel, children: tc("cancel") })
|
|
2916
3279
|
] })
|
|
2917
3280
|
] }) }) });
|
|
2918
3281
|
}
|
|
2919
3282
|
|
|
2920
3283
|
// src/areas/guard/MergeScreen.tsx
|
|
2921
|
-
import { useEffect as useEffect2, useRef, useState as
|
|
2922
|
-
import { HStack as HStack15, Input as Input7, SimpleGrid as SimpleGrid4, Stack as
|
|
3284
|
+
import { useEffect as useEffect2, useRef, useState as useState12 } from "react";
|
|
3285
|
+
import { HStack as HStack15, Input as Input7, SimpleGrid as SimpleGrid4, Stack as Stack14, Text as Text17 } from "@chakra-ui/react";
|
|
2923
3286
|
import {
|
|
2924
3287
|
boneWidth,
|
|
2925
|
-
Button as
|
|
3288
|
+
Button as Button13,
|
|
2926
3289
|
EMPTY_VALUE as EMPTY_VALUE5,
|
|
2927
|
-
Field as
|
|
3290
|
+
Field as Field7,
|
|
2928
3291
|
InlineAlert as InlineAlert13,
|
|
2929
3292
|
Loading as Loading5,
|
|
2930
3293
|
notify as notify9,
|
|
2931
3294
|
PageHeader as PageHeader8,
|
|
2932
3295
|
Panel as Panel13,
|
|
2933
3296
|
PropertyList as PropertyList4,
|
|
2934
|
-
RecordKey as
|
|
3297
|
+
RecordKey as RecordKey6,
|
|
2935
3298
|
SearchPicker,
|
|
2936
|
-
StatusPill as
|
|
3299
|
+
StatusPill as StatusPill12,
|
|
2937
3300
|
TextBone as TextBone2,
|
|
2938
3301
|
TextSlot as TextSlot4,
|
|
2939
|
-
useApiAction as
|
|
3302
|
+
useApiAction as useApiAction10,
|
|
2940
3303
|
useApiQuery as useApiQuery10,
|
|
2941
3304
|
useAreaRequest as useAreaRequest14,
|
|
2942
3305
|
useFormatters as useFormatters8,
|
|
2943
|
-
useNavigate as
|
|
3306
|
+
useNavigate as useNavigate5
|
|
2944
3307
|
} from "@abpjs/ui";
|
|
2945
|
-
import { Fragment as
|
|
3308
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2946
3309
|
function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
2947
3310
|
const t = useGuardNs("merge");
|
|
2948
3311
|
const tn = useGuardNs("nav");
|
|
2949
3312
|
const tc = useGuardNs("common");
|
|
2950
|
-
const navigate =
|
|
3313
|
+
const navigate = useNavigate5();
|
|
2951
3314
|
const request = useAreaRequest14("guard");
|
|
2952
3315
|
const source = useApiQuery10("guard", `/accounts/${id}`);
|
|
2953
|
-
const [survivor, setSurvivor] =
|
|
3316
|
+
const [survivor, setSurvivor] = useState12(null);
|
|
2954
3317
|
const pickedByHand = useRef(false);
|
|
2955
|
-
const [preview, setPreview] =
|
|
2956
|
-
const [confirm, setConfirm] =
|
|
2957
|
-
const loading =
|
|
2958
|
-
const merging =
|
|
3318
|
+
const [preview, setPreview] = useState12(null);
|
|
3319
|
+
const [confirm, setConfirm] = useState12("");
|
|
3320
|
+
const loading = useApiAction10();
|
|
3321
|
+
const merging = useApiAction10();
|
|
2959
3322
|
useEffect2(() => {
|
|
2960
3323
|
if (!into) return;
|
|
2961
3324
|
let live = true;
|
|
@@ -3008,8 +3371,8 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3008
3371
|
description: /* @__PURE__ */ jsx17(TextSlot4, { width: t("pageHint", { username: "" }).length + 16, children: t("pageHint", { username: account?.username ?? "" }) })
|
|
3009
3372
|
}
|
|
3010
3373
|
),
|
|
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(
|
|
3374
|
+
/* @__PURE__ */ jsxs17(Stack14, { gap: "section", children: [
|
|
3375
|
+
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
3376
|
SearchPicker,
|
|
3014
3377
|
{
|
|
3015
3378
|
"aria-label": t("survivor"),
|
|
@@ -3022,10 +3385,10 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3022
3385
|
known: [],
|
|
3023
3386
|
getId: (a) => a.id,
|
|
3024
3387
|
label: (a) => `${a.displayName} (@${a.username})`,
|
|
3025
|
-
renderOption: (a) => /* @__PURE__ */ jsxs17(
|
|
3026
|
-
/* @__PURE__ */ jsx17(
|
|
3388
|
+
renderOption: (a) => /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3389
|
+
/* @__PURE__ */ jsx17(Text17, { as: "span", textStyle: "body.sm", fontWeight: "medium", children: a.displayName }),
|
|
3027
3390
|
" ",
|
|
3028
|
-
/* @__PURE__ */ jsxs17(
|
|
3391
|
+
/* @__PURE__ */ jsxs17(Text17, { as: "span", textStyle: "caption", color: "fg.muted", dir: "ltr", children: [
|
|
3029
3392
|
"@",
|
|
3030
3393
|
a.username,
|
|
3031
3394
|
" \xB7 ",
|
|
@@ -3044,19 +3407,19 @@ function MergeScreen({ id, into, routes = guardRoutes() }) {
|
|
|
3044
3407
|
/* @__PURE__ */ jsx17(Side, { title: t("survivorTitle"), hint: t("survivorHint"), account: preview?.survivor, routes })
|
|
3045
3408
|
] }),
|
|
3046
3409
|
/* @__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(
|
|
3410
|
+
/* @__PURE__ */ jsx17(Panel13, { title: t("confirmTitle"), children: /* @__PURE__ */ jsxs17(Stack14, { gap: "field", maxW: "xl", children: [
|
|
3411
|
+
preview?.needsConfirmation && /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
3049
3412
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: preview.sameDirectory ? t("activeWarning", { username: account?.username ?? "" }) : t("activeOtherDirectory", { username: account?.username ?? "" }) }),
|
|
3050
|
-
/* @__PURE__ */ jsx17(
|
|
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" }) })
|
|
3051
3414
|
] }),
|
|
3052
|
-
/* @__PURE__ */ jsx17(
|
|
3415
|
+
/* @__PURE__ */ jsx17(Text17, { textStyle: "body.sm", color: "fg.muted", children: t("noUndo") }),
|
|
3053
3416
|
/* @__PURE__ */ jsx17(InlineAlert13, { tone: "danger", children: merging.error }),
|
|
3054
3417
|
/* @__PURE__ */ jsxs17(HStack15, { gap: "2", children: [
|
|
3055
|
-
/* @__PURE__ */ jsx17(
|
|
3418
|
+
/* @__PURE__ */ jsx17(Button13, { variant: "primary", danger: true, onClick: merge, loading: merging.busy, disabled: !confirmed, children: t("mergeButton", {
|
|
3056
3419
|
source: preview?.source.username ?? account?.username ?? "",
|
|
3057
3420
|
survivor: preview?.survivor.username ?? survivor.username
|
|
3058
3421
|
}) }),
|
|
3059
|
-
/* @__PURE__ */ jsx17(
|
|
3422
|
+
/* @__PURE__ */ jsx17(Button13, { onClick: () => navigate(routes.account(account?.id ?? id)), children: tc("cancel") })
|
|
3060
3423
|
] })
|
|
3061
3424
|
] }) })
|
|
3062
3425
|
] })
|
|
@@ -3070,59 +3433,59 @@ function Side({ title, hint, account, routes }) {
|
|
|
3070
3433
|
PropertyList4,
|
|
3071
3434
|
{
|
|
3072
3435
|
items: [
|
|
3073
|
-
{ label: tc("username"), value: /* @__PURE__ */ jsx17(
|
|
3436
|
+
{ label: tc("username"), value: /* @__PURE__ */ jsx17(RecordKey6, { value: account?.username, href: account && routes.account(account.id) }) },
|
|
3074
3437
|
{ label: tc("displayName"), value: account?.displayName },
|
|
3075
3438
|
{ label: tc("email"), value: account && (account.email ?? EMPTY_VALUE5) },
|
|
3076
3439
|
{ label: tc("directory"), value: account?.directoryName },
|
|
3077
|
-
{ label: tc("status"), value: account ? /* @__PURE__ */ jsx17(AccountStatusPill, { status: account.status }) : /* @__PURE__ */ jsx17(
|
|
3440
|
+
{ label: tc("status"), value: account ? /* @__PURE__ */ jsx17(AccountStatusPill, { status: account.status }) : /* @__PURE__ */ jsx17(StatusPill12, {}) },
|
|
3078
3441
|
{ label: tc("lastSignIn"), value: account && fmt.dateTime(account.lastLoginAt) }
|
|
3079
3442
|
]
|
|
3080
3443
|
}
|
|
3081
3444
|
) });
|
|
3082
3445
|
}
|
|
3083
3446
|
function PartsComing() {
|
|
3084
|
-
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs17(
|
|
3085
|
-
/* @__PURE__ */ jsx17(
|
|
3086
|
-
/* @__PURE__ */ jsx17(
|
|
3447
|
+
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
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) }) })
|
|
3087
3450
|
] }, i)) });
|
|
3088
3451
|
}
|
|
3089
3452
|
function Parts({ preview }) {
|
|
3090
3453
|
const t = useGuardNs("merge");
|
|
3091
3454
|
const partLabel = usePartLabel();
|
|
3092
3455
|
const moving = preview.parts.filter((p) => p.counts.length > 0 || p.error);
|
|
3093
|
-
if (moving.length === 0) return /* @__PURE__ */ jsx17(
|
|
3094
|
-
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: moving.map((p) => /* @__PURE__ */ jsxs17(
|
|
3095
|
-
/* @__PURE__ */ jsx17(
|
|
3456
|
+
if (moving.length === 0) return /* @__PURE__ */ jsx17(Text17, { color: "fg.muted", children: t("nothing") });
|
|
3457
|
+
return /* @__PURE__ */ jsx17(SimpleGrid4, { columns: { base: 1, md: 3 }, gap: "field", children: moving.map((p) => /* @__PURE__ */ jsxs17(Stack14, { gap: "1", children: [
|
|
3458
|
+
/* @__PURE__ */ jsx17(Text17, { fontWeight: "medium", children: partLabel(p.key, p.plugin) }),
|
|
3096
3459
|
p.error ? /* @__PURE__ */ jsx17(InlineAlert13, { tone: "warning", children: t("pluginError", { error: p.error }) }) : /* @__PURE__ */ jsx17(CountList, { counts: p.counts })
|
|
3097
3460
|
] }, p.key)) });
|
|
3098
3461
|
}
|
|
3099
3462
|
|
|
3100
3463
|
// src/areas/guard/MySecondFactorsPanel.tsx
|
|
3101
|
-
import { useEffect as useEffect4, useState as
|
|
3102
|
-
import { HStack as HStack17, Input as Input9, Stack as
|
|
3464
|
+
import { useEffect as useEffect4, useState as useState14 } from "react";
|
|
3465
|
+
import { HStack as HStack17, Input as Input9, Stack as Stack16, Text as Text19 } from "@chakra-ui/react";
|
|
3103
3466
|
import {
|
|
3104
3467
|
AbpApiError,
|
|
3105
|
-
Button as
|
|
3468
|
+
Button as Button15,
|
|
3106
3469
|
createPasskey,
|
|
3107
3470
|
DataTable as DataTable11,
|
|
3108
|
-
errorText as
|
|
3109
|
-
Field as
|
|
3110
|
-
FormDialog,
|
|
3471
|
+
errorText as errorText11,
|
|
3472
|
+
Field as Field9,
|
|
3473
|
+
FormDialog as FormDialog3,
|
|
3111
3474
|
InlineAlert as InlineAlert15,
|
|
3112
3475
|
notify as notify11,
|
|
3113
3476
|
Panel as Panel14,
|
|
3114
3477
|
passkeysSupported,
|
|
3115
|
-
StatusPill as
|
|
3478
|
+
StatusPill as StatusPill13,
|
|
3116
3479
|
useApiQuery as useApiQuery11,
|
|
3117
3480
|
useAreaRequest as useAreaRequest15,
|
|
3118
|
-
useConfirm as
|
|
3481
|
+
useConfirm as useConfirm6,
|
|
3119
3482
|
useFormatters as useFormatters9
|
|
3120
3483
|
} from "@abpjs/ui";
|
|
3121
3484
|
|
|
3122
3485
|
// src/areas/guard/SecondFactorParts.tsx
|
|
3123
|
-
import { useEffect as useEffect3, useState as
|
|
3124
|
-
import { Box as Box4, chakra as
|
|
3125
|
-
import { AppLink as
|
|
3486
|
+
import { useEffect as useEffect3, useState as useState13 } from "react";
|
|
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";
|
|
3126
3489
|
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3127
3490
|
function groupedKey(secret) {
|
|
3128
3491
|
return secret.replace(/(.{4})/g, "$1 ").trim();
|
|
@@ -3162,15 +3525,15 @@ function CodeInput({
|
|
|
3162
3525
|
}
|
|
3163
3526
|
function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
3164
3527
|
const t = useGuardNs("secondFactor.setup");
|
|
3165
|
-
const [enrolment, setEnrolment] =
|
|
3166
|
-
const [code, setCode] =
|
|
3167
|
-
const [error, setError] =
|
|
3168
|
-
const [busy, setBusy] =
|
|
3528
|
+
const [enrolment, setEnrolment] = useState13(null);
|
|
3529
|
+
const [code, setCode] = useState13("");
|
|
3530
|
+
const [error, setError] = useState13(null);
|
|
3531
|
+
const [busy, setBusy] = useState13(false);
|
|
3169
3532
|
useEffect3(() => {
|
|
3170
3533
|
let live = true;
|
|
3171
3534
|
start().then(
|
|
3172
3535
|
(e) => live && setEnrolment(e),
|
|
3173
|
-
(e) => live && setError(
|
|
3536
|
+
(e) => live && setError(errorText10(e))
|
|
3174
3537
|
);
|
|
3175
3538
|
return () => {
|
|
3176
3539
|
live = false;
|
|
@@ -3189,17 +3552,17 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3189
3552
|
}
|
|
3190
3553
|
onDone(result);
|
|
3191
3554
|
} catch (e2) {
|
|
3192
|
-
setError(
|
|
3555
|
+
setError(errorText10(e2));
|
|
3193
3556
|
} finally {
|
|
3194
3557
|
setBusy(false);
|
|
3195
3558
|
}
|
|
3196
3559
|
}
|
|
3197
|
-
return /* @__PURE__ */ jsx18("form", { onSubmit: (e) => void verify(e), "data-testid": "app-setup", children: /* @__PURE__ */ jsxs18(
|
|
3198
|
-
/* @__PURE__ */ jsx18(
|
|
3560
|
+
return /* @__PURE__ */ jsx18("form", { onSubmit: (e) => void verify(e), "data-testid": "app-setup", children: /* @__PURE__ */ jsxs18(Stack15, { gap: "field", children: [
|
|
3561
|
+
/* @__PURE__ */ jsx18(Text18, { color: "fg.muted", children: t("scan") }),
|
|
3199
3562
|
/* @__PURE__ */ jsxs18(Grid3, { templateColumns: { base: "1fr", sm: "auto minmax(0, 1fr)" }, gap: "5", alignItems: "center", children: [
|
|
3200
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" }) }),
|
|
3201
|
-
/* @__PURE__ */ jsxs18(
|
|
3202
|
-
/* @__PURE__ */ jsx18(
|
|
3564
|
+
/* @__PURE__ */ jsxs18(Stack15, { gap: "2", minW: "0", children: [
|
|
3565
|
+
/* @__PURE__ */ jsx18(Text18, { textStyle: "body.sm", color: "fg.muted", children: t("cantScan") }),
|
|
3203
3566
|
/* @__PURE__ */ jsx18(
|
|
3204
3567
|
Box4,
|
|
3205
3568
|
{
|
|
@@ -3216,14 +3579,14 @@ function AppSetup({ start, confirm, onDone, onCancel }) {
|
|
|
3216
3579
|
children: enrolment ? groupedKey(enrolment.secret) : " "
|
|
3217
3580
|
}
|
|
3218
3581
|
),
|
|
3219
|
-
enrolment && /* @__PURE__ */ jsx18(
|
|
3582
|
+
enrolment && /* @__PURE__ */ jsx18(AppLink9, { href: enrolment.address, textStyle: "body.sm", children: t("onThisDevice") })
|
|
3220
3583
|
] })
|
|
3221
3584
|
] }),
|
|
3222
|
-
/* @__PURE__ */ jsx18(
|
|
3585
|
+
/* @__PURE__ */ jsx18(Field8, { label: t("code"), helperText: t("codeHint"), children: /* @__PURE__ */ jsx18(CodeInput, { value: code, onChange: setCode, autoFocus: false }) }),
|
|
3223
3586
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "danger", children: error }),
|
|
3224
3587
|
/* @__PURE__ */ jsxs18(HStack16, { children: [
|
|
3225
|
-
/* @__PURE__ */ jsx18(
|
|
3226
|
-
onCancel && /* @__PURE__ */ jsx18(
|
|
3588
|
+
/* @__PURE__ */ jsx18(Button14, { type: "submit", loading: busy, disabled: !enrolment || !looksLikeCode(code, false), children: t("verify") }),
|
|
3589
|
+
onCancel && /* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: onCancel, disabled: busy, children: t("cancel") })
|
|
3227
3590
|
] })
|
|
3228
3591
|
] }) });
|
|
3229
3592
|
}
|
|
@@ -3252,36 +3615,36 @@ ${codes.join("\n")}
|
|
|
3252
3615
|
link.click();
|
|
3253
3616
|
URL.revokeObjectURL(url);
|
|
3254
3617
|
}
|
|
3255
|
-
return /* @__PURE__ */ jsxs18(
|
|
3618
|
+
return /* @__PURE__ */ jsxs18(Stack15, { gap: "field", "data-testid": "recovery-codes", children: [
|
|
3256
3619
|
/* @__PURE__ */ jsx18(InlineAlert14, { tone: "warning", children: t("hint") }),
|
|
3257
|
-
/* @__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(
|
|
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)) }),
|
|
3258
3621
|
/* @__PURE__ */ jsxs18(HStack16, { wrap: "wrap", children: [
|
|
3259
|
-
/* @__PURE__ */ jsx18(
|
|
3260
|
-
/* @__PURE__ */ jsx18(
|
|
3261
|
-
/* @__PURE__ */ jsx18(
|
|
3622
|
+
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: () => void copy(), children: t("copy") }),
|
|
3623
|
+
/* @__PURE__ */ jsx18(Button14, { variant: "secondary", onClick: download, children: t("download") }),
|
|
3624
|
+
/* @__PURE__ */ jsx18(Button14, { onClick: onSaved, "data-testid": "recovery-codes-saved", children: savedLabel ?? t("saved") })
|
|
3262
3625
|
] })
|
|
3263
3626
|
] });
|
|
3264
3627
|
}
|
|
3265
3628
|
|
|
3266
3629
|
// src/areas/guard/MySecondFactorsPanel.tsx
|
|
3267
|
-
import { Fragment as
|
|
3630
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3268
3631
|
function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
3269
3632
|
const t = useGuardNs("secondFactor");
|
|
3270
3633
|
const fmt = useFormatters9();
|
|
3271
|
-
const confirm =
|
|
3634
|
+
const confirm = useConfirm6();
|
|
3272
3635
|
const request = useAreaRequest15("guard");
|
|
3273
3636
|
const mine = useApiQuery11("guard", "/me/second-factors");
|
|
3274
3637
|
const nameOf = useSenderName();
|
|
3275
|
-
const [choice, setChoice] =
|
|
3638
|
+
const [choice, setChoice] = useState14(null);
|
|
3276
3639
|
const settingUp = choice ?? setUpNow;
|
|
3277
|
-
const [codes, setCodes] =
|
|
3278
|
-
const [error, setError] =
|
|
3640
|
+
const [codes, setCodes] = useState14(null);
|
|
3641
|
+
const [error, setError] = useState14(null);
|
|
3279
3642
|
const canPasskey = passkeysSupported();
|
|
3280
|
-
const [addingPasskey, setAddingPasskey] =
|
|
3281
|
-
const [passkeyName, setPasskeyName] =
|
|
3282
|
-
const [busy, setBusy] =
|
|
3283
|
-
const [renaming, setRenaming] =
|
|
3284
|
-
const [newName, setNewName] =
|
|
3643
|
+
const [addingPasskey, setAddingPasskey] = useState14(false);
|
|
3644
|
+
const [passkeyName, setPasskeyName] = useState14("");
|
|
3645
|
+
const [busy, setBusy] = useState14(false);
|
|
3646
|
+
const [renaming, setRenaming] = useState14(null);
|
|
3647
|
+
const [newName, setNewName] = useState14("");
|
|
3285
3648
|
const data = mine.data;
|
|
3286
3649
|
const factors = data?.factors ?? [];
|
|
3287
3650
|
useEffect4(() => {
|
|
@@ -3307,7 +3670,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3307
3670
|
await mine.reload();
|
|
3308
3671
|
onChange?.();
|
|
3309
3672
|
} catch (e) {
|
|
3310
|
-
setError(
|
|
3673
|
+
setError(errorText11(e));
|
|
3311
3674
|
}
|
|
3312
3675
|
}
|
|
3313
3676
|
async function renew() {
|
|
@@ -3317,7 +3680,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3317
3680
|
setCodes((await request("/me/second-factors/recovery-codes", { method: "POST" })).recoveryCodes);
|
|
3318
3681
|
await mine.reload();
|
|
3319
3682
|
} catch (e) {
|
|
3320
|
-
setError(
|
|
3683
|
+
setError(errorText11(e));
|
|
3321
3684
|
}
|
|
3322
3685
|
}
|
|
3323
3686
|
async function addPasskey() {
|
|
@@ -3340,7 +3703,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3340
3703
|
await mine.reload();
|
|
3341
3704
|
onChange?.();
|
|
3342
3705
|
} catch (e) {
|
|
3343
|
-
setError(
|
|
3706
|
+
setError(errorText11(e));
|
|
3344
3707
|
} finally {
|
|
3345
3708
|
setBusy(false);
|
|
3346
3709
|
}
|
|
@@ -3362,7 +3725,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3362
3725
|
const hasApp = factors.some((f) => f.kind === "app");
|
|
3363
3726
|
const actions = !settingUp && !addingPasskey && !codes && data && !data.disabled && /* @__PURE__ */ jsxs19(HStack17, { gap: "2", wrap: "wrap", children: [
|
|
3364
3727
|
canPasskey && /* @__PURE__ */ jsx19(
|
|
3365
|
-
|
|
3728
|
+
Button15,
|
|
3366
3729
|
{
|
|
3367
3730
|
size: "sm",
|
|
3368
3731
|
variant: factors.length ? "secondary" : "primary",
|
|
@@ -3375,17 +3738,17 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3375
3738
|
children: t("addPasskey")
|
|
3376
3739
|
}
|
|
3377
3740
|
),
|
|
3378
|
-
/* @__PURE__ */ jsx19(
|
|
3741
|
+
/* @__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
3742
|
] });
|
|
3380
3743
|
return /* @__PURE__ */ jsxs19(Panel14, { id: "second-factor", title: t("title"), description: t("panelHint"), actions, "data-testid": "second-factor", children: [
|
|
3381
|
-
/* @__PURE__ */ jsxs19(
|
|
3744
|
+
/* @__PURE__ */ jsxs19(Stack16, { gap: "field", children: [
|
|
3382
3745
|
/* @__PURE__ */ jsx19(InlineAlert15, { tone: "danger", children: mine.error ?? error }),
|
|
3383
3746
|
data?.disabled && /* @__PURE__ */ jsx19(InlineAlert15, { tone: "neutral", children: t("disabled") }),
|
|
3384
3747
|
data && /* @__PURE__ */ jsxs19(HStack17, { gap: "2", wrap: "wrap", children: [
|
|
3385
|
-
factors.length > 0 && !data.disabled ? /* @__PURE__ */ jsx19(
|
|
3386
|
-
/* @__PURE__ */ jsx19(
|
|
3748
|
+
factors.length > 0 && !data.disabled ? /* @__PURE__ */ jsx19(StatusPill13, { tone: "success", children: t("on") }) : /* @__PURE__ */ jsx19(StatusPill13, { children: t("off") }),
|
|
3749
|
+
/* @__PURE__ */ jsx19(Text19, { color: "fg.muted", textStyle: "body.sm", "data-testid": "second-factor-mode", children: t(`modeHint.${data.mode}`) })
|
|
3387
3750
|
] }),
|
|
3388
|
-
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(", ") }) }),
|
|
3389
3752
|
settingUp && /* @__PURE__ */ jsx19(
|
|
3390
3753
|
AppSetup,
|
|
3391
3754
|
{
|
|
@@ -3409,18 +3772,18 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3409
3772
|
void addPasskey();
|
|
3410
3773
|
},
|
|
3411
3774
|
"data-testid": "passkey-add-form",
|
|
3412
|
-
children: /* @__PURE__ */ jsxs19(
|
|
3413
|
-
/* @__PURE__ */ jsx19(
|
|
3414
|
-
/* @__PURE__ */ jsx19(
|
|
3775
|
+
children: /* @__PURE__ */ jsxs19(Stack16, { gap: "field", maxW: "md", children: [
|
|
3776
|
+
/* @__PURE__ */ jsx19(Text19, { color: "fg.muted", textStyle: "body.sm", children: t("passkeyHint") }),
|
|
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" }) }),
|
|
3415
3778
|
/* @__PURE__ */ jsxs19(HStack17, { children: [
|
|
3416
|
-
/* @__PURE__ */ jsx19(
|
|
3417
|
-
/* @__PURE__ */ jsx19(
|
|
3779
|
+
/* @__PURE__ */ jsx19(Button15, { type: "submit", loading: busy, "data-testid": "passkey-create", children: t("passkeyCreate") }),
|
|
3780
|
+
/* @__PURE__ */ jsx19(Button15, { variant: "secondary", onClick: () => setAddingPasskey(false), disabled: busy, children: t("cancel") })
|
|
3418
3781
|
] })
|
|
3419
3782
|
] })
|
|
3420
3783
|
}
|
|
3421
3784
|
),
|
|
3422
3785
|
codes && /* @__PURE__ */ jsx19(RecoveryCodes, { codes, onSaved: () => setCodes(null) }),
|
|
3423
|
-
!settingUp && !addingPasskey && !codes && /* @__PURE__ */ jsxs19(
|
|
3786
|
+
!settingUp && !addingPasskey && !codes && /* @__PURE__ */ jsxs19(Fragment9, { children: [
|
|
3424
3787
|
/* @__PURE__ */ jsx19(
|
|
3425
3788
|
DataTable11,
|
|
3426
3789
|
{
|
|
@@ -3435,10 +3798,10 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3435
3798
|
{
|
|
3436
3799
|
id: "kind",
|
|
3437
3800
|
header: t("title"),
|
|
3438
|
-
cell: (f) => f.kind === "passkey" ? /* @__PURE__ */ jsxs19(
|
|
3439
|
-
/* @__PURE__ */ jsx19(
|
|
3440
|
-
/* @__PURE__ */ jsx19(
|
|
3441
|
-
] }) : /* @__PURE__ */ jsx19(
|
|
3801
|
+
cell: (f) => f.kind === "passkey" ? /* @__PURE__ */ jsxs19(Stack16, { gap: "0", children: [
|
|
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}`) })
|
|
3442
3805
|
},
|
|
3443
3806
|
{ id: "added", header: t("added"), nowrap: true, cell: (f) => fmt.dateTime(f.createdAt) },
|
|
3444
3807
|
{ id: "used", header: t("lastUsed"), nowrap: true, cell: (f) => f.lastUsedAt ? fmt.dateTime(f.lastUsedAt) : t("never") },
|
|
@@ -3447,7 +3810,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3447
3810
|
header: "",
|
|
3448
3811
|
cell: (f) => /* @__PURE__ */ jsxs19(HStack17, { gap: "2", justify: "flex-end", children: [
|
|
3449
3812
|
f.kind === "passkey" && /* @__PURE__ */ jsx19(
|
|
3450
|
-
|
|
3813
|
+
Button15,
|
|
3451
3814
|
{
|
|
3452
3815
|
size: "sm",
|
|
3453
3816
|
variant: "ghost",
|
|
@@ -3458,20 +3821,20 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3458
3821
|
children: t("rename")
|
|
3459
3822
|
}
|
|
3460
3823
|
),
|
|
3461
|
-
/* @__PURE__ */ jsx19(
|
|
3824
|
+
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: "secondary", onClick: () => void remove(f), children: t("remove") })
|
|
3462
3825
|
] })
|
|
3463
3826
|
}
|
|
3464
3827
|
]
|
|
3465
3828
|
}
|
|
3466
3829
|
),
|
|
3467
3830
|
factors.length > 0 && /* @__PURE__ */ jsxs19(HStack17, { justify: "space-between", wrap: "wrap", gap: "2", children: [
|
|
3468
|
-
/* @__PURE__ */ jsx19(
|
|
3469
|
-
/* @__PURE__ */ jsx19(
|
|
3831
|
+
/* @__PURE__ */ jsx19(Text19, { textStyle: "body.sm", color: "fg.muted", "data-testid": "recovery-left", children: t("recoveryLeft", { count: num(data?.recoveryCodesLeft ?? 0) }) }),
|
|
3832
|
+
/* @__PURE__ */ jsx19(Button15, { size: "sm", variant: "secondary", onClick: () => void renew(), children: t("renew") })
|
|
3470
3833
|
] })
|
|
3471
3834
|
] })
|
|
3472
3835
|
] }),
|
|
3473
3836
|
/* @__PURE__ */ jsx19(
|
|
3474
|
-
|
|
3837
|
+
FormDialog3,
|
|
3475
3838
|
{
|
|
3476
3839
|
open: renaming != null,
|
|
3477
3840
|
onOpenChange: (open) => !open && setRenaming(null),
|
|
@@ -3479,7 +3842,7 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3479
3842
|
submitLabel: t("save"),
|
|
3480
3843
|
onSubmit: rename,
|
|
3481
3844
|
submitDisabled: !newName.trim(),
|
|
3482
|
-
children: /* @__PURE__ */ jsx19(
|
|
3845
|
+
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
3846
|
}
|
|
3484
3847
|
)
|
|
3485
3848
|
] });
|
|
@@ -3489,23 +3852,23 @@ function MySecondFactorsPanel({ setUpNow = false, onSetUpChosen, onChange }) {
|
|
|
3489
3852
|
import { useSyncExternalStore } from "react";
|
|
3490
3853
|
|
|
3491
3854
|
// src/areas/guard/SignUpScreen.tsx
|
|
3492
|
-
import { useEffect as useEffect5, useMemo as
|
|
3493
|
-
import { Grid as Grid4, HStack as HStack18, Input as Input10, Stack as
|
|
3494
|
-
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";
|
|
3495
3858
|
import {
|
|
3496
3859
|
AddButton,
|
|
3497
|
-
Button as
|
|
3498
|
-
EmptyState,
|
|
3499
|
-
Field as
|
|
3500
|
-
IconButton as
|
|
3860
|
+
Button as Button16,
|
|
3861
|
+
EmptyState as EmptyState2,
|
|
3862
|
+
Field as Field10,
|
|
3863
|
+
IconButton as IconButton2,
|
|
3501
3864
|
InlineAlert as InlineAlert16,
|
|
3502
3865
|
notify as notify12,
|
|
3503
3866
|
PageHeader as PageHeader9,
|
|
3504
3867
|
Panel as Panel15,
|
|
3505
3868
|
SaveBar,
|
|
3506
|
-
SelectField as
|
|
3507
|
-
SwitchField,
|
|
3508
|
-
useApiAction as
|
|
3869
|
+
SelectField as SelectField5,
|
|
3870
|
+
SwitchField as SwitchField2,
|
|
3871
|
+
useApiAction as useApiAction11,
|
|
3509
3872
|
useApiQuery as useApiQuery12,
|
|
3510
3873
|
useAreaRequest as useAreaRequest16
|
|
3511
3874
|
} from "@abpjs/ui";
|
|
@@ -3531,19 +3894,19 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3531
3894
|
const t = useGuardNs("signUpSettings");
|
|
3532
3895
|
const request = useAreaRequest16("guard");
|
|
3533
3896
|
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] =
|
|
3897
|
+
const action = useApiAction11();
|
|
3898
|
+
const [form, setForm] = useState15({ enabled: false, directoryId: "", domains: [] });
|
|
3899
|
+
const [started, setStarted] = useState15(false);
|
|
3900
|
+
const [adding, setAdding] = useState15(false);
|
|
3901
|
+
const [draft, setDraft] = useState15("");
|
|
3902
|
+
const [draftError, setDraftError] = useState15("");
|
|
3903
|
+
const [directoryError, setDirectoryError] = useState15("");
|
|
3541
3904
|
const addButton = useRef2(null);
|
|
3542
3905
|
const draftInput = useRef2(null);
|
|
3543
3906
|
useEffect5(() => {
|
|
3544
3907
|
if (settings.data) setForm(fromSettings(settings.data));
|
|
3545
3908
|
}, [settings.data]);
|
|
3546
|
-
const saved =
|
|
3909
|
+
const saved = useMemo4(() => settings.data ? fromSettings(settings.data) : form, [settings.data, form]);
|
|
3547
3910
|
const changes = settings.data ? signUpChanges(saved, form) + Number(draft.trim() !== "") : 0;
|
|
3548
3911
|
if (settings.error) return /* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: settings.error });
|
|
3549
3912
|
const listed = settings.data?.directories ?? [];
|
|
@@ -3622,10 +3985,10 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3622
3985
|
}
|
|
3623
3986
|
const saveBar = /* @__PURE__ */ jsx20(SaveBar, { open: changes > 0, count: changes, onSave: () => void save(), onDiscard: discard, busy: action.busy });
|
|
3624
3987
|
if (neverSetUp && !started && changes === 0) {
|
|
3625
|
-
return /* @__PURE__ */ jsxs20(
|
|
3988
|
+
return /* @__PURE__ */ jsxs20(Stack17, { gap: "section", children: [
|
|
3626
3989
|
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3627
3990
|
/* @__PURE__ */ jsx20(
|
|
3628
|
-
|
|
3991
|
+
EmptyState2,
|
|
3629
3992
|
{
|
|
3630
3993
|
variant: "page",
|
|
3631
3994
|
size: "md",
|
|
@@ -3633,7 +3996,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3633
3996
|
illustration: "records",
|
|
3634
3997
|
title: t("emptyTitle"),
|
|
3635
3998
|
description: t("emptyText"),
|
|
3636
|
-
action: /* @__PURE__ */ jsx20(
|
|
3999
|
+
action: /* @__PURE__ */ jsx20(Button16, { variant: "primary", onClick: () => {
|
|
3637
4000
|
setStarted(true);
|
|
3638
4001
|
change({ enabled: true });
|
|
3639
4002
|
}, children: t("turnOn") })
|
|
@@ -3641,16 +4004,16 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3641
4004
|
)
|
|
3642
4005
|
] });
|
|
3643
4006
|
}
|
|
3644
|
-
return /* @__PURE__ */ jsxs20(
|
|
4007
|
+
return /* @__PURE__ */ jsxs20(Stack17, { gap: "section", children: [
|
|
3645
4008
|
/* @__PURE__ */ jsx20(PageHeader9, { title: t("title"), description: t("subtitle") }),
|
|
3646
|
-
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(
|
|
3647
|
-
/* @__PURE__ */ jsx20(
|
|
4009
|
+
/* @__PURE__ */ jsx20(Panel15, { "data-testid": "signup-settings", loading: !settings.data, children: /* @__PURE__ */ jsxs20(Stack17, { gap: "5", children: [
|
|
4010
|
+
/* @__PURE__ */ jsx20(SwitchField2, { label: t("enabled"), checked: form.enabled, onCheckedChange: (c) => {
|
|
3648
4011
|
change({ enabled: c });
|
|
3649
4012
|
if (!c) setDirectoryError("");
|
|
3650
4013
|
} }),
|
|
3651
4014
|
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
4015
|
/* @__PURE__ */ jsx20(
|
|
3653
|
-
|
|
4016
|
+
Field10,
|
|
3654
4017
|
{
|
|
3655
4018
|
label: t("directory"),
|
|
3656
4019
|
required: true,
|
|
@@ -3658,7 +4021,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3658
4021
|
errorText: directoryError,
|
|
3659
4022
|
helperText: chosen ? t("grantHint", { group: `${chosen.name} (everyone)` }) : directoriesPage ? t("directoryHint") : t("directoryHintPlain"),
|
|
3660
4023
|
children: /* @__PURE__ */ jsx20(
|
|
3661
|
-
|
|
4024
|
+
SelectField5,
|
|
3662
4025
|
{
|
|
3663
4026
|
value: form.directoryId,
|
|
3664
4027
|
onChange: (e) => {
|
|
@@ -3670,25 +4033,25 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3670
4033
|
)
|
|
3671
4034
|
}
|
|
3672
4035
|
),
|
|
3673
|
-
/* @__PURE__ */ jsxs20(
|
|
3674
|
-
/* @__PURE__ */ jsx20(
|
|
3675
|
-
/* @__PURE__ */ jsxs20(
|
|
3676
|
-
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(
|
|
4036
|
+
/* @__PURE__ */ jsxs20(Stack17, { gap: "2", minW: "0", role: "group", "aria-labelledby": "signup-domains", children: [
|
|
4037
|
+
/* @__PURE__ */ jsx20(Text20, { id: "signup-domains", textStyle: "label", children: t("domains") }),
|
|
4038
|
+
/* @__PURE__ */ jsxs20(Stack17, { gap: "1", children: [
|
|
4039
|
+
form.domains.length === 0 && !adding && /* @__PURE__ */ jsx20(Text20, { textStyle: "body.sm", color: "fg.muted", py: "1.5", children: t("anyDomain") }),
|
|
3677
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: [
|
|
3678
|
-
/* @__PURE__ */ jsx20(
|
|
4041
|
+
/* @__PURE__ */ jsx20(Text20, { flex: "1", minW: "0", fontWeight: "bold", dir: "ltr", textAlign: "start", truncate: true, children: d }),
|
|
3679
4042
|
/* @__PURE__ */ jsx20(
|
|
3680
|
-
|
|
4043
|
+
IconButton2,
|
|
3681
4044
|
{
|
|
3682
4045
|
remove: true,
|
|
3683
4046
|
size: "sm",
|
|
3684
4047
|
"aria-label": t("removeDomain", { domain: d }),
|
|
3685
4048
|
onClick: () => change({ domains: form.domains.filter((x) => x !== d) }),
|
|
3686
|
-
children: /* @__PURE__ */ jsx20(
|
|
4049
|
+
children: /* @__PURE__ */ jsx20(Trash23, {})
|
|
3687
4050
|
}
|
|
3688
4051
|
)
|
|
3689
4052
|
] }, d))
|
|
3690
4053
|
] }),
|
|
3691
|
-
adding ? /* @__PURE__ */ jsx20(
|
|
4054
|
+
adding ? /* @__PURE__ */ jsx20(Field10, { invalid: !!draftError, errorText: draftError, children: /* @__PURE__ */ jsxs20(HStack18, { gap: "3", align: "center", w: "full", children: [
|
|
3692
4055
|
/* @__PURE__ */ jsx20(
|
|
3693
4056
|
Input10,
|
|
3694
4057
|
{
|
|
@@ -3713,7 +4076,7 @@ function SignUpScreen({ directoriesPage = true } = {}) {
|
|
|
3713
4076
|
/* @__PURE__ */ jsx20(AddButton, { onMouseDown: (e) => e.preventDefault(), onClick: addDraft, children: t("add") })
|
|
3714
4077
|
] }) }) : /* @__PURE__ */ jsx20(AddButton, { ref: addButton, alignSelf: "flex-start", onClick: () => setAdding(true), children: t("addDomain") })
|
|
3715
4078
|
] })
|
|
3716
|
-
] }) : /* @__PURE__ */ jsx20(
|
|
4079
|
+
] }) : /* @__PURE__ */ jsx20(Text20, { textStyle: "body.sm", color: "fg.muted", children: t("off") }),
|
|
3717
4080
|
/* @__PURE__ */ jsx20(InlineAlert16, { tone: "danger", children: action.error })
|
|
3718
4081
|
] }) }),
|
|
3719
4082
|
saveBar
|
|
@@ -3768,7 +4131,7 @@ function guardPages(options) {
|
|
|
3768
4131
|
|
|
3769
4132
|
// src/areas/guard/StrongFactorBanner.tsx
|
|
3770
4133
|
import { Box as Box5 } from "@chakra-ui/react";
|
|
3771
|
-
import { AppLink as
|
|
4134
|
+
import { AppLink as AppLink10, InlineAlert as InlineAlert17, useFormatters as useFormatters10 } from "@abpjs/ui";
|
|
3772
4135
|
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3773
4136
|
function StrongFactorBanner({ strongFactor, setUpHref }) {
|
|
3774
4137
|
const t = useGuardTexts();
|
|
@@ -3777,7 +4140,7 @@ function StrongFactorBanner({ strongFactor, setUpHref }) {
|
|
|
3777
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: [
|
|
3778
4141
|
t(strongFactor.overdue ? "secondFactor.required.overdue" : "secondFactor.required.by", { date: fmt.dateTime(strongFactor.requiredBy) }),
|
|
3779
4142
|
" ",
|
|
3780
|
-
/* @__PURE__ */ jsx22(
|
|
4143
|
+
/* @__PURE__ */ jsx22(AppLink10, { href: setUpHref, children: t("secondFactor.required.setUp") })
|
|
3781
4144
|
] }) });
|
|
3782
4145
|
}
|
|
3783
4146
|
export {
|