From 93b4cb562de32c6e32efe9fe1988c6777421737b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 7 Nov 2018 16:03:33 +0100 Subject: [PATCH] Fixed issues introduced by changing to PureComponent --- public/app/features/dashboard/dashboard_model.ts | 5 ----- public/app/features/dashboard/dashgrid/DashboardGrid.tsx | 8 ++++++-- public/app/features/dashboard/dashgrid/DashboardPanel.tsx | 7 ++++--- public/app/features/panel/viz_tab.ts | 4 +--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/public/app/features/dashboard/dashboard_model.ts b/public/app/features/dashboard/dashboard_model.ts index 65a234a2b94..3320783ec67 100644 --- a/public/app/features/dashboard/dashboard_model.ts +++ b/public/app/features/dashboard/dashboard_model.ts @@ -232,11 +232,6 @@ export class DashboardModel { return this.meta.fullscreen && !panel.fullscreen; } - changePanelType(panel: PanelModel, pluginId: string) { - panel.changeType(pluginId); - this.events.emit('panel-type-changed', panel); - } - private ensureListExist(data) { if (!data) { data = {}; diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index fe55e64634f..12b4809f51a 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -83,7 +83,6 @@ export class DashboardGrid extends React.Component { dashboard.on('view-mode-changed', this.onViewModeChanged.bind(this)); dashboard.on('row-collapsed', this.triggerForceUpdate.bind(this)); dashboard.on('row-expanded', this.triggerForceUpdate.bind(this)); - dashboard.on('panel-type-changed', this.triggerForceUpdate.bind(this)); } buildLayout() { @@ -176,7 +175,12 @@ export class DashboardGrid extends React.Component { const panelClasses = classNames({ panel: true, 'panel--fullscreen': panel.fullscreen }); panelElements.push(
- +
); } diff --git a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx index dd96c7b698e..6853ade474b 100644 --- a/public/app/features/dashboard/dashgrid/DashboardPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardPanel.tsx @@ -11,9 +11,10 @@ import { PanelChrome } from './PanelChrome'; import { PanelEditor } from './PanelEditor'; export interface Props { - panelType: string; panel: PanelModel; dashboard: DashboardModel; + isEditing: boolean; + isFullscreen: boolean; } export interface State { @@ -113,8 +114,8 @@ export class DashboardPanel extends PureComponent { renderReactPanel() { const { pluginExports } = this.state; - const containerClass = this.props.panel.isEditing ? 'panel-editor-container' : 'panel-height-helper'; - const panelWrapperClass = this.props.panel.isEditing ? 'panel-editor-container__panel' : 'panel-height-helper'; + const containerClass = this.props.isEditing ? 'panel-editor-container' : 'panel-height-helper'; + const panelWrapperClass = this.props.isEditing ? 'panel-editor-container__panel' : 'panel-height-helper'; // this might look strange with these classes that change when edit, but // I want to try to keep markup (parents) for panel the same in edit mode to avoide unmount / new mount of panel return ( diff --git a/public/app/features/panel/viz_tab.ts b/public/app/features/panel/viz_tab.ts index dfaf7395b97..b80b84a341a 100644 --- a/public/app/features/panel/viz_tab.ts +++ b/public/app/features/panel/viz_tab.ts @@ -16,9 +16,7 @@ export class VizTabCtrl { $scope.ctrl = this; } - onTypeChanged = (plugin: PanelPlugin) => { - this.dashboard.changePanelType(this.panelCtrl.panel, plugin.id); - }; + onTypeChanged = (plugin: PanelPlugin) => {}; } const template = `