mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-08 22:22:17 +02:00
feat(rename): complete searchSpace to workspace transition across frontend and backend
- Introduced a comprehensive specification for renaming `searchSpace` to `workspace` in `surfsense_web` and `surfsense_desktop`, ensuring all TypeScript identifiers, React props, and local data structures are updated. - Implemented migration shims for persisted local state to prevent data loss during the transition. - Updated observability metrics and IPC channels to reflect the new naming convention. - Removed legacy `active-search-space` module and replaced it with `active-workspace` to maintain consistency. - Ensured no behavioral changes or data loss for users during the renaming process.
This commit is contained in:
parent
2a020629c5
commit
a8c1fb660d
259 changed files with 5480 additions and 2285 deletions
|
|
@ -19,12 +19,12 @@ function videoStatus(status: string): LibraryArtifactStatus {
|
|||
|
||||
// Each list is fetched independently; one failing source shouldn't blank the
|
||||
// whole library, so failures degrade to an empty slice.
|
||||
async function fetchLibraryArtifacts(searchSpaceId: number): Promise<LibraryArtifact[]> {
|
||||
async function fetchLibraryArtifacts(workspaceId: number): Promise<LibraryArtifact[]> {
|
||||
const [reports, podcasts, videos, images] = await Promise.all([
|
||||
reportsApiService.list(searchSpaceId).catch(() => []),
|
||||
podcastsApiService.list(searchSpaceId).catch(() => []),
|
||||
videoPresentationsApiService.list(searchSpaceId).catch(() => []),
|
||||
imageGenerationsApiService.list(searchSpaceId).catch(() => []),
|
||||
reportsApiService.list(workspaceId).catch(() => []),
|
||||
podcastsApiService.list(workspaceId).catch(() => []),
|
||||
videoPresentationsApiService.list(workspaceId).catch(() => []),
|
||||
imageGenerationsApiService.list(workspaceId).catch(() => []),
|
||||
]);
|
||||
|
||||
const artifacts: LibraryArtifact[] = [];
|
||||
|
|
@ -86,11 +86,11 @@ async function fetchLibraryArtifacts(searchSpaceId: number): Promise<LibraryArti
|
|||
);
|
||||
}
|
||||
|
||||
export function useLibraryArtifacts(searchSpaceId: number) {
|
||||
export function useLibraryArtifacts(workspaceId: number) {
|
||||
const { data, isLoading, error, refetch } = useQuery({
|
||||
queryKey: ["artifacts-library", searchSpaceId],
|
||||
queryFn: () => fetchLibraryArtifacts(searchSpaceId),
|
||||
enabled: Number.isFinite(searchSpaceId) && searchSpaceId > 0,
|
||||
queryKey: ["artifacts-library", workspaceId],
|
||||
queryFn: () => fetchLibraryArtifacts(workspaceId),
|
||||
enabled: Number.isFinite(workspaceId) && workspaceId > 0,
|
||||
staleTime: 60 * 1000,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/** Deliverable kinds surfaced in the search-space-wide artifacts library. */
|
||||
/** Deliverable kinds surfaced in the workspace-wide artifacts library. */
|
||||
export type LibraryArtifactKind = "report" | "resume" | "podcast" | "video" | "image";
|
||||
|
||||
export type LibraryArtifactStatus = "ready" | "running" | "error";
|
||||
|
||||
/**
|
||||
* A deliverable aggregated from the search space's list endpoints. The heavy
|
||||
* A deliverable aggregated from the workspace's list endpoints. The heavy
|
||||
* content (report body, audio, video frames, image bytes) is fetched lazily by
|
||||
* the viewer when a card is opened.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ import { KIND_META } from "./kind-meta";
|
|||
|
||||
export function ArtifactCard({
|
||||
artifact,
|
||||
searchSpaceId,
|
||||
workspaceId,
|
||||
onOpen,
|
||||
}: {
|
||||
artifact: LibraryArtifact;
|
||||
searchSpaceId: number;
|
||||
workspaceId: number;
|
||||
onOpen: (artifact: LibraryArtifact) => void;
|
||||
}) {
|
||||
const meta = KIND_META[artifact.kind];
|
||||
|
|
@ -50,7 +50,7 @@ export function ArtifactCard({
|
|||
|
||||
{artifact.sourceThreadId ? (
|
||||
<Link
|
||||
href={`/dashboard/${searchSpaceId}/new-chat/${artifact.sourceThreadId}`}
|
||||
href={`/dashboard/${workspaceId}/new-chat/${artifact.sourceThreadId}`}
|
||||
title="Open source chat"
|
||||
className="relative z-10 flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function ErrorState({ onRetry }: { onRetry: () => void }) {
|
|||
<div>
|
||||
<p className="font-medium text-foreground">Couldn't load artifacts</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
Something went wrong fetching this search space's deliverables.
|
||||
Something went wrong fetching this workspace's deliverables.
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" onClick={onRetry}>
|
||||
|
|
@ -53,8 +53,7 @@ function EmptyState() {
|
|||
}
|
||||
|
||||
export function ArtifactsLibrary({ workspaceId }: { workspaceId: number }) {
|
||||
const searchSpaceId = workspaceId;
|
||||
const { artifacts, loading, error, refresh } = useLibraryArtifacts(searchSpaceId);
|
||||
const { artifacts, loading, error, refresh } = useLibraryArtifacts(workspaceId);
|
||||
const openReportPanel = useSetAtom(openReportPanelAtom);
|
||||
const [selectedMedia, setSelectedMedia] = useState<LibraryArtifact | null>(null);
|
||||
|
||||
|
|
@ -114,7 +113,7 @@ export function ArtifactsLibrary({ workspaceId }: { workspaceId: number }) {
|
|||
<ArtifactCard
|
||||
key={artifact.key}
|
||||
artifact={artifact}
|
||||
searchSpaceId={searchSpaceId}
|
||||
workspaceId={workspaceId}
|
||||
onOpen={handleOpen}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue