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(
- {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 =