From 966c3b453c308a177de48a42c137657dc2401ae0 Mon Sep 17 00:00:00 2001 From: Alireza Heidari Date: Tue, 7 May 2024 13:59:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8:=20update=20`WorkflowList`=20delet?= =?UTF-8?q?e=20and=20bookmark=20filter=20conditions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Workflow/WorkflowList.vue | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/client/src/components/Workflow/WorkflowList.vue b/client/src/components/Workflow/WorkflowList.vue index 8a0f770c88a2..3cbda017cc01 100644 --- a/client/src/components/Workflow/WorkflowList.vue +++ b/client/src/components/Workflow/WorkflowList.vue @@ -71,6 +71,10 @@ const sortDesc = computed(() => (listHeader.value && listHeader.value.sortDesc) const sortBy = computed(() => (listHeader.value && listHeader.value.sortBy) || "update_time"); const noItems = computed(() => !loading.value && workflowsLoaded.value.length === 0 && !filterText.value); const noResults = computed(() => !loading.value && workflowsLoaded.value.length === 0 && filterText.value); +const deleteButtonTitle = computed(() => (showDeleted.value ? "Hide deleted workflows" : "Show deleted workflows")); +const bookmarkButtonTitle = computed(() => + showBookmarked.value ? "Hide bookmarked workflows" : "Show bookmarked workflows" +); // Filtering computed refs const workflowFilters = computed(() => WorkflowFilters(props.activeList)); @@ -87,8 +91,17 @@ function updateFilterValue(filterKey: string, newValue: any) { filterText.value = workflowFilters.value.setFilterValue(currentFilterText, filterKey, newValue); } +function toggleBookmarked(bookmarked?: boolean) { + showBookmarked.value = bookmarked ?? !showBookmarked.value; +} + function onToggleBookmarked() { - showBookmarked.value = !showBookmarked.value; + toggleBookmarked(); +} + +function onToggleDeleted() { + updateFilterValue("deleted", true); + toggleBookmarked(false); } async function load(overlayLoading = false, silent = false) { @@ -234,10 +247,10 @@ onMounted(() => { id="show-deleted" v-b-tooltip.hover size="sm" - :title="!showDeleted ? 'Show deleted workflows' : 'Hide deleted workflows'" + :title="deleteButtonTitle" :pressed="showDeleted" variant="outline-primary" - @click="updateFilterValue('deleted', true)"> + @click="onToggleDeleted"> Show deleted @@ -246,8 +259,9 @@ onMounted(() => { id="show-bookmarked" v-b-tooltip.hover size="sm" - :title="!showBookmarked ? 'Show bookmarked workflows' : 'Hide bookmarked workflows'" + :title="bookmarkButtonTitle" :pressed="showBookmarked" + :disabled="showDeleted" variant="outline-primary" @click="onToggleBookmarked">