Add migrator for modules to widgets

This commit is contained in:
Manuel Ruwe
2023-01-07 20:18:53 +01:00
parent 44c3e68042
commit dad89e2862
4 changed files with 276 additions and 19 deletions

View File

@@ -44,7 +44,7 @@ const definition = defineWidget({
},
refreshInterval: {
type: 'slider',
defaultValue: 1,
defaultValue: 10,
min: 1,
max: 60,
step: 1,

View File

@@ -60,13 +60,13 @@ function DashDotTile({ widget }: DashDotTileProps) {
dashDotUrl,
});
const graphs = widget?.properties.graphs.map((g) => ({
id: g,
name: t(`card.graphs.${g}.title`),
twoSpan: ['network', 'gpu'].includes(g),
const graphs = widget?.properties.graphs.map((graph) => ({
id: graph,
name: t(`card.graphs.${graph}.title`),
twoSpan: ['network', 'gpu'].includes(graph),
isMultiView:
(g === 'cpu' && widget.properties.cpuMultiView) ||
(g === 'storage' && widget.properties.storageMultiView),
(graph === 'cpu' && widget.properties.cpuMultiView) ||
(graph === 'storage' && widget.properties.storageMultiView),
}));
const heading = (

View File

@@ -1,5 +1,7 @@
import { TablerIcon } from '@tabler/icons';
import React from 'react';
import { AreaType } from '../types/area';
import { ShapeType } from '../types/shape';
// Type of widgets which are safed to config
export type IWidget<TKey extends string, TDefinition extends IWidgetDefinition> = {