mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(editor): Hide execution buttons in readonly mode in new canvas (no-changelog) (#10603)
This commit is contained in:
parent
78f34f66c6
commit
1491cbd228
|
@ -96,6 +96,7 @@ import { createEventBus } from 'n8n-design-system';
|
|||
import type { PinDataSource } from '@/composables/usePinnedData';
|
||||
import { useClipboard } from '@/composables/useClipboard';
|
||||
import { useBeforeUnload } from '@/composables/useBeforeUnload';
|
||||
import { getResourcePermissions } from '@/permissions';
|
||||
|
||||
const LazyNodeCreation = defineAsyncComponent(
|
||||
async () => await import('@/components/Node/NodeCreation.vue'),
|
||||
|
@ -203,7 +204,11 @@ const isReadOnlyEnvironment = computed(() => {
|
|||
});
|
||||
|
||||
const isCanvasReadOnly = computed(() => {
|
||||
return isDemoRoute.value || isReadOnlyEnvironment.value;
|
||||
return (
|
||||
isDemoRoute.value ||
|
||||
isReadOnlyEnvironment.value ||
|
||||
!(workflowPermissions.value.update ?? projectPermissions.value.workflow.update)
|
||||
);
|
||||
});
|
||||
|
||||
const fallbackNodes = computed<INodeUi[]>(() =>
|
||||
|
@ -885,6 +890,21 @@ function onClickConnectionAdd(connection: Connection) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Permissions
|
||||
*/
|
||||
|
||||
const workflowPermissions = computed(() => {
|
||||
return getResourcePermissions(workflowsStore.getWorkflowById(workflowId.value)?.scopes).workflow;
|
||||
});
|
||||
|
||||
const projectPermissions = computed(() => {
|
||||
const project = route.query?.projectId
|
||||
? projectsStore.myProjects.find((p) => p.id === route.query.projectId)
|
||||
: projectsStore.currentProject ?? projectsStore.personalProject;
|
||||
return getResourcePermissions(project?.scopes);
|
||||
});
|
||||
|
||||
/**
|
||||
* Executions
|
||||
*/
|
||||
|
@ -1516,7 +1536,7 @@ onDeactivated(() => {
|
|||
@create:workflow="onCreateWorkflow"
|
||||
@viewport-change="onViewportChange"
|
||||
>
|
||||
<div :class="$style.executionButtons">
|
||||
<div v-if="!isCanvasReadOnly" :class="$style.executionButtons">
|
||||
<CanvasRunWorkflowButton
|
||||
:waiting-for-webhook="isExecutionWaitingForWebhook"
|
||||
:disabled="isExecutionDisabled"
|
||||
|
|
Loading…
Reference in a new issue