mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 18:33:37 +00:00
fix pagination (#414)
This commit is contained in:
parent
1945f23419
commit
ed0ec0ac1f
@ -70,7 +70,7 @@ limitations under the License. -->
|
|||||||
:current-page="currentPage"
|
:current-page="currentPage"
|
||||||
:page-size="pageSize"
|
:page-size="pageSize"
|
||||||
:total="searchText ? pods.filter((d: any) => d.label.includes(searchText)).length : pods.length"
|
:total="searchText ? pods.filter((d: any) => d.label.includes(searchText)).length : pods.length"
|
||||||
@current-change="changePage"
|
@current-change="handleCurrentChange"
|
||||||
@prev-click="changePage"
|
@prev-click="changePage"
|
||||||
@next-click="changePage"
|
@next-click="changePage"
|
||||||
/>
|
/>
|
||||||
@ -214,16 +214,20 @@ limitations under the License. -->
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePage(pageIndex: number) {
|
function changePage() {
|
||||||
let podList = pods.value;
|
let podList = pods.value;
|
||||||
if (searchText.value) {
|
if (searchText.value) {
|
||||||
podList = pods.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
podList = pods.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||||
}
|
}
|
||||||
instances.value = podList.filter(
|
instances.value = podList.filter(
|
||||||
(_, index: number) => index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize,
|
(_, index: number) => index >= (currentPage.value - 1) * pageSize && index < currentPage.value * pageSize,
|
||||||
);
|
);
|
||||||
queryInstanceMetrics(instances.value);
|
queryInstanceMetrics(instances.value);
|
||||||
currentPage.value = pageIndex;
|
}
|
||||||
|
|
||||||
|
function handleCurrentChange(val: number) {
|
||||||
|
currentPage.value = val;
|
||||||
|
changePage();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchList() {
|
function searchList() {
|
||||||
|
@ -63,7 +63,7 @@ limitations under the License. -->
|
|||||||
:current-page="currentPage"
|
:current-page="currentPage"
|
||||||
:page-size="pageSize"
|
:page-size="pageSize"
|
||||||
:total="searchText ? sortServices.filter((d: any) => d.label.includes(searchText)).length : sortServices.length"
|
:total="searchText ? sortServices.filter((d: any) => d.label.includes(searchText)).length : sortServices.length"
|
||||||
@current-change="changePage"
|
@current-change="handleCurrentChange"
|
||||||
@prev-click="changePage"
|
@prev-click="changePage"
|
||||||
@next-click="changePage"
|
@next-click="changePage"
|
||||||
/>
|
/>
|
||||||
@ -249,19 +249,22 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
return { rowspan: groups.value[param.row.group], colspan: 1 };
|
return { rowspan: groups.value[param.row.group], colspan: 1 };
|
||||||
}
|
}
|
||||||
function changePage(pageIndex: number) {
|
function changePage() {
|
||||||
let services = sortServices.value;
|
let services = sortServices.value;
|
||||||
if (searchText.value) {
|
if (searchText.value) {
|
||||||
services = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
services = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||||
}
|
}
|
||||||
const arr = services.filter((d: Service, index: number) => {
|
const arr = services.filter((d: Service, index: number) => {
|
||||||
if (index >= (pageIndex - 1) * pageSize && index < pageSize * pageIndex) {
|
if (index >= (currentPage.value - 1) * pageSize && index < pageSize * currentPage.value) {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setServices(arr);
|
setServices(arr);
|
||||||
currentPage.value = pageIndex;
|
}
|
||||||
|
function handleCurrentChange(val: number) {
|
||||||
|
currentPage.value = val;
|
||||||
|
changePage();
|
||||||
}
|
}
|
||||||
function searchList() {
|
function searchList() {
|
||||||
const searchServices = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
const searchServices = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||||
|
Loading…
Reference in New Issue
Block a user