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