diff --git a/client/src/components/Workflow/WorkflowCard.vue b/client/src/components/Workflow/WorkflowCard.vue index a8d73b0e97bd..6b92f0e939a2 100644 --- a/client/src/components/Workflow/WorkflowCard.vue +++ b/client/src/components/Workflow/WorkflowCard.vue @@ -3,6 +3,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faEdit, faEye, faPen, faUpload } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton } from "bootstrap-vue"; +import { storeToRefs } from "pinia"; import { computed, ref } from "vue"; import { useRouter } from "vue-router/composables"; @@ -42,6 +43,8 @@ const emit = defineEmits<{ const router = useRouter(); const userStore = useUserStore(); +const { isAnonymous } = storeToRefs(userStore); + const showRename = ref(false); const showPreview = ref(false); @@ -60,6 +63,35 @@ const description = computed(() => { 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) {