From ca9ccb9a9721672c93f551d535a087125721f0f1 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Wed, 7 Dec 2022 16:29:03 +0200 Subject: [PATCH] feat: Handle sharing features when user skips owner setup --- .../CredentialEdit/CredentialEdit.vue | 1 + .../CredentialEdit/CredentialSharing.ee.vue | 79 +++++++++++-------- .../src/components/WorkflowShareModal.ee.vue | 22 +++++- .../src/plugins/i18n/locales/en.json | 4 + packages/editor-ui/src/stores/users.ts | 3 + 5 files changed, 76 insertions(+), 33 deletions(-) diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue index e00da60bcc7d9..f7f69d9a28511 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialEdit.vue @@ -85,6 +85,7 @@ :credentialData="credentialData" :credentialId="credentialId" :credentialPermissions="credentialPermissions" + :modalBus="modalBus" @change="onChangeSharedWith" /> diff --git a/packages/editor-ui/src/components/CredentialEdit/CredentialSharing.ee.vue b/packages/editor-ui/src/components/CredentialEdit/CredentialSharing.ee.vue index f7f4fa9d95f54..f76b8b18bd4ff 100644 --- a/packages/editor-ui/src/components/CredentialEdit/CredentialSharing.ee.vue +++ b/packages/editor-ui/src/components/CredentialEdit/CredentialSharing.ee.vue @@ -1,35 +1,44 @@ @@ -40,17 +49,21 @@ import {showMessage} from "@/mixins/showMessage"; import { mapStores } from 'pinia'; import { useUsersStore } from '@/stores/users'; import { useCredentialsStore } from "@/stores/credentials"; +import {VIEWS} from "@/constants"; export default mixins( showMessage, ).extend({ name: 'CredentialSharing', - props: ['credential', 'credentialId', 'credentialData', 'sharedWith', 'credentialPermissions'], + props: ['credential', 'credentialId', 'credentialData', 'sharedWith', 'credentialPermissions', 'modalBus'], computed: { ...mapStores( useCredentialsStore, useUsersStore, ), + isDefaultUser(): boolean { + return this.usersStore.isDefaultUser; + }, usersList(): IUser[] { return this.usersStore.allUsers.filter((user: IUser) => { const isCurrentUser = user.id === this.usersStore.currentUser?.id; @@ -98,6 +111,10 @@ export default mixins( async loadUsers() { await this.usersStore.fetchUsers(); }, + goToUsersSettings() { + this.$router.push({ name: VIEWS.USERS_SETTINGS }); + this.modalBus.$emit('close'); + }, }, mounted() { this.loadUsers(); diff --git a/packages/editor-ui/src/components/WorkflowShareModal.ee.vue b/packages/editor-ui/src/components/WorkflowShareModal.ee.vue index ec5d983349aec..72bfa87cf43dd 100644 --- a/packages/editor-ui/src/components/WorkflowShareModal.ee.vue +++ b/packages/editor-ui/src/components/WorkflowShareModal.ee.vue @@ -8,7 +8,12 @@ :beforeClose="onCloseModal" >