mirror of https://github.com/halo-dev/halo
refactor: remove the pagination feature of plugin management (#4473)
#### What type of PR is this? /area console /kind improvement /milestone 2.9.x #### What this PR does / why we need it: 移除插件管理列表的分页功能,默认列表出所有安装的插件。 #### Which issue(s) this PR fixes: Fixes #4469 #### Does this PR introduce a user-facing change? ```release-note 移除 Console 端插件管理列表的分页功能,默认列表出所有安装的插件。 ```pull/4482/head^2
parent
401c3c79ce
commit
138ffde7e2
|
@ -7,7 +7,6 @@ import {
|
|||
VCard,
|
||||
VEmpty,
|
||||
VPageHeader,
|
||||
VPagination,
|
||||
VSpace,
|
||||
VLoading,
|
||||
Dialog,
|
||||
|
@ -21,10 +20,8 @@ import { useQuery } from "@tanstack/vue-query";
|
|||
import type { Plugin } from "@halo-dev/api-client";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRouteQuery } from "@vueuse/router";
|
||||
import { watch } from "vue";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const { currentUserHasPermission } = usePermission();
|
||||
|
||||
const pluginInstallationModal = ref(false);
|
||||
|
@ -36,9 +33,6 @@ function handleOpenUploadModal(plugin?: Plugin) {
|
|||
}
|
||||
|
||||
const keyword = ref("");
|
||||
const page = ref(1);
|
||||
const size = ref(20);
|
||||
const total = ref(0);
|
||||
|
||||
const selectedEnabledValue = ref();
|
||||
const selectedSortValue = ref();
|
||||
|
@ -52,33 +46,16 @@ function handleClearFilters() {
|
|||
selectedEnabledValue.value = undefined;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [selectedEnabledValue.value, selectedSortValue.value, keyword.value],
|
||||
() => {
|
||||
page.value = 1;
|
||||
}
|
||||
);
|
||||
|
||||
const { data, isLoading, isFetching, refetch } = useQuery<Plugin[]>({
|
||||
queryKey: [
|
||||
"plugins",
|
||||
page,
|
||||
size,
|
||||
keyword,
|
||||
selectedEnabledValue,
|
||||
selectedSortValue,
|
||||
],
|
||||
queryKey: ["plugins", keyword, selectedEnabledValue, selectedSortValue],
|
||||
queryFn: async () => {
|
||||
const { data } = await apiClient.plugin.listPlugins({
|
||||
page: page.value,
|
||||
size: size.value,
|
||||
page: 0,
|
||||
size: 0,
|
||||
keyword: keyword.value,
|
||||
enabled: selectedEnabledValue.value,
|
||||
sort: [selectedSortValue.value].filter(Boolean) as string[],
|
||||
});
|
||||
|
||||
total.value = data.total;
|
||||
|
||||
return data.items;
|
||||
},
|
||||
keepPreviousData: true,
|
||||
|
@ -251,20 +228,6 @@ onMounted(() => {
|
|||
</li>
|
||||
</ul>
|
||||
</Transition>
|
||||
|
||||
<template #footer>
|
||||
<VPagination
|
||||
v-model:page="page"
|
||||
v-model:size="size"
|
||||
:page-label="$t('core.components.pagination.page_label')"
|
||||
:size-label="$t('core.components.pagination.size_label')"
|
||||
:total-label="
|
||||
$t('core.components.pagination.total_label', { total: total })
|
||||
"
|
||||
:total="total"
|
||||
:size-options="[10, 20, 30, 50, 100]"
|
||||
/>
|
||||
</template>
|
||||
</VCard>
|
||||
</div>
|
||||
</template>
|
||||
|
|
Loading…
Reference in New Issue