mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
feat: Handle sharing features when user skips owner setup (#4850)
This commit is contained in:
parent
b0c158c64f
commit
6f1b78df98
|
@ -85,6 +85,7 @@
|
||||||
:credentialData="credentialData"
|
:credentialData="credentialData"
|
||||||
:credentialId="credentialId"
|
:credentialId="credentialId"
|
||||||
:credentialPermissions="credentialPermissions"
|
:credentialPermissions="credentialPermissions"
|
||||||
|
:modalBus="modalBus"
|
||||||
@change="onChangeSharedWith"
|
@change="onChangeSharedWith"
|
||||||
/>
|
/>
|
||||||
</enterprise-edition>
|
</enterprise-edition>
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.container">
|
<div :class="$style.container">
|
||||||
|
<div v-if="isDefaultUser">
|
||||||
|
<n8n-action-box
|
||||||
|
:description="$locale.baseText('credentialEdit.credentialSharing.isDefaultUser.description')"
|
||||||
|
:buttonText="$locale.baseText('credentialEdit.credentialSharing.isDefaultUser.button')"
|
||||||
|
@click="goToUsersSettings"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
<n8n-info-tip :bold="false" class="mb-s">
|
<n8n-info-tip :bold="false" class="mb-s">
|
||||||
<template v-if="credentialPermissions.isOwner">
|
<template v-if="credentialPermissions.isOwner">
|
||||||
{{ $locale.baseText('credentialEdit.credentialSharing.info.owner') }}
|
{{ $locale.baseText('credentialEdit.credentialSharing.info.owner') }}
|
||||||
|
@ -31,6 +39,7 @@
|
||||||
@delete="onRemoveSharee"
|
@delete="onRemoveSharee"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -40,17 +49,21 @@ import {showMessage} from "@/mixins/showMessage";
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
import { useUsersStore } from '@/stores/users';
|
import { useUsersStore } from '@/stores/users';
|
||||||
import { useCredentialsStore } from "@/stores/credentials";
|
import { useCredentialsStore } from "@/stores/credentials";
|
||||||
|
import {VIEWS} from "@/constants";
|
||||||
|
|
||||||
export default mixins(
|
export default mixins(
|
||||||
showMessage,
|
showMessage,
|
||||||
).extend({
|
).extend({
|
||||||
name: 'CredentialSharing',
|
name: 'CredentialSharing',
|
||||||
props: ['credential', 'credentialId', 'credentialData', 'sharedWith', 'credentialPermissions'],
|
props: ['credential', 'credentialId', 'credentialData', 'sharedWith', 'credentialPermissions', 'modalBus'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(
|
...mapStores(
|
||||||
useCredentialsStore,
|
useCredentialsStore,
|
||||||
useUsersStore,
|
useUsersStore,
|
||||||
),
|
),
|
||||||
|
isDefaultUser(): boolean {
|
||||||
|
return this.usersStore.isDefaultUser;
|
||||||
|
},
|
||||||
usersList(): IUser[] {
|
usersList(): IUser[] {
|
||||||
return this.usersStore.allUsers.filter((user: IUser) => {
|
return this.usersStore.allUsers.filter((user: IUser) => {
|
||||||
const isCurrentUser = user.id === this.usersStore.currentUser?.id;
|
const isCurrentUser = user.id === this.usersStore.currentUser?.id;
|
||||||
|
@ -98,6 +111,10 @@ export default mixins(
|
||||||
async loadUsers() {
|
async loadUsers() {
|
||||||
await this.usersStore.fetchUsers();
|
await this.usersStore.fetchUsers();
|
||||||
},
|
},
|
||||||
|
goToUsersSettings() {
|
||||||
|
this.$router.push({ name: VIEWS.USERS_SETTINGS });
|
||||||
|
this.modalBus.$emit('close');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadUsers();
|
this.loadUsers();
|
||||||
|
|
|
@ -8,7 +8,12 @@
|
||||||
:beforeClose="onCloseModal"
|
:beforeClose="onCloseModal"
|
||||||
>
|
>
|
||||||
<template #content>
|
<template #content>
|
||||||
<div :class="$style.container">
|
<div v-if="isDefaultUser" :class="$style.container">
|
||||||
|
<n8n-text>
|
||||||
|
{{ $locale.baseText('workflows.shareModal.isDefaultUser.description') }}
|
||||||
|
</n8n-text>
|
||||||
|
</div>
|
||||||
|
<div v-else :class="$style.container">
|
||||||
<enterprise-edition :features="[EnterpriseEditionFeature.WorkflowSharing]">
|
<enterprise-edition :features="[EnterpriseEditionFeature.WorkflowSharing]">
|
||||||
<n8n-user-select
|
<n8n-user-select
|
||||||
v-if="workflowPermissions.updateSharing"
|
v-if="workflowPermissions.updateSharing"
|
||||||
|
@ -62,7 +67,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<enterprise-edition :features="[EnterpriseEditionFeature.WorkflowSharing]" :class="$style.actionButtons">
|
<div v-if="isDefaultUser" :class="$style.actionButtons">
|
||||||
|
<n8n-button @click="goToUsersSettings">
|
||||||
|
{{ $locale.baseText('workflows.shareModal.isDefaultUser.button') }}
|
||||||
|
</n8n-button>
|
||||||
|
</div>
|
||||||
|
<enterprise-edition v-else :features="[EnterpriseEditionFeature.WorkflowSharing]" :class="$style.actionButtons">
|
||||||
<n8n-text
|
<n8n-text
|
||||||
v-show="isDirty"
|
v-show="isDirty"
|
||||||
color="text-light"
|
color="text-light"
|
||||||
|
@ -102,6 +112,7 @@ import Modal from './Modal.vue';
|
||||||
import {
|
import {
|
||||||
EnterpriseEditionFeature,
|
EnterpriseEditionFeature,
|
||||||
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
PLACEHOLDER_EMPTY_WORKFLOW_ID,
|
||||||
|
VIEWS,
|
||||||
WORKFLOW_SHARE_MODAL_KEY,
|
WORKFLOW_SHARE_MODAL_KEY,
|
||||||
} from '../constants';
|
} from '../constants';
|
||||||
import {IUser, IWorkflowDb, NestedRecord} from "@/Interface";
|
import {IUser, IWorkflowDb, NestedRecord} from "@/Interface";
|
||||||
|
@ -145,6 +156,9 @@ export default mixins(
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useSettingsStore, useUIStore, useUsersStore, useWorkflowsStore, useWorkflowsEEStore),
|
...mapStores(useSettingsStore, useUIStore, useUsersStore, useWorkflowsStore, useWorkflowsEEStore),
|
||||||
|
isDefaultUser(): boolean {
|
||||||
|
return this.usersStore.isDefaultUser;
|
||||||
|
},
|
||||||
usersList(): IUser[] {
|
usersList(): IUser[] {
|
||||||
return this.usersStore.allUsers.filter((user: IUser) => {
|
return this.usersStore.allUsers.filter((user: IUser) => {
|
||||||
const isCurrentUser = user.id === this.usersStore.currentUser?.id;
|
const isCurrentUser = user.id === this.usersStore.currentUser?.id;
|
||||||
|
@ -313,6 +327,10 @@ export default mixins(
|
||||||
async loadUsers() {
|
async loadUsers() {
|
||||||
await this.usersStore.fetchUsers();
|
await this.usersStore.fetchUsers();
|
||||||
},
|
},
|
||||||
|
goToUsersSettings() {
|
||||||
|
this.$router.push({ name: VIEWS.USERS_SETTINGS });
|
||||||
|
this.modalBus.$emit('close');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.isSharingAvailable) {
|
if (this.isSharingAvailable) {
|
||||||
|
|
|
@ -305,6 +305,8 @@
|
||||||
"credentialEdit.credentialSharing.list.delete.confirm.message": "This may break any workflows in which {name} has used this credential",
|
"credentialEdit.credentialSharing.list.delete.confirm.message": "This may break any workflows in which {name} has used this credential",
|
||||||
"credentialEdit.credentialSharing.list.delete.confirm.confirmButtonText": "Remove",
|
"credentialEdit.credentialSharing.list.delete.confirm.confirmButtonText": "Remove",
|
||||||
"credentialEdit.credentialSharing.list.delete.confirm.cancelButtonText": "Cancel",
|
"credentialEdit.credentialSharing.list.delete.confirm.cancelButtonText": "Cancel",
|
||||||
|
"credentialEdit.credentialSharing.isDefaultUser.description": "You first need to set up your owner account to enable credential sharing features.",
|
||||||
|
"credentialEdit.credentialSharing.isDefaultUser.button": "Go to settings",
|
||||||
"credentialSelectModal.addNewCredential": "Add new credential",
|
"credentialSelectModal.addNewCredential": "Add new credential",
|
||||||
"credentialSelectModal.continue": "Continue",
|
"credentialSelectModal.continue": "Continue",
|
||||||
"credentialSelectModal.searchForApp": "Search for app...",
|
"credentialSelectModal.searchForApp": "Search for app...",
|
||||||
|
@ -1410,6 +1412,8 @@
|
||||||
"workflows.shareModal.changesHint": "You made changes",
|
"workflows.shareModal.changesHint": "You made changes",
|
||||||
"workflows.shareModal.notAvailable": "Sharing workflows with others is currently available only on n8n cloud, our hosted offering.",
|
"workflows.shareModal.notAvailable": "Sharing workflows with others is currently available only on n8n cloud, our hosted offering.",
|
||||||
"workflows.shareModal.notAvailable.button": "Explore n8n cloud",
|
"workflows.shareModal.notAvailable.button": "Explore n8n cloud",
|
||||||
|
"workflows.shareModal.isDefaultUser.description": "You first need to set up your owner account to enable workflow sharing features.",
|
||||||
|
"workflows.shareModal.isDefaultUser.button": "Go to settings",
|
||||||
"workflows.roles.editor": "Editor",
|
"workflows.roles.editor": "Editor",
|
||||||
"workflows.concurrentChanges.confirmMessage.title": "Workflow was edited by someone else",
|
"workflows.concurrentChanges.confirmMessage.title": "Workflow was edited by someone else",
|
||||||
"workflows.concurrentChanges.confirmMessage.message": "Another user made <strong>an edit</strong> to this workflow since you last saved it. Do you want to overwrite their changes?",
|
"workflows.concurrentChanges.confirmMessage.message": "Another user made <strong>an edit</strong> to this workflow since you last saved it. Do you want to overwrite their changes?",
|
||||||
|
|
|
@ -23,6 +23,9 @@ export const useUsersStore = defineStore(STORES.USERS, {
|
||||||
currentUser(): IUser | null {
|
currentUser(): IUser | null {
|
||||||
return this.currentUserId ? this.users[this.currentUserId] : null;
|
return this.currentUserId ? this.users[this.currentUserId] : null;
|
||||||
},
|
},
|
||||||
|
isDefaultUser(): boolean {
|
||||||
|
return isDefaultUser(this.currentUser);
|
||||||
|
},
|
||||||
getUserById(state) {
|
getUserById(state) {
|
||||||
return (userId: string): IUser | null => state.users[userId];
|
return (userId: string): IUser | null => state.users[userId];
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue