@@ -39,12 +41,7 @@ limitations under the License. -->
:style="{ '--el-collapse-header-font-size': '15px' }"
>
-
+
@@ -52,34 +49,20 @@ limitations under the License. -->
v-for="(type, index) in states.visType"
:key="index"
@click="changeChartType(type)"
- :class="{ active: type.value === states.graph.type }"
+ :class="{ active: type.value === selectedGrid.graph.type }"
>
{{ type.label }}
-
+
-
+
-
+
@@ -106,7 +89,6 @@ import {
EntityType,
} from "../data";
import { Option } from "@/types/app";
-import { WidgetConfig, GraphConfig, StandardConfig } from "@/types/dashboard";
import graphs from "../graphs";
import configs from "./graph-styles";
import WidgetOptions from "./WidgetOptions.vue";
@@ -133,26 +115,16 @@ export default defineComponent({
activeNames: string;
source: any;
index: string;
- graph: GraphConfig | any;
- widget: WidgetConfig | any;
- standard: StandardConfig;
visType: Option[];
isTable: boolean;
- metrics: string[];
- metricTypes: string[];
}>({
activeNames: "1",
source: {},
index: selectedGrid.i,
- graph: selectedGrid.graph,
- widget: selectedGrid.widget,
- standard: selectedGrid.standard,
visType: [],
isTable: false,
- metrics: [],
- metricTypes: [],
});
- states.isTable = TableChartTypes.includes(states.graph.type || "");
+ states.isTable = TableChartTypes.includes(selectedGrid.graph.type || "");
if (entity === EntityType[0].value) {
states.visType = ChartTypes.filter(
@@ -169,62 +141,24 @@ export default defineComponent({
}
function changeChartType(item: Option) {
- states.graph = {
+ const graph = {
+ ...selectedGrid.graph,
...DefaultGraphConfig[item.value],
};
- states.isTable = TableChartTypes.includes(states.graph.type);
- }
- function updateWidgetOptions(param: { [key: string]: unknown }) {
- states.widget = {
- ...states.widget,
- ...param,
- };
- }
-
- function updateGraphOptions(param: { [key: string]: unknown }) {
- states.graph = {
- ...states.graph,
- ...param,
- };
- }
-
- function updateStandardOptions(param: { [key: string]: unknown }) {
- states.standard = {
- ...states.standard,
- ...param,
- };
+ states.isTable = TableChartTypes.includes(selectedGrid.graph.type);
+ dashboardStore.selectWidget({ ...selectedGrid, graph });
}
function getSource(source: unknown) {
states.source = source;
}
- function getMetricsConfig(opts: {
- metrics?: string[];
- metricTypes?: string[];
- }) {
- if (opts.metrics !== undefined) {
- states.metrics = opts.metrics;
- }
- if (opts.metricTypes !== undefined) {
- states.metricTypes = opts.metricTypes;
- }
- }
-
function setLoading(load: boolean) {
loading.value = load;
}
function applyConfig() {
- const opts = {
- ...dashboardStore.selectedGrid,
- metrics: states.metrics,
- metricTypes: states.metricTypes,
- widget: states.widget,
- graph: states.graph,
- standard: states.standard,
- };
- dashboardStore.setConfigs(opts);
+ dashboardStore.setConfigs(dashboardStore.selectedGrid);
dashboardStore.setConfigPanel(false);
}
@@ -234,13 +168,10 @@ export default defineComponent({
changeChartType,
t,
appStoreWithOut,
- updateWidgetOptions,
configHeight,
- updateGraphOptions,
- updateStandardOptions,
+ selectedGrid,
applyConfig,
getSource,
- getMetricsConfig,
setLoading,
};
},
diff --git a/src/views/dashboard/configuration/MetricOptions.vue b/src/views/dashboard/configuration/MetricOptions.vue
index 96154e78..611374fc 100644
--- a/src/views/dashboard/configuration/MetricOptions.vue
+++ b/src/views/dashboard/configuration/MetricOptions.vue
@@ -70,7 +70,6 @@ limitations under the License. -->