diff --git a/src/components/Graph.vue b/src/components/Graph.vue index cda7e30b..85d85d4d 100644 --- a/src/components/Graph.vue +++ b/src/components/Graph.vue @@ -43,9 +43,6 @@ const props = defineProps({ }); onMounted(() => { - if (!chartRef.value) { - return; - } setOptions(props.option); addResizeListener(unref(chartRef), resize); }); @@ -58,9 +55,6 @@ watch( ); onBeforeUnmount(() => { - if (!chartRef.value) { - return; - } removeResizeListener(unref(chartRef), resize); }); diff --git a/src/store/data.ts b/src/store/data.ts index c09a465f..fbff8ab7 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -27,7 +27,7 @@ export const NewControl = { graph: {}, standard: {}, }; -export const ConfigData = { +export const ConfigData: any = { x: 0, y: 0, w: 8, @@ -41,8 +41,6 @@ export const ConfigData = { tips: "Tooltip", }, graph: { - showBackground: true, - barWidth: 30, type: "Line", }, standard: { diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 7897a1aa..12e03df8 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -144,6 +144,7 @@ export const dashboardStore = defineStore({ ...this.layout[index], ...param, }; + this.selectedGrid = this.layout[index]; }, async fetchMetricType(item: string) { const res: AxiosResponse = await graph diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index cdf3431a..e2a3b046 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -20,9 +20,9 @@ export interface LayoutConfig { w: number; h: number; i: string; - widget: WidgetConfig; - graph: GraphConfig; - standard: StandardConfig; + widget?: WidgetConfig; + graph?: GraphConfig; + standard?: StandardConfig; metrics?: string[]; type?: string; queryMetricType?: string; @@ -30,8 +30,8 @@ export interface LayoutConfig { } export interface WidgetConfig { - title: string; - tips: string; + title?: string; + tips?: string; } export interface StandardConfig { @@ -39,19 +39,18 @@ export interface StandardConfig { unit?: string; max?: string; min?: string; - plus: string; - minus: string; - multiply: string; - divide: string; - milliseconds: string; - seconds: string; + plus?: string; + minus?: string; + multiply?: string; + divide?: string; + milliseconds?: string; + seconds?: string; } export type GraphConfig = BarConfig | LineConfig; export interface BarConfig { type?: string; showBackground?: boolean; - barWidth?: number; } export interface LineConfig extends AreaConfig { type?: string; diff --git a/src/views/dashboard/configuration/ConfigEdit.vue b/src/views/dashboard/configuration/ConfigEdit.vue index e7ee80b6..93b6c5e6 100644 --- a/src/views/dashboard/configuration/ConfigEdit.vue +++ b/src/views/dashboard/configuration/ConfigEdit.vue @@ -17,7 +17,7 @@ limitations under the License. -->
{{ states.widget.title }} -
+
diff --git a/src/views/dashboard/configuration/graph-styles/Bar.vue b/src/views/dashboard/configuration/graph-styles/Bar.vue index 076c7bc7..0e9d428f 100644 --- a/src/views/dashboard/configuration/graph-styles/Bar.vue +++ b/src/views/dashboard/configuration/graph-styles/Bar.vue @@ -13,16 +13,6 @@ 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. -->