feat(desktop): archive and delete from the workspace switcher

AV
10d ago
+353-81

What

⌘⌫ on the selected row of the workspace switcher (⌘.) archives a cloud workspace or deletes a local one, without closing the palette. Split out of #9799 to keep that PR small.

  • Cloud workspace: the row animates out, selection moves to the neighbouring row, and the palette stays open.
  • Local workspace: the existing delete confirmation opens over the palette. Focus returns to the search input when it closes.
  • Search text: ⌘⌫ keeps its normal meaning (clear the line) while there is typed search text. It acts on the row when the input is empty or holds only the # status filter.
  • Footer: shows the ⌘⌫ hint for the selected row.

Archive toast

useArchiveCloudWorkspace now shows its toast at once instead of after the server replies. This changes every caller of the hook, the sidebar included.

  • "Archiving workspace…" with Undo appears immediately.
  • On success it becomes "Workspace archived" with View and Undo.
  • Undo pressed while the archive is in flight shows "Restoring…" and sends the unarchive after the archive lands.
  • "Restoring…" stays until the unarchive resolves.

The palette ignores outside-interaction events from toasts and alert dialogs, so pressing Undo or answering the delete confirmation does not close it.

Verification

Driven live in the dev app over CDP:

  • ⌘⌫ on a cloud row: row leaves, neighbour selected, palette open, toast sequence as above.
  • Undo during the in-flight archive: "Restoring…" shown, unarchive sent after the archive.
  • ⌘⌫ with # in the input archives; with search text it clears the text.
  • ⌘⌫ on a local row opens the confirmation over the palette.

Not verified:

  • A successful restore. The dev stack has no sandbox provider token, so unarchive returns 403 there.
  • The sidebar archive path. It uses the same hook, but I did not drive it.

Known gaps, not addressed here

  • cloudWorkspace.delete reports success when no row changed state.
  • When a restore fails, "Restoring…" can stay next to the error toast until the list refetches.
  • Undo navigates to the restored workspace.

Summary by cubic

Adds ⌘⌫ (Cmd/Ctrl+Backspace) actions to the workspace switcher: it archives a cloud workspace or deletes a local one without closing the palette.

  • Cloud rows animate out, selection moves to the neighbour, and the palette stays open.
  • Local rows open the existing delete confirmation over the palette; focus returns to search when it closes.
  • With typed search text, ⌘⌫ clears the line as before; it only acts on the row when the input is empty or holds only the # filter.
  • The footer now shows the ⌘⌫ hint with Archive or Delete depending on the selected row.

Archive toast

useArchiveCloudWorkspace now shows its toast immediately instead of after the server replies, which also changes the sidebar's archive path.

  • "Archiving workspace…" with Undo appears at once; on success it becomes "Workspace archived" with View and Undo.
  • Undo pressed while the archive is in flight shows "Restoring…" and sends the unarchive after the archive lands.
  • The palette ignores outside-interaction events from toasts and alert dialogs, so using Undo or answering the delete confirmation doesn't close it.

Summary by CodeRabbit

  • New Features
    • Use ⌘/Ctrl + Backspace in the workspace switcher to archive a selected cloud workspace or delete another workspace. The shortcut is inactive while searching.
    • The switcher indicates the action for the selected workspace and animates cloud workspaces as they leave the list.
    • Cloud workspace archive notifications now show progress and offer View and Undo actions. Undo works even if requested before archiving finishes.
  • Improvements
    • The search field regains focus after closing a deletion confirmation.
  • Localization
    • Added translations for the archive progress message in supported languages.