mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
feat(cloud): Sleep and Delete in the team list row menu (control plane for workspaces this desktop does not run, confirm before delete), Running filter on Home; limit errors open Mine + Running (DS-12)
This commit is contained in:
@@ -173,6 +173,18 @@ export function createCloudWorkspacesClient(options: CloudWorkspacesClientOption
|
||||
GRANT_TIMEOUT_MS
|
||||
)
|
||||
},
|
||||
/** Owner or team admin: put the sandbox to sleep (counts as a person choosing to sleep it). */
|
||||
async sleep(id: string): Promise<void> {
|
||||
await call(
|
||||
'POST',
|
||||
`/v1/sandboxes/${encodeURIComponent(id)}/suspend`,
|
||||
NoteSentSchema.passthrough()
|
||||
)
|
||||
},
|
||||
/** Owner or team admin: delete the sandbox and its disk (grants revoked server-side). */
|
||||
async destroy(id: string): Promise<void> {
|
||||
await call('DELETE', `/v1/sandboxes/${encodeURIComponent(id)}`, NoteSentSchema.passthrough())
|
||||
},
|
||||
async listGrants(id: string) {
|
||||
return (await call('GET', `${ws(id)}/grants`, CloudWorkspaceGrantListSchema)).grants
|
||||
},
|
||||
|
||||
@@ -164,6 +164,8 @@ export function createCloudWorkspacesService(deps: {
|
||||
wrap(() => client.putOrgPrompts(document, revision)),
|
||||
localWorkspaces: () => localWorkspaces(),
|
||||
noteSent: (id: string) => wrap(() => client.noteSent(id)),
|
||||
sleep: (id: string) => wrap(() => client.sleep(id)),
|
||||
destroy: (id: string) => wrap(() => client.destroy(id)),
|
||||
|
||||
/**
|
||||
* A per-device credential for a workspace this desktop does not own: a fresh X25519 key lives
|
||||
|
||||
@@ -248,6 +248,13 @@ export function registerCloudWorkspacesHandlers(): void {
|
||||
? s.revokeGrant(parsed.data.id, parsed.data.grantId)
|
||||
: INVALID
|
||||
})
|
||||
for (const action of ['sleep', 'destroy'] as const) {
|
||||
handle(`cloudWorkspaces:${action}`, async (args) => {
|
||||
const parsed = z.object({ id: Id }).safeParse(args)
|
||||
const s = await getService()
|
||||
return !s ? NOT_CONFIGURED : parsed.success ? s[action](parsed.data.id) : INVALID
|
||||
})
|
||||
}
|
||||
handle(
|
||||
'cloudWorkspaces:localWorkspaces',
|
||||
async () => (await getService())?.localWorkspaces() ?? []
|
||||
|
||||
@@ -39,6 +39,9 @@ export type CloudWorkspacesApi = {
|
||||
listGrants: (id: string) => Promise<CloudWorkspacesResult<CloudWorkspaceGrant[]>>
|
||||
revokeGrant: (id: string, grantId: string) => Promise<CloudWorkspacesResult<void>>
|
||||
localWorkspaces: () => Promise<LocalCloudWorkspace[]>
|
||||
/** Owner or team admin, from the team list: sleep or delete a workspace this desktop doesn't run. */
|
||||
sleep: (id: string) => Promise<CloudWorkspacesResult<void>>
|
||||
destroy: (id: string) => Promise<CloudWorkspacesResult<void>>
|
||||
/** "I just sent a message here" (opens my git-as-sender window on the control plane). */
|
||||
noteSent: (id: string) => Promise<void>
|
||||
/** Remembers which local runtime environment a granted workspace was added as. */
|
||||
|
||||
@@ -12,6 +12,8 @@ export const cloudWorkspacesApi = {
|
||||
readSnapshot: (id) => ipcRenderer.invoke('cloudWorkspaces:readSnapshot', { id }),
|
||||
listGrants: (id) => ipcRenderer.invoke('cloudWorkspaces:listGrants', { id }),
|
||||
revokeGrant: (id, grantId) => ipcRenderer.invoke('cloudWorkspaces:revokeGrant', { id, grantId }),
|
||||
sleep: (id) => ipcRenderer.invoke('cloudWorkspaces:sleep', { id }),
|
||||
destroy: (id) => ipcRenderer.invoke('cloudWorkspaces:destroy', { id }),
|
||||
localWorkspaces: () => ipcRenderer.invoke('cloudWorkspaces:localWorkspaces'),
|
||||
noteSent: (id) => ipcRenderer.invoke('cloudWorkspaces:noteSent', { id }),
|
||||
bindEnvironment: (sandboxId, runtimeEnvironmentId, grantId) =>
|
||||
|
||||
@@ -115,3 +115,19 @@ export const archiveTeammateRunning = defineFixture({
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
||||
/** Deleting a workspace from the team list (one this computer doesn't run): DS-07 copy. */
|
||||
export const deleteFromTeamList = defineFixture({
|
||||
width: 640,
|
||||
render: () =>
|
||||
frame(
|
||||
<CloudWorkspaceConfirmDialog
|
||||
pending={{ kind: 'delete', workspace: workspace({ title: 'Checkout retries' }) }}
|
||||
directory={DIRECTORY}
|
||||
selfId={SELF_ID}
|
||||
canAdmin
|
||||
onCancel={() => {}}
|
||||
onConfirm={() => {}}
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
||||
@@ -21,6 +21,8 @@ export type PendingConfirm =
|
||||
| { kind: 'owner'; workspace: CloudWorkspace; ownerUserId: string }
|
||||
/** Archiving a teammate's running workspace stops their agents. */
|
||||
| { kind: 'archive'; workspace: CloudWorkspace }
|
||||
/** Deleting from the team list: the sandbox and its disk go (DS-07 copy). */
|
||||
| { kind: 'delete'; workspace: CloudWorkspace }
|
||||
|
||||
/** Teammates who would lose access: here now, or holding an active device grant. */
|
||||
function useConnectedTeammates(workspace: CloudWorkspace, selfId: string | null): string[] {
|
||||
@@ -103,16 +105,20 @@ export function CloudWorkspaceConfirmDialog({
|
||||
? t('auto.components.cloudWorkspaces.makePrivateTitle', 'Make {{title}} private?', {
|
||||
title: cloudWorkspaceTitle(w, t)
|
||||
})
|
||||
: pending.kind === 'archive'
|
||||
? t('auto.components.cloudWorkspaces.archiveConfirmTitle', 'Archive {{name}}?', {
|
||||
name: cloudWorkspaceTitle(w, t)
|
||||
})
|
||||
: pending.kind === 'archive' || pending.kind === 'delete'
|
||||
? pending.kind === 'archive'
|
||||
? t('auto.components.cloudWorkspaces.archiveConfirmTitle', 'Archive {{name}}?', {
|
||||
name: cloudWorkspaceTitle(w, t)
|
||||
})
|
||||
: t('auto.components.cloudWorkspaces.deleteConfirmTitle', 'Delete {{name}}?', {
|
||||
name: cloudWorkspaceTitle(w, t)
|
||||
})
|
||||
: t('auto.components.cloudWorkspaces.reassignTitle', 'Make {{name}} the owner?', {
|
||||
name: memberName(directory, pending.ownerUserId, selfId, t)
|
||||
})
|
||||
const losesManagement = pending.kind === 'owner' && w.ownerUserId === selfId && !canAdmin
|
||||
// Destructive for someone else (their agents stop, or you lose access): focus starts on Cancel.
|
||||
const focusCancel = losesManagement || pending.kind === 'archive'
|
||||
const focusCancel = losesManagement || pending.kind === 'archive' || pending.kind === 'delete'
|
||||
return (
|
||||
<Dialog open onOpenChange={(next) => !next && onCancel()}>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
@@ -120,6 +126,13 @@ export function CloudWorkspaceConfirmDialog({
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
{pending.kind === 'private' ? (
|
||||
<MakePrivateBody workspace={w} directory={directory} selfId={selfId} />
|
||||
) : pending.kind === 'delete' ? (
|
||||
<DialogDescription>
|
||||
{t(
|
||||
'auto.components.sidebar.DeleteCloudWorkspace.body',
|
||||
"Deletes the sandbox and its disk, including chats, terminals and uncommitted changes. This can't be undone. To keep a snapshot, archive it instead."
|
||||
)}
|
||||
</DialogDescription>
|
||||
) : pending.kind === 'archive' ? (
|
||||
<DialogDescription>
|
||||
{t(
|
||||
@@ -147,12 +160,19 @@ export function CloudWorkspaceConfirmDialog({
|
||||
<Button type="button" variant="ghost" onClick={onCancel} autoFocus={focusCancel}>
|
||||
{t('auto.components.cloudWorkspaces.cancel', 'Cancel')}
|
||||
</Button>
|
||||
<Button type="button" onClick={onConfirm} autoFocus={!focusCancel}>
|
||||
<Button
|
||||
type="button"
|
||||
variant={pending.kind === 'delete' ? 'destructive' : 'default'}
|
||||
onClick={onConfirm}
|
||||
autoFocus={!focusCancel}
|
||||
>
|
||||
{pending.kind === 'private'
|
||||
? t('auto.components.cloudWorkspaces.makePrivate', 'Make private')
|
||||
: pending.kind === 'archive'
|
||||
? t('auto.components.cloudWorkspaces.archive', 'Archive')
|
||||
: t('auto.components.cloudWorkspaces.makeOwner', 'Make owner')}
|
||||
: pending.kind === 'delete'
|
||||
? t('auto.components.sidebar.DeleteCloudWorkspace.delete', 'Delete workspace')
|
||||
: pending.kind === 'archive'
|
||||
? t('auto.components.cloudWorkspaces.archive', 'Archive')
|
||||
: t('auto.components.cloudWorkspaces.makeOwner', 'Make owner')}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
@@ -19,7 +19,9 @@ const ACTIONS: RowActions = {
|
||||
goToChat: () => {},
|
||||
patch: () => {},
|
||||
archive: () => {},
|
||||
unarchive: () => {}
|
||||
unarchive: () => {},
|
||||
sleep: () => {},
|
||||
remove: () => {}
|
||||
}
|
||||
const SECTIONS = ['Payments', 'Platform']
|
||||
const MEMBERS = [...DIRECTORY.entries()].map(([userId, m]) => ({ userId, name: m.name }))
|
||||
|
||||
@@ -2,6 +2,8 @@ import React, { useRef } from 'react'
|
||||
import {
|
||||
Archive,
|
||||
ArchiveRestore,
|
||||
Moon,
|
||||
Trash2,
|
||||
ArrowUpRight,
|
||||
BookOpen,
|
||||
FolderInput,
|
||||
@@ -52,6 +54,10 @@ export type RowActions = {
|
||||
/** Sleep and archive with a snapshot (Undo for 5 s); never just a label. */
|
||||
archive: (w: CloudWorkspace) => void
|
||||
unarchive: (w: CloudWorkspace) => void
|
||||
/** Put a running sandbox to sleep (frees a running slot). */
|
||||
sleep: (w: CloudWorkspace) => void
|
||||
/** Delete the sandbox and its disk, after a confirmation. */
|
||||
remove: (w: CloudWorkspace) => void
|
||||
}
|
||||
|
||||
/** Placeholder replaced by the inline section editor in CloudWorkspacesHome. */
|
||||
@@ -267,6 +273,12 @@ export function CloudWorkspaceRowMenu({
|
||||
</DropdownMenuSub>
|
||||
)}
|
||||
<DropdownMenuSeparator />
|
||||
{w.status === 'running' && w.archivedAt === null ? (
|
||||
<DropdownMenuItem onSelect={() => actions.sleep(w)}>
|
||||
<Moon />
|
||||
{t('auto.components.cloudWorkspaces.sleep', 'Sleep')}
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
{w.archivedAt === null ? (
|
||||
<DropdownMenuItem onSelect={() => actions.archive(w)}>
|
||||
<Archive />
|
||||
@@ -278,6 +290,10 @@ export function CloudWorkspaceRowMenu({
|
||||
{t('auto.components.cloudWorkspaces.unarchive', 'Unarchive')}
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
<DropdownMenuItem variant="destructive" onSelect={() => actions.remove(w)}>
|
||||
<Trash2 />
|
||||
{t('auto.components.cloudWorkspaces.deleteWorkspace', 'Delete…')}
|
||||
</DropdownMenuItem>
|
||||
</>
|
||||
)}
|
||||
</DropdownMenuContent>
|
||||
|
||||
@@ -14,7 +14,12 @@ import type {
|
||||
import { useOrgRoster } from '../billing/team/use-org-roster'
|
||||
import { CloudWorkspaceRow } from './CloudWorkspaceRow'
|
||||
import { NEW_SECTION } from './CloudWorkspaceRowMenu'
|
||||
import { ANY, CloudWorkspacesToolbar, type CloudWorkspacesFilters } from './CloudWorkspacesToolbar'
|
||||
import {
|
||||
ANY,
|
||||
CloudWorkspacesToolbar,
|
||||
INITIAL_CLOUD_WORKSPACE_FILTERS,
|
||||
type CloudWorkspacesFilters
|
||||
} from './CloudWorkspacesToolbar'
|
||||
import { EmptyState, ErrorState, NewSectionDialog, SkeletonRows } from './CloudWorkspacesStates'
|
||||
import { CloudWorkspaceConfirmDialog, type PendingConfirm } from './CloudWorkspaceConfirmDialog'
|
||||
import { CloudReadSnapshotSheet } from './CloudReadSnapshotSheet'
|
||||
@@ -33,13 +38,6 @@ import {
|
||||
import { useCloudWorkspaces, useCloudWorkspacesAvailable } from './use-cloud-workspaces'
|
||||
import { useOrcaAccountKey } from '@/hooks/use-orca-account-key'
|
||||
|
||||
const INITIAL_FILTERS: CloudWorkspacesFilters = {
|
||||
scope: 'team',
|
||||
by: ANY,
|
||||
repo: ANY,
|
||||
archived: false
|
||||
}
|
||||
|
||||
function useMemberDirectory(orgId: string | undefined, workspaces: readonly CloudWorkspace[]) {
|
||||
const roster = useOrgRoster(orgId ?? '')
|
||||
return useMemo(() => {
|
||||
@@ -85,13 +83,13 @@ export function CloudWorkspacesHome({
|
||||
const orgId = cloud?.activeOrgId
|
||||
const selfId = cloud?.userId ?? null
|
||||
const account = useOrcaAccountKey()
|
||||
const [filters, setFilters] = useState(INITIAL_FILTERS)
|
||||
const [filters, setFilters] = useState(INITIAL_CLOUD_WORKSPACE_FILTERS)
|
||||
homeArchive.usePendingHomeFilters(setFilters)
|
||||
// Owner and repo filters name the previous team's people and repos; a team switch starts over.
|
||||
const [filtersAccount, setFiltersAccount] = useState(account)
|
||||
if (filtersAccount !== account) {
|
||||
setFiltersAccount(account)
|
||||
setFilters(INITIAL_FILTERS)
|
||||
setFilters(INITIAL_CLOUD_WORKSPACE_FILTERS)
|
||||
}
|
||||
const [opening, setOpening] = useState<string | null>(null)
|
||||
const [now, setNow] = useState(() => Date.now())
|
||||
@@ -150,9 +148,10 @@ export function CloudWorkspacesHome({
|
||||
(w) =>
|
||||
w.id === highlightId ||
|
||||
((by === ANY || w.ownerUserId === by || w.createdBy === by) &&
|
||||
(repo === ANY || w.repo?.url === repo))
|
||||
(repo === ANY || w.repo?.url === repo) &&
|
||||
(!filters.running || w.status === 'running'))
|
||||
),
|
||||
[all, by, repo, highlightId]
|
||||
[all, by, repo, highlightId, filters.running]
|
||||
)
|
||||
const highlighted = highlightId ? visible.find((w) => w.id === highlightId) : undefined
|
||||
const groups = useMemo(() => {
|
||||
@@ -407,9 +406,9 @@ export function CloudWorkspacesHome({
|
||||
canAdmin={canAdmin}
|
||||
onCancel={() => setConfirm(null)}
|
||||
onConfirm={() => {
|
||||
if (confirm.kind === 'archive') {
|
||||
if (confirm.kind === 'archive' || confirm.kind === 'delete') {
|
||||
setConfirm(null)
|
||||
homeArchive.runHomeArchive(confirm.workspace, t, refresh)
|
||||
homeArchive.runConfirmed(confirm, t, refresh)
|
||||
return
|
||||
}
|
||||
const change: CloudWorkspacePatch =
|
||||
|
||||
@@ -48,7 +48,7 @@ export function ErrorState({
|
||||
: t('orcaCloudWorkspace.tryAgain', 'Try again')
|
||||
}
|
||||
retrying={retrying}
|
||||
onRetry={atLimit ? () => openCloudWorkspacesHome() : onRetry}
|
||||
onRetry={atLimit ? () => openCloudWorkspacesHome({ running: true }) : onRetry}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,16 @@ export type CloudWorkspacesFilters = {
|
||||
by: string
|
||||
repo: string
|
||||
archived: boolean
|
||||
/** Only sandboxes that are running now (where the team's running slots go). */
|
||||
running?: boolean
|
||||
}
|
||||
|
||||
export const INITIAL_CLOUD_WORKSPACE_FILTERS: CloudWorkspacesFilters = {
|
||||
scope: 'team',
|
||||
by: ANY,
|
||||
repo: ANY,
|
||||
archived: false,
|
||||
running: false
|
||||
}
|
||||
|
||||
/** Row 1: title, count and cost, refresh. Row 2: whose, by whom, which repo, archived. */
|
||||
@@ -165,6 +175,14 @@ export function CloudWorkspacesToolbar({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<label className="ml-auto flex h-7 cursor-pointer items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Switch
|
||||
checked={filters.running === true}
|
||||
onCheckedChange={(running) => onFiltersChange({ running })}
|
||||
aria-label={t('auto.components.cloudWorkspaces.showRunningOnly', 'Show running only')}
|
||||
/>
|
||||
{t('auto.components.cloudWorkspaces.running', 'Running')}
|
||||
</label>
|
||||
<label className="flex h-7 cursor-pointer items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Switch
|
||||
checked={filters.archived}
|
||||
onCheckedChange={(archived) => onFiltersChange({ archived })}
|
||||
|
||||
@@ -9,6 +9,9 @@ vi.mock('../orca-cloud/cloud-workspace-actions', () => ({
|
||||
|
||||
import {
|
||||
archiveFromHome,
|
||||
deleteFromHome,
|
||||
destroyFromHome,
|
||||
sleepFromHome,
|
||||
unarchiveFromHome,
|
||||
type HomeArchiveDeps
|
||||
} from './cloud-workspace-home-archive'
|
||||
@@ -63,3 +66,23 @@ describe('archive from the team list', () => {
|
||||
expect(remote.patchArchived).toHaveBeenCalledWith('sbx_1', false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('sleep and delete from the team list', () => {
|
||||
it('sleeps and deletes a workspace this desktop does not run through the control plane', async () => {
|
||||
const sleep = vi.fn(async () => ({ ok: true as const, value: undefined }))
|
||||
const destroy = vi.fn(async () => ({ ok: true as const, value: undefined }))
|
||||
vi.stubGlobal('window', {
|
||||
api: { cloudWorkspaces: { localWorkspaces: async () => [], sleep, destroy } }
|
||||
})
|
||||
await sleepFromHome(w, 'Fix login')
|
||||
expect(sleep).toHaveBeenCalledWith('sbx_1')
|
||||
const confirm = vi.fn()
|
||||
await deleteFromHome(w, confirm)
|
||||
// Deleting asks first; the control plane only deletes after the confirmation.
|
||||
expect(confirm).toHaveBeenCalledWith({ kind: 'delete', workspace: w })
|
||||
expect(destroy).not.toHaveBeenCalled()
|
||||
await destroyFromHome(w, 'Fix login')
|
||||
expect(destroy).toHaveBeenCalledWith('sbx_1')
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -14,6 +14,9 @@ import { describeError } from './cloud-workspace-errors'
|
||||
export { usePendingHomeFilters } from './cloud-workspaces-home-nav'
|
||||
import type { Translate } from '@/i18n/use-translate'
|
||||
import { cloudWorkspaceTitle } from './open-cloud-workspace'
|
||||
import type { RowActions } from './CloudWorkspaceRowMenu'
|
||||
import { useAppStore } from '@/store'
|
||||
import { runSleepWorktree } from '@/components/sidebar/workspace-actions/sleep/sleep-worktree-flow'
|
||||
|
||||
export type HomeArchiveDeps = {
|
||||
localWorktreeId: (sandboxId: string) => Promise<string | null>
|
||||
@@ -103,15 +106,64 @@ export function runHomeArchive(w: CloudWorkspace, t: Translate, refresh: () => v
|
||||
void archiveFromHome(w, cloudWorkspaceTitle(w, t)).finally(refresh)
|
||||
}
|
||||
|
||||
/** Sleep: this desktop's Sleep for a workspace it runs, else the control plane (owner or admin). */
|
||||
export async function sleepFromHome(w: CloudWorkspace, name: string): Promise<void> {
|
||||
const worktreeId = await defaultDeps().localWorktreeId(w.id)
|
||||
if (worktreeId) {
|
||||
await runSleepWorktree(worktreeId)
|
||||
return
|
||||
}
|
||||
const result = await window.api.cloudWorkspaces.sleep(w.id)
|
||||
if (!result.ok) {
|
||||
toastCloudSleepFailureRemote(name, describeError(result.error, result.reason, translate))
|
||||
}
|
||||
}
|
||||
|
||||
/** Delete: this desktop's delete dialog for a workspace it runs, else confirm then the control plane. */
|
||||
export async function deleteFromHome(
|
||||
w: CloudWorkspace,
|
||||
confirmDelete: (pending: { kind: 'delete'; workspace: CloudWorkspace }) => void
|
||||
): Promise<void> {
|
||||
const worktreeId = await defaultDeps().localWorktreeId(w.id)
|
||||
if (worktreeId) {
|
||||
useAppStore.getState().openModal('delete-worktree', { worktreeId })
|
||||
return
|
||||
}
|
||||
confirmDelete({ kind: 'delete', workspace: w })
|
||||
}
|
||||
|
||||
export async function destroyFromHome(w: CloudWorkspace, name: string): Promise<void> {
|
||||
const result = await window.api.cloudWorkspaces.destroy(w.id)
|
||||
if (result.ok) {
|
||||
toast.success(translate('orcaCloudWorkspace.deletedNamed', 'Deleted {{name}}', { name }))
|
||||
return
|
||||
}
|
||||
toast.error(
|
||||
translate('orcaCloudWorkspace.deleteFailedNamed', 'Couldn’t delete {{name}}', { name }),
|
||||
{
|
||||
description: describeError(result.error, result.reason, translate)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function toastCloudSleepFailureRemote(name: string, description: string): void {
|
||||
toast.error(
|
||||
translate('orcaCloudWorkspace.sleepFailedNamed', 'Couldn’t put {{name}} to sleep', { name }),
|
||||
{ description }
|
||||
)
|
||||
}
|
||||
|
||||
/** Row actions for the team list. A teammate's running workspace asks first (their agents stop). */
|
||||
export function homeArchiveActions(options: {
|
||||
selfId: string | null
|
||||
t: Translate
|
||||
refresh: () => void
|
||||
confirmArchive: (pending: { kind: 'archive'; workspace: CloudWorkspace }) => void
|
||||
}): { archive: (w: CloudWorkspace) => void; unarchive: (w: CloudWorkspace) => void } {
|
||||
confirmArchive: (pending: { kind: 'archive' | 'delete'; workspace: CloudWorkspace }) => void
|
||||
}): Pick<RowActions, 'archive' | 'unarchive' | 'sleep' | 'remove'> {
|
||||
const { selfId, t, refresh } = options
|
||||
return {
|
||||
sleep: (w) => void sleepFromHome(w, cloudWorkspaceTitle(w, t)).finally(refresh),
|
||||
remove: (w) => void deleteFromHome(w, options.confirmArchive),
|
||||
archive: (w) => {
|
||||
if (w.ownerUserId !== selfId && w.status === 'running') {
|
||||
options.confirmArchive({ kind: 'archive', workspace: w })
|
||||
@@ -122,3 +174,18 @@ export function homeArchiveActions(options: {
|
||||
unarchive: (w) => void unarchiveFromHome(w, cloudWorkspaceTitle(w, t)).finally(refresh)
|
||||
}
|
||||
}
|
||||
|
||||
/** The team list's confirm dialog was accepted for an archive or a delete. */
|
||||
export function runConfirmed(
|
||||
pending: { kind: 'archive' | 'delete'; workspace: CloudWorkspace },
|
||||
t: Translate,
|
||||
refresh: () => void
|
||||
): void {
|
||||
if (pending.kind === 'archive') {
|
||||
runHomeArchive(pending.workspace, t, refresh)
|
||||
return
|
||||
}
|
||||
void destroyFromHome(pending.workspace, cloudWorkspaceTitle(pending.workspace, t)).finally(
|
||||
refresh
|
||||
)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { CloudWorkspacesFilters } from './CloudWorkspacesToolbar'
|
||||
let pendingFilters: Partial<CloudWorkspacesFilters> | null = null
|
||||
const listeners = new Set<() => void>()
|
||||
|
||||
/** Home reads (and clears) this when it mounts or is already showing. */
|
||||
/** Home reads (and clears) this when it mounts or is already showing. Limit errors ask for Mine + Running. */
|
||||
export function takePendingHomeFilters(): Partial<CloudWorkspacesFilters> | null {
|
||||
const next = pendingFilters
|
||||
pendingFilters = null
|
||||
|
||||
@@ -302,7 +302,7 @@ export function VmBuildSheet({
|
||||
},
|
||||
onSignIn: signIn,
|
||||
// Your workspaces on Home, where you can put one to sleep or delete it.
|
||||
onShowWorkspaces: () => openCloudWorkspacesHome(),
|
||||
onShowWorkspaces: () => openCloudWorkspacesHome({ running: true }),
|
||||
onContactSupport: () => openAppHttpLink(SUPPORT_URL),
|
||||
onConnectGitHub: connectGitHub,
|
||||
onPushToGitHub: () => openAppHttpLink(PUSH_TO_GITHUB_URL)
|
||||
|
||||
@@ -20885,7 +20885,12 @@
|
||||
"archiveConfirmTitle": "Archive {{name}}?",
|
||||
"archiveConfirmBody": "{{owner}}'s agents in this workspace will stop. Files are kept and it can be unarchived.",
|
||||
"archiveBusy": "This workspace is still starting or going to sleep. Nothing was changed. Try again in a moment.",
|
||||
"showCloudWorkspaces": "Show cloud workspaces"
|
||||
"showCloudWorkspaces": "Show cloud workspaces",
|
||||
"deleteConfirmTitle": "Delete {{name}}?",
|
||||
"sleep": "Sleep",
|
||||
"deleteWorkspace": "Delete…",
|
||||
"showRunningOnly": "Show running only",
|
||||
"running": "Running"
|
||||
},
|
||||
"orcaCloud": {
|
||||
"QueuedPrompt": {
|
||||
@@ -26716,7 +26721,9 @@
|
||||
"olderDetail": "This version of Orca can’t connect to it, and restarting won’t update it. Your files are safe. New cloud workspaces use the current version.",
|
||||
"checkForUpdates": "Check for updates",
|
||||
"createWorkspace": "Create workspace"
|
||||
}
|
||||
},
|
||||
"deletedNamed": "Deleted {{name}}",
|
||||
"deleteFailedNamed": "Couldn’t delete {{name}}"
|
||||
},
|
||||
"cloudAgentSetup": {
|
||||
"loading": "Checking what agents can use…",
|
||||
|
||||
@@ -16,6 +16,8 @@ export function createWebCloudWorkspacesApi(): PreloadApi['cloudWorkspaces'] {
|
||||
readSnapshot: () => Promise.resolve(NOT_CONFIGURED),
|
||||
listGrants: () => Promise.resolve(NOT_CONFIGURED),
|
||||
revokeGrant: () => Promise.resolve(NOT_CONFIGURED),
|
||||
sleep: () => Promise.resolve(NOT_CONFIGURED),
|
||||
destroy: () => Promise.resolve(NOT_CONFIGURED),
|
||||
localWorkspaces: () => Promise.resolve([]),
|
||||
noteSent: () => Promise.resolve(),
|
||||
bindEnvironment: () => Promise.resolve(),
|
||||
|
||||
Reference in New Issue
Block a user