Skip to content

Commit

Permalink
Merge pull request #18103 from itisAliRH/workflow-bookmark-deleted
Browse files Browse the repository at this point in the history
Hide bookmark toggle on deleted workflows
  • Loading branch information
mvdbeek authored May 7, 2024
2 parents dfb4931 + 966c3b4 commit 3611778
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Workflow/WorkflowActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async function onDelete() {
const actions: ComputedRef<(AAction | BAction)[]> = computed(() => {
return [
{
condition: !shared.value && !props.workflow.show_in_tool_panel,
condition: !props.workflow.deleted && !shared.value && !props.workflow.show_in_tool_panel,
class: "workflow-bookmark-button-add",
component: "async",
title: "Add bookmarks",
Expand All @@ -137,7 +137,7 @@ const actions: ComputedRef<(AAction | BAction)[]> = computed(() => {
action: () => onToggleBookmark(true),
},
{
condition: !shared.value && props.workflow.show_in_tool_panel,
condition: !props.workflow.deleted && !shared.value && props.workflow.show_in_tool_panel,
class: "workflow-bookmark-button-remove",
component: "async",
title: "Remove bookmark",
Expand Down
22 changes: 18 additions & 4 deletions client/src/components/Workflow/WorkflowList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down Expand Up @@ -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">
<FontAwesomeIcon :icon="faTrash" fixed-width />
Show deleted
</BButton>
Expand All @@ -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">
<FontAwesomeIcon :icon="faStar" fixed-width />
Expand Down

0 comments on commit 3611778

Please sign in to comment.