diff --git a/packages/editor-ui/src/components/ActivationModal.vue b/packages/editor-ui/src/components/ActivationModal.vue index 20b79d8b37..33309ea883 100644 --- a/packages/editor-ui/src/components/ActivationModal.vue +++ b/packages/editor-ui/src/components/ActivationModal.vue @@ -39,7 +39,7 @@ import Vue from 'vue'; import Modal from '@/components/Modal.vue'; -import { WORKFLOW_ACTIVE_MODAL_KEY, EXECUTIONS_MODAL_KEY, WORKFLOW_SETTINGS_MODAL_KEY, LOCAL_STORAGE_ACTIVATION_FLAG } from '../constants'; +import { WORKFLOW_ACTIVE_MODAL_KEY, EXECUTIONS_MODAL_KEY, WORKFLOW_SETTINGS_MODAL_KEY, LOCAL_STORAGE_ACTIVATION_FLAG, ERROR_TRIGGER_NODE_TYPE } from '../constants'; import { INodeUi } from '../Interface'; import { getTriggerNodeServiceName } from './helpers'; @@ -73,14 +73,11 @@ export default Vue.extend({ triggerContent (): string { const foundTriggers = this.$store.getters.workflowTriggerNodes .filter((node: INodeUi) => { - return !node.disabled; - }) - .filter(({ type }: INodeUi) => { - return type !== 'n8n-nodes-base.errorTrigger'; + return !node.disabled && node.type !== ERROR_TRIGGER_NODE_TYPE; }); - // if multiple triggers + if (foundTriggers.length > 1) { - return 'Your triggers will now fire production executions automatically.'; + return this.$locale.baseText('activationModal.yourTriggersWillNowFire'); } const trigger = foundTriggers[0]; const triggerNodeType = this.$store.getters.nodeType(trigger.type); @@ -89,15 +86,20 @@ export default Vue.extend({ return triggerNodeType.activationMessage; } const serviceName = getTriggerNodeServiceName(triggerNodeType.displayName); - //check if webhook if (trigger.webhookId) { - return `Your workflow will now listen for events from ${serviceName} and trigger executions.`; + return this.$locale.baseText('activationModal.yourWorkflowWillNowListenForEvents', { + interpolate: { + serviceName, + }, + }); } else if (triggerNodeType.polling) { - //check if a polling trigger - return `Your workflow will now regularly check ${serviceName} for events and trigger executions for them.`; + return this.$locale.baseText('activationModal.yourWorkflowWillNowRegularlyCheck', { + interpolate: { + serviceName, + }, + }); } else { - // default message - return 'Your trigger will now fire production executions automatically.'; + return this.$locale.baseText('activationModal.yourTriggerWillNowFire'); } }, }, diff --git a/packages/editor-ui/src/components/WorkflowActivator.vue b/packages/editor-ui/src/components/WorkflowActivator.vue index 46ea798b23..1b0c7b729b 100644 --- a/packages/editor-ui/src/components/WorkflowActivator.vue +++ b/packages/editor-ui/src/components/WorkflowActivator.vue @@ -103,25 +103,7 @@ export default mixins( }, }, methods: { - async updateCurrentWorkflow(newActiveState: boolean) { - if (this.nodesIssuesExist === true) { - this.$showMessage({ - title: this.$locale.baseText('workflowActivator.showMessage.activeChangedNodesIssuesExistTrue.title'), - message: this.$locale.baseText('workflowActivator.showMessage.activeChangedNodesIssuesExistTrue.message'), - type: 'error', - }); - return; - } - - await this.saveCurrentWorkflow({ - active: newActiveState, - }); - - if (newActiveState && window.localStorage.getItem(LOCAL_STORAGE_ACTIVATION_FLAG) !== 'true') { - this.$store.dispatch('ui/openModal', WORKFLOW_ACTIVE_MODAL_KEY); - } - }, - async activateOtherWorkflow(newActiveState: boolean) { + async changeWorkflowActivationState(newActiveState: boolean) { // Set that the active state should be changed const data: IWorkflowDataUpdate = {}; data.active = newActiveState; @@ -134,6 +116,22 @@ export default mixins( this.$store.commit('setWorkflowInactive', this.workflowId); } }, + async updateCurrentWorkflow(newActiveState: boolean) { + if (this.nodesIssuesExist === true) { + this.$showMessage({ + title: this.$locale.baseText('workflowActivator.showMessage.activeChangedNodesIssuesExistTrue.title'), + message: this.$locale.baseText('workflowActivator.showMessage.activeChangedNodesIssuesExistTrue.message'), + type: 'error', + }); + return; + } + + await this.saveCurrentWorkflow({active: newActiveState}); + + if (newActiveState && window.localStorage.getItem(LOCAL_STORAGE_ACTIVATION_FLAG) !== 'true') { + this.$store.dispatch('ui/openModal', WORKFLOW_ACTIVE_MODAL_KEY); + } + }, async activeChanged (newActiveState: boolean) { this.loading = true; @@ -142,7 +140,7 @@ export default mixins( await this.updateCurrentWorkflow(newActiveState); } else { - await this.activateOtherWorkflow(newActiveState); + await this.changeWorkflowActivationState(newActiveState); } } catch (error) { const newStateName = newActiveState === true ? 'activated' : 'deactivated'; diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 5c10d61dad..83b958140d 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1043,6 +1043,10 @@ "executionList": "execution list", "ifYouChooseTo": "if you choose to", "saveExecutions": "save executions.", - "dontShowAgain": "Don't show again" + "dontShowAgain": "Don't show again", + "yourTriggersWillNowFire": "Your triggers will now fire production executions automatically.", + "yourTriggerWillNowFire": "Your trigger will now fire production executions automatically.", + "yourWorkflowWillNowRegularlyCheck": "Your workflow will now regularly check {serviceName} for events and trigger executions for them.", + "yourWorkflowWillNowListenForEvents": "Your workflow will now listen for events from ${serviceName} and trigger executions." } }