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

@@ -14,6 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const NewControl = {
x: 0,
y: 0,
w: 24,
h: 12,
i: "0",
type: "Widget",
widget: {
title: "Title",
},
graph: {},
standard: {},
};
export const ConfigData = {
x: 0,
y: 0,
@@ -24,8 +37,8 @@ export const ConfigData = {
queryMetricType: "readMetricsValues",
type: "Widget",
widget: {
title: "Title123",
tips: "Tooltip123",
title: "Title",
tips: "Tooltip",
},
graph: {
showBackground: true,
@@ -34,7 +47,7 @@ export const ConfigData = {
},
standard: {
sortOrder: "DEC",
unit: "s",
unit: "min",
},
children: [],
};

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,
};