mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
fix(automations): validate create destination projects
This commit is contained in:
@@ -152,7 +152,7 @@ describe('AutomationsPage create destination', () => {
|
||||
|
||||
expect(api.automations.create).not.toHaveBeenCalled()
|
||||
expect(runtimeCreateCalls()).toHaveLength(0)
|
||||
expect(mocks.editorDialog?.notice?.message).toBeTruthy()
|
||||
expect(mocks.toastError).toHaveBeenCalled()
|
||||
expect(mocks.editorDialog?.open).toBe(true)
|
||||
})
|
||||
|
||||
@@ -169,7 +169,7 @@ describe('AutomationsPage create destination', () => {
|
||||
// A repo with no connection ID is not evidence of local: this one is the
|
||||
// runtime's, and the desktop's Self host cannot hold an automation for it.
|
||||
expect(api.automations.create).not.toHaveBeenCalled()
|
||||
expect(mocks.editorDialog?.notice?.message).toBeTruthy()
|
||||
expect(mocks.toastError).toHaveBeenCalled()
|
||||
expect(mocks.editorDialog?.open).toBe(true)
|
||||
})
|
||||
|
||||
|
||||
@@ -992,9 +992,6 @@ export default function AutomationsPage(): React.JSX.Element {
|
||||
? getAutomationOwnerTarget(editingAutomation, automationHostTarget)
|
||||
: getAutomationListTarget(settings)
|
||||
const isOrcaForm = createTarget === 'orca' && editingExternalTarget === null
|
||||
const dialogRepos = isOrcaForm
|
||||
? getAutomationCreateRepos(repos, automationDialogTarget)
|
||||
: getAutomationCreateRepos(repos, { kind: 'local' })
|
||||
|
||||
const destinationForProject = useCallback(
|
||||
(projectId: string): AutomationCreateDestination | null => {
|
||||
@@ -1554,7 +1551,7 @@ export default function AutomationsPage(): React.JSX.Element {
|
||||
)
|
||||
return
|
||||
}
|
||||
if (isOrcaForm && !dialogRepos.some((repo) => repo.id === draft.projectId)) {
|
||||
if (isOrcaForm && !editorProjects.some((repo) => repo.id === draft.projectId)) {
|
||||
toast.error(
|
||||
translate(
|
||||
'auto.components.automations.AutomationsPage.destinationProjectUnavailable',
|
||||
|
||||
@@ -159,7 +159,7 @@ describe('owner-fenced mutations', () => {
|
||||
)
|
||||
expect(callRuntimeRpc.mock.calls[0]?.[2]).toEqual({
|
||||
id: 'a1',
|
||||
updates: { repo: 'repo-ssh' },
|
||||
updates: { repo: 'id:repo-ssh' },
|
||||
expectedOwner: { selector: { kind: 'self' } },
|
||||
destination: { selector: { kind: 'ssh', targetId: 'ssh-1', targetGeneration: 7 } }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user