mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-01 07:42:52 +00:00
fix: correct services and instances when changing page numbers (#409)
This commit is contained in:
parent
3c8b316b76
commit
d9f819d143
@ -67,8 +67,9 @@ limitations under the License. -->
|
||||
<el-pagination
|
||||
class="pagination flex-h"
|
||||
layout="prev, pager, next"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="pods.length"
|
||||
:total="searchText ? pods.filter((d: any) => d.label.includes(searchText)).length : pods.length"
|
||||
@current-change="changePage"
|
||||
@prev-click="changePage"
|
||||
@next-click="changePage"
|
||||
@ -122,6 +123,7 @@ limitations under the License. -->
|
||||
const dashboardStore = useDashboardStore();
|
||||
const chartLoading = ref<boolean>(false);
|
||||
const instances = ref<Instance[]>([]); // current instances
|
||||
const currentPage = ref<number>(1);
|
||||
const pageSize = 10;
|
||||
const searchText = ref<string>("");
|
||||
const colMetrics = ref<string[]>([]);
|
||||
@ -213,18 +215,22 @@ limitations under the License. -->
|
||||
}
|
||||
|
||||
function changePage(pageIndex: number) {
|
||||
instances.value = pods.value.filter((d: unknown, index: number) => {
|
||||
if (index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize) {
|
||||
return d;
|
||||
}
|
||||
});
|
||||
let podList = pods.value;
|
||||
if (searchText.value) {
|
||||
podList = pods.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||
}
|
||||
instances.value = podList.filter(
|
||||
(_, index: number) => index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize,
|
||||
);
|
||||
queryInstanceMetrics(instances.value);
|
||||
currentPage.value = pageIndex;
|
||||
}
|
||||
|
||||
function searchList() {
|
||||
const searchInstances = pods.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||
instances.value = searchInstances.filter((d: unknown, index: number) => index < pageSize);
|
||||
instances.value = searchInstances.filter((_, index: number) => index < pageSize);
|
||||
queryInstanceMetrics(instances.value);
|
||||
currentPage.value = 1;
|
||||
}
|
||||
|
||||
watch(
|
||||
|
@ -60,8 +60,9 @@ limitations under the License. -->
|
||||
<el-pagination
|
||||
class="pagination flex-h"
|
||||
layout="prev, pager, next"
|
||||
:current-page="currentPage"
|
||||
:page-size="pageSize"
|
||||
:total="selectorStore.services.length"
|
||||
:total="searchText ? sortServices.filter((d: any) => d.label.includes(searchText)).length : sortServices.length"
|
||||
@current-change="changePage"
|
||||
@prev-click="changePage"
|
||||
@next-click="changePage"
|
||||
@ -112,6 +113,7 @@ limitations under the License. -->
|
||||
const dashboardStore = useDashboardStore();
|
||||
const appStore = useAppStoreWithOut();
|
||||
const chartLoading = ref<boolean>(false);
|
||||
const currentPage = ref<number>(1);
|
||||
const pageSize = 10;
|
||||
const services = ref<Service[]>([]);
|
||||
const colMetrics = ref<string[]>([]);
|
||||
@ -248,18 +250,24 @@ limitations under the License. -->
|
||||
return { rowspan: groups.value[param.row.group], colspan: 1 };
|
||||
}
|
||||
function changePage(pageIndex: number) {
|
||||
const arr = sortServices.value.filter((d: Service, index: number) => {
|
||||
let services = sortServices.value;
|
||||
if (searchText.value) {
|
||||
services = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||
}
|
||||
const arr = services.filter((d: Service, index: number) => {
|
||||
if (index >= (pageIndex - 1) * pageSize && index < pageSize * pageIndex) {
|
||||
return d;
|
||||
}
|
||||
});
|
||||
|
||||
setServices(arr);
|
||||
currentPage.value = pageIndex;
|
||||
}
|
||||
function searchList() {
|
||||
const searchServices = sortServices.value.filter((d: { label: string }) => d.label.includes(searchText.value));
|
||||
const services = searchServices.filter((d: unknown, index: number) => index < pageSize);
|
||||
const services = searchServices.filter((_, index: number) => index < pageSize);
|
||||
setServices(services);
|
||||
currentPage.value = 1;
|
||||
}
|
||||
|
||||
watch(
|
||||
|
Loading…
Reference in New Issue
Block a user