From bb64a0673dcbd09667d0c983d85886e7ecc8b6a1 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Fri, 3 May 2019 12:55:22 -0700 Subject: [PATCH] PanelModel: expose isInView property to PanelModel (#16877) --- public/app/features/dashboard/dashgrid/DashboardGrid.tsx | 3 ++- public/app/features/dashboard/state/PanelModel.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index 4169270fd35..5651b99f4cf 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -233,6 +233,7 @@ export class DashboardGrid extends PureComponent { for (const panel of this.props.dashboard.panels) { const panelClasses = classNames({ 'react-grid-item--fullscreen': panel.fullscreen }); const id = panel.id.toString(); + panel.isInView = this.isInView(panel); panelElements.push(
{ dashboard={this.props.dashboard} isEditing={panel.isEditing} isFullscreen={panel.fullscreen} - isInView={this.isInView(panel)} + isInView={panel.isInView} />
); diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index c785cd3630a..e9ba12f1b20 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -23,6 +23,7 @@ const notPersistedProperties: { [str: string]: boolean } = { events: true, fullscreen: true, isEditing: true, + isInView: true, hasRefreshed: true, cachedPluginOptions: true, plugin: true, @@ -111,6 +112,7 @@ export class PanelModel { // non persisted fullscreen: boolean; isEditing: boolean; + isInView: boolean; hasRefreshed: boolean; events: Emitter; cacheTimeout?: any;