diff --git a/client/src/components/Workflow/WorkflowActions.vue b/client/src/components/Workflow/WorkflowActions.vue index 9e15d75c94eb..52e7f5ae0526 100644 --- a/client/src/components/Workflow/WorkflowActions.vue +++ b/client/src/components/Workflow/WorkflowActions.vue @@ -11,6 +11,7 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton } from "bootstrap-vue"; +import { storeToRefs } from "pinia"; import { computed, type ComputedRef } from "vue"; import { useRouter } from "vue-router/composables"; @@ -67,6 +68,7 @@ const emit = defineEmits<{ const router = useRouter(); const userStore = useUserStore(); +const { isAnonymous } = storeToRefs(userStore); const { confirm } = useConfirmDialog(); const shared = computed(() => { @@ -164,7 +166,7 @@ const actions: ComputedRef<(AAction | BAction)[]> = computed(() => { const menuActions: ComputedRef = computed(() => { return [ { - condition: !shared.value && !props.workflow.deleted, + condition: !isAnonymous.value && !shared.value && !props.workflow.deleted, class: "workflow-delete-button", component: "button", title: "Delete workflow", diff --git a/client/src/components/Workflow/WorkflowActionsExtend.vue b/client/src/components/Workflow/WorkflowActionsExtend.vue index d5f823dd5004..c7c2b92d3347 100644 --- a/client/src/components/Workflow/WorkflowActionsExtend.vue +++ b/client/src/components/Workflow/WorkflowActionsExtend.vue @@ -108,7 +108,7 @@ async function onRestore() { { return null; } }); +const editButtonTitle = computed(() => { + if (isAnonymous.value) { + return "Log in to edit Workflow"; + } else { + if (workflow.value.deleted) { + return "You cannot edit a deleted workflow. Restore it first."; + } else { + return "Edit Workflow"; + } + } +}); +const importedButtonTitle = computed(() => { + if (isAnonymous.value) { + return "Log in to import workflow"; + } else { + return "Import this workflow to edit"; + } +}); +const runButtonTitle = computed(() => { + if (isAnonymous.value) { + return "Log in to run workflow"; + } else { + if (workflow.value.deleted) { + return "You cannot run a deleted workflow. Restore it first."; + } else { + return "Run workflow"; + } + } +}); function onEdit() { router.push(`/workflows/edit?id=${workflow.value.id}`); @@ -119,7 +151,7 @@ async function onTagClick(tag: string) {
- + @@ -155,16 +187,12 @@ async function onTagClick(tag: string) {
@@ -175,20 +203,24 @@ async function onTagClick(tag: string) { v-else v-b-tooltip.hover.noninteractive size="sm" - title="Import this workflow to edit" + :disabled="isAnonymous" + :title="importedButtonTitle" :icon="faUpload" variant="outline-primary" :action="onImport"> Import - +
(); @@ -25,10 +27,11 @@ function ExecuteWorkflow() { Run