diff --git a/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx b/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx index 3ae8ed702..b0a5872fd 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/AutomationSettingsForm.tsx @@ -8,6 +8,7 @@ import Input from '../../../../common/components/input/input/Input'; import ExternalLink from '../../../../common/components/link/external-link/ExternalLink'; import Switch from '../../../../common/components/switch/Switch'; import Tag from '../../../../common/components/tag/Tag'; +import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings'; import { preventEscape } from '../../../../common/utils/keyEvent'; import { isOnlyNumbers } from '../../../../common/utils/regex'; import { isOntimeCloud } from '../../../../externals'; @@ -32,6 +33,7 @@ export default function AutomationSettingsForm({ oscInputState, isLoading, }: AutomationSettingsProps) { + const { refetch } = useAutomationSettings(); const { handleSubmit, reset, @@ -52,6 +54,10 @@ export default function AutomationSettingsForm({ try { await editAutomationSettings(formData); reset(formData); + // the rest of the panel reads these settings from the query, and the automations list + // greys itself out while they are off. Without this it keeps the stale answer until the + // slow poll comes round, so turning automations on appears to do nothing + await refetch(); } catch (error) { const message = maybeAxiosError(error); setError('root', { message }); diff --git a/apps/client/src/features/app-settings/panel/automations-panel/AutomationsList.tsx b/apps/client/src/features/app-settings/panel/automations-panel/AutomationsList.tsx index 387c76ef9..05817750b 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/AutomationsList.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/AutomationsList.tsx @@ -6,16 +6,15 @@ import Button from '../../../../common/components/buttons/Button'; import IconButton from '../../../../common/components/buttons/IconButton'; import Info from '../../../../common/components/info/Info'; import Tag from '../../../../common/components/tag/Tag'; -import { getLifecycleLabel } from '../../../../common/constants/timerLifecycle'; import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings'; -import { summariseOutputs } from '../../../../common/utils/automationOutputs'; import { cx } from '../../../../common/utils/styleUtils'; import * as Panel from '../../panel-utils/PanelUtils'; -import useAppSettingsNavigation from '../../useAppSettingsNavigation'; import AutomationForm from './AutomationForm'; +import { summariseOutputs } from './automationOutputs'; import { groupTriggersByAutomation, isAutomation } from './automationUtils'; import DeleteAutomationDialog from './DeleteAutomationDialog'; import NewAutomationDialog from './NewAutomationDialog'; +import { getLifecycleLabel } from './timerLifecycle'; import style from './AutomationsList.module.scss'; @@ -40,7 +39,6 @@ export default function AutomationsList({ isLoading, }: AutomationsListProps) { const { refetch } = useAutomationSettings(); - const { setLocation } = useAppSettingsNavigation(); const [editing, setEditing] = useState(null); const [isPickingStart, setIsPickingStart] = useState(false); const [deleteTarget, setDeleteTarget] = useState(null); @@ -103,14 +101,9 @@ export default function AutomationsList({ {enabledAutomations === false && ( - - Automations are off, so nothing in this list will run. - - {/* the master switch is at the top of the panel, out of sight once the list has rows */} - - + + Automations are disabled. You can still manage automation definitions here, but they will not run until + enabled. )} diff --git a/apps/client/src/features/app-settings/panel/automations-panel/DeleteAutomationDialog.tsx b/apps/client/src/features/app-settings/panel/automations-panel/DeleteAutomationDialog.tsx index ed16eb99d..d620dbc9e 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/DeleteAutomationDialog.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/DeleteAutomationDialog.tsx @@ -6,8 +6,8 @@ import { maybeAxiosError } from '../../../../common/api/utils'; import Button from '../../../../common/components/buttons/Button'; import Dialog from '../../../../common/components/dialog/Dialog'; import Info from '../../../../common/components/info/Info'; -import { getLifecycleLabel } from '../../../../common/constants/timerLifecycle'; import * as Panel from '../../panel-utils/PanelUtils'; +import { getLifecycleLabel } from './timerLifecycle'; interface DeleteAutomationDialogProps { automation: Automation; diff --git a/apps/client/src/features/app-settings/panel/automations-panel/NewAutomationDialog.tsx b/apps/client/src/features/app-settings/panel/automations-panel/NewAutomationDialog.tsx index a4b7deea2..721944f3a 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/NewAutomationDialog.tsx +++ b/apps/client/src/features/app-settings/panel/automations-panel/NewAutomationDialog.tsx @@ -11,11 +11,10 @@ import Modal from '../../../../common/components/modal/Modal'; import ScrollArea from '../../../../common/components/scroll-area/ScrollArea'; import Select from '../../../../common/components/select/Select'; import Tag from '../../../../common/components/tag/Tag'; -import { getLifecycleLabel } from '../../../../common/constants/timerLifecycle'; -import { summariseOutputs } from '../../../../common/utils/automationOutputs'; import { cx } from '../../../../common/utils/styleUtils'; import { isOntimeCloud } from '../../../../externals'; import * as Panel from '../../panel-utils/PanelUtils'; +import { summariseOutputs } from './automationOutputs'; import { automationRecipes, defaultValues, @@ -26,6 +25,7 @@ import { type RecipeValues, } from './automationRecipes'; import { makeTriggerTitle } from './automationUtils'; +import { getLifecycleLabel } from './timerLifecycle'; import style from './NewAutomationDialog.module.scss'; diff --git a/apps/client/src/common/utils/__tests__/automationOutputs.test.ts b/apps/client/src/features/app-settings/panel/automations-panel/__tests__/automationOutputs.test.ts similarity index 100% rename from apps/client/src/common/utils/__tests__/automationOutputs.test.ts rename to apps/client/src/features/app-settings/panel/automations-panel/__tests__/automationOutputs.test.ts diff --git a/apps/client/src/common/utils/automationOutputs.ts b/apps/client/src/features/app-settings/panel/automations-panel/automationOutputs.ts similarity index 100% rename from apps/client/src/common/utils/automationOutputs.ts rename to apps/client/src/features/app-settings/panel/automations-panel/automationOutputs.ts diff --git a/apps/client/src/features/app-settings/panel/automations-panel/automationUtils.ts b/apps/client/src/features/app-settings/panel/automations-panel/automationUtils.ts index 36d41c2f1..c046561bd 100644 --- a/apps/client/src/features/app-settings/panel/automations-panel/automationUtils.ts +++ b/apps/client/src/features/app-settings/panel/automations-panel/automationUtils.ts @@ -1,6 +1,6 @@ import { Automation, AutomationDTO, AutomationFilter, CustomFields, TimerLifeCycle, Trigger } from 'ontime-types'; -import { getLifecycleLabel, lifecycleLabels } from '../../../../common/constants/timerLifecycle'; +import { getLifecycleLabel, lifecycleLabels } from './timerLifecycle'; /** * Names a trigger created from an automation's lifecycle picker. diff --git a/apps/client/src/common/constants/timerLifecycle.ts b/apps/client/src/features/app-settings/panel/automations-panel/timerLifecycle.ts similarity index 100% rename from apps/client/src/common/constants/timerLifecycle.ts rename to apps/client/src/features/app-settings/panel/automations-panel/timerLifecycle.ts diff --git a/apps/client/src/features/rundown/entry-editor/composite/EventEditorTriggers.tsx b/apps/client/src/features/rundown/entry-editor/composite/EventEditorTriggers.tsx index fbe747658..5ee61f0da 100644 --- a/apps/client/src/features/rundown/entry-editor/composite/EventEditorTriggers.tsx +++ b/apps/client/src/features/rundown/entry-editor/composite/EventEditorTriggers.tsx @@ -7,10 +7,10 @@ import IconButton from '../../../../common/components/buttons/IconButton'; import Info from '../../../../common/components/info/Info'; import Select from '../../../../common/components/select/Select'; import Tag from '../../../../common/components/tag/Tag'; -import { getLifecycleLabel } from '../../../../common/constants/timerLifecycle'; import { useEntryActionsContext } from '../../../../common/context/EntryActionsContext'; import useAutomationSettings from '../../../../common/hooks-query/useAutomationSettings'; -import { summariseOutputs } from '../../../../common/utils/automationOutputs'; +import { summariseOutputs } from '../../../app-settings/panel/automations-panel/automationOutputs'; +import { getLifecycleLabel } from '../../../app-settings/panel/automations-panel/timerLifecycle'; import { eventTriggerOptions } from './eventTrigger.constants'; import style from './EventEditorTriggers.module.scss';