diff --git a/src/renderer/src/components/automations/AutomationDestinationField.test.tsx b/src/renderer/src/components/automations/AutomationDestinationField.test.tsx index 48eff9cc900..29d71acf0b8 100644 --- a/src/renderer/src/components/automations/AutomationDestinationField.test.tsx +++ b/src/renderer/src/components/automations/AutomationDestinationField.test.tsx @@ -62,11 +62,11 @@ const LEGACY_ENTRY: AutomationHostCatalogEntry = { function control( projects: Repo[], entries: AutomationHostCatalogEntry[] = [ENTRY], - note?: string + moveWarning?: string ): AutomationCreateDestinationControl { return { entries, - note, + moveWarning, resolution: { status: 'ready', authority: OWNER.authority, @@ -78,11 +78,15 @@ function control( } } -function render(projects: Repo[], entries?: AutomationHostCatalogEntry[], note?: string): void { +function render( + projects: Repo[], + entries?: AutomationHostCatalogEntry[], + moveWarning?: string +): void { act(() => { root.render( - + ) }) @@ -109,8 +113,10 @@ describe('AutomationDestinationField', () => { it('names the hosts a server update would let create, instead of hiding them', () => { render([{ id: 'repo-1' } as Repo], [ENTRY, LEGACY_ENTRY]) - const note = container.querySelector('[data-testid="automation-create-update-required"]') - expect(note?.textContent).toContain('legacy-box') + const updateRequired = container.querySelector( + '[data-testid="automation-create-update-required"]' + ) + expect(updateRequired?.textContent).toContain('legacy-box') }) it('says nothing about updates when every offered host is eligible', () => { diff --git a/src/renderer/src/components/automations/AutomationDestinationField.tsx b/src/renderer/src/components/automations/AutomationDestinationField.tsx index 0f222f1dd5f..e3ef789b670 100644 --- a/src/renderer/src/components/automations/AutomationDestinationField.tsx +++ b/src/renderer/src/components/automations/AutomationDestinationField.tsx @@ -79,11 +79,11 @@ export function AutomationDestinationField({ 'No projects are set up on {host}. Add one there, or choose another host.' ).replace('{host}', selected.label)}

- ) : control.note ? ( + ) : control.moveWarning ? ( // Replaces the storedOn line: both name the same host, and the move is // the consequential half.

- {control.note} + {control.moveWarning}

) : (

diff --git a/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx b/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx index fdfdb7d7ff0..a0778029ef9 100644 --- a/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx +++ b/src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx @@ -464,7 +464,7 @@ describe('AutomationsPage edit destination', () => { expect(mocks.editorDialog?.editDestination?.entries.map((entry) => entry.stableKey)).toContain( RUNTIME_SELF_KEY ) - expect(mocks.editorDialog?.editDestination?.note).toBeFalsy() + expect(mocks.editorDialog?.editDestination?.moveWarning).toBeFalsy() }) it('moves the record across authorities by creating there and deleting here', async () => { @@ -484,7 +484,7 @@ describe('AutomationsPage edit destination', () => { mocks.editorDialog?.editDestination?.onSelect(RUNTIME_SELF_KEY) }) - expect(mocks.editorDialog?.editDestination?.note).toBeTruthy() + expect(mocks.editorDialog?.editDestination?.moveWarning).toBeTruthy() await act(async () => { mocks.editorDialog?.onDraftChange((current) => ({ diff --git a/src/renderer/src/components/automations/AutomationsPage.tsx b/src/renderer/src/components/automations/AutomationsPage.tsx index 69d69c815ea..1ff12cf347a 100644 --- a/src/renderer/src/components/automations/AutomationsPage.tsx +++ b/src/renderer/src/components/automations/AutomationsPage.tsx @@ -1143,7 +1143,7 @@ export default function AutomationsPage(): React.JSX.Element { onSelect: handleEditHostChange, projects: editHostProjects, // Replacer fn: a literal replacement would expand `$` patterns in host labels. - note: editMoveTargetEntry + moveWarning: editMoveTargetEntry ? translate( 'auto.components.automations.createDestination.move', 'Saving creates this automation on {host} and deletes the original and its run history.' diff --git a/src/renderer/src/components/automations/use-automation-create-destination.ts b/src/renderer/src/components/automations/use-automation-create-destination.ts index 9ae52aa6729..a47faa37c71 100644 --- a/src/renderer/src/components/automations/use-automation-create-destination.ts +++ b/src/renderer/src/components/automations/use-automation-create-destination.ts @@ -35,8 +35,8 @@ export type AutomationCreateDestinationControl = { onSelect: (stableKey: string) => void /** Projects the resolved destination can hold; the whole list until one resolves. */ projects: readonly Repo[] - /** Stated consequence of saving here, when it is not the plain one. */ - note?: string | null + /** Set when saving would move the record to another host; replaces the plain line. */ + moveWarning?: string | null } export type AutomationCreateDestinationCheck =