mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-14 22:52:15 +02:00
refactor(workspace): standardize component props to use workspaceId
- Updated component props across multiple files to replace searchSpaceId with workspaceId for consistency. - Adjusted internal logic to maintain functionality while aligning with the new terminology.
This commit is contained in:
parent
ec617c1c6b
commit
3719037c16
13 changed files with 34 additions and 28 deletions
|
|
@ -156,10 +156,7 @@ export function AutomationBuilderForm({
|
|||
if (mode === "edit" && automation) {
|
||||
return { ...buildUpdatePayload(formForPayload), status: automation.status };
|
||||
}
|
||||
const { workspace_id: _ignored, ...rest } = buildCreatePayload(
|
||||
formForPayload,
|
||||
workspaceId
|
||||
);
|
||||
const { search_space_id: _ignored, ...rest } = buildCreatePayload(formForPayload, workspaceId);
|
||||
return rest;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ function toChipInput(mention: MentionedDocumentInfo): MentionChipInput {
|
|||
if (mention.kind === "folder") {
|
||||
return { id: mention.id, title: mention.title, kind: "folder" };
|
||||
}
|
||||
if (mention.kind === "thread") {
|
||||
return { id: mention.id, title: mention.title, kind: "thread" };
|
||||
}
|
||||
return {
|
||||
id: mention.id,
|
||||
title: mention.title,
|
||||
|
|
@ -232,7 +235,7 @@ export function MentionTaskInput({
|
|||
<ComposerSuggestionPopoverContent side="bottom">
|
||||
<DocumentMentionPicker
|
||||
ref={pickerRef}
|
||||
workspaceId={workspaceId}
|
||||
searchSpaceId={workspaceId}
|
||||
onSelectionChange={handleSelection}
|
||||
onDone={closePopover}
|
||||
initialSelectedDocuments={mentions}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export function DeleteAutomationDialog({
|
|||
async function handleConfirm() {
|
||||
setSubmitting(true);
|
||||
try {
|
||||
await deleteAutomation({ automationId, workspaceId });
|
||||
await deleteAutomation({ automationId, searchSpaceId: workspaceId });
|
||||
onDeleted?.();
|
||||
onOpenChange(false);
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ export default function NewChatPage() {
|
|||
error,
|
||||
flow,
|
||||
context: {
|
||||
workspaceId,
|
||||
searchSpaceId: workspaceId,
|
||||
threadId,
|
||||
},
|
||||
});
|
||||
|
|
@ -754,8 +754,8 @@ export default function NewChatPage() {
|
|||
syncChatTab({
|
||||
chatId: thread.id,
|
||||
title: thread.title,
|
||||
chatUrl: `/dashboard/${thread.workspace_id ?? workspaceId}/new-chat/${thread.id}`,
|
||||
workspaceId: thread.workspace_id ?? workspaceId,
|
||||
chatUrl: `/dashboard/${thread.search_space_id ?? workspaceId}/new-chat/${thread.id}`,
|
||||
searchSpaceId: thread.search_space_id ?? workspaceId,
|
||||
visibility: thread.visibility,
|
||||
hasComments: thread.has_comments ?? false,
|
||||
});
|
||||
|
|
@ -892,7 +892,7 @@ export default function NewChatPage() {
|
|||
}
|
||||
setCurrentThreadMetadata({
|
||||
id: null,
|
||||
workspaceId: null,
|
||||
searchSpaceId: null,
|
||||
visibility: null,
|
||||
hasComments: false,
|
||||
});
|
||||
|
|
@ -906,7 +906,7 @@ export default function NewChatPage() {
|
|||
|
||||
setCurrentThreadMetadata({
|
||||
id: currentThread.id,
|
||||
workspaceId: currentThread.workspace_id ?? workspaceId,
|
||||
searchSpaceId: currentThread.search_space_id ?? workspaceId,
|
||||
visibility,
|
||||
hasComments: currentThread.has_comments ?? false,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export function TeamContent({ workspaceId }: TeamContentProps) {
|
|||
const handleRevokeInvite = useCallback(
|
||||
async (inviteId: number): Promise<boolean> => {
|
||||
const request: DeleteInviteRequest = {
|
||||
workspace_id: workspaceId,
|
||||
search_space_id: workspaceId,
|
||||
invite_id: inviteId,
|
||||
};
|
||||
await revokeInvite(request);
|
||||
|
|
@ -151,7 +151,7 @@ export function TeamContent({ workspaceId }: TeamContentProps) {
|
|||
const handleCreateInvite = useCallback(
|
||||
async (inviteData: CreateInviteRequest["data"]) => {
|
||||
const request: CreateInviteRequest = {
|
||||
workspace_id: workspaceId,
|
||||
search_space_id: workspaceId,
|
||||
data: inviteData,
|
||||
};
|
||||
return await createInvite(request);
|
||||
|
|
@ -162,7 +162,7 @@ export function TeamContent({ workspaceId }: TeamContentProps) {
|
|||
const handleUpdateMember = useCallback(
|
||||
async (membershipId: number, roleId: number | null): Promise<Membership> => {
|
||||
const request: UpdateMembershipRequest = {
|
||||
workspace_id: workspaceId,
|
||||
search_space_id: workspaceId,
|
||||
membership_id: membershipId,
|
||||
data: { role_id: roleId },
|
||||
};
|
||||
|
|
@ -174,7 +174,7 @@ export function TeamContent({ workspaceId }: TeamContentProps) {
|
|||
const handleRemoveMember = useCallback(
|
||||
async (membershipId: number) => {
|
||||
const request: DeleteMembershipRequest = {
|
||||
workspace_id: workspaceId,
|
||||
search_space_id: workspaceId,
|
||||
membership_id: membershipId,
|
||||
};
|
||||
await deleteMember(request);
|
||||
|
|
@ -185,13 +185,13 @@ export function TeamContent({ workspaceId }: TeamContentProps) {
|
|||
|
||||
const { data: roles = [], isLoading: rolesLoading } = useQuery({
|
||||
queryKey: cacheKeys.roles.all(workspaceId.toString()),
|
||||
queryFn: () => rolesApiService.getRoles({ workspace_id: workspaceId }),
|
||||
queryFn: () => rolesApiService.getRoles({ search_space_id: workspaceId }),
|
||||
enabled: !!workspaceId,
|
||||
});
|
||||
|
||||
const { data: invites = [], isLoading: invitesLoading } = useQuery({
|
||||
queryKey: cacheKeys.invites.all(workspaceId.toString()),
|
||||
queryFn: () => invitesApiService.getInvites({ workspace_id: workspaceId }),
|
||||
queryFn: () => invitesApiService.getInvites({ search_space_id: workspaceId }),
|
||||
staleTime: 5 * 60 * 1000,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue