Repository navigation
feat(desktop): attach images to a cloud workspace at create #7633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| export { | ||
| CLOUD_UPLOAD_TARGET, | ||
| type UploadState, | ||
| useFileIdsForHost, | ||
| useUploadStateFor, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,6 +84,7 @@ import { useBranchPickerController } from "../DashboardNewWorkspaceForm/PromptGr | |
| import { useLinkedContext } from "../DashboardNewWorkspaceForm/PromptGroup/hooks/useLinkedContext"; | ||
| import { useSubmitWorkspace } from "../DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace"; | ||
| import { | ||
| CLOUD_UPLOAD_TARGET, | ||
| useFileIdsForHost, | ||
| useUploadAttachments, | ||
| } from "../DashboardNewWorkspaceForm/PromptGroup/hooks/useUploadAttachments"; | ||
|
|
@@ -525,11 +526,17 @@ export function NewWorkspaceScreen({ | |
| }); | ||
|
|
||
| // ── Submit ─────────────────────────────────────────────────────── | ||
| // A cloud workspace has no host to upload to, so its attachments go to | ||
| // cloud storage and the sandbox pulls them once it is up. | ||
| const uploadTarget = | ||
| (draft.hostId ?? machineId) === CLOUD_HOST_ID | ||
| ? CLOUD_UPLOAD_TARGET | ||
| : launchHostUrl; | ||
| const uploadAttachments = useUploadAttachments({ | ||
| files: attachments.files, | ||
| hostUrl: launchHostUrl, | ||
| hostUrl: uploadTarget, | ||
| }); | ||
| const fileIdsForCurrentHost = useFileIdsForHost(launchHostUrl); | ||
| const fileIdsForCurrentHost = useFileIdsForHost(uploadTarget); | ||
|
Comment on lines
+529
to
+539
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '500,555p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx
sed -n '1,245p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useUploadAttachments/store.ts
sed -n '1,180p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useUploadAttachments/useUploadAttachments.ts
rg -n -C 4 'useUploadAttachments|awaitUploads|startUpload|useFileIdsForHost|uploadTarget' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceModal apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceFormRepository: superset-sh/superset Length of output: 36268 🏁 Script executed: sed -n '540,700p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx
sed -n '1,230p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.ts
rg -n -C 8 'visibleFiles|attachments\.files|uploadAttachments|wantCloudAgent|attachmentIds|attachmentFileIds|submitWorkspace' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceFormRepository: superset-sh/superset Length of output: 50376 🏁 Script executed: sed -n '80,190p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/hooks/useSubmitWorkspace/useSubmitWorkspace.ts
sed -n '540,680p' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx
rg -n -C 6 'visibleFiles|uploadAttachments|wantCloudAgent|attachmentIds|attachmentFileIds|submitWorkspace' apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/NewWorkspaceScreen/NewWorkspaceScreen.tsx apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceFormRepository: superset-sh/superset Length of output: 49641 Track uploads by file and target. After a file uploads to the active non-cloud target, 🤖 Prompt for AI Agents |
||
| const visibleFiles = useMemo(() => { | ||
| const idSet = new Set(fileIdsForCurrentHost); | ||
| return attachments.files.filter((file) => idSet.has(file.id)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 18537
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 50377
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 50376
Include attachments in the cloud agent launch condition.
A cloud submission with only an attachment is allowed by the UI.
wantCloudAgentremains false because it excludesattachmentIds, so the request omits bothagentandattachmentFileIds. The API still creates the cloud workspace, but it creates no agent launch, so the uploaded file is not imported into the sandbox. IncludeattachmentIds.length > 0inwantCloudAgent.🤖 Prompt for AI Agents