feat(mobile): archive cloud workspaces, and a Cloud scope that matches desktop's sidebar

Merged
SA
1mo ago
+2082-425

What

Mobile catches up with the cloud archive work from #7969, and its Cloud list now matches desktop's cloud sidebar.

  • Cloud is a scope in the host selector. Under Cloud, the chip row adds Status (Active / Archived) and Created by (Mine, the saved default; Anyone; or a person). Sort is hidden under Archived.
  • Rows match desktop's cloud sidebar row: repo icon, name, the owner's avatar when it isn't you, a PR button that opens the PR, then the status slot: wave spinner, needs-input or failed state, the green unread dot, or a compact age. Rows are grouped under muted Today / Yesterday / N days ago headings.
  • Archive replaces delete for cloud workspaces: in the row menu, the workspace ⋯ menu, and the archived workspace screen (Unarchive). Archived rows have a one-tap undo and a long-press menu (Unarchive, Copy ID, Share).
  • PRs come from GitHub via integration.github.getByBranches, the same query desktop uses, so the list never wakes a box.

Shared code

  • Desktop's cloud grouping and sort move to @superset/shared/cloud-workspace-groups, and desktop imports them from there. groupCloudWorkspacesByTime gains an optional at for grouping by archive date.
  • formatRelativePeriod is added to @superset/i18n/format and used by both apps.
  • cloudWorkspace.list({ archived: true }) now leaves out rows with no deletedAt. Those were deleted before archiving existed and have no box: 70 of the 82 archived rows in our org. This only narrows the output; the input and output types are unchanged.

Fixes on the way

  • The workspace screen remounts per workspace id. A deep link to a second workspace used to keep the first one's terminal and save it as the second one's tab.
  • Cloud rows restored from the saved query cache get their dates back, which removes the "Archived · now" flash on a cold open.
  • The PR screen keeps loading while the box wakes, instead of saying the PR is "no longer available".
  • Archive and unarchive stay in place even when the 1-second provisioning poll lands mid-request.

Review

An adversarial review agent read the diff before this PR, and I fixed what it found:

  • The spinner that never ended on the PR screen.
  • The archived list being fetched on every workspace screen.
  • Pin, which did nothing for cloud rows (now removed), and unread, which now works like desktop's.
  • PR chips from the previous org showing after an org switch.
  • The optimistic-archive race above.
  • Stale times and "Today" headings (now on a 30s clock).
  • The spinner re-rendering 20 times a second (now Reanimated).
  • Search ignoring the cloud filters.
  • Dead code.

Verification

  • Checked on the iPhone 17 Pro Max simulator against production; screenshots: https://app.superset.sh/page/mobile-cloud-archive-xqmfxs
  • Typecheck passes for mobile, desktop, trpc, shared and i18n.
  • Tests pass: mobile 135, desktop dashboard 887, shared 1198, i18n 165.
  • Biome is clean, and check:i18n has 0 missing in all 16 locales.

Not verified: the server filter in the app (it needs a deploy), and the largest accessibility text size, where button labels squash. That predates this branch.


Summary by cubic

Mobile now archives cloud workspaces instead of deleting them, and its Cloud scope matches desktop's sidebar: Status and Created by filters, per-repo PR rows grouped by time, and unarchive from rows, menus, and the archived workspace screen.

Shared

  • Cloud grouping, sorting, and time formatting move to @superset/shared/cloud-workspace-groups and @superset/i18n/format, used by both apps.
  • The archived workspaces query now omits rows with no deletedAt; these predate archiving and have no box.

Fixes

  • The workspace screen remounts per workspace id so deep links don't leak the previous terminal.
  • Cached cloud rows restore their dates instead of flashing "Archived · now".
  • The PR screen keeps loading while the box wakes instead of reporting the PR gone.
  • Archive and unarchive survive the 1-second provisioning poll.

Summary by CodeRabbit

  • New Features
    • Mobile Cloud workspaces now have Active and Archived views, with filters for status and creator.
    • Archive and unarchive Cloud workspaces from workspace menus and screens. Archived workspaces remain accessible, and their archived date is shown when available.
    • Cloud workspace rows display repository and pull request details, workspace status, and unread indicators.
    • Cloud search now respects the selected creator and status filters.
  • Bug Fixes
    • Cloud workspace lists update immediately when archiving or unarchiving, and archived results exclude entries without an archive date.
  • Localization
    • Added translated labels, empty states, and archive-related messages across supported languages.