From fe28fae27d05743e4bb956bba8217daf6bcd8f42 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Mon, 15 May 2023 10:52:54 +0800 Subject: [PATCH] fix: pod list (#266) --- src/views/dashboard/graphs/EndpointList.vue | 2 +- src/views/dashboard/graphs/InstanceList.vue | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 87f4bee4..7cc95035 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -113,7 +113,7 @@ limitations under the License. --> ElMessage.error(resp.errors); return; } - endpoints.value = selectorStore.pods; + endpoints.value = resp.data.pods || []; queryEndpointMetrics(endpoints.value); } async function queryEndpointMetrics(currentPods: Endpoint[]) { diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue index 71a5b7c2..0be09631 100644 --- a/src/views/dashboard/graphs/InstanceList.vue +++ b/src/views/dashboard/graphs/InstanceList.vue @@ -70,7 +70,7 @@ limitations under the License. --> small layout="prev, pager, next" :page-size="pageSize" - :total="selectorStore.pods.length" + :total="pods.length" @current-change="changePage" @prev-click="changePage" @next-click="changePage" @@ -125,6 +125,7 @@ limitations under the License. --> const colMetrics = ref([]); const metricConfig = ref(props.config.metricConfig || []); const metricTypes = ref(props.config.metricTypes || []); + const pods = ref([]); // all instances if (props.needQuery) { queryInstance(); } @@ -137,9 +138,11 @@ limitations under the License. --> if (resp && resp.errors) { ElMessage.error(resp.errors); instances.value = []; + pods.value = []; return; } - instances.value = selectorStore.pods.filter((d: unknown, index: number) => index < pageSize); + pods.value = resp.data.pods || []; + instances.value = pods.value.filter((d: unknown, index: number) => index < pageSize); queryInstanceMetrics(instances.value); } @@ -189,7 +192,7 @@ limitations under the License. --> } function changePage(pageIndex: number) { - instances.value = selectorStore.pods.filter((d: unknown, index: number) => { + instances.value = pods.value.filter((d: unknown, index: number) => { if (index >= (pageIndex - 1) * pageSize && index < pageIndex * pageSize) { return d; } @@ -198,7 +201,7 @@ limitations under the License. --> } function searchList() { - const searchInstances = selectorStore.pods.filter((d: { label: string }) => d.label.includes(searchText.value)); + const searchInstances = pods.value.filter((d: { label: string }) => d.label.includes(searchText.value)); instances.value = searchInstances.filter((d: unknown, index: number) => index < pageSize); queryInstanceMetrics(instances.value); }