mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 04:54:09 +00:00
update instance and endpoint list
This commit is contained in:
parent
f0df3f2944
commit
04377173fa
@ -117,7 +117,7 @@ const selectorStore = useSelectorStore();
|
||||
const dashboardStore = useDashboardStore();
|
||||
const chartLoading = ref<boolean>(false);
|
||||
const endpoints = ref<Endpoint[]>([]);
|
||||
const pageSize = 15;
|
||||
const pageSize = 10;
|
||||
const searchText = ref<string>("");
|
||||
|
||||
queryEndpoints();
|
||||
@ -133,8 +133,10 @@ async function queryEndpoints() {
|
||||
ElMessage.error(resp.errors);
|
||||
return;
|
||||
}
|
||||
endpoints.value = selectorStore.pods.splice(0, pageSize);
|
||||
await queryEndpointMetrics(endpoints.value);
|
||||
endpoints.value = selectorStore.pods.filter(
|
||||
(d: unknown, index: number) => index < pageSize
|
||||
);
|
||||
queryEndpointMetrics(endpoints.value);
|
||||
}
|
||||
async function queryEndpointMetrics(currentPods: Endpoint[]) {
|
||||
if (!currentPods.length) {
|
||||
@ -179,10 +181,11 @@ function clickEndpoint(scope: any) {
|
||||
);
|
||||
}
|
||||
function changePage(pageIndex: number) {
|
||||
endpoints.value = selectorStore.pods.splice(
|
||||
(pageIndex - 1 || 0) * pageSize,
|
||||
pageSize * (pageIndex || 1)
|
||||
endpoints.value = selectorStore.pods.filter(
|
||||
(d: unknown, index: number) =>
|
||||
index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize
|
||||
);
|
||||
queryEndpointMetrics(endpoints.value);
|
||||
}
|
||||
async function searchList() {
|
||||
await queryEndpoints();
|
||||
|
@ -90,7 +90,7 @@ limitations under the License. -->
|
||||
small
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="searchInstances.length"
|
||||
:total="selectorStore.pods.length"
|
||||
@current-change="changePage"
|
||||
@prev-click="changePage"
|
||||
@next-click="changePage"
|
||||
@ -142,8 +142,7 @@ const selectorStore = useSelectorStore();
|
||||
const dashboardStore = useDashboardStore();
|
||||
const chartLoading = ref<boolean>(false);
|
||||
const instances = ref<Instance[]>([]); // current instances
|
||||
const searchInstances = ref<Instance[]>([]); // all instances
|
||||
const pageSize = 15;
|
||||
const pageSize = 10;
|
||||
const searchText = ref<string>("");
|
||||
|
||||
queryInstance();
|
||||
@ -154,12 +153,12 @@ async function queryInstance() {
|
||||
chartLoading.value = false;
|
||||
if (resp && resp.errors) {
|
||||
ElMessage.error(resp.errors);
|
||||
searchInstances.value = [];
|
||||
instances.value = [];
|
||||
return;
|
||||
}
|
||||
searchInstances.value = selectorStore.pods;
|
||||
instances.value = searchInstances.value.splice(0, pageSize);
|
||||
instances.value = selectorStore.pods.filter(
|
||||
(d: unknown, index: number) => index < pageSize
|
||||
);
|
||||
queryInstanceMetrics(instances.value);
|
||||
}
|
||||
|
||||
@ -209,14 +208,21 @@ function clickInstance(scope: any) {
|
||||
}
|
||||
|
||||
function changePage(pageIndex: number) {
|
||||
instances.value = searchInstances.value.splice(pageIndex - 1, pageSize);
|
||||
instances.value = selectorStore.pods.filter(
|
||||
(d: unknown, index: number) =>
|
||||
index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize
|
||||
);
|
||||
queryInstanceMetrics(instances.value);
|
||||
}
|
||||
|
||||
function searchList() {
|
||||
searchInstances.value = selectorStore.pods.filter((d: { label: string }) =>
|
||||
const searchInstances = selectorStore.pods.filter((d: { label: string }) =>
|
||||
d.label.includes(searchText.value)
|
||||
);
|
||||
instances.value = searchInstances.value.splice(0, pageSize);
|
||||
instances.value = searchInstances.filter(
|
||||
(d: unknown, index: number) => index < pageSize
|
||||
);
|
||||
queryInstanceMetrics(instances.value);
|
||||
}
|
||||
|
||||
function getUnit(index: number) {
|
||||
|
Loading…
Reference in New Issue
Block a user