feat: Add share button to workflows list (#4681)

* feat: Add share button to workflows list

* fix: take empty workflow into account when sharing
This commit is contained in:
Alex Grozav
2022-11-22 12:33:40 +02:00
committed by GitHub
parent b5b44d1b59
commit a356d7bdba
6 changed files with 40 additions and 7 deletions

View File

@@ -120,14 +120,23 @@ export default mixins(
components: {
Modal,
},
props: {
data: {
type: Object,
default: () => ({}),
},
},
data() {
const workflowsStore = useWorkflowsStore();
const workflow = this.data.id === PLACEHOLDER_EMPTY_WORKFLOW_ID
? workflowsStore.workflow
: workflowsStore.workflowsById[this.data.id];
return {
WORKFLOW_SHARE_MODAL_KEY,
loading: false,
modalBus: new Vue(),
sharedWith: [...(workflowsStore.workflow.sharedWith || [])] as Array<Partial<IUser>>,
sharedWith: [...(workflow.sharedWith || [])] as Array<Partial<IUser>>,
EnterpriseEditionFeature,
};
},
@@ -150,7 +159,9 @@ export default mixins(
] as Array<Partial<IUser>>).concat(this.sharedWith || []);
},
workflow(): IWorkflowDb {
return this.workflowsStore.workflow;
return this.data.id === PLACEHOLDER_EMPTY_WORKFLOW_ID
? this.workflowsStore.workflow
: this.workflowsStore.workflowsById[this.data.id];
},
currentUser(): IUser | null {
return this.usersStore.currentUser;
@@ -221,7 +232,7 @@ export default mixins(
}
if (confirm) {
this.sharedWith = this.sharedWith.filter((sharee: IUser) => {
this.sharedWith = this.sharedWith.filter((sharee: Partial<IUser>) => {
return sharee.id !== user.id;
});
}