diff --git a/public/app/features/dashboard/components/Inspector/InspectDataTab.tsx b/public/app/features/dashboard/components/Inspector/InspectDataTab.tsx index e05a9c533af..8f2b182bab6 100644 --- a/public/app/features/dashboard/components/Inspector/InspectDataTab.tsx +++ b/public/app/features/dashboard/components/Inspector/InspectDataTab.tsx @@ -131,6 +131,14 @@ export class InspectDataTab extends PureComponent { data = this.getTransformedData(); } + // In case the transform removes the currently selected data frame + if (!data[this.state.dataFrameIndex]) { + this.setState({ + dataFrameIndex: 0, + selectedDataFrame: 0, + }); + } + // We need to apply field config even though it was already applied in the PanelQueryRunner. // That's because transformers create new fields and data frames, so i.e. display processor is no longer there return applyFieldOverrides({ @@ -147,6 +155,7 @@ export class InspectDataTab extends PureComponent { getActiveString = () => { const { selectedDataFrame } = this.state; const { options, data } = this.props; + let activeString = ''; if (selectedDataFrame === DataTransformerID.seriesToColumns) { activeString = 'series joined by time'; @@ -173,6 +182,7 @@ export class InspectDataTab extends PureComponent { renderDataOptions = (dataFrames: DataFrame[]) => { const { options, onOptionsChange, panel, data } = this.props; const { transformId, transformationOptions, selectedDataFrame } = this.state; + const styles = getPanelInspectorStyles(); const panelTransformations = panel.getTransformations(); @@ -207,21 +217,21 @@ export class InspectDataTab extends PureComponent { >
- {data.length > 1 && ( - - + + {showPanelTransformationsOption && ( { return
No Data
; } + if (!dataFrames[dataFrameIndex]) { + return
Could not find the Data Frame
; + } + return (