Commit 4036a44a by Dominik Prokop Committed by GitHub

Panel inspect: Interpolate variables in panel inspect title (#28779)

* Interpolate variables in panel inspect title

* Update public/app/features/dashboard/components/Inspector/InspectContent.tsx

Co-authored-by: Torkel Ödegaard <torkel@grafana.org>

* fix typo

Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
parent a9e20133
import React, { useState } from 'react'; import React, { useState } from 'react';
import { getPanelInspectorStyles } from './styles'; import { DataSourceApi, PanelData, PanelPlugin } from '@grafana/data';
import { getTemplateSrv } from '@grafana/runtime';
import { CustomScrollbar, Drawer, TabContent } from '@grafana/ui'; import { CustomScrollbar, Drawer, TabContent } from '@grafana/ui';
import { getPanelInspectorStyles } from './styles';
import { InspectSubtitle } from './InspectSubtitle'; import { InspectSubtitle } from './InspectSubtitle';
import { InspectDataTab } from './InspectDataTab'; import { InspectDataTab } from './InspectDataTab';
import { InspectMetadataTab } from './InspectMetadataTab'; import { InspectMetadataTab } from './InspectMetadataTab';
...@@ -10,7 +12,6 @@ import { InspectStatsTab } from './InspectStatsTab'; ...@@ -10,7 +12,6 @@ import { InspectStatsTab } from './InspectStatsTab';
import { QueryInspector } from './QueryInspector'; import { QueryInspector } from './QueryInspector';
import { InspectTab } from './types'; import { InspectTab } from './types';
import { DashboardModel, PanelModel } from '../../state'; import { DashboardModel, PanelModel } from '../../state';
import { DataSourceApi, PanelData, PanelPlugin } from '@grafana/data';
import { GetDataOptions } from '../../state/PanelQueryRunner'; import { GetDataOptions } from '../../state/PanelQueryRunner';
interface Props { interface Props {
...@@ -56,10 +57,11 @@ export const InspectContent: React.FC<Props> = ({ ...@@ -56,10 +57,11 @@ export const InspectContent: React.FC<Props> = ({
if (!tabs.find(item => item.value === currentTab)) { if (!tabs.find(item => item.value === currentTab)) {
activeTab = InspectTab.JSON; activeTab = InspectTab.JSON;
} }
const title = getTemplateSrv().replace(panel.title, panel.scopedVars, 'text');
return ( return (
<Drawer <Drawer
title={`Inspect: ${panel.title}` || 'Panel inspect'} title={`Inspect: ${title || 'Panel'}`}
subtitle={ subtitle={
<InspectSubtitle <InspectSubtitle
tabs={tabs} tabs={tabs}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment