fix(container): reset sort to default when cleared (#14140)

The container list opens with name ascending but shows no sort indicator. Clearing the name sort kept the previous descending order, so two no-indicator states represented different orders. Reset the request to the default name ascending when the sort is cleared.
This commit is contained in:
Woolsen
2026-10-21 18:01:18 +08:00
committed by GitHub
parent 372855157d
commit b851c84290
@@ -540,14 +540,15 @@ const portsDialogContainer = ref('');
const portFilter = ref('');
const showIPv6Ports = ref(true);
const selects = ref<any>([]);
const defaultSort = { prop: 'name', order: 'ascending' };
const paginationConfig = reactive({
cacheSizeKey: 'container-page-size',
currentPage: 1,
pageSize: Number(localStorage.getItem('container-page-size')) || 20,
total: 0,
state: 'all',
orderBy: 'name',
order: 'ascending',
orderBy: defaultSort.prop,
order: defaultSort.order,
});
const searchName = ref();
useSearchReset({ search: searchName, page: toRef(paginationConfig, 'currentPage') }, { onRevisit: () => search() });
@@ -723,8 +724,10 @@ const search = async (column?: any) => {
}
localStorage.setItem('includeAppStore', includeAppStore.value ? 'true' : 'false');
let filterItem = (router.currentRoute.value.query?.filters as string) || '';
paginationConfig.orderBy = column?.order ? column.prop : paginationConfig.orderBy;
paginationConfig.order = column?.order ? column.order : paginationConfig.order;
if (column) {
paginationConfig.orderBy = column.order ? column.prop : defaultSort.prop;
paginationConfig.order = column.order || defaultSort.order;
}
let params = {
name: searchName.value,
state: paginationConfig.state || 'all',