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:
Ahsan Virani
2021-01-19 23:48:30 +01:00
committed by GitHub
parent fd1f60bbbe
commit 4d446229c3
12 changed files with 85 additions and 113 deletions

View File

@@ -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;
},