From 6a48d622f0c68e2abadf20652bd29e99823c2e93 Mon Sep 17 00:00:00 2001 From: YannC <37600690+Skraye@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:04:26 +0200 Subject: [PATCH] fix(): allow create flow and allow save when namespace is allowed (#4512) close kestraio/kestra-ee#1443 --- ui/src/components/flows/Flows.vue | 2 +- ui/src/components/inputs/EditorView.vue | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/src/components/flows/Flows.vue b/ui/src/components/flows/Flows.vue index 32580b68eb..c2c2e645cf 100644 --- a/ui/src/components/flows/Flows.vue +++ b/ui/src/components/flows/Flows.vue @@ -296,7 +296,7 @@ return this.canRead || this.canDelete || this.canUpdate; }, canCreate() { - return this.user && this.user.isAllowed(permission.FLOW, action.CREATE, this.$route.query.namespace); + return this.user && this.user.hasAnyActionOnAnyNamespace(permission.FLOW, action.CREATE); }, canRead() { return this.user && this.user.isAllowed(permission.FLOW, action.READ, this.$route.query.namespace); diff --git a/ui/src/components/inputs/EditorView.vue b/ui/src/components/inputs/EditorView.vue index 7583c3f1db..8c6f2214f2 100644 --- a/ui/src/components/inputs/EditorView.vue +++ b/ui/src/components/inputs/EditorView.vue @@ -370,7 +370,6 @@ stopTour(); }); window.addEventListener("beforeunload", persistEditorWidth); - window.addEventListener("resize", onResize); if (props.isCreating) { @@ -399,11 +398,12 @@ store.commit("core/setGuidedProperties", {tourStarted: false}); }; - const isAllowedEdit = () => { + const isAllowedEdit = computed(() => { + return ( - user && user.isAllowed(permission.FLOW, action.UPDATE, props.namespace) + user && user.isAllowed(permission.FLOW, action.UPDATE, flowParsed.value?.namespace ?? props.namespace) ); - }; + }); const forwardEvent = (type, event) => { emit(type, event); @@ -985,7 +985,7 @@ :is-creating="props.isCreating" :is-read-only="props.isReadOnly" :can-delete="canDelete()" - :is-allowed-edit="isAllowedEdit()" + :is-allowed-edit="isAllowedEdit" :have-change="flowYaml !== flowYamlOrigin" :flow-have-tasks="flowHaveTasks()" :errors="flowErrors" @@ -1074,7 +1074,7 @@ :execution="execution" :is-read-only="isReadOnly" :source="flowYaml" - :is-allowed-edit="isAllowedEdit()" + :is-allowed-edit="isAllowedEdit" :view-type="viewType" :expanded-subflows="props.expandedSubflows" />