feat: update config

This commit is contained in:
Qiuxia Fan
2022-01-12 11:44:54 +08:00
parent 7d1abb3421
commit ad1e500c54
11 changed files with 130 additions and 66 deletions

View File

@@ -19,8 +19,9 @@ import { store } from "@/store";
import { LayoutConfig } from "@/types/dashboard";
import graph from "@/graph";
import { AxiosResponse } from "axios";
import { ConfigData } from "./data";
import { ConfigData } from "../data";
import { useAppStoreWithOut } from "@/store/modules/app";
import { NewControl } from "../data";
interface DashboardState {
showConfig: boolean;
layout: LayoutConfig[];
@@ -29,19 +30,7 @@ interface DashboardState {
layerId: string;
activedGridItem: string;
}
const newControl: LayoutConfig = {
x: 0,
y: 0,
w: 24,
h: 12,
i: "0",
type: "Widget",
widget: {
title: "Title",
},
graph: {},
standard: {},
};
export const dashboardStore = defineStore({
id: "dashboard",
state: (): DashboardState => ({
@@ -58,7 +47,7 @@ export const dashboardStore = defineStore({
},
addControl(type: string) {
const newWidget: LayoutConfig = {
...newControl,
...NewControl,
i: String(this.layout.length),
type,
};

View File

@@ -1,40 +0,0 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const ConfigData = {
x: 0,
y: 0,
w: 8,
h: 12,
i: "0",
metrics: ["service_resp_time"],
queryMetricType: "readMetricsValues",
type: "Widget",
widget: {
title: "Title123",
tips: "Tooltip123",
},
graph: {
showBackground: true,
barWidth: 30,
type: "Line",
},
standard: {
sortOrder: "DEC",
unit: "s",
},
children: [],
};