diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue
index 402cf111..84fc4177 100644
--- a/src/views/dashboard/configuration/Widget.vue
+++ b/src/views/dashboard/configuration/Widget.vue
@@ -36,7 +36,7 @@ limitations under the License. -->
i: dashboardStore.selectedGrid.i,
metrics: dashboardStore.selectedGrid.metrics,
metricTypes: dashboardStore.selectedGrid.metricTypes,
- standard: dashboardStore.selectedGrid.standard,
+ metricConfig: dashboardStore.selectedGrid.metricConfig,
}"
:isEdit="isEdit"
@changeOpt="setStatus"
diff --git a/src/views/dashboard/configuration/widget/metric/Standard.vue b/src/views/dashboard/configuration/widget/metric/Standard.vue
index 1569b262..560a6cf8 100644
--- a/src/views/dashboard/configuration/widget/metric/Standard.vue
+++ b/src/views/dashboard/configuration/widget/metric/Standard.vue
@@ -31,7 +31,7 @@ limitations under the License. -->
/>
- {{ t("metricLabel") }}
+ {{ t("labels") }}
size="small"
placeholder="Select a option"
@change="changeConfigs(index, { calculation: $event[0].value })"
- class="aggregation"
+ class="selectors"
:clearable="true"
/>
@@ -71,7 +71,7 @@ limitations under the License. -->
:options="SortOrder"
size="small"
placeholder="Select a sort order"
- class="aggregation"
+ class="selectors"
@change="changeConfigs(index, { sortOrder: $event[0].value })"
/>
@@ -130,7 +130,7 @@ function closePopper() {
right: -15px;
}
-.aggregation {
+.selectors {
width: 365px;
}
diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue
index cffb9621..2d71bf22 100644
--- a/src/views/dashboard/controls/Widget.vue
+++ b/src/views/dashboard/controls/Widget.vue
@@ -64,8 +64,8 @@ limitations under the License. -->
metrics: data.metrics,
metricTypes: data.metricTypes,
i: data.i,
+ metricConfig: data.metricConfig,
}"
- :standard="data.metricConfig"
:needQuery="needQuery"
/>
diff --git a/src/views/dashboard/graphs/Card.vue b/src/views/dashboard/graphs/Card.vue
index 58baa321..cff1a47f 100644
--- a/src/views/dashboard/graphs/Card.vue
+++ b/src/views/dashboard/graphs/Card.vue
@@ -26,11 +26,13 @@ limitations under the License. -->
? null
: singleVal.toFixed(2)
}}
- {{ standard.unit }}
+
+ {{ m.unit }}
+
diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue
index a8d4c35b..442d0062 100644
--- a/src/views/dashboard/graphs/EndpointList.vue
+++ b/src/views/dashboard/graphs/EndpointList.vue
@@ -92,6 +92,7 @@ import Card from "./Card.vue";
import { EntityType } from "../data";
import router from "@/router";
import getDashboard from "@/hooks/useDashboardsSession";
+import { MetricConfigOpt } from "@/types/dashboard";
/*global defineProps */
const props = defineProps({
@@ -104,7 +105,7 @@ const props = defineProps({
i: string;
metrics: string[];
metricTypes: string[];
- }
+ } & { metricConfig: MetricConfigOpt[] }
>,
default: () => ({ dashboardName: "", fontSize: 12, i: "" }),
},
@@ -119,6 +120,7 @@ const endpoints = ref([]);
const pageSize = 5;
const total = 10;
const searchText = ref("");
+const metricConfig = ref(props.config.metricConfig || []);
queryEndpoints(total);
@@ -155,7 +157,10 @@ async function queryEndpointMetrics(currentPods: Endpoint[]) {
ElMessage.error(json.errors);
return;
}
- endpoints.value = usePodsSource(currentPods, json, props.config);
+ endpoints.value = usePodsSource(currentPods, json, {
+ ...props.config,
+ metricConfig: metricConfig.value,
+ });
return;
}
endpoints.value = currentPods;
diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue
index b2c7aa7d..8799c645 100644
--- a/src/views/dashboard/graphs/InstanceList.vue
+++ b/src/views/dashboard/graphs/InstanceList.vue
@@ -112,6 +112,7 @@ import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor";
import { EntityType } from "../data";
import router from "@/router";
import getDashboard from "@/hooks/useDashboardsSession";
+import { MetricConfigOpt } from "@/types/dashboard";
/*global defineProps */
const props = defineProps({
@@ -122,7 +123,7 @@ const props = defineProps({
metrics: string[];
metricTypes: string[];
isEdit: boolean;
- }
+ } & { metricConfig: MetricConfigOpt[] }
>,
default: () => ({
dashboardName: "",
@@ -144,6 +145,7 @@ const instances = ref([]); // current instances
const searchInstances = ref([]); // all instances
const pageSize = 5;
const searchText = ref("");
+const metricConfig = ref(props.config.metricConfig || []);
queryInstance();
async function queryInstance() {
@@ -180,7 +182,10 @@ async function queryInstanceMetrics(currentInstances: Instance[]) {
ElMessage.error(json.errors);
return;
}
- instances.value = usePodsSource(currentInstances, json, props.config);
+ instances.value = usePodsSource(currentInstances, json, {
+ ...props.config,
+ metricConfig: metricConfig.value,
+ });
return;
}
instances.value = currentInstances;
diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue
index 64cdea8a..2aea5d2f 100644
--- a/src/views/dashboard/graphs/ServiceList.vue
+++ b/src/views/dashboard/graphs/ServiceList.vue
@@ -118,16 +118,12 @@ const props = defineProps({
metrics: string[];
metricTypes: string[];
isEdit: boolean;
- }
+ } & { metricConfig: MetricConfigOpt[] }
>,
default: () => ({ dashboardName: "", fontSize: 12 }),
},
intervalTime: { type: Array as PropType, default: () => [] },
isEdit: { type: Boolean, default: false },
- standard: {
- type: Object as PropType,
- default: () => ({ unit: "" }),
- },
});
const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore();
@@ -137,6 +133,7 @@ const services = ref([]);
const searchText = ref("");
const groups = ref({});
const sortServices = ref<(Service & { merge: boolean })[]>([]);
+const metricConfig = ref(props.config.metricConfig || []);
queryServices();
@@ -206,7 +203,7 @@ async function queryServiceMetrics(currentServices: Service[]) {
return;
}
const { metrics } = props.config;
- console.log(props.config);
+
if (metrics.length && metrics[0]) {
const params = await useQueryPodsMetrics(
currentServices,
@@ -221,7 +218,7 @@ async function queryServiceMetrics(currentServices: Service[]) {
}
services.value = usePodsSource(currentServices, json, {
...props.config,
- metricConfig: props.standard || [],
+ metricConfig: metricConfig.value || [],
});
return;
}