@bevel-software/platform-core-frontend 0.15.1 → 0.20.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/THIRD-PARTY-NOTICES.md +2 -2
- package/package.json +3 -3
- package/src/core/CoreAppShell.tsx +20 -9
- package/src/core/__tests__/AppChrome.test.tsx +0 -3
- package/src/core/__tests__/events.test.ts +43 -0
- package/src/core/bootstrap.ts +11 -3
- package/src/core/events.ts +85 -3
- package/src/core/registry.ts +1 -1
- package/src/lib/__tests__/email.test.ts +44 -0
- package/src/lib/email.ts +37 -1
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +141 -0
- package/src/modules/access/__tests__/ManageAccessDialog.chip-truncation.test.tsx +204 -0
- package/src/modules/access/__tests__/ManageAccessDialog.download-read.test.tsx +234 -0
- package/src/modules/access/__tests__/ManageAccessDialog.edited-row-visible.test.tsx +160 -0
- package/src/modules/access/__tests__/ManageAccessDialog.placement.test.tsx +2 -2
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +166 -0
- package/src/modules/access/__tests__/ManageAccessDialog.restrict.test.tsx +510 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-axes.test.tsx +299 -0
- package/src/modules/access/__tests__/ManageAccessDialog.row-menu-width.test.tsx +226 -0
- package/src/modules/access/__tests__/ManageAccessDialog.test.tsx +721 -126
- package/src/modules/access/__tests__/ManageAccessDialog.unknown-email.test.tsx +314 -0
- package/src/modules/access/__tests__/manage-access-affordance.test.ts +14 -0
- package/src/modules/access/__tests__/tailwindDeclarations.ts +210 -0
- package/src/modules/access/api.ts +140 -6
- package/src/modules/access/components/ManageAccessDialog.tsx +1299 -561
- package/src/modules/access/manage-access-affordance.ts +17 -0
- package/src/modules/admin/__tests__/AddMemberInput.test.tsx +297 -0
- package/src/modules/admin/__tests__/AdminRolesPage.capabilities.test.tsx +2 -2
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +189 -0
- package/src/modules/admin/__tests__/AdminRolesPage.suggest.test.tsx +1 -1
- package/src/modules/admin/__tests__/DirectoryGroupsPage.suggest.test.tsx +182 -0
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +165 -14
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +401 -4
- package/src/modules/admin/__tests__/group-members-path.test.ts +27 -0
- package/src/modules/admin/components/AddMemberInput.tsx +268 -0
- package/src/modules/admin/components/AdminRolesPage.tsx +97 -132
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +91 -39
- package/src/modules/admin/components/UserAccountsPage.tsx +271 -37
- package/src/modules/admin/components/group-members-path.ts +32 -0
- package/src/modules/admin/services/roles.api.ts +12 -1
- package/src/modules/audit/__tests__/AuditLogPage.test.tsx +312 -0
- package/src/modules/audit/components/AuditEventsPanel.tsx +319 -0
- package/src/modules/audit/components/AuditLogPage.tsx +373 -0
- package/src/modules/audit/components/principal-grouping.ts +49 -0
- package/src/modules/audit/services/audit.api.ts +98 -0
- package/src/modules/auth/__tests__/AccountPage.test.tsx +50 -2
- package/src/modules/auth/components/AccountPage.tsx +73 -54
- package/src/modules/auth/components/LoginScreen.tsx +1 -0
- package/src/modules/auth/services/account.api.ts +78 -4
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +144 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +422 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +431 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +193 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +142 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +202 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +205 -13
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +271 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +208 -0
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +286 -0
- package/src/modules/change-requests/__tests__/propose.concurrent.test.ts +273 -0
- package/src/modules/change-requests/__tests__/readFailure.test.ts +122 -0
- package/src/modules/change-requests/__tests__/useCrFileDiffs.test.tsx +238 -0
- package/src/modules/change-requests/__tests__/useFileOnBranch.test.tsx +56 -1
- package/src/modules/change-requests/__tests__/useForkPointFile.test.tsx +79 -0
- package/src/modules/change-requests/components/BranchFilePreview.tsx +357 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +31 -2
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +862 -72
- package/src/modules/change-requests/components/CrFileTree.tsx +74 -58
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +19 -15
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +41 -7
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +181 -23
- package/src/modules/change-requests/hooks/useFileOnBranch.ts +70 -7
- package/src/modules/change-requests/hooks/useForkPointFile.ts +77 -0
- package/src/modules/change-requests/services/change-requests.api.ts +57 -1
- package/src/modules/change-requests/services/denied-file.api.ts +53 -0
- package/src/modules/change-requests/services/propose.api.ts +97 -8
- package/src/modules/change-requests/utils/approval.ts +15 -0
- package/src/modules/change-requests/utils/author.ts +32 -0
- package/src/modules/change-requests/utils/readFailure.ts +110 -0
- package/src/modules/git/__tests__/FileHistoryPanel.test.tsx +20 -0
- package/src/modules/git/components/FileHistoryPanel.tsx +5 -0
- package/src/modules/git/components/PullRequestsForMe.tsx +51 -24
- package/src/modules/git/services/__tests__/error-messages.test.ts +29 -0
- package/src/modules/git/services/error-messages.ts +12 -0
- package/src/modules/git/services/pr-prompts.ts +5 -5
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +401 -0
- package/src/modules/layout/__tests__/SidebarFooterGrid.test.tsx +286 -0
- package/src/modules/layout/__tests__/SidebarFrameResponsive.test.tsx +61 -0
- package/src/modules/layout/components/AppLayout.tsx +2 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +4 -1
- package/src/modules/layout/components/ResizableThreePaneLayout.tsx +4 -1
- package/src/modules/layout/components/SidebarFrame.tsx +108 -3
- package/src/modules/library/__tests__/AddToPluginDialog.test.tsx +171 -5
- package/src/modules/library/__tests__/DeleteToolDialog.test.tsx +356 -0
- package/src/modules/library/__tests__/IntegrationsSetupReminder.test.tsx +60 -0
- package/src/modules/library/__tests__/LibraryCard.test.tsx +91 -10
- package/src/modules/library/__tests__/LibraryRoutes.test.tsx +242 -107
- package/src/modules/library/__tests__/LibrarySidebarMenu.test.tsx +103 -98
- package/src/modules/library/__tests__/LinkSkillPanel.test.tsx +20 -5
- package/src/modules/library/__tests__/LockedPluginView.test.tsx +97 -7
- package/src/modules/library/__tests__/NewPluginDialog.test.tsx +13 -4
- package/src/modules/library/__tests__/PersonalAddDialog.test.tsx +79 -3
- package/src/modules/library/__tests__/PersonalPluginPage.test.tsx +201 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +100 -9
- package/src/modules/library/__tests__/PluginJoinRequests.test.tsx +60 -1
- package/src/modules/library/__tests__/PluginPage.test.tsx +258 -6
- package/src/modules/library/__tests__/PluginsSidebar.contextmenu.test.tsx +16 -56
- package/src/modules/library/__tests__/PluginsSidebar.test.tsx +155 -152
- package/src/modules/library/__tests__/PluginsSidebarMenu.test.tsx +16 -0
- package/src/modules/library/__tests__/SharedViaPlugins.test.tsx +106 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +386 -80
- package/src/modules/library/__tests__/SkillsTree.test.tsx +293 -4
- package/src/modules/library/__tests__/ToolConnectionSection.test.tsx +582 -71
- package/src/modules/library/__tests__/ToolPage.test.tsx +87 -4
- package/src/modules/library/__tests__/WorkspaceItemRoute.test.tsx +173 -26
- package/src/modules/library/__tests__/auth-harness.tsx +9 -9
- package/src/modules/library/__tests__/card-row-menu.test.tsx +320 -0
- package/src/modules/library/__tests__/library-data.mapping.test.tsx +98 -0
- package/src/modules/library/__tests__/library-data.stale.test.tsx +121 -28
- package/src/modules/library/__tests__/library-data.test.ts +7 -0
- package/src/modules/library/__tests__/library-paths.test.ts +47 -4
- package/src/modules/library/__tests__/link-membership.test.ts +13 -4
- package/src/modules/library/__tests__/name-with-badges.test.tsx +273 -0
- package/src/modules/library/__tests__/newSkillMarkdown.test.ts +30 -0
- package/src/modules/library/__tests__/owner-pill.test.tsx +357 -0
- package/src/modules/library/__tests__/pending-tools.test.tsx +400 -0
- package/src/modules/library/__tests__/plugin-entries.test.ts +122 -0
- package/src/modules/library/__tests__/plugin-summary.test.ts +36 -1
- package/src/modules/library/__tests__/status.test.ts +82 -2
- package/src/modules/library/__tests__/tools.api.test.ts +44 -1
- package/src/modules/library/components/AccessRequestsBanner.tsx +85 -47
- package/src/modules/library/components/AddDialogTabs.tsx +103 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +74 -18
- package/src/modules/library/components/IntegrationsSetupReminder.tsx +59 -0
- package/src/modules/library/components/ItemActionsMenu.tsx +288 -0
- package/src/modules/library/components/LibraryCard.tsx +146 -45
- package/src/modules/library/components/LibraryLayout.tsx +119 -256
- package/src/modules/library/components/LibraryPage.tsx +172 -39
- package/src/modules/library/components/LinkSkillPanel.tsx +1 -3
- package/src/modules/library/components/LockedPluginView.tsx +62 -34
- package/src/modules/library/components/NameWithBadges.tsx +164 -0
- package/src/modules/library/components/NewPluginDialog.tsx +16 -2
- package/src/modules/library/components/PageActions.tsx +11 -9
- package/src/modules/library/components/{PendingSkillReview.tsx → PendingItemReview.tsx} +14 -7
- package/src/modules/library/components/PersonalAddDialog.tsx +68 -18
- package/src/modules/library/components/PersonalPluginPage.tsx +121 -22
- package/src/modules/library/components/PluginExtras.tsx +140 -17
- package/src/modules/library/components/PluginIndexRow.tsx +47 -12
- package/src/modules/library/components/PluginPage.tsx +157 -41
- package/src/modules/library/components/PluginRows.tsx +286 -0
- package/src/modules/library/components/PluginsSidebar.tsx +239 -263
- package/src/modules/library/components/PluginsSidebarMenu.tsx +26 -1
- package/src/modules/library/components/ShareButton.tsx +17 -0
- package/src/modules/library/components/SkillsTree.tsx +141 -28
- package/src/modules/library/components/TeamRoute.tsx +15 -0
- package/src/modules/library/components/__tests__/upload-notices-once-per-page.test.tsx +144 -0
- package/src/modules/library/components/plugin-page-parts.tsx +103 -17
- package/src/modules/library/components/skill-page/SharedViaPlugins.tsx +6 -12
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +5 -0
- package/src/modules/library/components/skill-page/SkillPage.tsx +274 -122
- package/src/modules/library/components/tool-page/DeleteToolDialog.tsx +218 -0
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +79 -178
- package/src/modules/library/components/tool-page/ToolPage.tsx +106 -16
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +42 -41
- package/src/modules/library/hooks/__tests__/useLibraryData.test.ts +98 -0
- package/src/modules/library/hooks/useLibraryData.ts +92 -19
- package/src/modules/library/routes/LibraryRoutes.tsx +14 -11
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +77 -27
- package/src/modules/library/routes/library-paths.ts +26 -28
- package/src/modules/library/services/library.api.ts +38 -20
- package/src/modules/library/services/plugins.api.ts +69 -8
- package/src/modules/library/services/teams.api.ts +15 -0
- package/src/modules/library/services/tools.api.ts +78 -0
- package/src/modules/library/state/library-data.tsx +170 -32
- package/src/modules/library/utils/personal-plugin.ts +13 -15
- package/src/modules/library/utils/plugin-entries.ts +134 -0
- package/src/modules/library/utils/plugin-summary.ts +75 -9
- package/src/modules/library/utils/status.ts +135 -33
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +8 -1
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +853 -760
- package/src/modules/onboarding/agent-clients.ts +55 -23
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +5 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +98 -62
- package/src/modules/pr/services/pr-merge.api.ts +2 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +53 -8
- package/src/modules/review/components/ReviewPanel.tsx +15 -17
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +64 -0
- package/src/modules/review/components/__tests__/ReviewPanel.test.tsx +25 -1
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +454 -117
- package/src/modules/secrets-vault/components/SecretsPage.tsx +48 -7
- package/src/modules/secrets-vault/components/ToolSecretsPanel.tsx +84 -5
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +425 -0
- package/src/modules/secrets-vault/components/__tests__/SecretsPage.test.tsx +417 -82
- package/src/modules/secrets-vault/components/__tests__/ToolSecretsPanel.test.tsx +105 -0
- package/src/modules/secrets-vault/components/__tests__/connect-lists-what-the-banner-counted.test.tsx +407 -0
- package/src/modules/secrets-vault/probe/SavedKeyProbeResult.tsx +98 -0
- package/src/modules/secrets-vault/probe/__tests__/probe-verdict.test.ts +160 -0
- package/src/modules/secrets-vault/probe/probe-verdict.ts +108 -0
- package/src/modules/secrets-vault/probe/useSavedKeyProbe.ts +228 -0
- package/src/modules/secrets-vault/services/connect.api.ts +36 -5
- package/src/modules/secrets-vault/utils/connect-status.ts +98 -0
- package/src/modules/settings/components/ClaudeConnectionCard.tsx +9 -24
- package/src/modules/settings/components/ClaudeConnectionFields.tsx +23 -0
- package/src/modules/settings/components/DeploymentPage.tsx +10 -30
- package/src/modules/settings/components/MarketplaceSection.tsx +152 -0
- package/src/modules/settings/components/__tests__/DeploymentPage.test.tsx +67 -4
- package/src/modules/settings/components/__tests__/MarketplaceSection.test.tsx +325 -0
- package/src/modules/settings/components/__tests__/SettingsLayout.test.tsx +7 -6
- package/src/modules/settings/services/github-facade.api.ts +23 -0
- package/src/modules/settings/settings-nav-items.tsx +13 -3
- package/src/modules/setup/__tests__/setup.oidc.test.tsx +172 -0
- package/src/modules/setup/__tests__/setup.probe-refusal.test.tsx +123 -0
- package/src/modules/setup/__tests__/setup.test.tsx +497 -4
- package/src/modules/setup/__tests__/useSetupStatus.test.tsx +130 -0
- package/src/modules/setup/components/SetupGate.tsx +16 -16
- package/src/modules/setup/components/SetupScreen.tsx +532 -43
- package/src/modules/setup/hooks/useSetupStatus.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +141 -4
- package/src/modules/setup/utils/__tests__/root-folders.test.ts +72 -0
- package/src/modules/setup/utils/root-folders.ts +46 -0
- package/src/modules/toolbar/assets/claude-setup/01-add-manually.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/02-add-configuration.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/03-connect-account.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/04-pick-instance.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/05-plugins-add.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/06-add-marketplace.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/07-paste-url-sync.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/08-install-plugins.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/09-select-repository.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/10-connector-not-added.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/11-add-custom-connector.webp +0 -0
- package/src/modules/toolbar/assets/claude-setup/README.md +68 -0
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +296 -0
- package/src/modules/toolbar/components/ClaudeMarketplaceCarousel.tsx +107 -0
- package/src/modules/toolbar/components/ClaudeRegistrationSteps.tsx +127 -0
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +100 -0
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +177 -118
- package/src/modules/toolbar/components/ScreenshotStep.tsx +77 -0
- package/src/modules/toolbar/components/SetupCarousel.tsx +177 -0
- package/src/modules/toolbar/components/__tests__/AgentInstructionsCard.test.tsx +370 -0
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +542 -42
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +2 -2
- package/src/modules/toolbar/components/__tests__/claude-setup-shots.test.ts +104 -0
- package/src/modules/toolbar/components/claude-connector-slide.tsx +38 -0
- package/src/modules/toolbar/components/claude-setup-shots.ts +167 -0
- package/src/modules/toolbar/components/deployment-address.ts +29 -0
- package/src/modules/toolbar/components/setup-step-parts.tsx +35 -0
- package/src/modules/toolbar/services/__tests__/agent-instructions.api.test.ts +89 -0
- package/src/modules/toolbar/services/agent-instructions.api.ts +167 -0
- package/src/modules/toolbar/services/external-api-keys.api.ts +8 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +43 -0
- package/src/modules/workflow/state/EventBusProvider.tsx +122 -11
- package/src/modules/workflow/state/__tests__/EventBusProvider.storage.test.tsx +87 -0
- package/src/modules/workflow/state/__tests__/EventBusProvider.watch.test.tsx +223 -0
- package/src/modules/workflow/state/event-bus.context.ts +10 -0
- package/src/modules/workspace/__tests__/testFixtures.ts +5 -3
- package/src/modules/workspace/components/FileExplorer.tsx +1295 -191
- package/src/modules/workspace/components/FileRoute.tsx +353 -36
- package/src/modules/workspace/components/FileViewer.tsx +172 -46
- package/src/modules/workspace/components/KbDocumentShell.tsx +50 -6
- package/src/modules/workspace/components/KbPageHeader.tsx +120 -55
- package/src/modules/workspace/components/TreeActionConfirm.tsx +350 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +2533 -129
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +731 -18
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +381 -12
- package/src/modules/workspace/components/__tests__/KbDocumentShell.test.tsx +39 -0
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +33 -20
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +13 -4
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +8 -14
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +75 -16
- package/src/modules/workspace/components/renderers/KbImage.tsx +180 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +22 -6
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +48 -22
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +4 -5
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +4 -3
- package/src/modules/workspace/components/renderers/__tests__/DocxRenderer.test.tsx +12 -0
- package/src/modules/workspace/components/renderers/__tests__/DownloadFileButton.test.tsx +57 -9
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.test.tsx +13 -1
- package/src/modules/workspace/components/renderers/__tests__/ImageRenderer.test.tsx +163 -0
- package/src/modules/workspace/components/renderers/__tests__/KbMarkdownView.test.tsx +237 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +108 -14
- package/src/modules/workspace/components/renderers/__tests__/PptxRenderer.test.tsx +14 -1
- package/src/modules/workspace/components/renderers/__tests__/XlsxRenderer.test.tsx +16 -1
- package/src/modules/workspace/components/renderers/__tests__/rendererSelection.test.tsx +66 -1
- package/src/modules/workspace/components/renderers/index.ts +53 -2
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +25 -4
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +40 -0
- package/src/modules/workspace/hooks/__tests__/useImageRevision.test.tsx +174 -0
- package/src/modules/workspace/hooks/__tests__/useOpenChangeRequests.test.tsx +179 -1
- package/src/modules/workspace/hooks/__tests__/useWorkspaceImageResolver.test.tsx +122 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +892 -7
- package/src/modules/workspace/hooks/useImageRevision.ts +101 -0
- package/src/modules/workspace/hooks/useMergedWorkspaceTree.ts +22 -3
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +55 -0
- package/src/modules/workspace/hooks/useWorkspaceState.ts +424 -66
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +279 -3
- package/src/modules/workspace/routing/kb-routes.ts +206 -29
- package/src/modules/workspace/services/__tests__/workspace.api.test.ts +134 -1
- package/src/modules/workspace/services/workspace.api.ts +57 -4
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +343 -0
- package/src/modules/workspace/state/__tests__/upload-lands-where-it-was-dropped.test.tsx +158 -0
- package/src/modules/workspace/state/open-change-requests.tsx +100 -12
- package/src/modules/workspace/state/workspace.context.ts +125 -19
- package/src/modules/workspace/utils/__tests__/file-trace.test.ts +73 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +220 -6
- package/src/modules/workspace/utils/__tests__/pasteLink.test.ts +76 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +364 -0
- package/src/modules/workspace/utils/__tests__/uploadError.test.ts +35 -0
- package/src/modules/workspace/utils/file-trace.ts +50 -0
- package/src/modules/workspace/utils/fileTree.ts +112 -36
- package/src/modules/workspace/utils/frontmatter.ts +8 -4
- package/src/modules/workspace/utils/pasteLink.ts +90 -0
- package/src/modules/workspace/utils/treeConfirm.ts +338 -0
- package/src/modules/workspace/utils/uploadError.ts +29 -0
- package/src/shared/__tests__/marketplace-url.test.ts +6 -1
- package/src/shared/components/Button.tsx +16 -2
- package/src/shared/components/Dialog.tsx +27 -11
- package/src/shared/components/Menu.tsx +13 -1
- package/src/shared/components/PageShell.tsx +13 -8
- package/src/shared/components/__tests__/primitives.test.tsx +116 -2
- package/src/shared/components/__tests__/useFocusHandoff.test.tsx +192 -0
- package/src/shared/components/index.ts +2 -0
- package/src/shared/components/useDismissableMenu.ts +32 -10
- package/src/shared/components/useFocusHandoff.ts +51 -0
- package/src/shared/components/useLatestRef.ts +28 -0
- package/src/shared/markdown/Markdown.tsx +12 -3
- package/src/shared/markdown/__tests__/escapeSpacesInLinkDestinations.test.ts +39 -0
- package/src/shared/markdown/hrefs.ts +50 -0
- package/src/shared/marketplace-url.ts +33 -5
- package/src/shared/mcp/ChatGptInstallLink.tsx +3 -3
- package/src/shared/mcp/ConnectionInstructions.tsx +38 -27
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +3 -3
- package/src/shared/mcp/connect-snippets.ts +14 -9
- package/src/shared/mcp/index.ts +1 -1
- package/src/shared/theme/__tests__/header-band.test.ts +197 -0
- package/src/shared/theme/header.ts +75 -0
- package/src/shared/theme/measure.ts +7 -4
- package/src/shared/theme/tokens.css +25 -0
- package/src/modules/library/__tests__/PluginsIndexPage.test.tsx +0 -363
- package/src/modules/library/__tests__/PluginsSidebar.locked.test.tsx +0 -97
- package/src/modules/library/components/PluginsIndexPage.tsx +0 -270
- package/src/modules/update-check/__tests__/UpdateBanner.test.tsx +0 -126
- package/src/modules/update-check/components/UpdateBanner.tsx +0 -92
- package/src/modules/update-check/services/update-check.api.ts +0 -24
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
5
|
+
import { DirectoryGroupsPage } from '../components/DirectoryGroupsPage';
|
|
6
|
+
import { SUGGEST_DEBOUNCE_MS } from '../components/AddMemberInput';
|
|
7
|
+
import { AdminContext } from '../state/admin.context';
|
|
8
|
+
import { AppRegistryContext, EMPTY_REGISTRY } from '../../../core/registry';
|
|
9
|
+
import { addGroupMember, getGroupsRoster, type GroupsRoster } from '../services/groups.api';
|
|
10
|
+
import { suggestPrincipals, type SuggestResponse } from '../../access/api';
|
|
11
|
+
|
|
12
|
+
vi.mock('../services/groups.api', async (importOriginal) => {
|
|
13
|
+
const actual = await importOriginal<typeof import('../services/groups.api')>();
|
|
14
|
+
return { ...actual, getGroupsRoster: vi.fn(), addGroupMember: vi.fn() };
|
|
15
|
+
});
|
|
16
|
+
vi.mock('../../access/api', async (importOriginal) => {
|
|
17
|
+
const actual = await importOriginal<typeof import('../../access/api')>();
|
|
18
|
+
return { ...actual, suggestPrincipals: vi.fn() };
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* How long "no request" has to hold: the component's own debounce plus slack,
|
|
23
|
+
* derived from the component so raising the debounce cannot leave this test
|
|
24
|
+
* asserting over a window the request has not been scheduled in yet.
|
|
25
|
+
*/
|
|
26
|
+
const PAST_DEBOUNCE_MS = SUGGEST_DEBOUNCE_MS + 150;
|
|
27
|
+
|
|
28
|
+
const ALICE = { name: 'Alice Green', email: 'alice@example.com' };
|
|
29
|
+
const PAT = { name: 'Pat Kim', email: 'pat@example.com' };
|
|
30
|
+
|
|
31
|
+
function people(...list: { name: string; email: string }[]): SuggestResponse {
|
|
32
|
+
return { roles: [], groups: [], people: list, peopleWithheld: false };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const MANUAL_ROSTER: GroupsRoster = {
|
|
36
|
+
mode: 'manual',
|
|
37
|
+
groups: [
|
|
38
|
+
{
|
|
39
|
+
canonical: 'product',
|
|
40
|
+
displayName: 'Product',
|
|
41
|
+
members: ['pat@example.com'],
|
|
42
|
+
referencedBy: [],
|
|
43
|
+
assignedToRoles: [],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
canonical: 'design',
|
|
47
|
+
displayName: 'Design',
|
|
48
|
+
members: [],
|
|
49
|
+
referencedBy: [],
|
|
50
|
+
assignedToRoles: [],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
groupsHealth: { ok: true },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
function renderPage() {
|
|
57
|
+
return render(
|
|
58
|
+
<AppRegistryContext.Provider value={EMPTY_REGISTRY}>
|
|
59
|
+
<AdminContext.Provider
|
|
60
|
+
value={{
|
|
61
|
+
isAdmin: true,
|
|
62
|
+
unreadCount: 0,
|
|
63
|
+
lastSeen: null,
|
|
64
|
+
markSeen: () => {},
|
|
65
|
+
refresh: () => {},
|
|
66
|
+
rolesConfigCorrupted: false,
|
|
67
|
+
rolesConfigErrors: [],
|
|
68
|
+
runRolesRecovery: async () => {},
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<MemoryRouter initialEntries={['/directory-groups']}>
|
|
72
|
+
<DirectoryGroupsPage />
|
|
73
|
+
</MemoryRouter>
|
|
74
|
+
</AdminContext.Provider>
|
|
75
|
+
</AppRegistryContext.Provider>,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The Add button belonging to a member input's row. */
|
|
80
|
+
function addButtonFor(input: HTMLElement) {
|
|
81
|
+
return within(input.closest('div')!.parentElement!).getByRole('button', { name: 'Add' });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
beforeEach(() => {
|
|
85
|
+
vi.mocked(getGroupsRoster).mockReset().mockResolvedValue(MANUAL_ROSTER);
|
|
86
|
+
vi.mocked(addGroupMember).mockReset().mockResolvedValue(MANUAL_ROSTER);
|
|
87
|
+
vi.mocked(suggestPrincipals).mockReset().mockResolvedValue(people(ALICE));
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('DirectoryGroupsPage: add-member people suggestions', () => {
|
|
91
|
+
it('suggests people by name and email, from the same source the roles page uses', async () => {
|
|
92
|
+
renderPage();
|
|
93
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
94
|
+
await userEvent.type(input, 'al');
|
|
95
|
+
|
|
96
|
+
expect(await screen.findByText('Alice Green')).toBeInTheDocument();
|
|
97
|
+
expect(screen.getByText('alice@example.com')).toBeInTheDocument();
|
|
98
|
+
// The access suggest endpoint on the default-branch workspace — exactly
|
|
99
|
+
// what Roles & Members and the access dialog ask.
|
|
100
|
+
expect(suggestPrincipals).toHaveBeenCalledWith('target-company-state', 'al');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it("excludes the group's current members from the suggestions", async () => {
|
|
104
|
+
vi.mocked(suggestPrincipals).mockResolvedValue(people(PAT, ALICE));
|
|
105
|
+
renderPage();
|
|
106
|
+
// Product already has pat@example.com — suggesting him would offer a no-op.
|
|
107
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Product' });
|
|
108
|
+
await userEvent.type(input, 'ex');
|
|
109
|
+
|
|
110
|
+
expect(await screen.findByText('Alice Green')).toBeInTheDocument();
|
|
111
|
+
expect(screen.queryByText('Pat Kim')).not.toBeInTheDocument();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('choosing a suggestion adds the person exactly as typing the email would', async () => {
|
|
115
|
+
renderPage();
|
|
116
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
117
|
+
await userEvent.type(input, 'ali');
|
|
118
|
+
await userEvent.click(await screen.findByText('Alice Green'));
|
|
119
|
+
|
|
120
|
+
await waitFor(() =>
|
|
121
|
+
expect(addGroupMember).toHaveBeenCalledWith('design', 'alice@example.com'),
|
|
122
|
+
);
|
|
123
|
+
// The input is cleared, as after any successful add.
|
|
124
|
+
await waitFor(() => expect(input).toHaveValue(''));
|
|
125
|
+
|
|
126
|
+
// The typed path lands on the identical request.
|
|
127
|
+
vi.mocked(addGroupMember).mockClear();
|
|
128
|
+
await userEvent.type(input, 'alice@example.com{Enter}');
|
|
129
|
+
await waitFor(() =>
|
|
130
|
+
expect(addGroupMember).toHaveBeenCalledWith('design', 'alice@example.com'),
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('a full email that is not among the suggestions is still added', async () => {
|
|
135
|
+
// Suggestions only ever know people the deployment has seen; a colleague
|
|
136
|
+
// who has never signed in must still be addable.
|
|
137
|
+
renderPage();
|
|
138
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
139
|
+
await userEvent.type(input, 'newcomer@example.com');
|
|
140
|
+
await userEvent.click(addButtonFor(input));
|
|
141
|
+
|
|
142
|
+
await waitFor(() =>
|
|
143
|
+
expect(addGroupMember).toHaveBeenCalledWith('design', 'newcomer@example.com'),
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it('a failed suggest request never blocks adding a valid email', async () => {
|
|
148
|
+
vi.mocked(suggestPrincipals).mockRejectedValue(new Error('suggest is down'));
|
|
149
|
+
renderPage();
|
|
150
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
151
|
+
await userEvent.type(input, 'dana@example.com');
|
|
152
|
+
await waitFor(() => expect(suggestPrincipals).toHaveBeenCalled());
|
|
153
|
+
|
|
154
|
+
// The suggestion feature degrades; the form does not. No error banner, and
|
|
155
|
+
// the add goes through unchanged.
|
|
156
|
+
expect(screen.queryByText(/suggest is down/)).not.toBeInTheDocument();
|
|
157
|
+
await userEvent.click(addButtonFor(input));
|
|
158
|
+
await waitFor(() => expect(addGroupMember).toHaveBeenCalledWith('design', 'dana@example.com'));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('makes no suggestion request below two characters', async () => {
|
|
162
|
+
renderPage();
|
|
163
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
164
|
+
await userEvent.type(input, 'a');
|
|
165
|
+
await new Promise((resolve) => setTimeout(resolve, PAST_DEBOUNCE_MS));
|
|
166
|
+
|
|
167
|
+
expect(suggestPrincipals).not.toHaveBeenCalled();
|
|
168
|
+
expect(screen.queryByText('Alice Green')).not.toBeInTheDocument();
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('an IdP-synced group still has no member input at all', async () => {
|
|
172
|
+
vi.mocked(getGroupsRoster).mockResolvedValue({
|
|
173
|
+
...MANUAL_ROSTER,
|
|
174
|
+
mode: 'idp',
|
|
175
|
+
});
|
|
176
|
+
renderPage();
|
|
177
|
+
expect(await screen.findByText('Product')).toBeInTheDocument();
|
|
178
|
+
// Membership is managed in the directory — nothing to suggest into.
|
|
179
|
+
expect(screen.queryByRole('combobox', { name: /Add member/ })).not.toBeInTheDocument();
|
|
180
|
+
expect(suggestPrincipals).not.toHaveBeenCalled();
|
|
181
|
+
});
|
|
182
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
2
|
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
4
5
|
import { DirectoryGroupsPage } from '../components/DirectoryGroupsPage';
|
|
5
6
|
import { AdminContext } from '../state/admin.context';
|
|
6
7
|
import {
|
|
@@ -31,6 +32,13 @@ vi.mock('../services/groups.api', async (importOriginal) => {
|
|
|
31
32
|
renameGroup: vi.fn(),
|
|
32
33
|
};
|
|
33
34
|
});
|
|
35
|
+
// The add-member input suggests people from the access suggest endpoint —
|
|
36
|
+
// stubbed here so these tests stay about the groups roster.
|
|
37
|
+
vi.mock('../../access/api', async (importOriginal) => {
|
|
38
|
+
const actual = await importOriginal<typeof import('../../access/api')>();
|
|
39
|
+
return { ...actual, suggestPrincipals: vi.fn() };
|
|
40
|
+
});
|
|
41
|
+
import { suggestPrincipals } from '../../access/api';
|
|
34
42
|
|
|
35
43
|
const MANUAL_ROSTER: GroupsRoster = {
|
|
36
44
|
mode: 'manual',
|
|
@@ -68,10 +76,22 @@ const IDP_ROSTER: GroupsRoster = {
|
|
|
68
76
|
groupsHealth: { ok: true },
|
|
69
77
|
};
|
|
70
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The Add button of the row a member input belongs to — each group card has
|
|
81
|
+
* its own. The input sits inside its own wrapper (the suggestion list anchors
|
|
82
|
+
* to it), so the button is one level up from the input's closest div.
|
|
83
|
+
*/
|
|
84
|
+
function addButtonFor(input: HTMLElement) {
|
|
85
|
+
return within(input.closest('div')!.parentElement!).getByRole('button', { name: 'Add' });
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
function renderPage(opts: {
|
|
72
89
|
isAdmin?: boolean;
|
|
73
90
|
directoryPanel?: (props: GroupsDirectoryPanelProps) => React.ReactElement;
|
|
91
|
+
/** Where the page is opened — `?group=` lands it on one group. */
|
|
92
|
+
path?: string;
|
|
74
93
|
} = {}) {
|
|
94
|
+
const path = opts.path ?? '/directory-groups';
|
|
75
95
|
const registry = opts.directoryPanel
|
|
76
96
|
? { ...EMPTY_REGISTRY, groupsDirectoryPanel: opts.directoryPanel }
|
|
77
97
|
: EMPTY_REGISTRY;
|
|
@@ -89,7 +109,9 @@ function renderPage(opts: {
|
|
|
89
109
|
runRolesRecovery: async () => {},
|
|
90
110
|
}}
|
|
91
111
|
>
|
|
92
|
-
<
|
|
112
|
+
<MemoryRouter initialEntries={[path]}>
|
|
113
|
+
<DirectoryGroupsPage />
|
|
114
|
+
</MemoryRouter>
|
|
93
115
|
</AdminContext.Provider>
|
|
94
116
|
</AppRegistryContext.Provider>,
|
|
95
117
|
);
|
|
@@ -102,6 +124,9 @@ beforeEach(() => {
|
|
|
102
124
|
vi.mocked(addGroupMember).mockReset().mockResolvedValue(MANUAL_ROSTER);
|
|
103
125
|
vi.mocked(removeGroupMember).mockReset().mockResolvedValue(MANUAL_ROSTER);
|
|
104
126
|
vi.mocked(renameGroup).mockReset().mockResolvedValue(MANUAL_ROSTER);
|
|
127
|
+
vi.mocked(suggestPrincipals)
|
|
128
|
+
.mockReset()
|
|
129
|
+
.mockResolvedValue({ roles: [], groups: [], people: [], peopleWithheld: false });
|
|
105
130
|
});
|
|
106
131
|
|
|
107
132
|
describe('DirectoryGroupsPage', () => {
|
|
@@ -117,7 +142,7 @@ describe('DirectoryGroupsPage', () => {
|
|
|
117
142
|
expect(screen.getByText('pat@example.com')).toBeInTheDocument();
|
|
118
143
|
expect(screen.getByRole('textbox', { name: 'New group name' })).toBeInTheDocument();
|
|
119
144
|
expect(screen.getByRole('button', { name: 'Delete Product' })).toBeInTheDocument();
|
|
120
|
-
expect(screen.getByRole('
|
|
145
|
+
expect(screen.getByRole('combobox', { name: 'Add member to Product' })).toBeInTheDocument();
|
|
121
146
|
});
|
|
122
147
|
|
|
123
148
|
it('manual mode: creating a group calls the api and applies the returned roster', async () => {
|
|
@@ -144,10 +169,10 @@ describe('DirectoryGroupsPage', () => {
|
|
|
144
169
|
|
|
145
170
|
it('manual mode: adding and removing members hit the api', async () => {
|
|
146
171
|
renderPage();
|
|
147
|
-
const input = await screen.findByRole('
|
|
172
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
148
173
|
await userEvent.type(input, 'dana@example.com');
|
|
149
174
|
// Scope to the input's row — each group card has its own Add button.
|
|
150
|
-
await userEvent.click(
|
|
175
|
+
await userEvent.click(addButtonFor(input));
|
|
151
176
|
await waitFor(() =>
|
|
152
177
|
expect(addGroupMember).toHaveBeenCalledWith('design', 'dana@example.com'),
|
|
153
178
|
);
|
|
@@ -168,16 +193,16 @@ describe('DirectoryGroupsPage', () => {
|
|
|
168
193
|
);
|
|
169
194
|
renderPage();
|
|
170
195
|
|
|
171
|
-
const productInput = await screen.findByRole('
|
|
196
|
+
const productInput = await screen.findByRole('combobox', { name: 'Add member to Product' });
|
|
172
197
|
await userEvent.type(productInput, 'a@example.com');
|
|
173
|
-
await userEvent.click(
|
|
198
|
+
await userEvent.click(addButtonFor(productInput));
|
|
174
199
|
await waitFor(() => expect(addGroupMember).toHaveBeenCalledTimes(1));
|
|
175
200
|
|
|
176
201
|
// Second card: its own busy flag is free, so the click goes through — but
|
|
177
202
|
// the request must queue behind the unresolved first one.
|
|
178
|
-
const designInput = screen.getByRole('
|
|
203
|
+
const designInput = screen.getByRole('combobox', { name: 'Add member to Design' });
|
|
179
204
|
await userEvent.type(designInput, 'b@example.com');
|
|
180
|
-
await userEvent.click(
|
|
205
|
+
await userEvent.click(addButtonFor(designInput));
|
|
181
206
|
expect(addGroupMember).toHaveBeenCalledTimes(1);
|
|
182
207
|
|
|
183
208
|
resolvers[0](MANUAL_ROSTER);
|
|
@@ -187,7 +212,7 @@ describe('DirectoryGroupsPage', () => {
|
|
|
187
212
|
resolvers[1](MANUAL_ROSTER);
|
|
188
213
|
// Both cards settle back to idle.
|
|
189
214
|
await waitFor(() =>
|
|
190
|
-
expect(screen.getByRole('
|
|
215
|
+
expect(screen.getByRole('combobox', { name: 'Add member to Design' })).not.toBeDisabled(),
|
|
191
216
|
);
|
|
192
217
|
});
|
|
193
218
|
|
|
@@ -251,7 +276,7 @@ describe('DirectoryGroupsPage', () => {
|
|
|
251
276
|
).toBeInTheDocument();
|
|
252
277
|
// No manual CRUD anywhere: no create form, no add-member inputs, no deletes.
|
|
253
278
|
expect(screen.queryByRole('textbox', { name: 'New group name' })).not.toBeInTheDocument();
|
|
254
|
-
expect(screen.queryByRole('
|
|
279
|
+
expect(screen.queryByRole('combobox', { name: /Add member/ })).not.toBeInTheDocument();
|
|
255
280
|
expect(screen.queryByRole('button', { name: /^Delete / })).not.toBeInTheDocument();
|
|
256
281
|
});
|
|
257
282
|
|
|
@@ -284,7 +309,7 @@ describe('DirectoryGroupsPage', () => {
|
|
|
284
309
|
await userEvent.click(screen.getByRole('button', { name: 'simulate-connect' }));
|
|
285
310
|
// No create form, no member editing — the IdP owns groups now.
|
|
286
311
|
expect(screen.queryByRole('textbox', { name: 'New group name' })).not.toBeInTheDocument();
|
|
287
|
-
expect(screen.queryByRole('
|
|
312
|
+
expect(screen.queryByRole('combobox', { name: /Add member/ })).not.toBeInTheDocument();
|
|
288
313
|
expect(
|
|
289
314
|
await screen.findByText(/Groups appear here after its first provisioning push/),
|
|
290
315
|
).toBeInTheDocument();
|
|
@@ -393,7 +418,7 @@ describe('DirectoryGroupsPage', () => {
|
|
|
393
418
|
// Stale rows + CRUD controls are gone.
|
|
394
419
|
await waitFor(() => expect(screen.queryByText('Product')).not.toBeInTheDocument());
|
|
395
420
|
expect(screen.queryByRole('textbox', { name: 'New group name' })).not.toBeInTheDocument();
|
|
396
|
-
expect(screen.queryByRole('
|
|
421
|
+
expect(screen.queryByRole('combobox', { name: /Add member/ })).not.toBeInTheDocument();
|
|
397
422
|
expect(screen.queryByRole('button', { name: /^Delete / })).not.toBeInTheDocument();
|
|
398
423
|
// The pending delete confirm was dismissed — no dialog left to act on the
|
|
399
424
|
// unparseable file.
|
|
@@ -427,12 +452,138 @@ describe('DirectoryGroupsPage', () => {
|
|
|
427
452
|
|
|
428
453
|
it("a 'group:'-prefixed member value gets the inline hint and no request", async () => {
|
|
429
454
|
renderPage();
|
|
430
|
-
const input = await screen.findByRole('
|
|
455
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
431
456
|
await userEvent.type(input, 'group:engineering');
|
|
432
|
-
await userEvent.click(
|
|
457
|
+
await userEvent.click(addButtonFor(input));
|
|
433
458
|
expect(
|
|
434
459
|
await screen.findByText(/Group members are emails — 'group:' references aren't allowed/),
|
|
435
460
|
).toBeInTheDocument();
|
|
436
461
|
expect(addGroupMember).not.toHaveBeenCalled();
|
|
437
462
|
});
|
|
438
463
|
});
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* `?group=` — the landing the Library sidebar's "Manage members" links to. The
|
|
467
|
+
* group lives in the URL, so the same link lands the same way after a reload
|
|
468
|
+
* or in someone else's browser.
|
|
469
|
+
*/
|
|
470
|
+
describe('DirectoryGroupsPage: opened on a named group', () => {
|
|
471
|
+
const scrolled: Element[] = [];
|
|
472
|
+
const proto = window.HTMLElement.prototype as HTMLElement & { scrollIntoView?: (o?: unknown) => void };
|
|
473
|
+
let before: typeof proto.scrollIntoView;
|
|
474
|
+
beforeEach(() => {
|
|
475
|
+
scrolled.length = 0;
|
|
476
|
+
before = proto.scrollIntoView;
|
|
477
|
+
proto.scrollIntoView = function (this: Element) {
|
|
478
|
+
scrolled.push(this);
|
|
479
|
+
};
|
|
480
|
+
return () => {
|
|
481
|
+
proto.scrollIntoView = before;
|
|
482
|
+
};
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it("manual mode: scrolls the group's card into view and focuses its add-member field", async () => {
|
|
486
|
+
renderPage({ path: '/directory-groups?group=Design' });
|
|
487
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Design' });
|
|
488
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
489
|
+
const card = input.closest('[data-group]')!;
|
|
490
|
+
expect(card).toHaveAttribute('data-group', 'design');
|
|
491
|
+
expect(card).toHaveAttribute('aria-current', 'true');
|
|
492
|
+
expect(scrolled).toEqual([card]);
|
|
493
|
+
// Only the named card is marked.
|
|
494
|
+
const product = screen.getByRole('combobox', { name: 'Add member to Product' });
|
|
495
|
+
expect(product.closest('[data-group]')).not.toHaveAttribute('aria-current');
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it('matches the display name without regard to case', async () => {
|
|
499
|
+
renderPage({ path: '/directory-groups?group=PRODUCT' });
|
|
500
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to Product' });
|
|
501
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it('matches by canonical name when it differs from the display name', async () => {
|
|
505
|
+
vi.mocked(getGroupsRoster).mockResolvedValue({
|
|
506
|
+
...MANUAL_ROSTER,
|
|
507
|
+
groups: [{ ...MANUAL_ROSTER.groups[0]!, canonical: 'gtm-team', displayName: 'GTM Team' }],
|
|
508
|
+
});
|
|
509
|
+
renderPage({ path: '/directory-groups?group=GTM-TEAM' });
|
|
510
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to GTM Team' });
|
|
511
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
it('a name with spaces survives the query string', async () => {
|
|
515
|
+
vi.mocked(getGroupsRoster).mockResolvedValue({
|
|
516
|
+
...MANUAL_ROSTER,
|
|
517
|
+
groups: [{ ...MANUAL_ROSTER.groups[0]!, canonical: 'gtm-team', displayName: 'GTM Team' }],
|
|
518
|
+
});
|
|
519
|
+
const { pathForGroupMembers } = await import('../components/group-members-path');
|
|
520
|
+
expect(pathForGroupMembers('GTM Team')).toBe('/directory-groups?group=GTM+Team');
|
|
521
|
+
renderPage({ path: pathForGroupMembers('GTM Team') });
|
|
522
|
+
const input = await screen.findByRole('combobox', { name: 'Add member to GTM Team' });
|
|
523
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
it('idp mode: brings the synced row into view under the read-only notice', async () => {
|
|
527
|
+
vi.mocked(getGroupsRoster).mockResolvedValue(IDP_ROSTER);
|
|
528
|
+
renderPage({ path: '/directory-groups?group=Sales' });
|
|
529
|
+
const name = await screen.findByText('Sales');
|
|
530
|
+
const row = name.closest('li')!;
|
|
531
|
+
expect(row).toHaveAttribute('aria-current', 'true');
|
|
532
|
+
// The scroll is an effect, so it can land a tick after the row does —
|
|
533
|
+
// asserting on it synchronously made this the one flaky case here. (The
|
|
534
|
+
// manual-mode test above is already shielded by its focus `waitFor`.)
|
|
535
|
+
await waitFor(() => expect(scrolled).toEqual([row]));
|
|
536
|
+
expect(
|
|
537
|
+
screen.getByText(/Groups are synced from your identity provider and are read-only here/),
|
|
538
|
+
).toBeInTheDocument();
|
|
539
|
+
expect(screen.queryByRole('combobox', { name: /Add member/ })).not.toBeInTheDocument();
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
it('says so when the named group is not in the roster', async () => {
|
|
543
|
+
renderPage({ path: '/directory-groups?group=Ghosts' });
|
|
544
|
+
expect(await screen.findByText('No group named “Ghosts”.')).toBeInTheDocument();
|
|
545
|
+
expect(scrolled).toEqual([]);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('idp mode: says so when the named group is not synced, even with a directory connected', async () => {
|
|
549
|
+
vi.mocked(getGroupsRoster).mockResolvedValue(IDP_ROSTER);
|
|
550
|
+
renderPage({
|
|
551
|
+
path: '/directory-groups?group=Ghosts',
|
|
552
|
+
directoryPanel: ({ onConnectedChange }) => (
|
|
553
|
+
<button onClick={() => onConnectedChange(true)}>simulate-connect</button>
|
|
554
|
+
),
|
|
555
|
+
});
|
|
556
|
+
await userEvent.click(await screen.findByRole('button', { name: 'simulate-connect' }));
|
|
557
|
+
expect(screen.getByText('No group named “Ghosts”.')).toBeInTheDocument();
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it('connected but not yet synced: no missing-group notice', async () => {
|
|
561
|
+
renderPage({
|
|
562
|
+
path: '/directory-groups?group=Ghosts',
|
|
563
|
+
directoryPanel: ({ onConnectedChange }) => (
|
|
564
|
+
<button onClick={() => onConnectedChange(true)}>simulate-connect</button>
|
|
565
|
+
),
|
|
566
|
+
});
|
|
567
|
+
await userEvent.click(await screen.findByRole('button', { name: 'simulate-connect' }));
|
|
568
|
+
expect(screen.getByText(/An identity provider is connected/)).toBeInTheDocument();
|
|
569
|
+
expect(screen.queryByText(/No group named/)).not.toBeInTheDocument();
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
it('a broken synced groups file: the banner explains, no missing-group notice', async () => {
|
|
573
|
+
vi.mocked(getGroupsRoster).mockResolvedValue({
|
|
574
|
+
mode: 'idp',
|
|
575
|
+
groups: [],
|
|
576
|
+
groupsHealth: { ok: false, file: 'synced-groups.yaml', reason: 'bad indentation on line 3' },
|
|
577
|
+
});
|
|
578
|
+
renderPage({ path: '/directory-groups?group=Sales' });
|
|
579
|
+
expect(await screen.findByRole('alert')).toHaveTextContent('synced-groups.yaml');
|
|
580
|
+
expect(screen.queryByText(/No group named/)).not.toBeInTheDocument();
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
it('without a group, nothing is focused or scrolled', async () => {
|
|
584
|
+
renderPage();
|
|
585
|
+
await screen.findByRole('combobox', { name: 'Add member to Product' });
|
|
586
|
+
expect(scrolled).toEqual([]);
|
|
587
|
+
expect(screen.queryByText(/No group named/)).not.toBeInTheDocument();
|
|
588
|
+
});
|
|
589
|
+
});
|