diff --git a/src/components/dialog/content/manager/registrySearchBar/RegistrySearchBar.vue b/src/components/dialog/content/manager/registrySearchBar/RegistrySearchBar.vue index 6fa1cf54fc..387a06162f 100644 --- a/src/components/dialog/content/manager/registrySearchBar/RegistrySearchBar.vue +++ b/src/components/dialog/content/manager/registrySearchBar/RegistrySearchBar.vue @@ -47,56 +47,13 @@
- +
@@ -107,8 +64,6 @@ import { stubTrue } from 'lodash' import AutoComplete, { AutoCompleteOptionSelectEvent } from 'primevue/autocomplete' -import Dropdown from 'primevue/dropdown' -import MultiSelect from 'primevue/multiselect' import { computed } from 'vue' import { useI18n } from 'vue-i18n' @@ -157,6 +112,17 @@ const searchModeOptions: SearchOption[] = [ { id: 'nodes', label: t('g.nodes') } ] +// Convert filter options to SearchOption format for SearchFilterDropdown +const availableFilterOptions = ( + filter: SearchFilter +): SearchOption[] => { + if (!filter.options) return [] + return filter.options.map((option) => ({ + id: option.value, + label: option.label + })) +} + // When a dropdown query suggestion is selected, update the search query const onOptionSelect = (event: AutoCompleteOptionSelectEvent) => { searchQuery.value = event.value.query diff --git a/src/components/dialog/content/manager/registrySearchBar/SearchFilterDropdown.vue b/src/components/dialog/content/manager/registrySearchBar/SearchFilterDropdown.vue index f91035b3cf..52b38ad315 100644 --- a/src/components/dialog/content/manager/registrySearchBar/SearchFilterDropdown.vue +++ b/src/components/dialog/content/manager/registrySearchBar/SearchFilterDropdown.vue @@ -6,6 +6,7 @@ :options="options" option-label="label" option-value="id" + placeholder="Any" class="min-w-[6rem] border-none bg-transparent shadow-none" :pt="{ input: { class: 'py-0 px-1 border-none' }, diff --git a/src/composables/useRegistrySearch.ts b/src/composables/useRegistrySearch.ts index 2bf06b10c8..d22faec4df 100644 --- a/src/composables/useRegistrySearch.ts +++ b/src/composables/useRegistrySearch.ts @@ -108,25 +108,6 @@ export function useRegistrySearch( return getFilterableFields() }) - // Initialize filters with default values when they become available - const filterOptionsInitialized = ref(false) - watch( - filterOptions, - (newOptions) => { - if (!filterOptionsInitialized.value && newOptions.length > 0) { - const defaultFilters: ActiveFilters = {} - for (const option of newOptions) { - if (option.defaultValue !== undefined) { - defaultFilters[option.id] = option.defaultValue - } - } - activeFilters.value = { ...activeFilters.value, ...defaultFilters } - filterOptionsInitialized.value = true - } - }, - { immediate: true } - ) - return { isLoading, pageNumber, diff --git a/src/types/searchServiceTypes.ts b/src/types/searchServiceTypes.ts index 030a90763e..71f0dbee39 100644 --- a/src/types/searchServiceTypes.ts +++ b/src/types/searchServiceTypes.ts @@ -16,9 +16,9 @@ export type QuerySuggestion = { export interface SearchFilter { id: string label: string - type: 'multi-select' | 'single-select' | 'boolean' + type: 'single-select' | 'boolean' options?: FilterOption[] - defaultValue?: string | string[] | boolean + defaultValue?: string | boolean } export interface FilterOption { @@ -27,7 +27,7 @@ export interface FilterOption { icon?: string } -export type ActiveFilters = Record +export type ActiveFilters = Record export interface SearchPacksResult { nodePacks: RegistryNodePack[]