Dashboard: Fix Table view when editing causes the panel data to not update (#34998)

* Dashboard: Fix Table view when editing causes the panel data to not update

- Add event subscription on PanelEditorTableView
- Extract runAllPanelQueries into Panel Model in order to use it on PanelChrome and PanelEditorTableView
- Add simple unit test for runAllQueryPaneQueries
This commit is contained in:
Maria Alexandra
2021-06-01 13:52:08 +02:00
committed by GitHub
parent 22544bd135
commit ff03b456f1
5 changed files with 71 additions and 22 deletions

View File

@@ -38,7 +38,6 @@ import {
} from './getPanelOptionsWithDefaults';
import { QueryGroupOptions } from 'app/types';
import { PanelModelLibraryPanel } from '../../library-panels/types';
export interface GridPos {
x: number;
y: number;
@@ -47,6 +46,8 @@ export interface GridPos {
static?: boolean;
}
import { TimeOverrideResult } from '../utils/panel';
const notPersistedProperties: { [str: string]: boolean } = {
events: true,
isViewing: true,
@@ -292,6 +293,23 @@ export class PanelModel implements DataConfigSource {
this.gridPos.h = newPos.h;
}
runAllPanelQueries(dashboardId: number, dashboardTimezone: string, timeData: TimeOverrideResult, width: number) {
this.getQueryRunner().run({
datasource: this.datasource,
queries: this.targets,
panelId: this.editSourceId || this.id,
dashboardId: dashboardId,
timezone: dashboardTimezone,
timeRange: timeData.timeRange,
timeInfo: timeData.timeInfo,
maxDataPoints: this.maxDataPoints || width,
minInterval: this.interval,
scopedVars: this.scopedVars,
cacheTimeout: this.cacheTimeout,
transformations: this.transformations,
});
}
refresh() {
this.hasRefreshed = true;
this.events.publish(new RefreshEvent());