@bevel-software/platform-core-frontend 0.25.2 → 0.27.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 +2 -2
- package/src/core/CoreAppShell.tsx +87 -25
- package/src/core/ProductName.tsx +49 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
- package/src/core/__tests__/core-contributions.test.ts +16 -0
- package/src/core/core-contributions.ts +17 -0
- package/src/core/registry.ts +51 -1
- package/src/index.css +23 -5
- package/src/index.ts +5 -0
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
- package/src/modules/access/components/ManageAccessDialog.tsx +1 -1
- package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
- package/src/modules/auth/components/LoginScreen.tsx +4 -1
- package/src/modules/auth/services/account.api.ts +28 -1
- package/src/modules/auth/services/sso.ts +1 -2
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
- package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
- package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
- package/src/modules/change-requests/services/change-requests.api.ts +15 -2
- package/src/modules/change-requests/utils/readFailure.ts +22 -0
- package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
- package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
- package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
- package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
- package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
- package/src/modules/embed/__tests__/mount.test.tsx +157 -0
- package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
- package/src/modules/embed/components/EmbedView.tsx +545 -0
- package/src/modules/embed/embed-config.ts +132 -0
- package/src/modules/embed/embed-host.ts +120 -0
- package/src/modules/embed/mount.tsx +80 -0
- package/src/modules/embed/services/embed-token.ts +22 -0
- package/src/modules/embed/services/embed.api.ts +158 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
- package/src/modules/git/branch-delete-menu-item.tsx +24 -0
- package/src/modules/git/components/BranchSwitcher.tsx +29 -5
- package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
- package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
- package/src/modules/git/components/PullNeededBanner.tsx +15 -49
- package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
- package/src/modules/git/index.ts +15 -0
- package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
- package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
- package/src/modules/git/services/error-messages.ts +58 -1
- package/src/modules/git/services/pull-failure.ts +68 -0
- package/src/modules/git/state/branch-delete-confirm.ts +46 -0
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
- package/src/modules/layout/breakpoints.ts +8 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
- package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
- package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
- package/src/modules/library/__tests__/ToolPage.test.tsx +53 -0
- package/src/modules/library/components/LibraryPage.tsx +22 -0
- package/src/modules/library/components/PluginExtras.tsx +23 -6
- package/src/modules/library/components/PluginPage.tsx +6 -1
- package/src/modules/library/components/tool-page/ToolPage.tsx +45 -1
- package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
- package/src/modules/library/services/plugins.api.ts +4 -1
- package/src/modules/library/services/tools.api.ts +27 -0
- package/src/modules/library/state/plugins-revision.ts +28 -0
- package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
- package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +109 -0
- package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1001 -0
- package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +392 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
- package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
- package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
- package/src/modules/onboarding/components/GetStartedColumn.tsx +651 -0
- package/src/modules/onboarding/components/InviteButton.tsx +35 -0
- package/src/modules/onboarding/components/InviteDialog.tsx +424 -0
- package/src/modules/onboarding/components/RootLanding.tsx +8 -24
- package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
- package/src/modules/onboarding/first-page-prompt.ts +89 -0
- package/src/modules/onboarding/invite-emails.ts +175 -0
- package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
- package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
- package/src/modules/onboarding/state/agent-connection.ts +167 -0
- package/src/modules/onboarding/state/invite-dialog.context.ts +32 -0
- package/src/modules/onboarding/state/invite-dialog.tsx +31 -0
- package/src/modules/onboarding/state/onboarding.ts +133 -59
- package/src/modules/onboarding/state/starter-packs.ts +169 -0
- package/src/modules/settings/settings-nav-items.tsx +8 -3
- package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
- package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
- package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
- package/src/modules/setup/__tests__/setup.test.tsx +65 -81
- package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
- package/src/modules/setup/components/SetupGate.tsx +46 -1
- package/src/modules/setup/components/SetupScreen.tsx +92 -152
- package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +3 -3
- package/src/modules/setup/utils/suggested-branch.ts +27 -0
- package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
- package/src/modules/toolbar/commands/actions.tsx +324 -0
- package/src/modules/toolbar/commands/command-menu.ts +44 -0
- package/src/modules/toolbar/commands/useCommandActions.ts +69 -0
- package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +106 -22
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
- package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
- package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
- package/src/modules/toolbar/components/Toolbar.tsx +10 -0
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +187 -54
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +4 -4
- package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
- package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +832 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
- package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
- package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
- package/src/modules/toolbar/search/rank.ts +111 -0
- package/src/modules/toolbar/search/sources.ts +169 -0
- package/src/modules/workflow/hooks/useFileLock.ts +10 -7
- package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
- package/src/modules/workflow/services/lock.api.ts +17 -2
- package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
- package/src/modules/workspace/components/EditorTabs.tsx +39 -15
- package/src/modules/workspace/components/FileExplorer.tsx +39 -6
- package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
- package/src/modules/workspace/components/FileRoute.tsx +12 -7
- package/src/modules/workspace/components/FileViewer.tsx +271 -74
- package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +101 -11
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
- package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
- package/src/modules/workspace/components/renderers/index.ts +26 -0
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
- package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
- package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
- package/src/modules/workspace/hooks/useCreatePage.ts +116 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
- package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
- package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
- package/src/modules/workspace/routing/kb-routes.ts +66 -12
- package/src/modules/workspace/state/editable-page.ts +42 -0
- package/src/modules/workspace/state/workspace.context.ts +13 -4
- package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +26 -14
- package/src/modules/workspace/utils/display-file-name.ts +102 -0
- package/src/modules/workspace/utils/fileTree.ts +49 -14
- package/src/modules/workspace/utils/treeConfirm.ts +22 -5
- package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
- package/src/shared/components/ConfirmProvider.tsx +156 -0
- package/src/shared/components/Dialog.tsx +7 -0
- package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
- package/src/shared/components/confirm-context.ts +94 -0
- package/src/shared/components/index.ts +3 -0
- package/src/shared/mcp/__tests__/connect-snippets.test.ts +2 -2
- package/src/shared/mcp/connect-snippets.ts +8 -5
- package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
- package/src/modules/onboarding/welcome-state.ts +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bevel-software/platform-core-frontend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Open-source core UI of the Bevel platform (raw TS/TSX source): workspace explorer/viewer, branches & change requests, Library, secrets, tools, access control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tailwind-merge": "^3.5.0",
|
|
46
46
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
47
47
|
"yaml": "^2.9.0",
|
|
48
|
-
"@bevel-software/platform-shared": "0.
|
|
48
|
+
"@bevel-software/platform-shared": "0.27.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -52,8 +52,11 @@ import { ToolsExplorerPage } from '../modules/tools/ToolsExplorerPage';
|
|
|
52
52
|
import { LibraryRoutes } from '../modules/library/routes/LibraryRoutes';
|
|
53
53
|
import { RootLanding } from '../modules/onboarding/components/RootLanding';
|
|
54
54
|
import { ConnectAgentPill } from '../modules/onboarding/components/ConnectAgentPill';
|
|
55
|
+
import { GetStartedColumn } from '../modules/onboarding/components/GetStartedColumn';
|
|
56
|
+
import { InviteDialogProvider } from '../modules/onboarding/state/invite-dialog';
|
|
55
57
|
import { PullRequestsForMe } from '../modules/git/components/PullRequestsForMe';
|
|
56
58
|
import { OpenChangeRequestDialog } from '../modules/pr/components/OpenChangeRequestDialog';
|
|
59
|
+
import { ChangeRequestLink } from '../modules/change-requests/components/ChangeRequestLink';
|
|
57
60
|
import { useMediaQuery } from '../modules/layout/hooks/useMediaQuery';
|
|
58
61
|
import { NARROW_QUERY } from '../modules/layout/breakpoints';
|
|
59
62
|
import { setSidebarCollapsed } from '../modules/layout/state/sidebar';
|
|
@@ -67,12 +70,17 @@ import {
|
|
|
67
70
|
useAppRegistry,
|
|
68
71
|
type AppDef,
|
|
69
72
|
type AppRegistry,
|
|
73
|
+
type RouteDef,
|
|
70
74
|
type BannerDef,
|
|
71
75
|
type CrCreationInput,
|
|
72
76
|
type CrCreationPort,
|
|
73
77
|
type PaneDef,
|
|
74
78
|
} from './registry';
|
|
79
|
+
import { withCoreModuleContributions } from './core-contributions';
|
|
75
80
|
import { isLibraryLocation } from '../modules/library/routes/library-paths';
|
|
81
|
+
import { EmbedView } from '../modules/embed/components/EmbedView';
|
|
82
|
+
import { EmbedLinkPage } from '../modules/embed/components/EmbedLinkPage';
|
|
83
|
+
import { ConfirmProvider } from '../shared/components';
|
|
76
84
|
|
|
77
85
|
/**
|
|
78
86
|
* The registry-driven application shell for the core modules (workspace, git,
|
|
@@ -193,6 +201,18 @@ const CORE_PANES: PaneDef[] = [
|
|
|
193
201
|
{ id: 'viewer', order: 20, node: <ViewerRoutes />, minSize: '30%' },
|
|
194
202
|
];
|
|
195
203
|
|
|
204
|
+
/**
|
|
205
|
+
* The two pages that are not part of the app: the embed a chat host frames,
|
|
206
|
+
* and the account-link page it sends an unlinked viewer to. Routes rather
|
|
207
|
+
* than apps — neither has a place in the switcher, neither sits inside the
|
|
208
|
+
* three-pane shell, and neither goes through the session gate (see the
|
|
209
|
+
* comment at the `<Routes>` block below).
|
|
210
|
+
*/
|
|
211
|
+
const CORE_TOP_LEVEL_ROUTES: RouteDef[] = [
|
|
212
|
+
{ path: '/embed', element: <EmbedView /> },
|
|
213
|
+
{ path: '/embed/link', element: <EmbedLinkPage /> },
|
|
214
|
+
];
|
|
215
|
+
|
|
196
216
|
/**
|
|
197
217
|
* The core apps behind the toolbar's app switcher. Each app is a full
|
|
198
218
|
* surface below the always-mounted toolbar. "Skills & Tools" mounts
|
|
@@ -258,8 +278,21 @@ function CoreSurfaces() {
|
|
|
258
278
|
// strip, the viewer's banner AND the Library's Skills tree all ask the same
|
|
259
279
|
// question, and a tree rendered outside the provider would read the empty
|
|
260
280
|
// default and never show a proposed file.
|
|
281
|
+
//
|
|
282
|
+
// The "Get set up" column sits beside whichever surface is on screen, here
|
|
283
|
+
// for the same reason: one checklist across both apps, mounted once, so it
|
|
284
|
+
// does not re-fetch or re-flash on a switch between them. The row wraps
|
|
285
|
+
// both branches identically, so it is the COLUMN that keeps its place in the
|
|
286
|
+
// tree and stays mounted across the switch. The surface beside it does not:
|
|
287
|
+
// `LibraryRoutes` and `KnowledgeSurface` are different components, so a
|
|
288
|
+
// switch unmounts one and mounts the other, as it always has.
|
|
261
289
|
return (
|
|
262
|
-
<OpenChangeRequestsProvider>
|
|
290
|
+
<OpenChangeRequestsProvider>
|
|
291
|
+
<div className="flex h-full min-h-0">
|
|
292
|
+
<div className="min-w-0 flex-1">{library ? <LibraryRoutes /> : <KnowledgeSurface />}</div>
|
|
293
|
+
<GetStartedColumn />
|
|
294
|
+
</div>
|
|
295
|
+
</OpenChangeRequestsProvider>
|
|
263
296
|
);
|
|
264
297
|
}
|
|
265
298
|
|
|
@@ -349,6 +382,11 @@ export function AppChrome() {
|
|
|
349
382
|
<AppClaimContext.Provider value={setClaimedApp}>
|
|
350
383
|
<LayoutContext.Provider value={paneController ?? NO_PANES_LAYOUT}>
|
|
351
384
|
<PaneControllerContext.Provider value={setPaneController}>
|
|
385
|
+
{/* The invite dialog's host: the toolbar's Invite button and the
|
|
386
|
+
"Get set up" column open the same one. Inside the registry's
|
|
387
|
+
providers (this is their child), so the dialog's slot can read
|
|
388
|
+
what a distribution provides there. */}
|
|
389
|
+
<InviteDialogProvider>
|
|
352
390
|
{/* Flex-col wrapper so the (conditional) banner strip takes its own
|
|
353
391
|
height and the toolbar + active surface flex into the rest. */}
|
|
354
392
|
<div className="flex flex-col h-full">
|
|
@@ -362,6 +400,7 @@ export function AppChrome() {
|
|
|
362
400
|
<ShellRoutes apps={apps} />
|
|
363
401
|
</div>
|
|
364
402
|
</div>
|
|
403
|
+
</InviteDialogProvider>
|
|
365
404
|
</PaneControllerContext.Provider>
|
|
366
405
|
</LayoutContext.Provider>
|
|
367
406
|
</AppClaimContext.Provider>
|
|
@@ -430,29 +469,34 @@ export function ShellRoutes({ apps }: { apps: AppDef[] }) {
|
|
|
430
469
|
<Route path="/connection-keys" element={<Navigate to="/audit-log" replace />} />
|
|
431
470
|
<Route path="/tools" element={<ToolsExplorerPage />} />
|
|
432
471
|
</Route>
|
|
433
|
-
{/* `/`
|
|
434
|
-
|
|
435
|
-
Knowledge as always.
|
|
472
|
+
{/* `/` lands on Knowledge — or on the deep link an SSO sign-in carried
|
|
473
|
+
through its round-trip (see `RootLanding`).
|
|
436
474
|
|
|
437
475
|
`/auth/*` lands the same way, and that is not decoration. The SSO
|
|
438
476
|
callback scrubs its own URL with a RAW `history.replaceState`
|
|
439
477
|
(`microsoft-oauth.ts`), which BrowserRouter never observes — react
|
|
440
478
|
-router only re-reads location on its own navigations and on
|
|
441
479
|
popstate. So after a Microsoft sign-in the address bar says `/`
|
|
442
|
-
while the router still matches `/auth/microsoft/callback
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
and never be greeted. Routing the callback path here fixes it
|
|
447
|
-
without moving the token-scrub out of the service that owns it.
|
|
480
|
+
while the router still matches `/auth/microsoft/callback`, and the
|
|
481
|
+
catch-all would drop the stashed deep link on the floor. Routing the
|
|
482
|
+
callback path here keeps it without moving the token-scrub out of
|
|
483
|
+
the service that owns it.
|
|
448
484
|
|
|
449
|
-
The `*` catch-all stays a plain redirect: a mistyped URL
|
|
450
|
-
|
|
485
|
+
The `*` catch-all stays a plain redirect: a mistyped URL carries no
|
|
486
|
+
intention to honour.
|
|
451
487
|
|
|
452
488
|
OUTSIDE the settings layout, like `/connect` above: these are landing
|
|
453
489
|
and redirect targets, not settings destinations. */}
|
|
454
490
|
<Route path="/" element={<RootLanding />} />
|
|
455
491
|
<Route path="/auth/*" element={<RootLanding />} />
|
|
492
|
+
{/* The address every change-request link carries (the backend's
|
|
493
|
+
change-request-link helper: `open_change_request`, the read tools,
|
|
494
|
+
every summary's `url`). It opens the request itself, in the
|
|
495
|
+
change-request view, over a quiet page; closing it goes to Knowledge.
|
|
496
|
+
Before this route existed the catch-all below swallowed the link.
|
|
497
|
+
OUTSIDE the settings layout and the apps, like `/connect`: a landing
|
|
498
|
+
target, not a destination with a nav row. */}
|
|
499
|
+
<Route path="/change-requests/:number" element={<ChangeRequestLink />} />
|
|
456
500
|
<Route path="*" element={<Navigate to={KB_ROUTE_PREFIX} replace />} />
|
|
457
501
|
</Routes>
|
|
458
502
|
);
|
|
@@ -569,12 +613,13 @@ function AppShell() {
|
|
|
569
613
|
*/
|
|
570
614
|
export function CoreAppShell({ registry }: { registry: AppRegistry }) {
|
|
571
615
|
// Core contributions merge ahead of registry-contributed ones: the core
|
|
572
|
-
// apps (Knowledge + Skills & Tools) that the switcher and AppChrome read
|
|
573
|
-
//
|
|
574
|
-
//
|
|
616
|
+
// apps (Knowledge + Skills & Tools) that the switcher and AppChrome read,
|
|
617
|
+
// and core modules' own rows (see `withCoreModuleContributions`). The
|
|
618
|
+
// review file-viewer panel is no longer registered here — see the note on
|
|
619
|
+
// `chrome` above.
|
|
575
620
|
const mergedRegistry = useMemo<AppRegistry>(
|
|
576
621
|
() => ({
|
|
577
|
-
...registry,
|
|
622
|
+
...withCoreModuleContributions(registry),
|
|
578
623
|
apps: [...CORE_APPS, ...registry.apps],
|
|
579
624
|
}),
|
|
580
625
|
[registry],
|
|
@@ -592,15 +637,32 @@ export function CoreAppShell({ registry }: { registry: AppRegistry }) {
|
|
|
592
637
|
return (
|
|
593
638
|
<AppRegistryContext.Provider value={mergedRegistry}>
|
|
594
639
|
<BrowserRouter>
|
|
595
|
-
{/*
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
<
|
|
603
|
-
|
|
640
|
+
{/* The app's own confirmation dialog, for every route: whatever asks
|
|
641
|
+
before acting asks through `useConfirm()`, never `window.confirm`,
|
|
642
|
+
which the browser can silence. Above the state hooks
|
|
643
|
+
(`useWorkspaceState` asks before closing an unsaved tab). */}
|
|
644
|
+
<ConfirmProvider>
|
|
645
|
+
{/* Sits above every route (including /embed) — backend downtime during
|
|
646
|
+
a redeploy affects them all equally. */}
|
|
647
|
+
<MaintenanceOverlay />
|
|
648
|
+
<Routes>
|
|
649
|
+
{/* The embed surface, OUTSIDE `AppShell` and its auth gate — like
|
|
650
|
+
the registry routes below, it owns its own auth story. `/embed`
|
|
651
|
+
authenticates by the embed token in its query and by nothing
|
|
652
|
+
else (there is no session inside a host's frame);
|
|
653
|
+
`/embed/link` is the one page that DOES act under a session,
|
|
654
|
+
which is why the server refuses to let any site frame it.
|
|
655
|
+
Core's first, so a deployment adds to the app rather than
|
|
656
|
+
having to re-register these. */}
|
|
657
|
+
{CORE_TOP_LEVEL_ROUTES.map((r) => (
|
|
658
|
+
<Route key={r.path} path={r.path} element={r.element} />
|
|
659
|
+
))}
|
|
660
|
+
{registry.topLevelRoutes.map((r) => (
|
|
661
|
+
<Route key={r.path} path={r.path} element={r.element} />
|
|
662
|
+
))}
|
|
663
|
+
<Route path="*" element={<AppShell />} />
|
|
664
|
+
</Routes>
|
|
665
|
+
</ConfirmProvider>
|
|
604
666
|
</BrowserRouter>
|
|
605
667
|
</AppRegistryContext.Provider>
|
|
606
668
|
);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product's name and its maker's: BRANDING, which is the app shell's
|
|
3
|
+
* to own. It lives beside the shell rather than among the shared components
|
|
4
|
+
* because those are domain-agnostic building blocks (a button, a dialog) and
|
|
5
|
+
* this is the one thing in the frontend that says which product this is.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** The product's own name, before its maker's: the first half of {@link PRODUCT_NAME}. */
|
|
9
|
+
const PRODUCT = 'Hexis';
|
|
10
|
+
|
|
11
|
+
/** The maker's name: the second half of {@link PRODUCT_NAME}, and the linked part of {@link ProductName}. */
|
|
12
|
+
const MAKER = 'Bevel';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The product's name, as text: where a link cannot go, such as inside a
|
|
16
|
+
* button or another interactive control. A heading is not such a place — a
|
|
17
|
+
* link inside one is fine, so a title uses {@link ProductName}.
|
|
18
|
+
*/
|
|
19
|
+
export const PRODUCT_NAME = `${PRODUCT} by ${MAKER}`;
|
|
20
|
+
|
|
21
|
+
/** Where the maker's name leads. */
|
|
22
|
+
export const MAKER_URL = 'https://bevel.software';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The product's name wherever it is shown: "Hexis by Bevel", with the maker's
|
|
26
|
+
* name a link to its site.
|
|
27
|
+
*
|
|
28
|
+
* One component rather than the words at each call site, because the name
|
|
29
|
+
* used to differ by screen ("Bevel" in the toolbar and on the login page,
|
|
30
|
+
* "Hexis" elsewhere) and every copy is a place it can drift again. Both forms
|
|
31
|
+
* are built from the same two names, so the linked one cannot fall out of
|
|
32
|
+
* step with {@link PRODUCT_NAME}. A caller that sits inside a control, where
|
|
33
|
+
* a nested link is not allowed, passes `link={false}` or uses
|
|
34
|
+
* {@link PRODUCT_NAME}.
|
|
35
|
+
*/
|
|
36
|
+
export function ProductName({ link = true, className }: { link?: boolean; className?: string }) {
|
|
37
|
+
return (
|
|
38
|
+
<span className={className}>
|
|
39
|
+
{PRODUCT} by{' '}
|
|
40
|
+
{link ? (
|
|
41
|
+
<a href={MAKER_URL} target="_blank" rel="noopener noreferrer" className="text-accent hover:underline">
|
|
42
|
+
{MAKER}
|
|
43
|
+
</a>
|
|
44
|
+
) : (
|
|
45
|
+
MAKER
|
|
46
|
+
)}
|
|
47
|
+
</span>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -24,6 +24,17 @@ vi.mock('../../modules/secrets-vault/services/tool-secrets.api', () => ({
|
|
|
24
24
|
deleteAdminVar: vi.fn(async () => {}),
|
|
25
25
|
deleteUserVar: vi.fn(async () => {}),
|
|
26
26
|
}));
|
|
27
|
+
// The change-request address opens the request by number; the fetch is
|
|
28
|
+
// stubbed so the route can render without a network, and the view is the
|
|
29
|
+
// stand-in below — the route table is what is under test.
|
|
30
|
+
vi.mock('../../modules/git/services/pr.api', () => ({
|
|
31
|
+
getPullRequest: vi.fn(async (num: number) => ({ number: num, title: `Request `, author: { login: 'bot' } })),
|
|
32
|
+
listPullRequestsForMe: vi.fn(async () => []),
|
|
33
|
+
listMyPullRequests: vi.fn(async () => []),
|
|
34
|
+
}));
|
|
35
|
+
vi.mock('../../modules/change-requests/components/ChangeRequestDialog', () => ({
|
|
36
|
+
ChangeRequestDialog: ({ cr }: { cr: { number: number } }) => <div data-testid="cr-dialog">{cr.number}</div>,
|
|
37
|
+
}));
|
|
27
38
|
|
|
28
39
|
/** Exposes the router's current pathname so redirects can be asserted. */
|
|
29
40
|
function LocationProbe() {
|
|
@@ -128,3 +139,14 @@ describe('ShellRoutes', () => {
|
|
|
128
139
|
expect(screen.getByTestId('knowledge-surface')).toBeInTheDocument();
|
|
129
140
|
});
|
|
130
141
|
});
|
|
142
|
+
|
|
143
|
+
describe('ShellRoutes — the change-request address', () => {
|
|
144
|
+
// The link the backend builds for every change request. It used to fall
|
|
145
|
+
// into the catch-all and land on Knowledge with nothing open.
|
|
146
|
+
it('opens the request at /change-requests/<number> instead of redirecting', async () => {
|
|
147
|
+
renderAt('/change-requests/276');
|
|
148
|
+
expect(screen.getByTestId('pathname')).toHaveTextContent(/^\/change-requests\/276$/);
|
|
149
|
+
expect(await screen.findByTestId('cr-dialog')).toHaveTextContent('276');
|
|
150
|
+
expect(screen.queryByTestId('knowledge-surface')).not.toBeInTheDocument();
|
|
151
|
+
});
|
|
152
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { withCoreModuleContributions } from '../core-contributions';
|
|
3
|
+
import { makeRegistry, type AdminMenuItem } from '../registry';
|
|
4
|
+
|
|
5
|
+
// Core modules offer their rows through their public surface and the shell
|
|
6
|
+
// merges them; the settings list never imports another module's rows.
|
|
7
|
+
describe('withCoreModuleContributions', () => {
|
|
8
|
+
it("merges git's profile-menu row ahead of the registry's", () => {
|
|
9
|
+
const extension: AdminMenuItem = { id: 'stub', label: 'Stub', path: '/stub' };
|
|
10
|
+
const merged = withCoreModuleContributions(makeRegistry({ adminMenuItems: [extension] }));
|
|
11
|
+
expect(merged.adminMenuItems.map((item) => item.id)).toEqual([
|
|
12
|
+
'ask-before-branch-delete',
|
|
13
|
+
'stub',
|
|
14
|
+
]);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GIT_MENU_ITEMS } from '../modules/git';
|
|
2
|
+
import type { AppRegistry } from './registry';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Core modules' own contributions to the registry, merged AHEAD of
|
|
6
|
+
* registry-contributed ones so a downstream build adds to the app rather than
|
|
7
|
+
* reordering what core already put there. Each module offers them through its
|
|
8
|
+
* public surface (git's {@link GIT_MENU_ITEMS}); the settings list never
|
|
9
|
+
* imports another module's rows. The core apps are merged by `CoreAppShell`
|
|
10
|
+
* itself, since they are its own surfaces.
|
|
11
|
+
*/
|
|
12
|
+
export function withCoreModuleContributions(registry: AppRegistry): AppRegistry {
|
|
13
|
+
return {
|
|
14
|
+
...registry,
|
|
15
|
+
adminMenuItems: [...GIT_MENU_ITEMS, ...registry.adminMenuItems],
|
|
16
|
+
};
|
|
17
|
+
}
|
package/src/core/registry.ts
CHANGED
|
@@ -17,8 +17,9 @@ import {
|
|
|
17
17
|
type ReactElement,
|
|
18
18
|
type ReactNode,
|
|
19
19
|
} from 'react';
|
|
20
|
-
import type { FileTreeEntry } from '@bevel-software/platform-shared';
|
|
20
|
+
import type { AuthUser, FileTreeEntry } from '@bevel-software/platform-shared';
|
|
21
21
|
import type { FileRendererProps } from '../modules/workspace/components/renderers/types';
|
|
22
|
+
import type { CommandAction } from '../modules/toolbar/commands/actions';
|
|
22
23
|
|
|
23
24
|
/** A route contributed to one of the shell's `<Routes>` blocks. */
|
|
24
25
|
export interface RouteDef {
|
|
@@ -71,6 +72,8 @@ export interface AdminMenuItemHelpers {
|
|
|
71
72
|
closeMenu(): void;
|
|
72
73
|
/** react-router navigation. */
|
|
73
74
|
navigate(to: string): void;
|
|
75
|
+
/** The signed-in person the menu belongs to. */
|
|
76
|
+
user: AuthUser;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
/**
|
|
@@ -108,6 +111,12 @@ export interface AdminMenuItem {
|
|
|
108
111
|
*/
|
|
109
112
|
path?: string;
|
|
110
113
|
onSelect?(helpers: AdminMenuItemHelpers): void;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the dropdown offers this row to `user` right now. Asked each time
|
|
116
|
+
* the panel renders, so a row can come and go with state the menu does not
|
|
117
|
+
* own (a preference in storage, say). Absent means always shown.
|
|
118
|
+
*/
|
|
119
|
+
isShown?(user: AuthUser): boolean;
|
|
111
120
|
dialog?(props: { open: boolean; onClose(): void }): ReactElement;
|
|
112
121
|
}
|
|
113
122
|
|
|
@@ -449,6 +458,21 @@ export interface AppRegistry {
|
|
|
449
458
|
* deployment's own identity provider. See {@link SignInOptionDef}.
|
|
450
459
|
*/
|
|
451
460
|
signInOption?: SignInOptionDef;
|
|
461
|
+
/**
|
|
462
|
+
* What the first-run storage screen calls the repository the deployment
|
|
463
|
+
* keeps for itself: the card a new admin is steered towards.
|
|
464
|
+
*
|
|
465
|
+
* WHO keeps it is a property of the distribution, not of the screen. On a
|
|
466
|
+
* core deployment it is this server ("This server keeps it"); a hosted
|
|
467
|
+
* distribution keeps it on the admin's behalf and says so by name. Absent
|
|
468
|
+
* means core's words.
|
|
469
|
+
*
|
|
470
|
+
* The description travels WITH the title for the same reason the
|
|
471
|
+
* `welcomeExit` label travels with its path: a caller renaming the keeper
|
|
472
|
+
* without the sentence under it is how the card would come to contradict
|
|
473
|
+
* itself.
|
|
474
|
+
*/
|
|
475
|
+
managedStorage?: { title: string; description: string };
|
|
452
476
|
/**
|
|
453
477
|
* How many unread items the gear menu's badge should show, if anything is
|
|
454
478
|
* counting. CORE COUNTS NOTHING: the feedback inbox behind that badge is an
|
|
@@ -493,6 +517,32 @@ export interface AppRegistry {
|
|
|
493
517
|
* the other is the likeliest way to produce it.
|
|
494
518
|
*/
|
|
495
519
|
welcomeExit?: { path: string; label: string };
|
|
520
|
+
/**
|
|
521
|
+
* A panel inside the invite dialog, between the role choice and the footer.
|
|
522
|
+
*
|
|
523
|
+
* Core invites by creating accounts and knows nothing about what a place in
|
|
524
|
+
* the deployment costs. A hosted deployment does: it renders its seat meter
|
|
525
|
+
* here (how many of the plan's seats these invites would fill — `inviting`
|
|
526
|
+
* is the number of valid addresses entered so far), and its "anyone at
|
|
527
|
+
* your domain can join" switch. Rendered inside a boundary, so a panel that
|
|
528
|
+
* throws costs its own place, never the invite form. Absent means core
|
|
529
|
+
* renders nothing there.
|
|
530
|
+
*/
|
|
531
|
+
inviteExtras?: ComponentType<{ inviting: number }>;
|
|
532
|
+
/**
|
|
533
|
+
* Commands a distribution adds to the toolbar's command menu (Ctrl/⌘K),
|
|
534
|
+
* listed after core's own.
|
|
535
|
+
*
|
|
536
|
+
* Core's commands are the verbs every deployment has — New page, Invite
|
|
537
|
+
* people, the apps, the settings pages. A verb like "New ontology" belongs
|
|
538
|
+
* to the distribution that has ontologies, so core offers the place rather
|
|
539
|
+
* than the command, as it does for folder-menu entries. Each one is plain
|
|
540
|
+
* data plus `visible` and `run`, both handed the menu's context (router,
|
|
541
|
+
* admin verdict, page on screen) — see `CommandAction`. An id core already
|
|
542
|
+
* uses is dropped; a `visible` that throws costs only its own row. Absent
|
|
543
|
+
* means the menu offers core's commands and no others.
|
|
544
|
+
*/
|
|
545
|
+
commandActions?: CommandAction[];
|
|
496
546
|
}
|
|
497
547
|
|
|
498
548
|
export const EMPTY_REGISTRY: AppRegistry = {
|
package/src/index.css
CHANGED
|
@@ -11,6 +11,26 @@
|
|
|
11
11
|
@import './shared/theme/index.css';
|
|
12
12
|
@plugin "@tailwindcss/typography";
|
|
13
13
|
|
|
14
|
+
/* The hand over anything that can be clicked. Tailwind v4's preflight gives
|
|
15
|
+
buttons the browser's plain arrow, so a card, a tab or a text-styled link
|
|
16
|
+
built from <button> looked like text under the pointer. One rule here
|
|
17
|
+
rather than `cursor-pointer` at each call site, so a new control cannot
|
|
18
|
+
forget it. Disabled controls keep their own `cursor-not-allowed` — and
|
|
19
|
+
that includes a <button aria-disabled>, the disabled-by-choice spelling
|
|
20
|
+
that stays focusable (Menu.tsx), so both spellings are excluded alike. */
|
|
21
|
+
@layer base {
|
|
22
|
+
button:not(:disabled):not([aria-disabled='true']),
|
|
23
|
+
[role='button']:not([aria-disabled='true']),
|
|
24
|
+
summary,
|
|
25
|
+
select:not(:disabled),
|
|
26
|
+
input[type='checkbox']:not(:disabled),
|
|
27
|
+
input[type='radio']:not(:disabled),
|
|
28
|
+
label:has(> input[type='checkbox']:not(:disabled)),
|
|
29
|
+
label:has(> input[type='radio']:not(:disabled)) {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
14
34
|
/* T21 is resolved: the brand purple is retired. Every call site now uses the
|
|
15
35
|
design system's `accent` / `accent-hover`, so the app has ONE accent colour
|
|
16
36
|
instead of a blue token and a purple one competing for the same job. The
|
|
@@ -23,7 +43,7 @@
|
|
|
23
43
|
- `onboarding-pulse`: a soft accent ring that swells and fades — the CTA
|
|
24
44
|
breathing. Box-shadow, not scale: the text must hold still while the
|
|
25
45
|
control calls.
|
|
26
|
-
- `onboarding-fade`: the
|
|
46
|
+
- `onboarding-fade`: a gentle arrival (the Get set up column's "You're set up").
|
|
27
47
|
|
|
28
48
|
NAMED animations rather than `animate-[onboarding-fade_2.2s_…]` arbitrary
|
|
29
49
|
values, and the difference is not tidiness. An arbitrary value encodes the
|
|
@@ -36,11 +56,9 @@
|
|
|
36
56
|
which hot-reloads reliably — so tuning these numbers is now a CSS edit that
|
|
37
57
|
takes effect, not a gamble on a cache. */
|
|
38
58
|
@theme {
|
|
39
|
-
/*
|
|
59
|
+
/* A short arrival: the Get set up column's "You're set up" lands and is
|
|
60
|
+
allowed to be read. */
|
|
40
61
|
--animate-onboarding-greeting: onboarding-fade 2.2s cubic-bezier(0.16, 1, 0.3, 1) both;
|
|
41
|
-
/* Everything under it, starting at the moment the greeting's opacity
|
|
42
|
-
completes (55% of 2.2s) — the second beat, not a second event. */
|
|
43
|
-
--animate-onboarding-body: onboarding-fade 1.5s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both;
|
|
44
62
|
/* The welcome page's Done, and the sidebar pill — the pill breathes slower,
|
|
45
63
|
because it lives in the corner of your eye rather than under your cursor. */
|
|
46
64
|
--animate-onboarding-pulse: onboarding-pulse 2.4s ease-out infinite;
|
package/src/index.ts
CHANGED
|
@@ -20,5 +20,10 @@ import './html-extensions';
|
|
|
20
20
|
|
|
21
21
|
export { loadServerConfig, renderConfigFailure } from './core/bootstrap';
|
|
22
22
|
export { CoreAppShell, AuthGate } from './core/CoreAppShell';
|
|
23
|
+
// The embed, mounted OUTSIDE the app: what a deployment's `embed` entry calls
|
|
24
|
+
// when the MCP App view loads it into a chat host's sandbox (see
|
|
25
|
+
// `modules/embed/mount.tsx`).
|
|
26
|
+
export { mountEmbed, type MountEmbedOptions } from './modules/embed/mount';
|
|
27
|
+
export { readEmbedHandoff, EMBED_HANDOFF_GLOBAL, type EmbedHandoff } from './modules/embed/embed-config';
|
|
23
28
|
export * from './core/registry';
|
|
24
29
|
export * from './core/events';
|
|
@@ -38,7 +38,7 @@ const ENTRY: FileTreeEntry = {
|
|
|
38
38
|
const BRANCH = 'suggestions/me/knowledge';
|
|
39
39
|
const BRANCH_WS = encodeURIComponent(BRANCH);
|
|
40
40
|
const PROPOSAL = { number: 12, branch: BRANCH };
|
|
41
|
-
const NOTICE = /editing access on change request #12\. It takes effect when the request
|
|
41
|
+
const NOTICE = /editing access on change request #12\. It takes effect when the request is published/i;
|
|
42
42
|
const A = { name: 'Alice', email: 'alice@x.com' };
|
|
43
43
|
|
|
44
44
|
/** Alice, granted `write` directly on the file. */
|
|
@@ -1870,7 +1870,7 @@ export function ManageAccessDialog({
|
|
|
1870
1870
|
|
|
1871
1871
|
{proposal && (
|
|
1872
1872
|
<Banner tone="neutral" role="status" className="mt-3">
|
|
1873
|
-
{`You're editing access on change request #${proposal.number}. It takes effect when the request
|
|
1873
|
+
{`You're editing access on change request #${proposal.number}. It takes effect when the request is published.`}
|
|
1874
1874
|
</Banner>
|
|
1875
1875
|
)}
|
|
1876
1876
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest';
|
|
2
|
+
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
|
3
|
+
import { AdminContext } from '../state/admin.context';
|
|
4
|
+
import { RolesCorruptedBanner } from '../components/RolesCorruptedBanner';
|
|
5
|
+
import { ConfirmProvider } from '../../../shared/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bevel Recovery asks before it runs — in the app's own dialog, which the
|
|
9
|
+
* browser cannot silence — with today's text.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const QUESTION =
|
|
13
|
+
'Bevel Recovery will back up the corrupted roles.yaml to old-roles.yaml and ' +
|
|
14
|
+
'restore the default Bevel roster. Only continue if you are from Bevel. Proceed?';
|
|
15
|
+
|
|
16
|
+
let confirmSpy: MockInstance<Window['confirm']>;
|
|
17
|
+
let reload: ReturnType<typeof vi.fn>;
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
|
20
|
+
reload = vi.fn();
|
|
21
|
+
vi.spyOn(window, 'location', 'get').mockReturnValue({ ...window.location, reload } as Location);
|
|
22
|
+
});
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
expect(confirmSpy).not.toHaveBeenCalled();
|
|
25
|
+
vi.restoreAllMocks();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
function renderBanner() {
|
|
29
|
+
const runRolesRecovery = vi.fn(async () => {});
|
|
30
|
+
render(
|
|
31
|
+
<ConfirmProvider>
|
|
32
|
+
<AdminContext.Provider
|
|
33
|
+
value={{
|
|
34
|
+
isAdmin: true,
|
|
35
|
+
isAdminLoading: false,
|
|
36
|
+
unreadCount: 0,
|
|
37
|
+
lastSeen: null,
|
|
38
|
+
markSeen: () => {},
|
|
39
|
+
refresh: () => {},
|
|
40
|
+
rolesConfigCorrupted: true,
|
|
41
|
+
rolesConfigErrors: ['bad indent'],
|
|
42
|
+
runRolesRecovery,
|
|
43
|
+
} as never}
|
|
44
|
+
>
|
|
45
|
+
<RolesCorruptedBanner />
|
|
46
|
+
</AdminContext.Provider>
|
|
47
|
+
</ConfirmProvider>,
|
|
48
|
+
);
|
|
49
|
+
fireEvent.click(screen.getByRole('button', { name: /Bevel Recovery/ }));
|
|
50
|
+
return runRolesRecovery;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
describe('roles recovery', () => {
|
|
54
|
+
it("asks with today's text; Cancel runs nothing", async () => {
|
|
55
|
+
const run = renderBanner();
|
|
56
|
+
const dialog = await screen.findByRole('dialog');
|
|
57
|
+
expect(dialog.textContent).toContain(QUESTION);
|
|
58
|
+
expect(within(dialog).queryByText("Don't ask again")).toBeNull();
|
|
59
|
+
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
|
|
60
|
+
await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
|
|
61
|
+
expect(run).not.toHaveBeenCalled();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('Proceed runs the recovery, with the browser\'s dialogs suppressed', async () => {
|
|
65
|
+
const run = renderBanner();
|
|
66
|
+
fireEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Proceed' }));
|
|
67
|
+
await waitFor(() => expect(run).toHaveBeenCalledTimes(1));
|
|
68
|
+
await waitFor(() => expect(reload).toHaveBeenCalled());
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -2,7 +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
|
+
import { Button, useConfirm } from '../../../shared/components';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* App-wide break-glass banner shown when `roles.yaml` fails to parse. A
|
|
@@ -16,15 +16,20 @@ export function RolesCorruptedBanner() {
|
|
|
16
16
|
const { rolesConfigCorrupted, rolesConfigErrors, runRolesRecovery } = useAdmin();
|
|
17
17
|
const [running, setRunning] = useState(false);
|
|
18
18
|
const [error, setError] = useState<string | null>(null);
|
|
19
|
+
const confirm = useConfirm();
|
|
19
20
|
|
|
20
21
|
if (!rolesConfigCorrupted) return null;
|
|
21
22
|
|
|
22
23
|
const onRecover = async () => {
|
|
23
24
|
if (running) return;
|
|
24
|
-
const confirmed =
|
|
25
|
-
'Bevel Recovery
|
|
25
|
+
const { confirmed } = await confirm({
|
|
26
|
+
title: 'Bevel Recovery',
|
|
27
|
+
message:
|
|
28
|
+
'Bevel Recovery will back up the corrupted roles.yaml to old-roles.yaml and ' +
|
|
26
29
|
'restore the default Bevel roster. Only continue if you are from Bevel. Proceed?',
|
|
27
|
-
|
|
30
|
+
confirmLabel: 'Proceed',
|
|
31
|
+
destructive: true,
|
|
32
|
+
});
|
|
28
33
|
if (!confirmed) return;
|
|
29
34
|
setRunning(true);
|
|
30
35
|
setError(null);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, type FormEvent } from 'react';
|
|
2
2
|
import { useAuth } from '../state/auth.context';
|
|
3
|
+
import { ProductName } from '../../../core/ProductName';
|
|
3
4
|
import {
|
|
4
5
|
startSsoLogin,
|
|
5
6
|
fetchLoginProviders,
|
|
@@ -76,7 +77,9 @@ export function LoginScreen() {
|
|
|
76
77
|
className="bg-white p-8 rounded-xl border border-line w-full max-w-sm space-y-5"
|
|
77
78
|
>
|
|
78
79
|
<div className="text-center space-y-1">
|
|
79
|
-
<h1 className="text-2xl font-semibold text-ink">
|
|
80
|
+
<h1 className="text-2xl font-semibold text-ink">
|
|
81
|
+
<ProductName />
|
|
82
|
+
</h1>
|
|
80
83
|
<p className="text-sm text-ink-muted">Sign in to continue</p>
|
|
81
84
|
</div>
|
|
82
85
|
|