@bevel-software/platform-core-frontend 0.32.0 → 0.34.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 +1 -1
- package/src/lib/__tests__/api.test.ts +28 -1
- package/src/lib/api.ts +4 -2
- package/src/modules/access/__tests__/ManageAccessDialog.add-row-picking.test.tsx +53 -1
- package/src/modules/access/api.ts +4 -5
- package/src/modules/access/components/ManageAccessDialog.tsx +11 -12
- package/src/modules/access/hooks/useAccessRequests.ts +1 -1
- package/src/modules/access/hooks/useFileAccess.ts +1 -1
- package/src/modules/access/index.ts +11 -0
- package/src/modules/access/requests.api.ts +1 -1
- package/src/modules/admin/__tests__/DirectoryGroupsPage.test.tsx +51 -0
- package/src/modules/admin/components/AddMemberInput.tsx +1 -1
- package/src/modules/admin/components/DirectoryGroupsPage.tsx +42 -5
- package/src/modules/admin/components/UserAccountsPage.tsx +3 -3
- package/src/modules/admin/index.ts +7 -0
- package/src/modules/admin/services/groups.api.ts +11 -1
- package/src/modules/admin/state/admin.context.tsx +1 -1
- package/src/modules/agents/__tests__/useConnectAsChoice.test.ts +56 -0
- package/src/modules/agents/components/ConnectAsChoice.tsx +81 -0
- package/src/modules/agents/connect-as.ts +15 -0
- package/src/modules/agents/index.ts +5 -0
- package/src/modules/agents/services/agent-choices.api.ts +39 -0
- package/src/modules/agents/useConnectAsChoice.ts +66 -0
- package/src/modules/audit/__tests__/AuditLogPage.test.tsx +13 -0
- package/src/modules/audit/components/AuditEventsPanel.tsx +1 -1
- package/src/modules/audit/components/AuditLogPage.tsx +11 -2
- package/src/modules/audit/services/audit.api.ts +5 -0
- package/src/modules/auth/__tests__/AccountPage.test.tsx +21 -0
- package/src/modules/auth/__tests__/account.api.test.ts +69 -0
- package/src/modules/auth/components/AccountPage.tsx +8 -2
- package/src/modules/auth/index.ts +12 -0
- package/src/modules/auth/services/account.api.ts +18 -2
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.access-rules.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.binary.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.brings-itself-up-to-date.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.edit.test.tsx +166 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.fork-point.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.initial-file.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.moved.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.test.tsx +0 -2
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +0 -1
- package/src/modules/change-requests/__tests__/apply-outcome-for-every-viewer.test.tsx +0 -1
- package/src/modules/change-requests/components/BranchFilePreview.tsx +4 -12
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +138 -30
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +2 -3
- package/src/modules/change-requests/components/CrFileTree.tsx +1 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +2 -3
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +3 -5
- package/src/modules/change-requests/hooks/useCrFileDiffs.ts +1 -1
- package/src/modules/change-requests/index.ts +14 -0
- package/src/modules/change-requests/services/change-requests.api.ts +2 -2
- package/src/modules/change-requests/services/denied-file.api.ts +2 -2
- package/src/modules/change-requests/services/propose.api.ts +3 -4
- package/src/modules/change-requests/utils/diff.ts +1 -1
- package/src/modules/change-requests/utils/readFailure.ts +1 -1
- package/src/modules/embed/__tests__/EmbedView.test.tsx +19 -2
- package/src/modules/embed/components/EmbedLinkPage.tsx +1 -2
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +0 -14
- package/src/modules/git/__tests__/git.api.test.ts +2 -2
- package/src/modules/git/components/BranchSwitcher.tsx +3 -4
- package/src/modules/git/components/FileHistoryPanel.tsx +2 -2
- package/src/modules/git/components/GitSyncFailedBanner.tsx +2 -4
- package/src/modules/git/components/HistoryVersionPreview.tsx +4 -15
- package/src/modules/git/components/PullNeededBanner.tsx +1 -1
- package/src/modules/git/hooks/__tests__/useGitState.deleteBranch.test.tsx +1 -1
- package/src/modules/git/hooks/useAutoPullUpdates.ts +1 -1
- package/src/modules/git/index.ts +11 -0
- package/src/modules/layout/components/MobileChatLayout.tsx +1 -1
- package/src/modules/layout/index.ts +9 -0
- package/src/modules/library/__tests__/SkillPage.test.tsx +268 -24
- package/src/modules/library/__tests__/propose-change.test.ts +75 -0
- package/src/modules/library/components/AddToPluginDialog.tsx +1 -1
- package/src/modules/library/components/ChangeRequestDock.tsx +1 -1
- package/src/modules/library/components/LibraryLayout.tsx +2 -2
- package/src/modules/library/components/LibraryPage.tsx +3 -3
- package/src/modules/library/components/ManagedPluginRequests.tsx +1 -1
- package/src/modules/library/components/NewSkillPanel.tsx +2 -2
- package/src/modules/library/components/PersonalAddDialog.tsx +1 -1
- package/src/modules/library/components/PersonalPluginPage.tsx +1 -1
- package/src/modules/library/components/PluginExtras.tsx +1 -4
- package/src/modules/library/components/PluginPage.tsx +1 -1
- package/src/modules/library/components/PluginRows.tsx +1 -1
- package/src/modules/library/components/SkillsTree.tsx +1 -4
- package/src/modules/library/components/plugin-page-parts.tsx +1 -1
- package/src/modules/library/components/skill-page/SkillFilePane.tsx +74 -14
- package/src/modules/library/components/skill-page/SkillPage.tsx +80 -47
- package/src/modules/library/components/tool-page/ToolConnectionSection.tsx +2 -4
- package/src/modules/library/components/tool-page/ToolVarRow.tsx +2 -2
- package/src/modules/library/hooks/useJoinRequests.ts +1 -1
- package/src/modules/library/hooks/useLibraryData.ts +3 -3
- package/src/modules/library/hooks/useToolPage.ts +1 -1
- package/src/modules/library/hooks/useToolSource.ts +1 -1
- package/src/modules/library/index.ts +12 -0
- package/src/modules/library/routes/LibraryRoutes.tsx +1 -1
- package/src/modules/library/routes/WorkspaceItemRoute.tsx +1 -3
- package/src/modules/library/routes/library-paths.ts +1 -1
- package/src/modules/library/services/library.api.ts +10 -8
- package/src/modules/library/services/plugins.api.ts +1 -1
- package/src/modules/library/services/teams.api.ts +1 -1
- package/src/modules/library/utils/status.ts +2 -2
- package/src/modules/onboarding/components/ConnectAgentPill.tsx +1 -1
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +2 -3
- package/src/modules/onboarding/components/GetStartedColumn.tsx +6 -13
- package/src/modules/onboarding/components/InviteButton.tsx +2 -2
- package/src/modules/onboarding/components/InviteDialog.tsx +4 -6
- package/src/modules/onboarding/components/RootLanding.tsx +2 -2
- package/src/modules/onboarding/components/StarterPackCard.tsx +1 -1
- package/src/modules/onboarding/components/WelcomePage.tsx +2 -5
- package/src/modules/onboarding/index.ts +10 -0
- package/src/modules/onboarding/paths.ts +1 -1
- package/src/modules/onboarding/state/agent-connection.ts +2 -2
- package/src/modules/onboarding/state/onboarding.ts +1 -1
- package/src/modules/onboarding/state/starter-packs.ts +1 -1
- package/src/modules/pr/components/OpenChangeRequestDialog.tsx +1 -1
- package/src/modules/pr/index.ts +14 -0
- package/src/modules/pr/services/pr-approvals.api.ts +1 -1
- package/src/modules/pr/services/pr-cancel.api.ts +1 -1
- package/src/modules/pr/services/pr-detail.api.ts +2 -2
- package/src/modules/pr/services/pr-edit.api.ts +22 -0
- package/src/modules/pr/services/pr-merge.api.ts +1 -1
- package/src/modules/pr/services/pr-open.api.ts +1 -1
- package/src/modules/review/components/DiffViewer.tsx +1 -1
- package/src/modules/review/components/MarkdownDiffViewer.tsx +24 -3
- package/src/modules/review/components/ReviewPanel.tsx +10 -5
- package/src/modules/review/components/__tests__/MarkdownDiffViewer.test.tsx +31 -0
- package/src/modules/review/state/ReviewProvider.tsx +2 -2
- package/src/modules/secrets-vault/components/ConnectToolsPage.tsx +79 -16
- package/src/modules/secrets-vault/components/__tests__/ConnectToolsPage.test.tsx +112 -2
- package/src/modules/secrets-vault/index.ts +6 -0
- package/src/modules/secrets-vault/services/connect.api.ts +20 -5
- package/src/modules/settings/components/DeploymentPage.tsx +2 -2
- package/src/modules/settings/components/SettingsLayout.tsx +2 -2
- package/src/modules/settings/index.ts +8 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +1 -1
- package/src/modules/setup/index.ts +6 -0
- package/src/modules/toolbar/commands/actions.tsx +3 -3
- package/src/modules/toolbar/commands/useCommandActions.ts +5 -9
- package/src/modules/toolbar/components/AgentInstructionsCard.tsx +2 -2
- package/src/modules/toolbar/components/AppSwitcher.tsx +1 -2
- package/src/modules/toolbar/components/CoworkSetupSteps.tsx +1 -1
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +39 -5
- package/src/modules/toolbar/components/ProfileMenu.tsx +3 -3
- package/src/modules/toolbar/components/SearchPalette.tsx +4 -8
- package/src/modules/toolbar/components/Toolbar.tsx +2 -5
- package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +91 -2
- package/src/modules/toolbar/index.ts +6 -0
- package/src/modules/toolbar/search/sources.ts +4 -7
- package/src/modules/toolbar/services/agent-instructions.api.ts +1 -1
- package/src/modules/toolbar/services/external-api-keys.api.ts +5 -2
- package/src/modules/tools/ToolsExplorerPage.tsx +217 -18
- package/src/modules/tools/__tests__/ToolsExplorerPage.read-only.test.tsx +220 -0
- package/src/modules/tools/tool-hints.api.ts +44 -0
- package/src/modules/workflow/index.ts +7 -0
- package/src/modules/workflow/state/ChangeRequestStaleBinder.tsx +1 -0
- package/src/modules/workflow/state/EventBusFocusBinder.tsx +1 -1
- package/src/modules/workspace/components/FileExplorer.tsx +35 -8
- package/src/modules/workspace/components/FilePaneCard.tsx +37 -12
- package/src/modules/workspace/components/FileRoute.tsx +10 -3
- package/src/modules/workspace/components/FileViewer.tsx +169 -25
- package/src/modules/workspace/components/FullScreenView.tsx +93 -0
- package/src/modules/workspace/components/KbFileRail.tsx +1 -1
- package/src/modules/workspace/components/KbPageHeader.tsx +9 -0
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +163 -0
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +11 -0
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +487 -3
- package/src/modules/workspace/components/readingCarry.ts +59 -0
- package/src/modules/workspace/components/renderers/HtmlRenderer.tsx +74 -180
- package/src/modules/workspace/components/renderers/KbAppLink.tsx +56 -0
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +30 -10
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +37 -40
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +1 -1
- package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.links.test.tsx +185 -0
- package/src/modules/workspace/components/renderers/__tests__/HtmlRenderer.tools.test.tsx +168 -42
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.sectionReclick.test.tsx +88 -0
- package/src/modules/workspace/components/renderers/__tests__/MarkdownRenderer.test.tsx +199 -29
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +57 -7
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +122 -4
- package/src/modules/workspace/components/renderers/__tests__/htmlToolBridge.test.ts +235 -1
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +29 -4
- package/src/modules/workspace/components/renderers/__tests__/liveDataReferencePage.test.ts +397 -0
- package/src/modules/workspace/components/renderers/__tests__/pageToolsHarness.ts +79 -0
- package/src/modules/workspace/components/renderers/__tests__/useHtmlToolBridge.test.tsx +316 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +123 -28
- package/src/modules/workspace/components/renderers/htmlToolBridge.ts +215 -25
- package/src/modules/workspace/components/renderers/index.ts +10 -0
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +35 -28
- package/src/modules/workspace/components/renderers/scrollToHeading.ts +35 -0
- package/src/modules/workspace/components/renderers/useHtmlToolBridge.tsx +253 -0
- package/src/modules/workspace/hooks/__tests__/useLinksOut.test.ts +6 -0
- package/src/modules/workspace/hooks/useFullScreenView.ts +52 -0
- package/src/modules/workspace/hooks/useImageRevision.ts +1 -1
- package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +1 -1
- package/src/modules/workspace/hooks/useLastCommit.ts +1 -1
- package/src/modules/workspace/hooks/useLinksOut.ts +12 -6
- package/src/modules/workspace/hooks/useWorkspaceState.ts +4 -4
- package/src/modules/workspace/index.ts +50 -2
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +262 -25
- package/src/modules/workspace/routing/kb-routes.ts +222 -54
- package/src/modules/workspace/state/__tests__/applied-request-clears-pending.test.tsx +0 -1
- package/src/modules/workspace/state/open-change-requests.tsx +1 -1
- package/src/modules/workspace/utils/fileTree.ts +1 -1
- package/src/modules/workspace/utils/frameEscape.ts +15 -0
- package/src/modules/workspace/utils/treeConfirm.ts +1 -1
- package/src/shared/theme/measure.ts +7 -0
- package/src/modules/pr/services/pr-comments.api.ts +0 -45
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { ExternalLink } from 'lucide-react';
|
|
3
3
|
import { Banner } from '../../../shared/components';
|
|
4
|
-
import { fetchFileAccess } from '../../access
|
|
4
|
+
import { fetchFileAccess } from '../../access';
|
|
5
5
|
import { FilePaneCard } from '../../workspace/components/FilePaneCard';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
DownloadFileButton,
|
|
9
|
-
} from '../../workspace/components/renderers/DownloadFileButton';
|
|
6
|
+
import { CanDownloadContext, RendererWorkspaceContext, kbFileUrl, getOrCreateWorkspace } from '../../workspace';
|
|
7
|
+
import { DownloadFileButton } from '../../workspace/components/renderers/DownloadFileButton';
|
|
10
8
|
import { READ_PANE } from '../../workspace/components/renderers/readPane';
|
|
11
|
-
import {
|
|
12
|
-
RendererWorkspaceContext,
|
|
13
|
-
getFileRenderer,
|
|
14
|
-
getRendererLayout,
|
|
15
|
-
} from '../../workspace/components/renderers';
|
|
16
|
-
import { kbFileUrl } from '../../workspace/routing/kb-routes';
|
|
17
|
-
import { getOrCreateWorkspace } from '../../workspace/services/workspace.api';
|
|
9
|
+
import { getFileRenderer, getRendererLayout } from '../../workspace/components/renderers';
|
|
18
10
|
|
|
19
11
|
/**
|
|
20
12
|
* A document or image shown with the FILE PAGE's viewer, read from a named
|
|
@@ -4,24 +4,29 @@ import {
|
|
|
4
4
|
type FileDiffPayload,
|
|
5
5
|
type PullRequestDetail,
|
|
6
6
|
type PullRequestSummary,
|
|
7
|
+
type UpdateChangeRequestInput,
|
|
7
8
|
} from '@bevel-software/platform-shared';
|
|
8
9
|
import '../change-requests.css';
|
|
9
|
-
import { Banner, Button, Surface } from '../../../shared/components';
|
|
10
|
+
import { Banner, Button, Surface, TextAreaField, TextField } from '../../../shared/components';
|
|
10
11
|
import { useModalLayer } from '../../../shared/components/useModalLayer';
|
|
11
12
|
import { cn } from '../../../lib/utils';
|
|
12
13
|
import { PR_STALE_EVENT } from '../../../core/events';
|
|
13
|
-
import { AuthContext } from '../../auth
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
import { AuthContext } from '../../auth';
|
|
15
|
+
import { useEventBus } from '../../workflow';
|
|
16
|
+
import {
|
|
17
|
+
approvePrFile,
|
|
18
|
+
deleteChangeRequest,
|
|
19
|
+
fetchPrDetail,
|
|
20
|
+
refreshChangeRequestFromTarget,
|
|
21
|
+
revertPrFile,
|
|
22
|
+
unapprovePrFile,
|
|
23
|
+
updateChangeRequest,
|
|
24
|
+
} from '../../pr';
|
|
25
|
+
import { GitApiError, friendlyGitError, friendlyGitMessage } from '../../git';
|
|
21
26
|
import { GitSyncFailedBanner } from '../../git/components/GitSyncFailedBanner';
|
|
22
27
|
import { useApplyChangeRequest } from '../hooks/useApplyChangeRequest';
|
|
23
28
|
import { readFileOnBranch } from '../services/change-requests.api';
|
|
24
|
-
import { WorkspaceApiError } from '../../workspace
|
|
29
|
+
import { WorkspaceApiError } from '../../workspace';
|
|
25
30
|
import { describeReadFailure } from '../services/denied-file.api';
|
|
26
31
|
import { deniedSentence, readErrorLead, type ReadFailure } from '../utils/readFailure';
|
|
27
32
|
import { changeAuthorName } from '../utils/author';
|
|
@@ -233,6 +238,8 @@ export function ChangeRequestDialog({
|
|
|
233
238
|
const offs = [
|
|
234
239
|
bus.subscribe('change-request-apply-failed', reread),
|
|
235
240
|
bus.subscribe('change-request-merged', reread),
|
|
241
|
+
// Somebody changed the title or description: show the new text.
|
|
242
|
+
bus.subscribe('change-request-edited', reread),
|
|
236
243
|
];
|
|
237
244
|
return () => {
|
|
238
245
|
cancelled = true;
|
|
@@ -873,6 +880,68 @@ export function ChangeRequestDialog({
|
|
|
873
880
|
}
|
|
874
881
|
}
|
|
875
882
|
|
|
883
|
+
/**
|
|
884
|
+
* Editing the title and description — the author's, or anyone's who may
|
|
885
|
+
* merge the request (`viewerCanEdit`, the server's verdict; the PATCH route
|
|
886
|
+
* re-checks it). The description field holds the body whole: it is nothing
|
|
887
|
+
* but the description, and a save replaces exactly what the field showed.
|
|
888
|
+
*/
|
|
889
|
+
const [editing, setEditing] = useState(false);
|
|
890
|
+
const [draftTitle, setDraftTitle] = useState('');
|
|
891
|
+
const [draftDescription, setDraftDescription] = useState('');
|
|
892
|
+
const [saving, setSaving] = useState(false);
|
|
893
|
+
const [editError, setEditError] = useState<string | null>(null);
|
|
894
|
+
const shownTitle = detail?.title ?? cr.title;
|
|
895
|
+
// The text the form opened with. A save sends only the fields the reader
|
|
896
|
+
// changed FROM it — not from `detail`, which a remote edit may refresh
|
|
897
|
+
// while the form is open — so the untouched field is never written back
|
|
898
|
+
// with a stale draft.
|
|
899
|
+
const editBaseline = useRef({ title: '', description: '' });
|
|
900
|
+
function startEditing() {
|
|
901
|
+
const baseline = { title: shownTitle, description: detail?.body.trim() ?? '' };
|
|
902
|
+
editBaseline.current = baseline;
|
|
903
|
+
setDraftTitle(baseline.title);
|
|
904
|
+
setDraftDescription(baseline.description);
|
|
905
|
+
setEditError(null);
|
|
906
|
+
setEditing(true);
|
|
907
|
+
}
|
|
908
|
+
async function saveEdit() {
|
|
909
|
+
if (saving || !detail) return;
|
|
910
|
+
const title = draftTitle.trim();
|
|
911
|
+
const description = draftDescription.trim();
|
|
912
|
+
const titleChanged = title !== editBaseline.current.title;
|
|
913
|
+
const descriptionChanged = description !== editBaseline.current.description;
|
|
914
|
+
let changes: UpdateChangeRequestInput;
|
|
915
|
+
if (titleChanged) changes = descriptionChanged ? { title, description } : { title };
|
|
916
|
+
else if (descriptionChanged) changes = { description };
|
|
917
|
+
else {
|
|
918
|
+
setEditing(false);
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
setSaving(true);
|
|
922
|
+
setEditError(null);
|
|
923
|
+
try {
|
|
924
|
+
await updateChangeRequest(cr.number, changes);
|
|
925
|
+
} catch (err) {
|
|
926
|
+
setEditError(err instanceof Error ? err.message : "Couldn't save the change request.");
|
|
927
|
+
setSaving(false);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
// Saved. Every list on the page re-reads — this tab does not wait on its
|
|
931
|
+
// own broadcast — and the dialog shows the new text from a fresh read; a
|
|
932
|
+
// failed read leaves the saved edit saved and shows the last text known.
|
|
933
|
+
window.dispatchEvent(new Event(PR_STALE_EVENT));
|
|
934
|
+
setEditing(false);
|
|
935
|
+
setSaving(false);
|
|
936
|
+
const seq = ++detailSeq.current;
|
|
937
|
+
try {
|
|
938
|
+
const fresh = await fetchPrDetail(cr.number, { fresh: true });
|
|
939
|
+
if (seq === detailSeq.current) setDetail(fresh);
|
|
940
|
+
} catch {
|
|
941
|
+
// The server's `change-request-edited` broadcast re-reads it again.
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
876
945
|
/**
|
|
877
946
|
* Apply = record the approvals the gate requires, then merge, then wait for
|
|
878
947
|
* the merge to land. The POST only acks — see `useApplyChangeRequest` for
|
|
@@ -1013,7 +1082,7 @@ export function ChangeRequestDialog({
|
|
|
1013
1082
|
|
|
1014
1083
|
const author = changeAuthorName(cr);
|
|
1015
1084
|
const firstName = author.split(' ')[0];
|
|
1016
|
-
const why =
|
|
1085
|
+
const why = descriptionOf(detail?.body);
|
|
1017
1086
|
const [whyExpanded, setWhyExpanded] = useState(false);
|
|
1018
1087
|
/**
|
|
1019
1088
|
* Whether the one-line view is actually hiding anything — a short reason
|
|
@@ -1029,7 +1098,7 @@ export function ChangeRequestDialog({
|
|
|
1029
1098
|
className="fixed inset-0 z-[60] flex flex-col"
|
|
1030
1099
|
role="dialog"
|
|
1031
1100
|
aria-modal="true"
|
|
1032
|
-
aria-label={`Change request: ${
|
|
1101
|
+
aria-label={`Change request: ${shownTitle}`}
|
|
1033
1102
|
>
|
|
1034
1103
|
<div className="absolute inset-0 bg-scrim" onClick={onClose} />
|
|
1035
1104
|
|
|
@@ -1042,13 +1111,29 @@ export function ChangeRequestDialog({
|
|
|
1042
1111
|
<div className="flex items-start gap-4 px-8 pt-7">
|
|
1043
1112
|
<div className="min-w-0 flex-1">
|
|
1044
1113
|
<p className="text-label font-semibold uppercase text-ink-faint">Change request</p>
|
|
1045
|
-
|
|
1114
|
+
{editing ? (
|
|
1115
|
+
<TextField
|
|
1116
|
+
className="mt-1 text-title font-medium"
|
|
1117
|
+
aria-label="Title"
|
|
1118
|
+
value={draftTitle}
|
|
1119
|
+
maxLength={256}
|
|
1120
|
+
disabled={saving}
|
|
1121
|
+
onChange={(e) => setDraftTitle(e.target.value)}
|
|
1122
|
+
/>
|
|
1123
|
+
) : (
|
|
1124
|
+
<h1 className="mt-1 text-title font-medium text-ink">{shownTitle}</h1>
|
|
1125
|
+
)}
|
|
1046
1126
|
<p className="mt-2 flex flex-wrap items-center gap-2 text-detail text-ink-muted">
|
|
1047
1127
|
<span>{author}</span>
|
|
1048
1128
|
<span aria-hidden="true" className="text-ink-faint">·</span>
|
|
1049
1129
|
<span className="font-mono">{cr.branch}</span>
|
|
1050
1130
|
</p>
|
|
1051
1131
|
</div>
|
|
1132
|
+
{detail?.viewerCanEdit && !editing && (
|
|
1133
|
+
<Button variant="quiet" size="sm" onClick={startEditing}>
|
|
1134
|
+
Edit
|
|
1135
|
+
</Button>
|
|
1136
|
+
)}
|
|
1052
1137
|
<Button variant="quiet" size="sm" onClick={onClose} aria-label="Close change request">
|
|
1053
1138
|
✕
|
|
1054
1139
|
</Button>
|
|
@@ -1064,7 +1149,39 @@ export function ChangeRequestDialog({
|
|
|
1064
1149
|
more opens the whole thing (self-scrolling past half the surface,
|
|
1065
1150
|
so even an essay never pushes the files off screen); Hide folds it
|
|
1066
1151
|
back to the line. */}
|
|
1067
|
-
{
|
|
1152
|
+
{editing && (
|
|
1153
|
+
<div className="mx-8 mt-5 shrink-0">
|
|
1154
|
+
<TextAreaField
|
|
1155
|
+
className="max-h-[40vh] min-h-32"
|
|
1156
|
+
aria-label="Description"
|
|
1157
|
+
placeholder="Why this change, in your words"
|
|
1158
|
+
value={draftDescription}
|
|
1159
|
+
maxLength={64_000}
|
|
1160
|
+
disabled={saving}
|
|
1161
|
+
onChange={(e) => setDraftDescription(e.target.value)}
|
|
1162
|
+
/>
|
|
1163
|
+
{editError && (
|
|
1164
|
+
<Banner tone="danger" role="alert" className="mt-3">
|
|
1165
|
+
{editError}
|
|
1166
|
+
</Banner>
|
|
1167
|
+
)}
|
|
1168
|
+
<div className="mt-3 flex items-center gap-3">
|
|
1169
|
+
<Button
|
|
1170
|
+
variant="primary"
|
|
1171
|
+
size="sm"
|
|
1172
|
+
disabled={saving || draftTitle.trim().length === 0}
|
|
1173
|
+
onClick={() => void saveEdit()}
|
|
1174
|
+
>
|
|
1175
|
+
{saving ? 'Saving…' : 'Save'}
|
|
1176
|
+
</Button>
|
|
1177
|
+
<Button variant="quiet" size="sm" disabled={saving} onClick={() => setEditing(false)}>
|
|
1178
|
+
Cancel
|
|
1179
|
+
</Button>
|
|
1180
|
+
</div>
|
|
1181
|
+
</div>
|
|
1182
|
+
)}
|
|
1183
|
+
|
|
1184
|
+
{!editing && why && (
|
|
1068
1185
|
<blockquote
|
|
1069
1186
|
className={cn(
|
|
1070
1187
|
'mx-8 mt-5 shrink-0 border-l-2 border-line-strong pl-4 text-body text-ink',
|
|
@@ -1491,23 +1608,14 @@ export function ChangeRequestDialog({
|
|
|
1491
1608
|
}
|
|
1492
1609
|
|
|
1493
1610
|
/**
|
|
1494
|
-
* The
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1498
|
-
* author wrote, and our propose flow writes no description at all — so the body
|
|
1499
|
-
* is USUALLY pure machinery. Rendering it as a pull-quote under the title
|
|
1500
|
-
* presents a routing table as the reason someone wants this change. Everything
|
|
1501
|
-
* from the first generated heading on is dropped; what survives is quoted only
|
|
1502
|
-
* if a human actually wrote it.
|
|
1611
|
+
* The request's description, or nothing. The body IS the description — the
|
|
1612
|
+
* server writes nothing of its own into it — so the quote under the title is
|
|
1613
|
+
* the whole of what the author wrote, and the same text the Edit control
|
|
1614
|
+
* offers. Nothing when nobody wrote one (the propose flow may leave it empty).
|
|
1503
1615
|
*/
|
|
1504
|
-
function
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
.split(/^##\s+/m)[0]
|
|
1508
|
-
.replace(/<!--[\s\S]*?-->/g, '')
|
|
1509
|
-
.trim();
|
|
1510
|
-
return human.length > 0 ? human : null;
|
|
1616
|
+
function descriptionOf(body: string | undefined): string | null {
|
|
1617
|
+
const text = body?.trim() ?? '';
|
|
1618
|
+
return text.length > 0 ? text : null;
|
|
1511
1619
|
}
|
|
1512
1620
|
|
|
1513
1621
|
/**
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { Link, useNavigate, useParams } from 'react-router-dom';
|
|
3
3
|
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
4
|
-
import { getPullRequest } from '../../git
|
|
5
|
-
import {
|
|
6
|
-
import { KB_ROUTE_PREFIX } from '../../workspace/routing/kb-routes';
|
|
4
|
+
import { getPullRequest, GitApiError } from '../../git';
|
|
5
|
+
import { KB_ROUTE_PREFIX } from '../../workspace';
|
|
7
6
|
import { ChangeRequestDialog } from './ChangeRequestDialog';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import type { FileApprovalState, PrFileStatus } from '@bevel-software/platform-shared';
|
|
14
14
|
import { cn } from '../../../lib/utils';
|
|
15
15
|
import { hasOwnApproval } from '../utils/approval';
|
|
16
|
-
import { displayFileName } from '../../workspace
|
|
16
|
+
import { displayFileName } from '../../workspace';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* The change request's files as a TREE — the Knowledge sidebar's visual
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback, useState } from 'react';
|
|
2
2
|
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
3
3
|
import { Banner, Button } from '../../../shared/components';
|
|
4
|
-
import { cancelPullRequest } from '../../pr
|
|
5
|
-
import { useOpenChangeRequests } from '../../workspace
|
|
4
|
+
import { cancelPullRequest } from '../../pr';
|
|
5
|
+
import { useOpenChangeRequests, displayFileName, fileNameTooltip } from '../../workspace';
|
|
6
6
|
import { PR_STALE_EVENT } from '../../../core/events';
|
|
7
7
|
import { refusalLine, useApplyChangeRequest } from '../hooks/useApplyChangeRequest';
|
|
8
8
|
import { useCrFileDiffs } from '../hooks/useCrFileDiffs';
|
|
@@ -11,7 +11,6 @@ import { conflictResolutionPrompt } from '../utils/conflict';
|
|
|
11
11
|
import { isBinaryFile } from '../../workspace/components/renderers';
|
|
12
12
|
import { ChangeBox } from './ChangeBox';
|
|
13
13
|
import { ChangeRequestDialog } from './ChangeRequestDialog';
|
|
14
|
-
import { displayFileName, fileNameTooltip } from '../../workspace/utils/display-file-name';
|
|
15
14
|
|
|
16
15
|
export interface FileChangeBoxesProps {
|
|
17
16
|
/** Repo-root-relative path of the open file (kbDirName stripped). */
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
3
|
-
import { useEventBus } from '../../workflow
|
|
4
|
-
import { fetchPrDetail } from '../../pr
|
|
5
|
-
import {
|
|
6
|
-
import { mergePullRequest } from '../../pr/services/pr-merge.api';
|
|
7
|
-
import { friendlyGitError, friendlyGitMessage } from '../../git/services/error-messages';
|
|
3
|
+
import { useEventBus } from '../../workflow';
|
|
4
|
+
import { fetchPrDetail, approvePrFile, mergePullRequest } from '../../pr';
|
|
5
|
+
import { friendlyGitError, friendlyGitMessage } from '../../git';
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Safety net for the async apply: if neither a `change-request-merged` nor a
|
|
@@ -3,7 +3,7 @@ import type { PullRequestSummary } from '@bevel-software/platform-shared';
|
|
|
3
3
|
import { readFileAtForkPoint, readFileOnBranch, type ForkPointFile } from '../services/change-requests.api';
|
|
4
4
|
import { subscribePrStale } from '../../../core/events';
|
|
5
5
|
import { isBinaryFile } from '../../workspace/components/renderers';
|
|
6
|
-
import { WorkspaceApiError } from '../../workspace
|
|
6
|
+
import { WorkspaceApiError } from '../../workspace';
|
|
7
7
|
import { diffLines, hasChanges, type DiffLine } from '../utils/diff';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the change-requests module offers the other modules. A consumer outside the
|
|
3
|
+
* module imports from here, never from the files: they are the module's own
|
|
4
|
+
* layout and free to move. Export what another module needs; nothing more.
|
|
5
|
+
*/
|
|
6
|
+
export { refusalLine, useApplyChangeRequest } from './hooks/useApplyChangeRequest';
|
|
7
|
+
export { useCrFileDiffs } from './hooks/useCrFileDiffs';
|
|
8
|
+
export { useDefaultBranchFile, useFileOnBranch } from './hooks/useFileOnBranch';
|
|
9
|
+
export { listChangeRequestsUnderFolder, listMyChangeRequests, listOpenChangeRequests, readFileOnBranch, removeFolderFromChangeRequests } from './services/change-requests.api';
|
|
10
|
+
export { branchSegment, ensureKnowledgeChangeRequest, ensureKnowledgeSuggestionWorkspace, knowledgeSuggestionBranchFor, proposeKnowledgeChange } from './services/propose.api';
|
|
11
|
+
export type { KnowledgeSuggestionTarget } from './services/propose.api';
|
|
12
|
+
export { changeAuthorName, formatWhen, othersPendingBesides } from './utils/author';
|
|
13
|
+
export { conflictResolutionPrompt } from './utils/conflict';
|
|
14
|
+
export type { DiffLine } from './utils/diff';
|
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
PullRequestSummary,
|
|
5
5
|
} from '@bevel-software/platform-shared';
|
|
6
6
|
import { authFetch } from '../../../lib/api';
|
|
7
|
-
import { handleApiResponse } from '../../git
|
|
8
|
-
import { getOrCreateWorkspace, readFile } from '../../workspace
|
|
7
|
+
import { handleApiResponse } from '../../git';
|
|
8
|
+
import { getOrCreateWorkspace, readFile } from '../../workspace';
|
|
9
9
|
import { BranchUnavailableError } from '../utils/readFailure';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fetchFileAccess } from '../../access
|
|
2
|
-
import { getOrCreateWorkspace } from '../../workspace
|
|
1
|
+
import { fetchFileAccess } from '../../access';
|
|
2
|
+
import { getOrCreateWorkspace } from '../../workspace';
|
|
3
3
|
import { failureReason, isDenial, nearestRuleFolder, type ReadFailure } from '../utils/readFailure';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -4,10 +4,9 @@ import {
|
|
|
4
4
|
suggestionsBranchPrefixFor,
|
|
5
5
|
type PullRequestSummary,
|
|
6
6
|
} from '@bevel-software/platform-shared';
|
|
7
|
-
import { createBranch, deleteBranch, GitApiError } from '../../git
|
|
8
|
-
import { getOrCreateWorkspace, writeFile } from '../../workspace
|
|
9
|
-
import { openChangeRequest } from '../../pr
|
|
10
|
-
import { fetchPrDetail } from '../../pr/services/pr-detail.api';
|
|
7
|
+
import { createBranch, deleteBranch, GitApiError } from '../../git';
|
|
8
|
+
import { getOrCreateWorkspace, writeFile } from '../../workspace';
|
|
9
|
+
import { openChangeRequest, fetchPrDetail } from '../../pr';
|
|
11
10
|
import { listMyChangeRequests } from './change-requests.api';
|
|
12
11
|
|
|
13
12
|
/** The default branch's workspace id (id = encodeURIComponent(branch)), read lazily. */
|
|
@@ -4,10 +4,10 @@ import userEvent from '@testing-library/user-event';
|
|
|
4
4
|
import { MemoryRouter } from 'react-router-dom';
|
|
5
5
|
import { AppRegistryContext, type AppRegistry } from '../../../core/registry';
|
|
6
6
|
import type { EmbedFileView } from '../services/embed.api';
|
|
7
|
-
import { useEffect, useState } from 'react';
|
|
7
|
+
import { useContext, useEffect, useState } from 'react';
|
|
8
8
|
import { EMBED_EXPIRED, EMBED_HEIGHT_MESSAGE } from '../embed-host';
|
|
9
9
|
import { configureEmbed, resetEmbedConfig } from '../embed-config';
|
|
10
|
-
import { useKbGraphLoader, useRendererSurface } from '../../workspace';
|
|
10
|
+
import { PageToolsContext, useKbGraphLoader, useRendererSurface } from '../../workspace';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* The HTTP surface, stubbed. The error CLASS is hoisted with the rest: the
|
|
@@ -550,6 +550,23 @@ describe('the renderer', () => {
|
|
|
550
550
|
expect((await screen.findByTestId('sizing-reader')).textContent).toBe('false');
|
|
551
551
|
});
|
|
552
552
|
|
|
553
|
+
/**
|
|
554
|
+
* The embed is outside the platform: a page there gets no tools — the
|
|
555
|
+
* renderer shows it the "only available in the platform" card instead —
|
|
556
|
+
* even for a skill's page, which the skill page answers.
|
|
557
|
+
*/
|
|
558
|
+
it('mounts the renderer without the page-tool bridge, a skill page included', async () => {
|
|
559
|
+
api.loadEmbed.mockResolvedValue(
|
|
560
|
+
view({ repoRelative: 'Skills/qa-bridge/view.html', workspacePath: `${KB}/Skills/qa-bridge/view.html`, content: '<p>qa</p>' }),
|
|
561
|
+
);
|
|
562
|
+
const BridgeReader = () => {
|
|
563
|
+
const tools = useContext(PageToolsContext);
|
|
564
|
+
return <div data-testid="bridge-reader">{tools ? tools.pagePath : 'no tools'}</div>;
|
|
565
|
+
};
|
|
566
|
+
mount({ ...EMPTY_REGISTRY, renderers: [{ extensions: ['.html'], Component: BridgeReader }] } as unknown as AppRegistry);
|
|
567
|
+
expect((await screen.findByTestId('bridge-reader')).textContent).toBe('no tools');
|
|
568
|
+
});
|
|
569
|
+
|
|
553
570
|
it("opens a page on its FILE PAGE in a new tab by an address that asks for it — a skill's page would claim the bare one", async () => {
|
|
554
571
|
api.loadEmbed.mockResolvedValue(
|
|
555
572
|
view({ repoRelative: 'Skills/qa-bridge/view.html', workspacePath: `${KB}/Skills/qa-bridge/view.html`, content: '<p>qa</p>' }),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useCallback, useState, type ReactNode } from 'react';
|
|
2
2
|
import { Button } from '../../../shared/components';
|
|
3
|
-
import { AuthContext } from '../../auth
|
|
4
|
-
import { useAuthState } from '../../auth/hooks/useAuthState';
|
|
3
|
+
import { AuthContext, useAuthState } from '../../auth';
|
|
5
4
|
import { LoginScreen } from '../../auth/components/LoginScreen';
|
|
6
5
|
import { getToken } from '../../../lib/api';
|
|
7
6
|
import { linkEmbedAccount } from '../services/embed.api';
|
|
@@ -219,8 +219,6 @@ describe('BranchSwitcher: author-can-delete affordance', () => {
|
|
|
219
219
|
{
|
|
220
220
|
name: 'alice/my-draft',
|
|
221
221
|
isProtected: false,
|
|
222
|
-
ahead: 0,
|
|
223
|
-
behind: 0,
|
|
224
222
|
hasRemote: true,
|
|
225
223
|
},
|
|
226
224
|
]));
|
|
@@ -239,8 +237,6 @@ describe('BranchSwitcher: author-can-delete affordance', () => {
|
|
|
239
237
|
{
|
|
240
238
|
name: 'bob/other-draft',
|
|
241
239
|
isProtected: false,
|
|
242
|
-
ahead: 0,
|
|
243
|
-
behind: 0,
|
|
244
240
|
hasRemote: true,
|
|
245
241
|
},
|
|
246
242
|
]));
|
|
@@ -260,8 +256,6 @@ describe('BranchSwitcher: author-can-delete affordance', () => {
|
|
|
260
256
|
{
|
|
261
257
|
name: 'bob/merged-and-pruned',
|
|
262
258
|
isProtected: false,
|
|
263
|
-
ahead: 0,
|
|
264
|
-
behind: 0,
|
|
265
259
|
hasRemote: false,
|
|
266
260
|
},
|
|
267
261
|
]));
|
|
@@ -307,8 +301,6 @@ describe('BranchSwitcher: admin-can-delete affordance', () => {
|
|
|
307
301
|
{
|
|
308
302
|
name: 'bob/other-draft',
|
|
309
303
|
isProtected: false,
|
|
310
|
-
ahead: 0,
|
|
311
|
-
behind: 0,
|
|
312
304
|
hasRemote: true,
|
|
313
305
|
},
|
|
314
306
|
]));
|
|
@@ -326,8 +318,6 @@ describe('BranchSwitcher: admin-can-delete affordance', () => {
|
|
|
326
318
|
{
|
|
327
319
|
name: 'fix/some-cli-branch',
|
|
328
320
|
isProtected: false,
|
|
329
|
-
ahead: 0,
|
|
330
|
-
behind: 0,
|
|
331
321
|
hasRemote: true,
|
|
332
322
|
},
|
|
333
323
|
]));
|
|
@@ -344,8 +334,6 @@ describe('BranchSwitcher: admin-can-delete affordance', () => {
|
|
|
344
334
|
{
|
|
345
335
|
name: 'current-company-state',
|
|
346
336
|
isProtected: true,
|
|
347
|
-
ahead: 0,
|
|
348
|
-
behind: 0,
|
|
349
337
|
hasRemote: true,
|
|
350
338
|
},
|
|
351
339
|
]));
|
|
@@ -369,8 +357,6 @@ describe('BranchSwitcher: deleting a shared branch asks in the app', () => {
|
|
|
369
357
|
const shared = (name: string): BranchInfo => ({
|
|
370
358
|
name,
|
|
371
359
|
isProtected: false,
|
|
372
|
-
ahead: 0,
|
|
373
|
-
behind: 0,
|
|
374
360
|
hasRemote: true,
|
|
375
361
|
});
|
|
376
362
|
|
|
@@ -46,7 +46,7 @@ describe('git.api', () => {
|
|
|
46
46
|
it('fetchBranches returns the array body', async () => {
|
|
47
47
|
fetchMock.mockResolvedValueOnce(
|
|
48
48
|
ok([
|
|
49
|
-
{ name: 'current-company-state', isCurrent: true, isProtected: true
|
|
49
|
+
{ name: 'current-company-state', isCurrent: true, isProtected: true },
|
|
50
50
|
]),
|
|
51
51
|
);
|
|
52
52
|
const bs = await fetchBranches('ws-1');
|
|
@@ -56,7 +56,7 @@ describe('git.api', () => {
|
|
|
56
56
|
|
|
57
57
|
it('createBranch POSTs JSON body', async () => {
|
|
58
58
|
fetchMock.mockResolvedValueOnce(
|
|
59
|
-
ok({ name: 'feature/x', isCurrent: false, isProtected: false
|
|
59
|
+
ok({ name: 'feature/x', isCurrent: false, isProtected: false }),
|
|
60
60
|
);
|
|
61
61
|
await createBranch('ws-1', 'feature/x');
|
|
62
62
|
const [, init] = fetchMock.mock.calls[0];
|
|
@@ -13,11 +13,10 @@ import { useGit } from '../state/git.context';
|
|
|
13
13
|
import { isBranchDeleteConfirmSkipped, skipBranchDeleteConfirm } from '../state/branch-delete-confirm';
|
|
14
14
|
import { useConfirm } from '../../../shared/components';
|
|
15
15
|
import { parseGitError, type GitErrorInfo } from '../services/error-messages';
|
|
16
|
-
import { useAuth } from '../../auth
|
|
17
|
-
import { useWorkspace } from '../../workspace
|
|
18
|
-
import { kbFileUrl, KB_ROUTE_PREFIX } from '../../workspace/routing/kb-routes';
|
|
16
|
+
import { useAuth } from '../../auth';
|
|
17
|
+
import { useWorkspace, kbFileUrl, KB_ROUTE_PREFIX } from '../../workspace';
|
|
19
18
|
import { useCrCreationPort } from '../../../core/registry';
|
|
20
|
-
import { fetchFileAccess } from '../../access
|
|
19
|
+
import { fetchFileAccess } from '../../access';
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Convert a free-text "what are you changing?" answer into a branch name slug.
|
|
@@ -6,8 +6,8 @@ import { formatRelativeTime } from '../../../lib/utils';
|
|
|
6
6
|
import { MarkdownDiffViewer } from '../../review/components/MarkdownDiffViewer';
|
|
7
7
|
import { HistoryVersionPreview } from './HistoryVersionPreview';
|
|
8
8
|
import { friendlyGitError } from '../services/error-messages';
|
|
9
|
-
import { useEventBus, canonicalizeWorkspaceId } from '../../workflow
|
|
10
|
-
import { useWorkspace } from '../../workspace
|
|
9
|
+
import { useEventBus, canonicalizeWorkspaceId } from '../../workflow';
|
|
10
|
+
import { useWorkspace } from '../../workspace';
|
|
11
11
|
|
|
12
12
|
function shortSha(sha: string): string {
|
|
13
13
|
return sha.slice(0, 7);
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { useCallback, useContext, useState } from 'react';
|
|
2
2
|
import { AlertTriangle, CloudOff } from 'lucide-react';
|
|
3
|
-
import { useEventBusSubscription } from '../../workflow
|
|
4
|
-
import {
|
|
5
|
-
import { useWorkspace, WorkspaceContext } from '../../workspace/state/workspace.context';
|
|
6
|
-
import { useFileNav } from '../../workspace/routing/kb-routes';
|
|
3
|
+
import { useEventBusSubscription, canonicalizeWorkspaceId } from '../../workflow';
|
|
4
|
+
import { useWorkspace, WorkspaceContext, useFileNav } from '../../workspace';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* The files a remote sync could not reconcile, each a link that opens it.
|
|
@@ -6,24 +6,13 @@ import { formatRelativeTime } from '../../../lib/utils';
|
|
|
6
6
|
import { useGit } from '../state/git.context';
|
|
7
7
|
import { friendlyGitError } from '../services/error-messages';
|
|
8
8
|
import { UnifiedDiffView } from './UnifiedDiffView';
|
|
9
|
-
import { useFileAccess } from '../../access
|
|
9
|
+
import { useFileAccess } from '../../access';
|
|
10
10
|
import { FilePaneCard } from '../../workspace/components/FilePaneCard';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
DownloadFileButton,
|
|
14
|
-
} from '../../workspace/components/renderers/DownloadFileButton';
|
|
11
|
+
import { CanDownloadContext, RendererWorkspaceContext, useWorkspace, displayFileName, fileNameTooltip } from '../../workspace';
|
|
12
|
+
import { DownloadFileButton } from '../../workspace/components/renderers/DownloadFileButton';
|
|
15
13
|
import { RetryReadButton } from '../../workspace/components/renderers/RetryReadButton';
|
|
16
14
|
import { READ_PANE } from '../../workspace/components/renderers/readPane';
|
|
17
|
-
import {
|
|
18
|
-
RendererWorkspaceContext,
|
|
19
|
-
getFileRenderer,
|
|
20
|
-
getRendererLayout,
|
|
21
|
-
hasFileViewer,
|
|
22
|
-
isBinaryFile,
|
|
23
|
-
type RendererFileRef,
|
|
24
|
-
} from '../../workspace/components/renderers';
|
|
25
|
-
import { useWorkspace } from '../../workspace/state/workspace.context';
|
|
26
|
-
import { displayFileName, fileNameTooltip } from '../../workspace/utils/display-file-name';
|
|
15
|
+
import { getFileRenderer, getRendererLayout, hasFileViewer, isBinaryFile, type RendererFileRef } from '../../workspace/components/renderers';
|
|
27
16
|
|
|
28
17
|
/**
|
|
29
18
|
* One past save of a file, shown the way the FILE PAGE shows that file.
|
|
@@ -5,7 +5,7 @@ import { useGit } from '../state/git.context';
|
|
|
5
5
|
import { useAutoUpdate } from '../state/auto-update.context';
|
|
6
6
|
import { useCrCreationPort } from '../../../core/registry';
|
|
7
7
|
import { PR_STALE_EVENT } from '../../../core/events';
|
|
8
|
-
import { useWorkspace } from '../../workspace
|
|
8
|
+
import { useWorkspace } from '../../workspace';
|
|
9
9
|
import { sanitizeErrorText } from '../services/error-messages';
|
|
10
10
|
import { describePullFailure, pullFailurePhrase } from '../services/pull-failure';
|
|
11
11
|
import { Button } from '../../../shared/components';
|
|
@@ -34,7 +34,7 @@ const mockFetchStatus = vi.mocked(fetchStatus);
|
|
|
34
34
|
const mockDeleteBranch = vi.mocked(apiDeleteBranch);
|
|
35
35
|
|
|
36
36
|
function mkBranch(name: string): BranchInfo {
|
|
37
|
-
return { name, isProtected: false,
|
|
37
|
+
return { name, isProtected: false, hasRemote: true };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
describe('useGitState: optimistic deleteBranch', () => {
|