feat: add Tab on the dashboard

This commit is contained in:
Qiuxia Fan
2022-01-07 15:19:30 +08:00
parent edda37078a
commit 59ea77d65c
13 changed files with 201 additions and 105 deletions

View File

@@ -49,6 +49,34 @@ export const dashboardStore = defineStore({
w: 24,
h: 12,
i: String(this.layout.length),
type: "Widget",
widget: {},
graph: {},
standard: {},
};
this.layout = this.layout.map((d: LayoutConfig) => {
d.y = d.y + newWidget.h;
return d;
});
this.layout.push(newWidget);
},
addTab() {
const newWidget: LayoutConfig = {
x: 0,
y: 0,
w: 24,
h: 12,
i: String(this.layout.length),
type: "Tab",
children: [
{
name: "Tab1",
children: [],
},
],
widget: {},
graph: {},
standard: {},
};
this.layout = this.layout.map((d: LayoutConfig) => {
d.y = d.y + newWidget.h;

View File

@@ -14,8 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LayoutConfig } from "@/types/dashboard";
export const ConfigData: LayoutConfig = {
export const ConfigData = {
x: 0,
y: 0,
w: 8,
@@ -23,7 +22,7 @@ export const ConfigData: LayoutConfig = {
i: "0",
metrics: ["service_resp_time"],
queryMetricType: "readMetricsValues",
chart: "Line",
type: "Widget",
widget: {
title: "Title123",
tips: "Tooltip123",
@@ -31,6 +30,7 @@ export const ConfigData: LayoutConfig = {
graph: {
showBackground: true,
barWidth: 30,
type: "Line",
},
standard: {
sortOrder: "DEC",