mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
clean up activator impl
This commit is contained in:
parent
c7146bb015
commit
8120dca277
|
@ -38,6 +38,7 @@ import { mapGetters } from "vuex";
|
||||||
import {
|
import {
|
||||||
WORKFLOW_ACTIVE_MODAL_KEY,
|
WORKFLOW_ACTIVE_MODAL_KEY,
|
||||||
LOCAL_STORAGE_ACTIVATION_FLAG,
|
LOCAL_STORAGE_ACTIVATION_FLAG,
|
||||||
|
ERROR_TRIGGER_NODE_TYPE,
|
||||||
} from '@/constants';
|
} from '@/constants';
|
||||||
|
|
||||||
|
|
||||||
|
@ -81,21 +82,20 @@ export default mixins(
|
||||||
return '#13ce66';
|
return '#13ce66';
|
||||||
},
|
},
|
||||||
disabled(): boolean {
|
disabled(): boolean {
|
||||||
// Switch should be enabled if workflow is currently active and should always be enabled for workflows not currently in editor
|
const isCurrentWorkflow = this.$store.getters['workflowId'] !== this.workflowId;
|
||||||
return this.isCurrentWorkflow && !this.workflowActive && !this.containsTrigger;
|
if (this.workflowId && isCurrentWorkflow) {
|
||||||
},
|
return false;
|
||||||
isCurrentWorkflow(): boolean {
|
}
|
||||||
return this.workflowId ? this.$store.state.workflow.id === this.workflowId : true;
|
|
||||||
|
return !this.workflowActive && !this.containsTrigger;
|
||||||
},
|
},
|
||||||
containsTrigger(): boolean {
|
containsTrigger(): boolean {
|
||||||
const foundTriggers = this.$store.getters.workflowTriggerNodes
|
const foundTriggers = this.$store.getters.workflowTriggerNodes
|
||||||
.filter((node: INodeUi) => {
|
.filter((node: INodeUi) => {
|
||||||
return !node.disabled;
|
// Error Trigger does not behave like other triggers and workflows using it can not be activated
|
||||||
})
|
return !node.disabled && node.type !== ERROR_TRIGGER_NODE_TYPE;
|
||||||
// Error Trigger does not behave like other triggers and workflows using it can not be activated
|
|
||||||
.filter(({ type }: INodeUi) => {
|
|
||||||
return type !== 'n8n-nodes-base.errorTrigger';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return foundTriggers.length > 0;
|
return foundTriggers.length > 0;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue