Refactor filter status values to use string type (#7873)

#### What type of PR is this?

/area ui
/kind bug
/milestone 2.22.x

#### What this PR does / why we need it:

Fix comment and plugin list filtering not working correctly

This issue might have been caused by the VueUse dependency upgrade in #7819.

#### Does this PR introduce a user-facing change?

```release-note
None
```
This commit is contained in:
Ryan Wang
2025-10-27 20:46:16 +08:00
committed by GitHub
parent 40a7785c58
commit 7fcec8fd0b
4 changed files with 12 additions and 24 deletions

View File

@@ -36,14 +36,7 @@ const pluginInstallationModalVisible = ref(false);
const keyword = useRouteQuery<string>("keyword", "");
const selectedEnabledValue = useRouteQuery<
string | undefined,
boolean | undefined
>("enabled", undefined, {
transform: (value) => {
return value ? value === "true" : undefined;
},
});
const selectedEnabledValue = useRouteQuery<string | undefined>("enabled");
const selectedSortValue = useRouteQuery<string | undefined>("sort");
const hasFilters = computed(() => {
@@ -64,7 +57,9 @@ const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
page: 0,
size: 0,
keyword: keyword.value,
enabled: selectedEnabledValue.value,
enabled: selectedEnabledValue.value
? JSON.parse(selectedEnabledValue.value)
: undefined,
sort: [selectedSortValue.value].filter(Boolean) as string[],
});
@@ -251,11 +246,11 @@ onMounted(() => {
},
{
label: t('core.plugin.filters.status.items.active'),
value: true,
value: 'true',
},
{
label: t('core.plugin.filters.status.items.inactive'),
value: false,
value: 'false',
},
]"
/>