fix modal closing

This commit is contained in:
Mutasem 2022-01-17 17:08:53 +01:00
parent 39b2988ccb
commit a37cf53244
4 changed files with 15 additions and 19 deletions

View file

@ -80,7 +80,6 @@ export default mixins(workflowHelpers).extend({
instance_id: this.$store.getters.instanceId,
email: null,
});
this.$store.commit('ui/closeTopModal');
},
async send() {
if (this.isEmailValid) {
@ -100,7 +99,7 @@ export default mixins(workflowHelpers).extend({
type: 'success',
});
}
this.$store.commit('ui/closeTopModal');
this.modalBus.$emit('close');
}
},
},

View file

@ -345,7 +345,7 @@ export default mixins(showMessage, nodeHelpers).extend({
},
},
methods: {
async beforeClose(done: () => void) {
async beforeClose() {
let keepEditing = false;
if (this.hasUnsavedChanges) {
@ -369,8 +369,7 @@ export default mixins(showMessage, nodeHelpers).extend({
}
if (!keepEditing) {
done();
return;
return true;
}
else if (!this.requiredPropertiesFilled) {
this.showValidationWarning = true;
@ -379,6 +378,8 @@ export default mixins(showMessage, nodeHelpers).extend({
else if (this.isOAuthType) {
this.scrollToBottom();
}
return false;
},
displayCredentialParameter(parameter: INodeProperties): boolean {

View file

@ -144,22 +144,15 @@ export default Vue.extend({
closeAllDialogs() {
this.$store.commit('ui/closeAllModals');
},
closeDialog(callback?: () => void) {
async closeDialog() {
if (this.beforeClose) {
this.beforeClose(() => {
this.$store.commit('ui/closeModal', this.$props.name);
if (typeof callback === 'function') {
callback();
}
});
return;
const shouldClose = await this.beforeClose();
if (shouldClose === false) {
return;
}
}
this.$store.commit('ui/closeModal', this.$props.name);
if (typeof callback === 'function') {
callback();
}
},
getCustomClass() {
let classes = this.$props.customClass || '';

View file

@ -1,6 +1,7 @@
<template>
<ModalDrawer
:name="VALUE_SURVEY_MODAL_KEY"
:eventBus="modalBus"
:beforeClose="closeDialog"
:modal="false"
:wrapperClosable="false"
@ -60,6 +61,7 @@ import ModalDrawer from './ModalDrawer.vue';
import mixins from 'vue-typed-mixins';
import { workflowHelpers } from '@/components/mixins/workflowHelpers';
import Vue from 'vue';
const DEFAULT_TITLE = `How likely are you to recommend n8n to a friend or colleague?`;
const GREAT_FEEDBACK_TITLE = `Great to hear! Can we reach out to see how we can make n8n even better for you?`;
@ -104,6 +106,7 @@ export default mixins(workflowHelpers).extend({
},
showButtons: true,
VALUE_SURVEY_MODAL_KEY,
modalBus: new Vue(),
};
},
methods: {
@ -120,7 +123,7 @@ export default mixins(workflowHelpers).extend({
});
}
this.$store.commit('ui/closeTopModal');
this.modalBus.$emit('close');
},
onInputChange(value: string) {
this.form.email = value;
@ -169,7 +172,7 @@ export default mixins(workflowHelpers).extend({
this.form.email = '';
this.showButtons = true;
}, 1000);
this.$store.commit('ui/closeTopModal');
this.modalBus.$emit('close');
}
},
},