Skip to content

Commit

Permalink
Don't allow multiple status filters of the same value (#2325)
Browse files Browse the repository at this point in the history
* Check if status exists

* Remove allow empty
  • Loading branch information
Alex-Tideman authored Sep 12, 2024
1 parent 292196a commit 0ffe093
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/lib/components/workflow/workflow-counts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -124,25 +124,31 @@
};
const onStatusClick = (status) => {
const filter = {
attribute: 'ExecutionStatus',
type: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
value: status,
operator: '',
conditional: '=',
parenthesis: '',
};
$workflowFilters = [...$workflowFilters, filter];
const searchQuery = toListWorkflowQueryFromFilters(
combineFilters($workflowFilters),
const statusExists = $workflowFilters.some(
(filter) =>
filter.attribute === 'ExecutionStatus' && filter.value === status,
);
updateQueryParameters({
url: $page.url,
parameter: 'query',
value: searchQuery,
allowEmpty: true,
clearParameters: [currentPageKey],
});
if (!statusExists) {
const filter = {
attribute: 'ExecutionStatus',
type: SEARCH_ATTRIBUTE_TYPE.KEYWORD,
value: status,
operator: '',
conditional: '=',
parenthesis: '',
};
$workflowFilters = [...$workflowFilters, filter];
const searchQuery = toListWorkflowQueryFromFilters(
combineFilters($workflowFilters),
);
updateQueryParameters({
url: $page.url,
parameter: 'query',
value: searchQuery,
clearParameters: [currentPageKey],
});
}
};
$: query, namespace, $refresh, fetchCounts();
Expand Down

0 comments on commit 0ffe093

Please sign in to comment.