-
+
/>
-
+
@@ -107,7 +117,7 @@ import {
DefaultGraphConfig,
} from "../data";
import { Option } from "@/types/app";
-import { WidgetConfig, GraphConfig } from "@/types/dashboard";
+import { WidgetConfig, GraphConfig, StandardConfig } from "@/types/dashboard";
import graphs from "../graphs";
import configs from "./graph-styles";
import WidgetOptions from "./WidgetOptions.vue";
@@ -138,6 +148,7 @@ export default defineComponent({
index: string;
graph: GraphConfig;
widget: WidgetConfig | any;
+ standard: StandardConfig;
}>({
metrics: selectedGrid.metrics || [],
valueTypes: [],
@@ -148,10 +159,8 @@ export default defineComponent({
source: {},
index: selectedGrid.i,
graph: {},
- widget: {
- tips: selectedGrid.widget.tips,
- title: selectedGrid.widget.title,
- },
+ widget: selectedGrid.widget,
+ standard: selectedGrid.standard,
});
if (states.metrics[0]) {
queryMetricType(states.metrics[0]);
@@ -210,21 +219,27 @@ export default defineComponent({
];
const configHeight = document.documentElement.clientHeight - 520;
- function updateWidgetOptions(param: { label: string; value: string }) {
- if (states.widget[param.label] === undefined) {
- return;
- }
- states.widget[param.label] = param.value;
+ function updateWidgetOptions(param: { [key: string]: unknown }) {
+ states.widget = {
+ ...states.widget,
+ ...param,
+ };
}
- function updateGraphOptions(param: { label: string; value: unknown }) {
- console.log(param);
+ function updateGraphOptions(param: { [key: string]: unknown }) {
states.graph = {
...states.graph,
...param,
};
}
+ function updateStandardOptions(param: { [key: string]: unknown }) {
+ states.standard = {
+ ...states.standard,
+ ...param,
+ };
+ }
+
async function queryMetrics() {
const json = await dashboardStore.fetchMetricValue(
dashboardStore.selectedGrid
@@ -284,6 +299,7 @@ export default defineComponent({
updateWidgetOptions,
configHeight,
updateGraphOptions,
+ updateStandardOptions,
applyConfig,
loading,
};
@@ -311,6 +327,13 @@ export default defineComponent({
text-align: center;
background-color: aliceblue;
font-size: 12px;
+ position: relative;
+}
+
+.tips {
+ position: absolute;
+ right: 5px;
+ top: 0;
}
.render-chart {
diff --git a/src/views/dashboard/configuration/StandardOptions.vue b/src/views/dashboard/configuration/StandardOptions.vue
index be2d949d..56081354 100644
--- a/src/views/dashboard/configuration/StandardOptions.vue
+++ b/src/views/dashboard/configuration/StandardOptions.vue
@@ -20,6 +20,7 @@ limitations under the License. -->
v-model="state.unit"
size="mini"
placeholder="Please input Unit"
+ @change="changeStandardOpt({ unit: state.unit })"
/>
@@ -30,6 +31,7 @@ limitations under the License. -->
size="mini"
placeholder="Select a sort order"
class="selector"
+ @change="changeStandardOpt({ sortOrder: state.sortOrder })"
/>
@@ -39,6 +41,7 @@ limitations under the License. -->
v-model="state.max"
size="mini"
placeholder="auto"
+ @change="changeStandardOpt({ max: state.max })"
/>
@@ -48,6 +51,7 @@ limitations under the License. -->
v-model="state.min"
size="mini"
placeholder="auto"
+ @change="changeStandardOpt({ min: state.min })"
/>
@@ -57,6 +61,7 @@ limitations under the License. -->
v-model="state.plus"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ plus: state.plus })"
/>
@@ -66,6 +71,7 @@ limitations under the License. -->
v-model="state.minus"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ minus: state.minus })"
/>
@@ -75,6 +81,7 @@ limitations under the License. -->
v-model="state.multiply"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ multiply: state.multiply })"
/>
@@ -84,6 +91,7 @@ limitations under the License. -->
v-model="state.divide"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ divide: state.divide })"
/>
@@ -93,6 +101,7 @@ limitations under the License. -->
v-model="state.milliseconds"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ milliseconds: state.milliseconds })"
/>
@@ -102,17 +111,27 @@ limitations under the License. -->
v-model="state.seconds"
size="mini"
placeholder="none"
+ @change="changeStandardOpt({ seconds: state.seconds })"
/>