mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
⚡ Introduce FE external hooks (#1332)
* ⚡ Introduce FE external hooks * ⚡ update hooks * ⚡ add data from frontend settings to hooks * re-organize and update * cleanup * 👌 * ⚡ cleanup workflowSave mixin, add events * avoid alert on new workflow save as * ⚡ update workflow active events * rename externalhooks method * ⚡ Rename frontend hooks Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
import { externalHooks } from '@/components/mixins/externalHooks';
|
||||
import { genericHelpers } from '@/components/mixins/genericHelpers';
|
||||
import { restApi } from '@/components/mixins/restApi';
|
||||
import { showMessage } from '@/components/mixins/showMessage';
|
||||
@@ -33,6 +34,7 @@ import {
|
||||
import mixins from 'vue-typed-mixins';
|
||||
|
||||
export default mixins(
|
||||
externalHooks,
|
||||
genericHelpers,
|
||||
restApi,
|
||||
showMessage,
|
||||
@@ -121,10 +123,12 @@ export default mixins(
|
||||
}
|
||||
|
||||
const currentWorkflowId = this.$store.getters.workflowId;
|
||||
let activationEventName = 'workflow.activeChange';
|
||||
if (currentWorkflowId === this.workflowId) {
|
||||
// If the status of the current workflow got changed
|
||||
// commit it specifically
|
||||
this.$store.commit('setActive', newActiveState);
|
||||
activationEventName = 'workflow.activeChangeCurrent';
|
||||
}
|
||||
|
||||
if (newActiveState === true) {
|
||||
@@ -133,6 +137,8 @@ export default mixins(
|
||||
this.$store.commit('setWorkflowInactive', this.workflowId);
|
||||
}
|
||||
|
||||
this.$externalHooks().run(activationEventName, { workflowId: this.workflowId, active: newActiveState });
|
||||
|
||||
this.$emit('workflowActiveChanged', { id: this.workflowId, active: newActiveState });
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user