mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
* refactor(editor): Turn showMessage mixin to composable (#6081) * refactor(editor): move $getExecutionError from showMessages mixin to pushConnection (it is used there only) * refactor(editor): resolve showMessage mixin methods * fix(editor): use composable instead of mixin * fix(editor): resolve conflicts * fix(editor): replace clearAllStickyNotifications * fix(editor): replace confirmMessage * fix(editor): replace confirmMessage * fix(editor): replace confirmMessage * fix(editor): remove last confirmMessage usage * fix(editor): remove $prompt usage * fix(editor): remove $show methods * fix(editor): lint fix * fix(editor): lint fix * fix(editor): fixes after review * fix(editor): Fix external hook call in App * fix(editor): mixins & composables * fix: add pushConnection setup composables to components as well * fix(editor): mixins & composables * fix(editor): mixins & composables * fix: add void on non-await async calls * fix: fix close without connecting confirmation * fix: remove .only --------- Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
@@ -126,15 +126,16 @@
|
||||
import Modal from './Modal.vue';
|
||||
import {
|
||||
EnterpriseEditionFeature,
|
||||
MODAL_CONFIRM,
|
||||
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||
VIEWS,
|
||||
WORKFLOW_SHARE_MODAL_KEY,
|
||||
} from '../constants';
|
||||
} from '@/constants';
|
||||
import type { IUser, IWorkflowDb } from '@/Interface';
|
||||
import type { IPermissions } from '@/permissions';
|
||||
import { getWorkflowPermissions } from '@/permissions';
|
||||
import mixins from 'vue-typed-mixins';
|
||||
import { showMessage } from '@/mixins/showMessage';
|
||||
import { defineComponent } from 'vue';
|
||||
import { useToast, useMessage } from '@/composables';
|
||||
import { createEventBus, nodeViewEventBus } from '@/event-bus';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/settings.store';
|
||||
@@ -147,7 +148,7 @@ import { useUsageStore } from '@/stores/usage.store';
|
||||
import type { BaseTextKey } from '@/plugins/i18n';
|
||||
import { isNavigationFailure } from 'vue-router';
|
||||
|
||||
export default mixins(showMessage).extend({
|
||||
export default defineComponent({
|
||||
name: 'workflow-share-modal',
|
||||
components: {
|
||||
Modal,
|
||||
@@ -158,6 +159,12 @@ export default mixins(showMessage).extend({
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {
|
||||
...useToast(),
|
||||
...useMessage(),
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const workflowsStore = useWorkflowsStore();
|
||||
const workflow =
|
||||
@@ -188,11 +195,6 @@ export default mixins(showMessage).extend({
|
||||
isSharingEnabled(): boolean {
|
||||
return this.settingsStore.isEnterpriseFeatureEnabled(EnterpriseEditionFeature.Sharing);
|
||||
},
|
||||
fallbackLinkUrl(): string {
|
||||
return `${this.$locale.baseText(
|
||||
this.uiStore.contextBasedTranslationKeys.upgradeLinkUrl as BaseTextKey,
|
||||
)}${true ? '&utm_campaign=upgrade-workflow-sharing' : ''}`;
|
||||
},
|
||||
modalTitle(): string {
|
||||
return this.$locale.baseText(
|
||||
this.isSharingEnabled
|
||||
@@ -292,12 +294,12 @@ export default mixins(showMessage).extend({
|
||||
sharees_removed: shareesRemoved.length,
|
||||
});
|
||||
|
||||
this.$showMessage({
|
||||
this.showMessage({
|
||||
title: this.$locale.baseText('workflows.shareModal.onSave.success.title'),
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
this.$showError(error, this.$locale.baseText('workflows.shareModal.onSave.error.title'));
|
||||
this.showError(error, this.$locale.baseText('workflows.shareModal.onSave.error.title'));
|
||||
} finally {
|
||||
this.modalBus.emit('close');
|
||||
this.loading = false;
|
||||
@@ -370,7 +372,7 @@ export default mixins(showMessage).extend({
|
||||
|
||||
let confirm = true;
|
||||
if (!isNewSharee && isLastUserWithAccessToCredentials) {
|
||||
confirm = await this.confirmMessage(
|
||||
const confirmAction = await this.confirm(
|
||||
this.$locale.baseText(
|
||||
'workflows.shareModal.list.delete.confirm.lastUserWithAccessToCredentials.message',
|
||||
{
|
||||
@@ -380,10 +382,17 @@ export default mixins(showMessage).extend({
|
||||
this.$locale.baseText('workflows.shareModal.list.delete.confirm.title', {
|
||||
interpolate: { name: user.fullName as string },
|
||||
}),
|
||||
null,
|
||||
this.$locale.baseText('workflows.shareModal.list.delete.confirm.confirmButtonText'),
|
||||
this.$locale.baseText('workflows.shareModal.list.delete.confirm.cancelButtonText'),
|
||||
{
|
||||
confirmButtonText: this.$locale.baseText(
|
||||
'workflows.shareModal.list.delete.confirm.confirmButtonText',
|
||||
),
|
||||
cancelButtonText: this.$locale.baseText(
|
||||
'workflows.shareModal.list.delete.confirm.cancelButtonText',
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
confirm = confirmAction === MODAL_CONFIRM;
|
||||
}
|
||||
|
||||
if (confirm) {
|
||||
@@ -404,15 +413,21 @@ export default mixins(showMessage).extend({
|
||||
},
|
||||
async onCloseModal() {
|
||||
if (this.isDirty) {
|
||||
const shouldSave = await this.confirmMessage(
|
||||
const shouldSave = await this.confirm(
|
||||
this.$locale.baseText('workflows.shareModal.saveBeforeClose.message'),
|
||||
this.$locale.baseText('workflows.shareModal.saveBeforeClose.title'),
|
||||
'warning',
|
||||
this.$locale.baseText('workflows.shareModal.saveBeforeClose.confirmButtonText'),
|
||||
this.$locale.baseText('workflows.shareModal.saveBeforeClose.cancelButtonText'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: this.$locale.baseText(
|
||||
'workflows.shareModal.saveBeforeClose.confirmButtonText',
|
||||
),
|
||||
cancelButtonText: this.$locale.baseText(
|
||||
'workflows.shareModal.saveBeforeClose.cancelButtonText',
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
if (shouldSave) {
|
||||
if (shouldSave === MODAL_CONFIRM) {
|
||||
return this.onSave();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user