@bevel-software/platform-core-frontend 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/src/core/CoreAppShell.tsx +195 -56
- package/src/core/__tests__/AppChrome.test.tsx +125 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +37 -2
- package/src/core/__tests__/bootstrap.test.ts +63 -0
- package/src/core/bootstrap.ts +73 -0
- package/src/core/events.ts +12 -0
- package/src/core/registry.ts +58 -9
- package/src/index.css +100 -11
- package/src/index.ts +24 -23
- package/src/lib/utils.ts +93 -117
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +281 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +166 -1
- package/src/modules/access/api.ts +49 -0
- package/src/modules/access/components/ManageAccessDialog.tsx +786 -481
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +86 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +17 -1
- package/src/modules/admin/__tests__/admin.unread.test.tsx +61 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +44 -38
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +11 -10
- package/src/modules/admin/components/UserAccountsPage.tsx +36 -28
- package/src/modules/admin/state/admin.context.tsx +15 -6
- package/src/modules/auth/components/AccountPage.tsx +11 -11
- package/src/modules/auth/components/LoginScreen.tsx +12 -12
- package/src/modules/auth/services/sso.ts +47 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +277 -0
- package/src/modules/change-requests/__tests__/author.test.ts +48 -0
- package/src/modules/change-requests/__tests__/conflict.test.ts +73 -0
- package/src/modules/change-requests/__tests__/diff.test.ts +134 -0
- package/src/modules/change-requests/__tests__/propose.test.ts +93 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +72 -0
- package/src/modules/change-requests/change-requests.css +22 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +277 -0
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +713 -0
- package/src/modules/change-requests/components/ConflictHelp.tsx +47 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +398 -0
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +168 -0
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +236 -0
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +79 -0
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +80 -0
- package/src/modules/change-requests/services/change-requests.api.ts +45 -0
- package/src/modules/change-requests/services/propose.api.ts +162 -0
- package/src/modules/change-requests/utils/author.ts +47 -0
- package/src/modules/change-requests/utils/conflict.ts +38 -0
- package/src/modules/change-requests/utils/diff.ts +80 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +27 -18
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +36 -83
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +5 -5
- package/src/modules/git/__tests__/PullRequestsForMe.test.tsx +147 -0
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +2 -8
- package/src/modules/git/components/BranchSwitcher.tsx +68 -31
- package/src/modules/git/components/DiffView.tsx +4 -4
- package/src/modules/git/components/FileComparisonPanel.tsx +20 -20
- package/src/modules/git/components/FileHistoryPanel.tsx +71 -107
- package/src/modules/git/components/PullNeededBanner.tsx +6 -13
- package/src/modules/git/components/PullRequestsForMe.tsx +71 -36
- package/src/modules/git/components/UnifiedDiffView.tsx +4 -4
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +2 -2
- package/src/modules/git/hooks/useGitState.ts +15 -14
- package/src/modules/git/services/__tests__/error-messages.test.ts +4 -4
- package/src/modules/git/services/error-messages.ts +7 -7
- package/src/modules/git/services/git.api.ts +17 -11
- package/src/modules/git/services/pr-prompts.ts +2 -2
- package/src/modules/git/state/git.context.ts +10 -1
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +224 -0
- package/src/modules/layout/__tests__/SidebarToggle.test.tsx +242 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +56 -0
- package/src/modules/layout/breakpoints.ts +6 -0
- package/src/modules/layout/components/AppLayout.tsx +17 -5
- package/src/modules/layout/components/DemoBanner.tsx +10 -1
- package/src/modules/layout/components/MaintenanceOverlay.tsx +3 -3
- package/src/modules/layout/components/MobileChatLayout.tsx +31 -26
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +59 -24
- package/src/modules/layout/components/SidebarFrame.tsx +317 -0
- package/src/modules/layout/components/SidebarToggle.tsx +86 -0
- package/src/modules/layout/components/SlideOverlay.tsx +1 -1
- package/src/modules/layout/components/__tests__/MobileChatLayout.test.tsx +40 -2
- package/src/modules/layout/components/__tests__/ResizableThreePaneLayout.test.tsx +19 -3
- package/src/modules/layout/state/sidebar.ts +200 -0
- package/src/modules/library/__tests__/AddToGroupDialog.test.tsx +313 -0
- package/src/modules/library/__tests__/ChangeRequestDock.test.tsx +84 -0
- package/src/modules/library/__tests__/GroupJoinRequests.test.tsx +178 -0
- package/src/modules/library/__tests__/GroupPage.test.tsx +479 -0
- package/src/modules/library/__tests__/GroupsIndexPage.test.tsx +283 -0
- package/src/modules/library/__tests__/GroupsSidebar.contextmenu.test.tsx +175 -0
- package/src/modules/library/__tests__/GroupsSidebar.locked.test.tsx +96 -0
- package/src/modules/library/__tests__/GroupsSidebar.test.tsx +142 -0
- package/src/modules/library/__tests__/GroupsSidebarMenu.test.tsx +142 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +149 -0
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +378 -0
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +347 -0
- package/src/modules/library/__tests__/LockedGroupView.test.tsx +203 -0
- package/src/modules/library/__tests__/NewGroupDialog.test.tsx +114 -0
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +177 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +1063 -0
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +259 -0
- package/src/modules/library/__tests__/ToolLogo.test.tsx +63 -0
- package/src/modules/library/__tests__/ToolPage.test.tsx +315 -0
- package/src/modules/library/__tests__/ToolSharePanel.test.tsx +36 -0
- package/src/modules/library/__tests__/ToolVarRow.test.tsx +260 -0
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +197 -0
- package/src/modules/library/__tests__/auth-harness.tsx +37 -0
- package/src/modules/library/__tests__/oauth-fragment.test.ts +48 -0
- package/src/modules/library/__tests__/status.test.ts +113 -20
- package/src/modules/library/__tests__/useSkillDetail.test.tsx +102 -0
- package/src/modules/library/__tests__/useToolPage.test.tsx +146 -0
- package/src/modules/library/components/AccessRequestsBanner.tsx +101 -0
- package/src/modules/library/components/AddToGroupDialog.tsx +115 -0
- package/src/modules/library/components/ChangeRequestDock.tsx +52 -28
- package/src/modules/library/components/DeleteGroupDialog.tsx +87 -0
- package/src/modules/library/components/GroupIndexRow.tsx +63 -0
- package/src/modules/library/components/GroupJoinRequests.tsx +56 -0
- package/src/modules/library/components/GroupPage.tsx +373 -0
- package/src/modules/library/components/GroupsIndexPage.tsx +222 -0
- package/src/modules/library/components/GroupsSidebar.tsx +338 -0
- package/src/modules/library/components/GroupsSidebarMenu.tsx +160 -0
- package/src/modules/library/components/LibraryCard.tsx +123 -102
- package/src/modules/library/components/LibraryLayout.tsx +344 -0
- package/src/modules/library/components/LibraryPage.tsx +111 -227
- package/src/modules/library/components/LockGlyph.tsx +31 -0
- package/src/modules/library/components/LockedGroupView.tsx +159 -0
- package/src/modules/library/components/ManagedGroupRequests.tsx +70 -0
- package/src/modules/library/components/NewGroupDialog.tsx +112 -0
- package/src/modules/library/components/NewSkillPanel.tsx +151 -0
- package/src/modules/library/components/PageActions.tsx +156 -0
- package/src/modules/library/components/PendingSkillReview.tsx +63 -0
- package/src/modules/library/components/PersonalAddDialog.tsx +88 -0
- package/src/modules/library/components/PersonalGroupPage.tsx +125 -0
- package/src/modules/library/components/StatusDot.tsx +25 -0
- package/src/modules/library/components/ToolLogo.tsx +171 -0
- package/src/modules/library/components/group-page-parts.tsx +419 -0
- package/src/modules/library/components/skill-page/SkillFileEditor.tsx +134 -0
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +117 -0
- package/src/modules/library/components/skill-page/SkillFileTabs.tsx +112 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +673 -0
- package/src/modules/library/components/skill-page/tab-ids.ts +33 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +175 -0
- package/src/modules/library/components/tool-page/ToolPage.tsx +228 -0
- package/src/modules/library/components/tool-page/ToolSharePanel.tsx +45 -0
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +289 -0
- package/src/modules/library/hooks/useJoinRequests.ts +114 -0
- package/src/modules/library/hooks/useLibraryData.ts +134 -119
- package/src/modules/library/hooks/useSkillDetail.ts +119 -74
- package/src/modules/library/hooks/useToolPage.ts +145 -0
- package/src/modules/library/library.css +33 -245
- package/src/modules/library/routes/LibraryRoutes.tsx +134 -0
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +74 -0
- package/src/modules/library/routes/library-paths.ts +191 -0
- package/src/modules/library/services/groups.api.ts +189 -0
- package/src/modules/library/services/library.api.ts +291 -164
- package/src/modules/library/services/tools.api.ts +60 -0
- package/src/modules/library/state/library-context.ts +22 -0
- package/src/modules/library/state/library-data.tsx +223 -0
- package/src/modules/library/state/toast.context.ts +32 -0
- package/src/modules/library/state/toast.tsx +84 -42
- package/src/modules/library/utils/clipboard.ts +33 -0
- package/src/modules/library/utils/group-summary.ts +68 -0
- package/src/modules/library/utils/names.ts +30 -0
- package/src/modules/library/utils/navigate-external.ts +15 -0
- package/src/modules/library/utils/oauth-fragment.ts +32 -0
- package/src/modules/library/utils/personal-group.ts +36 -0
- package/src/modules/library/utils/status.ts +108 -25
- package/src/modules/library/utils/toast-duration.ts +16 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +533 -0
- package/src/modules/onboarding/agent-clients.ts +48 -0
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +133 -0
- package/src/modules/onboarding/components/RootLanding.tsx +54 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +364 -0
- package/src/modules/onboarding/paths.ts +9 -0
- package/src/modules/onboarding/state/onboarding.ts +191 -0
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +10 -10
- package/src/modules/pr/services/pr-approvals.api.ts +19 -0
- package/src/modules/pr/services/pr-cancel.api.ts +11 -0
- package/src/modules/review/components/BinaryChangePlaceholder.tsx +3 -3
- package/src/modules/review/components/DiffViewer.tsx +4 -4
- package/src/modules/review/components/MarkdownDiffViewer.tsx +84 -26
- package/src/modules/review/components/ReviewFileRow.tsx +10 -10
- package/src/modules/review/components/ReviewPanel.tsx +49 -17
- package/src/modules/review/components/ReviewPanelSurface.tsx +1 -1
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +122 -0
- package/src/modules/review/hooks/__tests__/useReviewState.test.ts +1 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +273 -171
- package/src/modules/secrets-vault/components/SecretsPage.tsx +147 -110
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +109 -92
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +35 -4
- package/src/modules/secrets-vault/services/connect.api.ts +24 -3
- package/src/modules/settings/components/DeploymentPage.tsx +90 -0
- package/src/modules/settings/components/SettingsLayout.tsx +135 -0
- package/src/modules/settings/components/SettingsNav.tsx +114 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +110 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +249 -0
- package/src/modules/settings/settings-nav-items.tsx +166 -0
- package/src/modules/setup/__tests__/setup.test.tsx +540 -0
- package/src/modules/setup/components/SetupGate.tsx +67 -0
- package/src/modules/setup/components/SetupScreen.tsx +573 -0
- package/src/modules/setup/services/setup.api.ts +106 -0
- package/src/modules/setup/utils/git-host.ts +34 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +38 -15
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +50 -50
- package/src/modules/toolbar/components/ProfileMenu.tsx +294 -0
- package/src/modules/toolbar/components/Toolbar.tsx +56 -54
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +176 -122
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +252 -77
- package/src/modules/tools/ToolsExplorerPage.tsx +45 -40
- package/src/modules/workspace/__tests__/design-system-parity.test.ts +133 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +2 -0
- package/src/modules/workspace/components/EditorTabs.tsx +82 -50
- package/src/modules/workspace/components/FileExplorer.tsx +413 -189
- package/src/modules/workspace/components/FilePaneCard.tsx +53 -0
- package/src/modules/workspace/components/FileRoute.tsx +89 -84
- package/src/modules/workspace/components/FileViewer.tsx +700 -294
- package/src/modules/workspace/components/KbDocumentShell.tsx +138 -0
- package/src/modules/workspace/components/KbFileRail.tsx +128 -0
- package/src/modules/workspace/components/KbPageHeader.tsx +390 -0
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +87 -3
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +293 -39
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +1 -16
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +462 -44
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +84 -0
- package/src/modules/workspace/components/__tests__/KbFileRail.test.tsx +83 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +192 -0
- package/src/modules/workspace/components/renderers/CopyAnchorButton.tsx +64 -0
- package/src/modules/workspace/components/renderers/CsvRenderer.tsx +8 -8
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +18 -9
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +14 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +31 -165
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +18 -5
- package/src/modules/workspace/components/renderers/MermaidDiagram.tsx +27 -10
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +2 -2
- package/src/modules/workspace/components/renderers/TextRenderer.tsx +11 -5
- package/src/modules/workspace/components/renderers/ToolForm.tsx +24 -24
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +27 -27
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -11
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +66 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +17 -1
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/MermaidDiagram.test.tsx +58 -0
- package/src/modules/workspace/components/renderers/__tests__/lazyRenderer.test.tsx +68 -0
- package/src/modules/workspace/components/renderers/__tests__/rendererLayout.test.ts +64 -0
- package/src/modules/workspace/components/renderers/__tests__/sanitizeDocxHtml.test.ts +0 -0
- package/src/modules/workspace/components/renderers/chunk-boundary.tsx +71 -0
- package/src/modules/workspace/components/renderers/index.ts +78 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +241 -0
- package/src/modules/workspace/components/renderers/lazyRenderer.tsx +59 -0
- package/src/modules/workspace/components/renderers/sanitizeDocxHtml.ts +91 -0
- package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +59 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +237 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +185 -0
- package/src/modules/workspace/hooks/useAutoGrowTextarea.ts +30 -0
- package/src/modules/workspace/hooks/useLastCommit.ts +66 -0
- package/src/modules/workspace/hooks/useLinksOut.ts +56 -0
- package/src/modules/workspace/hooks/useOpenChangeRequests.ts +20 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +123 -14
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +1 -1
- package/src/modules/workspace/services/workspace.api.ts +9 -2
- package/src/modules/workspace/state/open-change-requests.context.ts +35 -0
- package/src/modules/workspace/state/open-change-requests.tsx +185 -0
- package/src/modules/workspace/state/workspace.context.ts +9 -0
- package/src/modules/workspace/utils/__tests__/diff.test.ts +87 -0
- package/src/modules/workspace/utils/diff.ts +130 -53
- package/src/modules/workspace/utils/fileTree.ts +7 -4
- package/src/modules/workspace/workspace.css +28 -0
- package/src/shared/components/Badge.tsx +62 -0
- package/src/shared/components/Banner.tsx +58 -0
- package/src/shared/components/Button.tsx +90 -0
- package/src/shared/components/Dialog.tsx +6 -6
- package/src/shared/components/Field.tsx +45 -0
- package/src/shared/components/IconButton.tsx +74 -0
- package/src/shared/components/ListRow.tsx +96 -0
- package/src/shared/components/Menu.tsx +88 -0
- package/src/shared/components/PageShell.tsx +8 -5
- package/src/shared/components/Surface.tsx +86 -0
- package/src/shared/components/__tests__/primitives.test.tsx +333 -0
- package/src/shared/components/index.ts +48 -0
- package/src/shared/components/useDismissableMenu.ts +71 -0
- package/src/shared/theme/__tests__/accent-contrast.test.ts +84 -0
- package/src/shared/theme/index.css +12 -0
- package/src/shared/theme/measure.ts +64 -0
- package/src/shared/theme/shadows.css +34 -0
- package/src/shared/theme/tokens.css +193 -0
- package/src/test-setup.ts +9 -0
- package/src/modules/access/components/AccessRestrictedBanner.tsx +0 -31
- package/src/modules/access/components/NodeOwnersBanner.tsx +0 -30
- package/src/modules/git/__tests__/ProtectedBranchBanner.test.tsx +0 -82
- package/src/modules/git/components/ProtectedBranchBanner.tsx +0 -42
- package/src/modules/library/__tests__/DetailDialog.test.tsx +0 -200
- package/src/modules/library/__tests__/diff.test.ts +0 -62
- package/src/modules/library/__tests__/loadout.test.tsx +0 -72
- package/src/modules/library/components/CompareView.tsx +0 -357
- package/src/modules/library/components/DetailDialog.tsx +0 -566
- package/src/modules/library/components/GearIcon.tsx +0 -12
- package/src/modules/library/components/LoadoutSidebar.tsx +0 -156
- package/src/modules/library/components/StatusGem.tsx +0 -21
- package/src/modules/library/components/SuggestChange.tsx +0 -171
- package/src/modules/library/components/particles.ts +0 -50
- package/src/modules/library/state/loadout.tsx +0 -129
- package/src/modules/library/utils/diff.ts +0 -102
- package/src/modules/pr/__tests__/PrApprovalBadge.test.tsx +0 -93
- package/src/modules/pr/__tests__/PrCancelButton.test.tsx +0 -158
- package/src/modules/pr/__tests__/PrCancelConfirmDialog.test.tsx +0 -44
- package/src/modules/pr/__tests__/PrMergeButton.test.tsx +0 -360
- package/src/modules/pr/__tests__/bucketize-comments.test.ts +0 -85
- package/src/modules/pr/__tests__/parsePatch.test.ts +0 -104
- package/src/modules/pr/__tests__/usePrViewerState.test.ts +0 -72
- package/src/modules/pr/components/PrApprovalBadge.tsx +0 -80
- package/src/modules/pr/components/PrCancelButton.tsx +0 -99
- package/src/modules/pr/components/PrCancelConfirmDialog.tsx +0 -119
- package/src/modules/pr/components/PrCommentComposer.tsx +0 -92
- package/src/modules/pr/components/PrCommentThread.tsx +0 -168
- package/src/modules/pr/components/PrCommentsPanel.tsx +0 -143
- package/src/modules/pr/components/PrDiffPane.tsx +0 -425
- package/src/modules/pr/components/PrFileRow.tsx +0 -164
- package/src/modules/pr/components/PrFilesList.tsx +0 -53
- package/src/modules/pr/components/PrHeader.tsx +0 -45
- package/src/modules/pr/components/PrHeaderOverflowMenu.tsx +0 -58
- package/src/modules/pr/components/PrMergeButton.tsx +0 -268
- package/src/modules/pr/components/PrMergeConfirmDialog.tsx +0 -112
- package/src/modules/pr/components/PrRefreshFromTargetButton.tsx +0 -110
- package/src/modules/pr/components/PrViewer.tsx +0 -364
- package/src/modules/pr/hooks/usePrViewerState.ts +0 -150
- package/src/modules/pr/state/pr-viewer.context.ts +0 -34
- package/src/modules/pr/utils/bucketize-comments.ts +0 -55
- package/src/modules/pr/utils/parsePatch.ts +0 -57
- package/src/modules/toolbar/components/AdminMenu.tsx +0 -271
|
@@ -136,7 +136,7 @@ export function useFileAccess(
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* Render-helper for the "you don't have permission to edit this file" copy.
|
|
139
|
-
* Used
|
|
139
|
+
* Used as a tooltip on disabled save
|
|
140
140
|
* buttons.
|
|
141
141
|
*/
|
|
142
142
|
export function formatEligible(eligible: AccessEligible): string {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { AdminRolesPage } from '../components/AdminRolesPage';
|
|
5
|
+
import { AdminContext } from '../state/admin.context';
|
|
6
|
+
import { fetchRoles, type RoleRosterEntry } from '../services/roles.api';
|
|
7
|
+
import { suggestPrincipals } from '../../access/api';
|
|
8
|
+
|
|
9
|
+
vi.mock('../services/roles.api', async (importOriginal) => {
|
|
10
|
+
const actual = await importOriginal<typeof import('../services/roles.api')>();
|
|
11
|
+
return {
|
|
12
|
+
...actual,
|
|
13
|
+
fetchRoles: vi.fn(),
|
|
14
|
+
addMember: vi.fn(),
|
|
15
|
+
removeMember: vi.fn(),
|
|
16
|
+
createRole: vi.fn(),
|
|
17
|
+
deleteRole: vi.fn(),
|
|
18
|
+
renameRole: vi.fn(),
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
vi.mock('../../access/api', async (importOriginal) => {
|
|
22
|
+
const actual = await importOriginal<typeof import('../../access/api')>();
|
|
23
|
+
return { ...actual, suggestPrincipals: vi.fn() };
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const ENGINEERING: RoleRosterEntry = {
|
|
27
|
+
canonical: 'engineering',
|
|
28
|
+
displayName: 'Engineering',
|
|
29
|
+
members: [],
|
|
30
|
+
isAdmin: false,
|
|
31
|
+
referencedBy: [],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function renderPage() {
|
|
35
|
+
return render(
|
|
36
|
+
<AdminContext.Provider
|
|
37
|
+
value={{
|
|
38
|
+
isAdmin: true,
|
|
39
|
+
unreadCount: 0,
|
|
40
|
+
lastSeen: null,
|
|
41
|
+
markSeen: () => {},
|
|
42
|
+
refresh: () => {},
|
|
43
|
+
rolesConfigCorrupted: false,
|
|
44
|
+
rolesConfigErrors: [],
|
|
45
|
+
runRolesRecovery: async () => {},
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
<AdminRolesPage />
|
|
49
|
+
</AdminContext.Provider>,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
vi.mocked(fetchRoles).mockReset().mockResolvedValue([ENGINEERING]);
|
|
55
|
+
vi.mocked(suggestPrincipals)
|
|
56
|
+
.mockReset()
|
|
57
|
+
.mockResolvedValue({
|
|
58
|
+
groups: [],
|
|
59
|
+
people: [{ name: 'Alice', email: 'alice@example.com' }],
|
|
60
|
+
peopleWithheld: false,
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('AdminRolesPage: add-member autocomplete', () => {
|
|
65
|
+
it('caps the suggestion list at its wrapper so it cannot overflow the card', async () => {
|
|
66
|
+
const user = userEvent.setup();
|
|
67
|
+
renderPage();
|
|
68
|
+
|
|
69
|
+
const input = await screen.findByRole('textbox', { name: 'Member email' });
|
|
70
|
+
await user.type(input, 'al');
|
|
71
|
+
|
|
72
|
+
// The suggest fetch is debounced 200ms; wait for the list to materialise.
|
|
73
|
+
const alice = await screen.findByText(
|
|
74
|
+
'alice@example.com',
|
|
75
|
+
undefined,
|
|
76
|
+
{ timeout: 2000 },
|
|
77
|
+
);
|
|
78
|
+
const list = alice.closest('ul')!;
|
|
79
|
+
|
|
80
|
+
// The wrapper is `flex-1 min-w-0 max-w-[16rem]` and can shrink below
|
|
81
|
+
// 16rem; the list forces `sm:w-72` (18rem) at the sm breakpoint. Without
|
|
82
|
+
// `max-w-full` the absolutely-positioned list escapes the shrinking
|
|
83
|
+
// wrapper and runs past the card border on narrow viewports.
|
|
84
|
+
expect(list.className).toContain('max-w-full');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -125,7 +125,11 @@ describe('UserAccountsPage', () => {
|
|
|
125
125
|
const dialog = within(screen.getByRole('dialog'));
|
|
126
126
|
await userEvent.click(dialog.getByRole('button', { name: 'Delete account' }));
|
|
127
127
|
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
|
128
|
-
|
|
128
|
+
// Announced, not merely coloured — same guarantee the load failure gets.
|
|
129
|
+
expect(screen.getByRole('alert')).toHaveTextContent('Failed to erase user');
|
|
130
|
+
// And the rows survive: keeping what was already fetched is the half of
|
|
131
|
+
// the old `[]` coercion that was worth keeping, so it is pinned here.
|
|
132
|
+
expect(screen.getByText('Alice')).toBeInTheDocument();
|
|
129
133
|
expect(listAccounts).toHaveBeenCalledTimes(1);
|
|
130
134
|
});
|
|
131
135
|
|
|
@@ -153,4 +157,16 @@ describe('UserAccountsPage', () => {
|
|
|
153
157
|
await userEvent.click(screen.getByRole('button', { name: 'Add account' }));
|
|
154
158
|
expect(await screen.findByRole('alert')).toHaveTextContent('at least 8 characters');
|
|
155
159
|
});
|
|
160
|
+
|
|
161
|
+
// "We could not ask" is not "there is nobody". The failure used to store an
|
|
162
|
+
// empty list, so an admin whose backend was unreachable read "No user
|
|
163
|
+
// accounts." — a deployment they would have had every reason to believe.
|
|
164
|
+
it('a failed FIRST load reports the failure rather than an empty deployment', async () => {
|
|
165
|
+
vi.mocked(listAccounts).mockReset().mockRejectedValue(new Error('Backend unreachable'));
|
|
166
|
+
renderPage();
|
|
167
|
+
expect(await screen.findByRole('alert')).toHaveTextContent('Backend unreachable');
|
|
168
|
+
expect(screen.queryByText('No user accounts.')).not.toBeInTheDocument();
|
|
169
|
+
// ...and no "Loading…" left sitting beside the banner forever, either.
|
|
170
|
+
expect(screen.queryByText('Loading…')).not.toBeInTheDocument();
|
|
171
|
+
});
|
|
156
172
|
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
3
|
+
import { AdminProvider, useAdmin } from '../state/admin.context';
|
|
4
|
+
import { AuthContext, type AuthContextValue } from '../../auth/state/auth.context';
|
|
5
|
+
import { AppRegistryContext, makeRegistry } from '../../../core/registry';
|
|
6
|
+
|
|
7
|
+
vi.mock('../services/admin.api', () => ({
|
|
8
|
+
fetchAdminAccess: vi.fn().mockResolvedValue({ isAdmin: true, rolesConfig: { ok: true } }),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const auth = {
|
|
12
|
+
user: { id: 'u1', email: 'root@example.com', name: 'Root' },
|
|
13
|
+
token: 't',
|
|
14
|
+
isLoading: false,
|
|
15
|
+
login: async () => {},
|
|
16
|
+
logout: () => {},
|
|
17
|
+
} as AuthContextValue;
|
|
18
|
+
|
|
19
|
+
function Badge() {
|
|
20
|
+
return <span data-testid="count">{useAdmin().unreadCount}</span>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function renderWith(registry: ReturnType<typeof makeRegistry>) {
|
|
24
|
+
return render(
|
|
25
|
+
<AuthContext.Provider value={auth}>
|
|
26
|
+
<AppRegistryContext.Provider value={registry}>
|
|
27
|
+
<AdminProvider>
|
|
28
|
+
<Badge />
|
|
29
|
+
</AdminProvider>
|
|
30
|
+
</AppRegistryContext.Provider>
|
|
31
|
+
</AuthContext.Provider>,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let fetchSpy: ReturnType<typeof vi.fn>;
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
fetchSpy = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ count: 0 }) });
|
|
38
|
+
vi.stubGlobal('fetch', fetchSpy);
|
|
39
|
+
});
|
|
40
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The badge counts an ENTERPRISE inbox. Core polled its endpoint every thirty
|
|
44
|
+
* seconds anyway — a guaranteed 404 on every core deployment, forever, filling
|
|
45
|
+
* the console of the one screen an operator opens when something is wrong.
|
|
46
|
+
*/
|
|
47
|
+
describe('AdminProvider: the unread badge', () => {
|
|
48
|
+
it('makes no request at all when nothing is counting', async () => {
|
|
49
|
+
renderWith(makeRegistry({}));
|
|
50
|
+
await waitFor(() => expect(screen.getByTestId('count')).toHaveTextContent('0'));
|
|
51
|
+
const asked = fetchSpy.mock.calls.some((call) => String(call[0]).includes('unread-count'));
|
|
52
|
+
expect(asked).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('uses the counter an overlay registers', async () => {
|
|
56
|
+
const adminUnreadCount = vi.fn().mockResolvedValue(7);
|
|
57
|
+
renderWith(makeRegistry({ adminUnreadCount }));
|
|
58
|
+
await waitFor(() => expect(screen.getByTestId('count')).toHaveTextContent('7'));
|
|
59
|
+
expect(adminUnreadCount).toHaveBeenCalled();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -16,7 +16,10 @@ import {
|
|
|
16
16
|
import { suggestPrincipals } from '../../access/api';
|
|
17
17
|
|
|
18
18
|
/** The default-branch workspace id — roles are managed there (admin status derives from it). */
|
|
19
|
-
|
|
19
|
+
// A function, not a constant: the branch model arrives from `/api/config`
|
|
20
|
+
// during boot, and a module-scope capture would freeze this at the empty
|
|
21
|
+
// string that exists before it.
|
|
22
|
+
const rolesWorkspaceId = () => encodeURIComponent(DEFAULT_BRANCH);
|
|
20
23
|
|
|
21
24
|
const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
22
25
|
|
|
@@ -216,8 +219,8 @@ export function AdminRolesPage() {
|
|
|
216
219
|
|
|
217
220
|
if (!isAdmin) {
|
|
218
221
|
return (
|
|
219
|
-
<PageShell title="Roles & Members"
|
|
220
|
-
<div className="text-sm text-
|
|
222
|
+
<PageShell title="Roles & Members">
|
|
223
|
+
<div className="text-sm text-ink-muted">
|
|
221
224
|
Admins only. Ask an admin if you need a role or membership changed.
|
|
222
225
|
</div>
|
|
223
226
|
</PageShell>
|
|
@@ -227,11 +230,11 @@ export function AdminRolesPage() {
|
|
|
227
230
|
return (
|
|
228
231
|
<PageShell
|
|
229
232
|
title="Roles & Members"
|
|
230
|
-
|
|
233
|
+
|
|
231
234
|
actions={<NewRoleControl onCreate={createOptimistic} />}
|
|
232
235
|
>
|
|
233
236
|
{loading && roster.length === 0 ? (
|
|
234
|
-
<div className="flex items-center gap-2 p-2 text-sm text-
|
|
237
|
+
<div className="flex items-center gap-2 p-2 text-sm text-ink-muted">
|
|
235
238
|
<Loader2 size={14} className="animate-spin" /> Loading…
|
|
236
239
|
</div>
|
|
237
240
|
) : error ? (
|
|
@@ -239,7 +242,7 @@ export function AdminRolesPage() {
|
|
|
239
242
|
{error}
|
|
240
243
|
</div>
|
|
241
244
|
) : visibleRoster.length === 0 ? (
|
|
242
|
-
<div className="p-2 text-sm text-
|
|
245
|
+
<div className="p-2 text-sm text-ink-muted">No roles yet.</div>
|
|
243
246
|
) : (
|
|
244
247
|
<div className="flex flex-col gap-3">
|
|
245
248
|
{visibleRoster.map((role) => (
|
|
@@ -296,7 +299,7 @@ function NewRoleControl({
|
|
|
296
299
|
<button
|
|
297
300
|
type="button"
|
|
298
301
|
onClick={() => setOpen(true)}
|
|
299
|
-
className="px-3 py-1.5 text-xs rounded border border-
|
|
302
|
+
className="px-3 py-1.5 text-xs rounded border border-line hover:bg-hover flex items-center gap-1.5"
|
|
300
303
|
>
|
|
301
304
|
<Plus size={12} /> New role
|
|
302
305
|
</button>
|
|
@@ -315,20 +318,20 @@ function NewRoleControl({
|
|
|
315
318
|
if (e.key === 'Escape') reset();
|
|
316
319
|
}}
|
|
317
320
|
placeholder="Role name"
|
|
318
|
-
className="text-xs px-2 py-1 border border-
|
|
321
|
+
className="text-xs px-2 py-1 border border-line rounded focus:outline-none focus:border-accent w-48 max-w-full min-w-0"
|
|
319
322
|
aria-label="New role name"
|
|
320
323
|
/>
|
|
321
324
|
<button
|
|
322
325
|
type="button"
|
|
323
326
|
onClick={submit}
|
|
324
|
-
className="px-2 py-1 text-xs rounded bg-
|
|
327
|
+
className="px-2 py-1 text-xs rounded bg-accent hover:bg-accent-hover text-white disabled:opacity-50 flex items-center gap-1"
|
|
325
328
|
>
|
|
326
329
|
Add
|
|
327
330
|
</button>
|
|
328
331
|
<button
|
|
329
332
|
type="button"
|
|
330
333
|
onClick={reset}
|
|
331
|
-
className="p-1 rounded hover:bg-
|
|
334
|
+
className="p-1 rounded hover:bg-hover text-ink-muted"
|
|
332
335
|
aria-label="Cancel"
|
|
333
336
|
>
|
|
334
337
|
<X size={14} />
|
|
@@ -398,7 +401,7 @@ function RoleCard({
|
|
|
398
401
|
}
|
|
399
402
|
const myReq = ++suggestReq.current;
|
|
400
403
|
const t = setTimeout(() => {
|
|
401
|
-
suggestPrincipals(
|
|
404
|
+
suggestPrincipals(rolesWorkspaceId(), q)
|
|
402
405
|
.then((res) => {
|
|
403
406
|
if (myReq !== suggestReq.current) return;
|
|
404
407
|
// People only; drop anyone already a member (server or optimistic).
|
|
@@ -593,7 +596,7 @@ function RoleCard({
|
|
|
593
596
|
};
|
|
594
597
|
|
|
595
598
|
return (
|
|
596
|
-
<div className="border border-
|
|
599
|
+
<div className="border border-line rounded-lg p-4">
|
|
597
600
|
<div className="flex items-start gap-3">
|
|
598
601
|
<div className="flex-1 min-w-0">
|
|
599
602
|
{renaming ? (
|
|
@@ -610,14 +613,14 @@ function RoleCard({
|
|
|
610
613
|
}
|
|
611
614
|
}}
|
|
612
615
|
disabled={busy}
|
|
613
|
-
className="text-base font-semibold px-2 py-1 border border-
|
|
616
|
+
className="text-base font-semibold px-2 py-1 border border-line rounded focus:outline-none focus:border-accent min-w-0"
|
|
614
617
|
aria-label="Role name"
|
|
615
618
|
/>
|
|
616
619
|
<button
|
|
617
620
|
type="button"
|
|
618
621
|
onClick={submitRename}
|
|
619
622
|
disabled={busy}
|
|
620
|
-
className="p-1 rounded hover:bg-
|
|
623
|
+
className="p-1 rounded hover:bg-hover text-ink-muted disabled:opacity-50 shrink-0"
|
|
621
624
|
aria-label="Save name"
|
|
622
625
|
>
|
|
623
626
|
{busy ? <Loader2 size={14} className="animate-spin" /> : <Check size={14} />}
|
|
@@ -629,7 +632,7 @@ function RoleCard({
|
|
|
629
632
|
setRenaming(false);
|
|
630
633
|
}}
|
|
631
634
|
disabled={busy}
|
|
632
|
-
className="p-1 rounded hover:bg-
|
|
635
|
+
className="p-1 rounded hover:bg-hover text-ink-muted shrink-0"
|
|
633
636
|
aria-label="Cancel rename"
|
|
634
637
|
>
|
|
635
638
|
<X size={14} />
|
|
@@ -637,11 +640,11 @@ function RoleCard({
|
|
|
637
640
|
</div>
|
|
638
641
|
) : (
|
|
639
642
|
<div className="flex items-center gap-2">
|
|
640
|
-
<h2 className="text-base font-semibold text-
|
|
643
|
+
<h2 className="text-base font-semibold text-ink truncate">
|
|
641
644
|
{displayName}
|
|
642
645
|
</h2>
|
|
643
646
|
{role.isAdmin && (
|
|
644
|
-
<span className="text-[10px] uppercase tracking-wide text-
|
|
647
|
+
<span className="text-[10px] uppercase tracking-wide text-ink-muted border border-line rounded px-1.5 py-0.5">
|
|
645
648
|
Required
|
|
646
649
|
</span>
|
|
647
650
|
)}
|
|
@@ -658,7 +661,7 @@ function RoleCard({
|
|
|
658
661
|
setRenaming(true);
|
|
659
662
|
}}
|
|
660
663
|
disabled={busy || renamePending}
|
|
661
|
-
className="p-1.5 rounded hover:bg-
|
|
664
|
+
className="p-1.5 rounded hover:bg-hover text-ink-muted disabled:opacity-50"
|
|
662
665
|
title="Rename"
|
|
663
666
|
aria-label="Rename role"
|
|
664
667
|
>
|
|
@@ -683,24 +686,24 @@ function RoleCard({
|
|
|
683
686
|
{/* Member chips — optimistically hides members pending removal. */}
|
|
684
687
|
<div className="mt-3 flex flex-wrap gap-2">
|
|
685
688
|
{visibleMembers.length === 0 ? (
|
|
686
|
-
<span className="text-xs text-
|
|
689
|
+
<span className="text-xs text-ink-faint">No members.</span>
|
|
687
690
|
) : (
|
|
688
691
|
visibleMembers.map((email) => {
|
|
689
692
|
const isLastAdminMember = role.isAdmin && visibleMembers.length === 1;
|
|
690
693
|
return (
|
|
691
694
|
<span
|
|
692
695
|
key={email}
|
|
693
|
-
className="inline-flex items-center gap-1.5 pl-1 pr-1.5 py-1 bg-
|
|
696
|
+
className="inline-flex max-w-full items-center gap-1.5 pl-1 pr-1.5 py-1 bg-sunken border border-line rounded-full text-xs text-ink"
|
|
694
697
|
>
|
|
695
|
-
<span className="w-5 h-5 rounded-full bg-
|
|
698
|
+
<span className="w-5 h-5 shrink-0 rounded-full bg-ink-muted text-white text-[9px] font-semibold flex items-center justify-center">
|
|
696
699
|
{initials(email)}
|
|
697
700
|
</span>
|
|
698
|
-
<span className="truncate max-w-[14rem]">{email}</span>
|
|
701
|
+
<span className="min-w-0 truncate max-w-[14rem]">{email}</span>
|
|
699
702
|
<button
|
|
700
703
|
type="button"
|
|
701
704
|
onClick={() => handleRemoveMember(email)}
|
|
702
705
|
disabled={busy || renamePending || isLastAdminMember}
|
|
703
|
-
className="rounded-full p-0.5 text-
|
|
706
|
+
className="shrink-0 rounded-full p-0.5 text-ink-faint hover:text-red-600 hover:bg-red-50 disabled:cursor-not-allowed disabled:hover:text-ink-faint disabled:hover:bg-transparent"
|
|
704
707
|
title={
|
|
705
708
|
isLastAdminMember
|
|
706
709
|
? 'Admin must keep at least one member'
|
|
@@ -717,8 +720,11 @@ function RoleCard({
|
|
|
717
720
|
</div>
|
|
718
721
|
|
|
719
722
|
{/* Add member — with people autocomplete (Manage Access suggest source). */}
|
|
723
|
+
{/* The input is capped rather than fixed-width, and its wrapper may shrink,
|
|
724
|
+
so the row fits the card on a narrow viewport instead of pushing the
|
|
725
|
+
Add button past the card border. */}
|
|
720
726
|
<div className="mt-3 flex items-center gap-1.5">
|
|
721
|
-
<div className="relative">
|
|
727
|
+
<div className="relative flex-1 min-w-0 max-w-[16rem]">
|
|
722
728
|
<input
|
|
723
729
|
type="email"
|
|
724
730
|
value={memberEmail}
|
|
@@ -735,12 +741,12 @@ function RoleCard({
|
|
|
735
741
|
}}
|
|
736
742
|
placeholder="Add member by email"
|
|
737
743
|
disabled={busy || renamePending}
|
|
738
|
-
className="text-xs px-2 py-1 border border-
|
|
744
|
+
className="text-xs px-2 py-1 border border-line rounded focus:outline-none focus:border-accent w-full min-w-0"
|
|
739
745
|
aria-label="Member email"
|
|
740
746
|
autoComplete="off"
|
|
741
747
|
/>
|
|
742
748
|
{showSuggest && suggestions.length > 0 && (
|
|
743
|
-
<ul className="absolute z-10 mt-1 w-72 max-h-56 overflow-auto bg-white border border-
|
|
749
|
+
<ul className="absolute z-10 mt-1 w-full sm:w-72 max-w-full max-h-56 overflow-auto bg-white border border-line rounded shadow-lg py-1">
|
|
744
750
|
{suggestions.map((p) => (
|
|
745
751
|
<li key={p.email}>
|
|
746
752
|
<button
|
|
@@ -750,13 +756,13 @@ function RoleCard({
|
|
|
750
756
|
e.preventDefault();
|
|
751
757
|
submitAddMember(p.email);
|
|
752
758
|
}}
|
|
753
|
-
className="w-full text-left px-2 py-1.5 hover:bg-
|
|
759
|
+
className="w-full text-left px-2 py-1.5 hover:bg-hover flex items-center gap-2"
|
|
754
760
|
>
|
|
755
|
-
<span className="w-5 h-5 rounded-full bg-
|
|
761
|
+
<span className="w-5 h-5 rounded-full bg-ink-muted text-white text-[9px] font-semibold flex items-center justify-center shrink-0">
|
|
756
762
|
{initials(p.email)}
|
|
757
763
|
</span>
|
|
758
|
-
<span className="flex-1 truncate text-xs text-
|
|
759
|
-
<span className="text-[10px] text-
|
|
764
|
+
<span className="flex-1 truncate text-xs text-ink">{p.name || p.email}</span>
|
|
765
|
+
<span className="text-[10px] text-ink-faint truncate">{p.email}</span>
|
|
760
766
|
</button>
|
|
761
767
|
</li>
|
|
762
768
|
))}
|
|
@@ -767,7 +773,7 @@ function RoleCard({
|
|
|
767
773
|
type="button"
|
|
768
774
|
onClick={() => submitAddMember()}
|
|
769
775
|
disabled={busy || renamePending}
|
|
770
|
-
className="px-3 py-1 text-xs rounded border border-
|
|
776
|
+
className="shrink-0 px-3 py-1 text-xs rounded border border-line hover:bg-hover disabled:opacity-50 flex items-center gap-1"
|
|
771
777
|
>
|
|
772
778
|
{busy && <Loader2 size={12} className="animate-spin" />}
|
|
773
779
|
Add
|
|
@@ -791,12 +797,12 @@ function RoleCard({
|
|
|
791
797
|
>
|
|
792
798
|
{deleteTarget.role.referencedBy.length > 0 ? (
|
|
793
799
|
<>
|
|
794
|
-
<p className="text-sm text-
|
|
800
|
+
<p className="text-sm text-ink">
|
|
795
801
|
{deleteTarget.role.referencedBy.length} access rule
|
|
796
802
|
{deleteTarget.role.referencedBy.length === 1 ? '' : 's'} will be
|
|
797
803
|
ignored after deletion:
|
|
798
804
|
</p>
|
|
799
|
-
<ul className="mt-2 max-h-40 overflow-auto text-xs text-
|
|
805
|
+
<ul className="mt-2 max-h-40 overflow-auto text-xs text-ink-muted space-y-0.5">
|
|
800
806
|
{deleteTarget.role.referencedBy.map((ref, i) => (
|
|
801
807
|
<li key={`${ref.path}:${ref.verb}:${i}`} className="truncate">
|
|
802
808
|
{ref.verb} · {ref.path}
|
|
@@ -805,7 +811,7 @@ function RoleCard({
|
|
|
805
811
|
</ul>
|
|
806
812
|
</>
|
|
807
813
|
) : (
|
|
808
|
-
<p className="text-sm text-
|
|
814
|
+
<p className="text-sm text-ink">This role has no access rules.</p>
|
|
809
815
|
)}
|
|
810
816
|
</ConfirmDialog>
|
|
811
817
|
)}
|
|
@@ -819,7 +825,7 @@ function RoleCard({
|
|
|
819
825
|
onCancel={() => setSelfRemove(null)}
|
|
820
826
|
onConfirm={confirmSelfRemove}
|
|
821
827
|
>
|
|
822
|
-
<p className="text-sm text-
|
|
828
|
+
<p className="text-sm text-ink">
|
|
823
829
|
You are removing your own last Admin membership. You may lose access
|
|
824
830
|
to admin tools.
|
|
825
831
|
</p>
|
|
@@ -914,14 +920,14 @@ function ConfirmDialog({
|
|
|
914
920
|
tabIndex={-1}
|
|
915
921
|
className="bg-white rounded-lg shadow-lg w-full max-w-md p-5 outline-none"
|
|
916
922
|
>
|
|
917
|
-
<h3 id={titleId} className="text-sm font-semibold text-
|
|
923
|
+
<h3 id={titleId} className="text-sm font-semibold text-ink">{title}</h3>
|
|
918
924
|
<div className="mt-3">{children}</div>
|
|
919
925
|
<div className="mt-5 flex justify-end gap-2">
|
|
920
926
|
<button
|
|
921
927
|
type="button"
|
|
922
928
|
onClick={onCancel}
|
|
923
929
|
disabled={busy}
|
|
924
|
-
className="px-3 py-1.5 text-xs rounded border border-
|
|
930
|
+
className="px-3 py-1.5 text-xs rounded border border-line hover:bg-hover disabled:opacity-50"
|
|
925
931
|
>
|
|
926
932
|
Cancel
|
|
927
933
|
</button>
|
|
@@ -930,7 +936,7 @@ function ConfirmDialog({
|
|
|
930
936
|
onClick={onConfirm}
|
|
931
937
|
disabled={busy}
|
|
932
938
|
className={`px-3 py-1.5 text-xs rounded text-white disabled:opacity-50 flex items-center gap-1 ${
|
|
933
|
-
danger ? 'bg-red-600 hover:bg-red-700' : 'bg-
|
|
939
|
+
danger ? 'bg-red-600 hover:bg-red-700' : 'bg-accent hover:bg-accent-hover'
|
|
934
940
|
}`}
|
|
935
941
|
>
|
|
936
942
|
{busy && <Loader2 size={12} className="animate-spin" />}
|
|
@@ -2,6 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import { ShieldAlert, Loader2 } from 'lucide-react';
|
|
3
3
|
import { useAdmin } from '../state/admin.context';
|
|
4
4
|
import { RolesApiError } from '../services/roles.api';
|
|
5
|
+
import { Button } from '../../../shared/components';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* App-wide break-glass banner shown when `roles.yaml` fails to parse. A
|
|
@@ -46,29 +47,29 @@ export function RolesCorruptedBanner() {
|
|
|
46
47
|
return (
|
|
47
48
|
<div
|
|
48
49
|
role="alert"
|
|
49
|
-
className="flex flex-col gap-1 px-4 py-2.5 bg-
|
|
50
|
+
className="flex flex-col gap-1 px-4 py-2.5 bg-danger-soft border-b border-line text-danger text-sm shrink-0"
|
|
50
51
|
>
|
|
51
52
|
<div className="flex items-center gap-2">
|
|
52
53
|
<ShieldAlert size={16} className="shrink-0" />
|
|
53
54
|
<span className="flex-1 font-semibold">
|
|
54
|
-
Roles file corrupted
|
|
55
|
+
Roles file corrupted: contact Bevel for assistance.
|
|
55
56
|
</span>
|
|
56
|
-
<
|
|
57
|
-
|
|
57
|
+
<Button
|
|
58
|
+
variant="danger"
|
|
59
|
+
size="tiny"
|
|
58
60
|
onClick={onRecover}
|
|
59
61
|
disabled={running}
|
|
60
|
-
|
|
62
|
+
leadingIcon={running ? <Loader2 size={12} className="animate-spin" /> : undefined}
|
|
61
63
|
>
|
|
62
|
-
{running
|
|
63
|
-
|
|
64
|
-
</button>
|
|
64
|
+
{running ? 'Recovering…' : 'Bevel Recovery. Only press if you are from Bevel'}
|
|
65
|
+
</Button>
|
|
65
66
|
</div>
|
|
66
67
|
{rolesConfigErrors.length > 0 && (
|
|
67
|
-
<span className="pl-6 text-xs text-
|
|
68
|
+
<span className="pl-6 text-xs text-ink-muted font-mono break-all">
|
|
68
69
|
{rolesConfigErrors.join('; ')}
|
|
69
70
|
</span>
|
|
70
71
|
)}
|
|
71
|
-
{error && <span className="pl-6 text-xs text-
|
|
72
|
+
{error && <span className="pl-6 text-xs text-danger">{error}</span>}
|
|
72
73
|
</div>
|
|
73
74
|
);
|
|
74
75
|
}
|