mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
feat(settings): Orca Cloud above Hosts on Agent accounts; CLI steps behind a disclosure (JA-04) (#501)
* feat(settings): Orca Cloud above Hosts on Agent accounts; CLI steps behind 'Use from the command line' (JA-04 A1) * fix(settings): CLI disclosure spacing on a plain wrapper; refresh protected-copy keys
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
import { defineFixture } from '../../../../component-fixtures/component-fixture'
|
||||
import { ManagedDataAccountsSection } from './ManagedDataAccountsSection'
|
||||
|
||||
function Frame(): React.JSX.Element {
|
||||
return (
|
||||
<div className="bg-background p-6">
|
||||
<ManagedDataAccountsSection provider="opencode" target={{ kind: 'local' }} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** The CLI steps start hidden behind "Use from the command line". */
|
||||
export const cliCollapsed = defineFixture({ width: 720, render: () => <Frame /> })
|
||||
|
||||
export const cliOpen = defineFixture({
|
||||
width: 720,
|
||||
render: () => <Frame />,
|
||||
interact: async (frame) => {
|
||||
const trigger = [...frame.querySelectorAll('button')].find((button) =>
|
||||
button.textContent?.includes('Use from the command line')
|
||||
)
|
||||
trigger?.click()
|
||||
await new Promise((resolve) => setTimeout(resolve, 200))
|
||||
}
|
||||
})
|
||||
+37
-15
@@ -6,7 +6,10 @@ import type {
|
||||
ManagedDataAccountProvider,
|
||||
ManagedDataAccountsState
|
||||
} from '../../../../../../shared/managed-account-types'
|
||||
import { ChevronDown } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button } from '../../../ui/button'
|
||||
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../../ui/collapsible'
|
||||
import { Badge } from '../../../ui/badge'
|
||||
import {
|
||||
Dialog,
|
||||
@@ -33,6 +36,7 @@ export function ManagedDataAccountsSection({
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [removeId, setRemoveId] = useState<string | null>(null)
|
||||
const [copied, setCopied] = useState(false)
|
||||
const [cliOpen, setCliOpen] = useState(false)
|
||||
const environmentId = target.kind === 'environment' ? target.environmentId : null
|
||||
|
||||
useEffect(() => {
|
||||
@@ -100,22 +104,40 @@ export function ManagedDataAccountsSection({
|
||||
)}
|
||||
>
|
||||
<div className="space-y-3 py-3">
|
||||
<code className="text-xs">{command}</code>
|
||||
<Collapsible open={cliOpen} onOpenChange={setCliOpen}>
|
||||
<CollapsibleTrigger asChild>
|
||||
<Button type="button" variant="quiet" size="xs" className="-ml-2">
|
||||
{t('accounts.managedData.useCli', 'Use from the command line')}
|
||||
<ChevronDown
|
||||
aria-hidden
|
||||
className={cn(
|
||||
'size-3 transition-transform motion-reduce:transition-none',
|
||||
cliOpen && 'rotate-180'
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent className="mt-2">
|
||||
<div className="space-y-2">
|
||||
<code className="block text-xs">{command}</code>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
void window.api.ui
|
||||
.writeClipboardText(command)
|
||||
.then(() => setCopied(true))
|
||||
.catch((cause: unknown) => setError(String(cause)))
|
||||
}}
|
||||
>
|
||||
{copied
|
||||
? t('accounts.managedData.copied', 'Copied')
|
||||
: t('accounts.managedData.add', 'Copy add account command')}
|
||||
</Button>
|
||||
</div>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => {
|
||||
void window.api.ui
|
||||
.writeClipboardText(command)
|
||||
.then(() => setCopied(true))
|
||||
.catch((cause: unknown) => setError(String(cause)))
|
||||
}}
|
||||
>
|
||||
{copied
|
||||
? t('accounts.managedData.copied', 'Copied')
|
||||
: t('accounts.managedData.add', 'Copy add account command')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { orcaCloudAgentAccountsParts } from './settings-orca-cloud-agent-accounts-sections'
|
||||
import type { SettingsRenderContext } from './settings-render-context'
|
||||
|
||||
function context(model: { showDesktopOnlySettings: boolean; orcaCloudApiAvailable: boolean }) {
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the parts read only model.showDesktopOnlySettings and model.orcaCloudApiAvailable.
|
||||
return { model } as unknown as SettingsRenderContext
|
||||
}
|
||||
|
||||
describe('Agent accounts: Orca Cloud parts', () => {
|
||||
it('puts Orca Cloud above Hosts, after This computer (JA-04, option A1)', () => {
|
||||
const parts = orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: true, orcaCloudApiAvailable: true })
|
||||
)
|
||||
expect(parts.map((part) => part.id)).toEqual(['accounts-orca-cloud', 'accounts-hosts'])
|
||||
})
|
||||
|
||||
it('adds nothing without an Orca Cloud control plane or outside the desktop', () => {
|
||||
expect(
|
||||
orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: true, orcaCloudApiAvailable: false })
|
||||
)
|
||||
).toEqual([])
|
||||
expect(
|
||||
orcaCloudAgentAccountsParts(
|
||||
context({ showDesktopOnlySettings: false, orcaCloudApiAvailable: true })
|
||||
)
|
||||
).toEqual([])
|
||||
})
|
||||
})
|
||||
+7
-7
@@ -6,7 +6,7 @@ import { translate } from '@/i18n/i18n'
|
||||
import type { Translate } from '@/i18n/use-translate'
|
||||
import type { SettingsRenderContext } from './settings-render-context'
|
||||
|
||||
/** Settings → Agent accounts, after "This computer": Hosts (S3) and Orca Cloud (S0). The page
|
||||
/** Settings → Agent accounts, after "This computer": Orca Cloud (S0), then Hosts (S3). The page
|
||||
* titles each part and lists it in its jump row. Desktop only, and only in builds with an Orca
|
||||
* Cloud control plane. */
|
||||
export function orcaCloudAgentAccountsParts(
|
||||
@@ -18,6 +18,12 @@ export function orcaCloudAgentAccountsParts(
|
||||
return []
|
||||
}
|
||||
return [
|
||||
{
|
||||
id: 'accounts-orca-cloud',
|
||||
title: t('orcaCloudAccounts.title', 'Orca Cloud'),
|
||||
description: <OrcaCloudAccountsDescription />,
|
||||
content: <OrcaCloudAccountsSection hideHeader />
|
||||
},
|
||||
{
|
||||
id: 'accounts-hosts',
|
||||
title: t('settings.agentAccounts.hostsTitle', 'Hosts'),
|
||||
@@ -26,12 +32,6 @@ export function orcaCloudAgentAccountsParts(
|
||||
'Where Claude and Codex are signed in, and which key they use. Orca never copies a sign-in between machines.'
|
||||
),
|
||||
content: <AgentAccountsOverviewSection hideHeader />
|
||||
},
|
||||
{
|
||||
id: 'accounts-orca-cloud',
|
||||
title: t('orcaCloudAccounts.title', 'Orca Cloud'),
|
||||
description: <OrcaCloudAccountsDescription />,
|
||||
content: <OrcaCloudAccountsSection hideHeader />
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -24764,7 +24764,8 @@
|
||||
"remove": "Remove",
|
||||
"removeTitle": "Remove managed account?",
|
||||
"removeDescription": "Stop agents using this profile first. Removal deletes its saved credentials and conversation data. Your system login stays unchanged.",
|
||||
"cancel": "Cancel"
|
||||
"cancel": "Cancel",
|
||||
"useCli": "Use from the command line"
|
||||
},
|
||||
"hostSignIn": {
|
||||
"copied": "Copied",
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
"accounts.managedData.select",
|
||||
"accounts.managedData.system",
|
||||
"accounts.managedData.upgrade",
|
||||
"accounts.managedData.useCli",
|
||||
"auto.components.TaskPageJiraSavedFilters.0ab71bb840",
|
||||
"auto.components.TaskPageJiraSavedFilters.19af906d12",
|
||||
"auto.components.TaskPageJiraSavedFilters.42ce360813",
|
||||
|
||||
Reference in New Issue
Block a user