diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue
index c88b25be..55d0b35c 100644
--- a/src/views/dashboard/configuration/widget/metric/Index.vue
+++ b/src/views/dashboard/configuration/widget/metric/Index.vue
@@ -26,23 +26,43 @@ limitations under the License. -->
/>
{{ t("metrics") }}
+
-
-
+ placeholder="Please input a expression"
+ @change="changeExpression"
+ /> -->
+
+ {{ metric }}
+
+
+
+
+
@@ -51,7 +71,12 @@ limitations under the License. -->
-
+
PodsChartTypes,
MetricsType,
ProtocolTypes,
+ ExpressionResultType,
} from "../../../data";
import { ElMessage } from "element-plus";
import Icon from "@/components/Icon.vue";
@@ -104,6 +130,7 @@ limitations under the License. -->
const metrics = computed(() => dashboardStore.selectedGrid.metrics || []);
const graph = computed(() => dashboardStore.selectedGrid.graph || {});
const metricTypes = computed(() => dashboardStore.selectedGrid.metricTypes || []);
+ const isExpression = ref(dashboardStore.selectedGrid.metricMode === "Expression" ? true : false);
const states = reactive<{
metrics: string[];
metricTypes: string[];
@@ -393,6 +420,18 @@ limitations under the License. -->
...dashboardStore.selectedGrid.metricConfig[index],
};
}
+ function changeMetricMode() {
+ console.log(isExpression.value);
+ dashboardStore.selectWidget({
+ ...dashboardStore.selectedGrid,
+ metricMode: isExpression.value ? "Expression" : "General",
+ });
+ }
+ function changeExpression(event: any, index: number) {
+ const params = event.target.textContent;
+ states.metrics[index] = params;
+ // states.metricTypes[index] =
+ }
diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts
index 3e68f50e..3e50cf84 100644
--- a/src/views/dashboard/data.ts
+++ b/src/views/dashboard/data.ts
@@ -56,6 +56,15 @@ export enum ProtocolTypes {
ReadMetricsValues = "readMetricsValues",
ReadMetricsValue = "readMetricsValue",
}
+
+export enum ExpressionResultType {
+ UNKNOWN = "UNKNOWN",
+ SINGLE_VALUE = "SINGLE_VALUE",
+ TIME_SERIES_VALUES = "TIME_SERIES_VALUES",
+ SORTED_LIST = "SORTED_LIST",
+ RECORD_LIST = "RECORD_LIST",
+}
+
export const DefaultGraphConfig: { [key: string]: any } = {
Bar: {
type: "Bar",
diff --git a/src/views/dashboard/graphs/Bar.vue b/src/views/dashboard/graphs/Bar.vue
index 302c4c69..98c2bd02 100644
--- a/src/views/dashboard/graphs/Bar.vue
+++ b/src/views/dashboard/graphs/Bar.vue
@@ -23,6 +23,7 @@ limitations under the License. -->
import type { PropType } from "vue";
import type { BarConfig, EventParams, RelatedTrace, Filters } from "@/types/dashboard";
import useLegendProcess from "@/hooks/useLegendProcessor";
+ import Legend from "./components/Legend.vue";
/*global defineProps, defineEmits */
const emits = defineEmits(["click"]);