mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决系统分页错误问题
This commit is contained in:
parent
41be181c7d
commit
b1c2c4be83
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -67,6 +68,9 @@ func (u *ContainerService) Page(req dto.PageContainer) (int64, interface{}, erro
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
sort.Slice(list, func(i, j int) bool {
|
||||
return list[i].Created > list[j].Created
|
||||
})
|
||||
total, start, end := len(list), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
||||
if start > total {
|
||||
records = make([]types.Container, 0)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -96,6 +97,9 @@ func (u *ContainerService) PageCompose(req dto.PageInfo) (int64, interface{}, er
|
||||
value.Name = key
|
||||
records = append(records, value)
|
||||
}
|
||||
sort.Slice(records, func(i, j int) bool {
|
||||
return records[i].CreatedAt > records[j].CreatedAt
|
||||
})
|
||||
total, start, end := len(records), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
||||
if start > total {
|
||||
BackDatas = make([]dto.ComposeInfo, 0)
|
||||
|
@ -3,6 +3,7 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/backend/utils/docker"
|
||||
@ -23,6 +24,9 @@ func (u *ContainerService) PageNetwork(req dto.PageInfo) (int64, interface{}, er
|
||||
data []dto.Network
|
||||
records []types.NetworkResource
|
||||
)
|
||||
sort.Slice(list, func(i, j int) bool {
|
||||
return list[i].Created.Before(list[j].Created)
|
||||
})
|
||||
total, start, end := len(list), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
||||
if start > total {
|
||||
records = make([]types.NetworkResource, 0)
|
||||
|
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||
@ -24,6 +25,9 @@ func (u *ContainerService) PageVolume(req dto.PageInfo) (int64, interface{}, err
|
||||
data []dto.Volume
|
||||
records []*types.Volume
|
||||
)
|
||||
sort.Slice(list.Volumes, func(i, j int) bool {
|
||||
return list.Volumes[i].CreatedAt > list.Volumes[j].CreatedAt
|
||||
})
|
||||
total, start, end := len(list.Volumes), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
||||
if start > total {
|
||||
records = make([]*types.Volume, 0)
|
||||
|
@ -134,7 +134,7 @@ const acceptParams = (props: DialogProps): void => {
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -144,7 +144,7 @@ const loading = ref(false);
|
||||
const search = async () => {
|
||||
let filterItem = filters.value;
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
filters: filterItem,
|
||||
};
|
||||
|
@ -73,14 +73,14 @@ const loading = ref(false);
|
||||
const isOnDetail = ref(false);
|
||||
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const search = async () => {
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
loading.value = true;
|
||||
|
@ -96,7 +96,7 @@ import i18n from '@/lang';
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -117,7 +117,7 @@ const dialogReNameRef = ref();
|
||||
const search = async () => {
|
||||
let filterItem = props.filters ? props.filters : '';
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
filters: filterItem,
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ const data = ref();
|
||||
const repos = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -120,13 +120,11 @@ const deleteForm = reactive({
|
||||
|
||||
const search = async () => {
|
||||
const repoSearch = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
await searchImage(repoSearch).then((res) => {
|
||||
if (res.data) {
|
||||
data.value = res.data.items;
|
||||
}
|
||||
data.value = res.data.items || [];
|
||||
paginationConfig.total = res.data.total;
|
||||
});
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ const codemirror = ref();
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -88,16 +88,14 @@ function selectable(row) {
|
||||
|
||||
const search = async () => {
|
||||
const params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
await searchNetwork(params).then((res) => {
|
||||
if (res.data) {
|
||||
data.value = res.data.items;
|
||||
data.value = res.data.items || [];
|
||||
for (const item of data.value) {
|
||||
item.isSystem = isSystem(item.name);
|
||||
}
|
||||
}
|
||||
paginationConfig.total = res.data.total;
|
||||
});
|
||||
};
|
||||
|
@ -47,14 +47,14 @@ import i18n from '@/lang';
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const search = async () => {
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
await searchImageRepo(params).then((res) => {
|
||||
|
@ -85,20 +85,19 @@ const detailInfo = ref();
|
||||
const extensions = [javascript(), oneDark];
|
||||
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
|
||||
const search = async () => {
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
await searchComposeTemplate(params).then((res) => {
|
||||
if (res.data) {
|
||||
data.value = res.data.items;
|
||||
}
|
||||
data.value = res.data.items || [];
|
||||
paginationConfig.total = res.data.total;
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -57,7 +57,7 @@ const codemirror = ref();
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -73,13 +73,11 @@ const onCreate = async () => {
|
||||
|
||||
const search = async () => {
|
||||
const params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
};
|
||||
await searchVolume(params).then((res) => {
|
||||
if (res.data) {
|
||||
data.value = res.data.items;
|
||||
}
|
||||
data.value = res.data.items || [];
|
||||
paginationConfig.total = res.data.total;
|
||||
});
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ import { ElMessage } from 'element-plus';
|
||||
const data = ref();
|
||||
const selects = ref<any>([]);
|
||||
const paginationConfig = reactive({
|
||||
page: 1,
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
});
|
||||
@ -139,12 +139,12 @@ const buttons = [
|
||||
|
||||
const search = async () => {
|
||||
let params = {
|
||||
page: paginationConfig.page,
|
||||
page: paginationConfig.currentPage,
|
||||
pageSize: paginationConfig.pageSize,
|
||||
info: info.value,
|
||||
};
|
||||
const res = await getCommandPage(params);
|
||||
data.value = res.data.items;
|
||||
data.value = res.data.items || [];
|
||||
paginationConfig.total = res.data.total;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user