From 435ef5fc73ca7ddadd97af522b9ae6f620e23d55 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 23 Feb 2024 12:10:02 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=E2=9C=A8:=20Add=20optional=20title=20and?= =?UTF-8?q?=20disabled=20props=20to=20`WorkflowRunButton`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Workflow/WorkflowRunButton.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/Workflow/WorkflowRunButton.vue b/client/src/components/Workflow/WorkflowRunButton.vue index f32f07855fb4..918a8f05658a 100644 --- a/client/src/components/Workflow/WorkflowRunButton.vue +++ b/client/src/components/Workflow/WorkflowRunButton.vue @@ -10,6 +10,8 @@ library.add(faPlay); interface Props { id: string; full?: boolean; + title?: string; + disabled?: boolean; } const props = defineProps(); @@ -25,10 +27,11 @@ function ExecuteWorkflow() { Run From 853fa5aac38d068e85d0974a8da55e9782127a70 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Fri, 23 Feb 2024 12:14:01 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=E2=9C=A8:=20update=20`WorkflowCard`=20butt?= =?UTF-8?q?on=20titles=20for=20Anonymous=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Workflow/WorkflowCard.vue | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/client/src/components/Workflow/WorkflowCard.vue b/client/src/components/Workflow/WorkflowCard.vue index a0405168ebe2..d70b1655ff1a 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) {
- + @@ -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 - +
Date: Mon, 26 Feb 2024 13:41:12 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E2=9C=A8:=20hide=20`Delete=20Workflow`=20f?= =?UTF-8?q?or=20anonymous=20user=20in=20`WorkflowActions`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Workflow/WorkflowActions.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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", From 2c966400d18ac4fd17feb4410ac8822b99ed94b5 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Mon, 26 Feb 2024 13:41:30 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E2=9C=A8:=20hide=20`Share=20Workflow`=20fo?= =?UTF-8?q?r=20anonymous=20user=20in=20`WorkflowCard`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Workflow/WorkflowActionsExtend.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() {