diff --git a/src/hooks/useListConfig.ts b/src/hooks/useListConfig.ts
index e48e9edd..47e7269e 100644
--- a/src/hooks/useListConfig.ts
+++ b/src/hooks/useListConfig.ts
@@ -15,16 +15,17 @@
* limitations under the License.
*/
import { MetricQueryTypes, Calculations } from "./data";
-export function useListConfig(config: any, index: number) {
+export function useListConfig(config: any, index: string) {
+ const i = Number(index);
const calculation =
config.metricConfig &&
- config.metricConfig[index] &&
- config.metricConfig[index].calculation;
+ config.metricConfig[i] &&
+ config.metricConfig[i].calculation;
const line =
- config.metricTypes[index] === MetricQueryTypes.ReadMetricsValues &&
+ config.metricTypes[i] === MetricQueryTypes.ReadMetricsValues &&
calculation !== Calculations.Average;
const isAvg =
- config.metricTypes[index] === MetricQueryTypes.ReadMetricsValues &&
+ config.metricTypes[i] === MetricQueryTypes.ReadMetricsValues &&
calculation === Calculations.Average;
return {
isLinear: line,
diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue
index c43c7827..9bc86313 100644
--- a/src/views/dashboard/graphs/EndpointList.vue
+++ b/src/views/dashboard/graphs/EndpointList.vue
@@ -42,34 +42,11 @@ limitations under the License. -->
-
-
-
-
-
-
-
-
+
@@ -83,13 +60,11 @@ import { EndpointListConfig } from "@/types/dashboard";
import { Endpoint } from "@/types/selector";
import { useDashboardStore } from "@/store/modules/dashboard";
import { useQueryPodsMetrics, usePodsSource } from "@/hooks/useProcessor";
-import { useListConfig } from "@/hooks/useListConfig";
-import Line from "./Line.vue";
-import Card from "./Card.vue";
import { EntityType } from "../data";
import router from "@/router";
import getDashboard from "@/hooks/useDashboardsSession";
import { MetricConfigOpt } from "@/types/dashboard";
+import MetricGraph from "./components/MetricGraph.vue";
/*global defineProps */
const props = defineProps({
@@ -185,26 +160,6 @@ function clickEndpoint(scope: any) {
async function searchList() {
await queryEndpoints();
}
-function getUnit(index: number) {
- const u =
- props.config.metricConfig &&
- props.config.metricConfig[index] &&
- props.config.metricConfig[index].unit;
- if (u) {
- return `(${encodeURIComponent(u)})`;
- }
- return encodeURIComponent("");
-}
-function getLabel(metric: string, index: number) {
- const label =
- props.config.metricConfig &&
- props.config.metricConfig[index] &&
- props.config.metricConfig[index].label;
- if (label) {
- return encodeURIComponent(label);
- }
- return encodeURIComponent(metric);
-}
watch(
() => [...(props.config.metricTypes || []), ...(props.config.metrics || [])],
(data, old) => {
diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue
index 94dd0716..8a572eb2 100644
--- a/src/views/dashboard/graphs/InstanceList.vue
+++ b/src/views/dashboard/graphs/InstanceList.vue
@@ -42,35 +42,11 @@ limitations under the License. -->
-
-
-
-
-
-
-
-
+
@@ -110,8 +86,6 @@ import { ref, watch, computed } from "vue";
import { useI18n } from "vue-i18n";
import { ElMessage } from "element-plus";
import type { PropType } from "vue";
-import Line from "./Line.vue";
-import Card from "./Card.vue";
import { useSelectorStore } from "@/store/modules/selectors";
import { useDashboardStore } from "@/store/modules/dashboard";
import { InstanceListConfig } from "@/types/dashboard";
@@ -121,7 +95,7 @@ import { EntityType } from "../data";
import router from "@/router";
import getDashboard from "@/hooks/useDashboardsSession";
import { MetricConfigOpt } from "@/types/dashboard";
-import { useListConfig } from "@/hooks/useListConfig";
+import MetricGraph from "./components/MetricGraph.vue";
/*global defineProps */
const props = defineProps({
@@ -237,28 +211,6 @@ function searchList() {
queryInstanceMetrics(instances.value);
}
-function getUnit(index: number) {
- const u =
- props.config.metricConfig &&
- props.config.metricConfig[index] &&
- props.config.metricConfig[index].unit;
- if (u) {
- return `(${encodeURIComponent(u)})`;
- }
- return encodeURIComponent("");
-}
-
-function getLabel(metric: string, index: number) {
- const label =
- props.config.metricConfig &&
- props.config.metricConfig[index] &&
- props.config.metricConfig[index].label;
- if (label) {
- return encodeURIComponent(label);
- }
- return encodeURIComponent(metric);
-}
-
watch(
() => [...(props.config.metricTypes || []), ...(props.config.metrics || [])],
(data, old) => {
diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue
index c8e53466..6fa5634d 100644
--- a/src/views/dashboard/graphs/ServiceList.vue
+++ b/src/views/dashboard/graphs/ServiceList.vue
@@ -54,74 +54,11 @@ limitations under the License. -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
[...(props.config.metricTypes || []), ...(props.config.metrics || [])],
@@ -360,35 +275,7 @@ watch(
diff --git a/src/views/dashboard/graphs/components/MetricGraph.vue b/src/views/dashboard/graphs/components/MetricGraph.vue
new file mode 100644
index 00000000..7801f6e4
--- /dev/null
+++ b/src/views/dashboard/graphs/components/MetricGraph.vue
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+