mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelInspector: hides Query tab for plugins without Query ability (#24216)
* PanelInspector: fixes so Query tab is hidden for plugins without Query ability * Refactor: changes after PR comments
This commit is contained in:
@@ -27,6 +27,7 @@ import { config } from 'app/core/config';
|
||||
import { getPanelInspectorStyles } from './styles';
|
||||
import { StoreState } from 'app/types';
|
||||
import { InspectDataTab } from './InspectDataTab';
|
||||
import { supportsDataQuery } from '../PanelEditor/utils';
|
||||
|
||||
interface OwnProps {
|
||||
dashboard: DashboardModel;
|
||||
@@ -269,7 +270,7 @@ export class PanelInspectorUnconnected extends PureComponent<Props, State> {
|
||||
const error = last?.error;
|
||||
const tabs = [];
|
||||
|
||||
if (plugin && !plugin.meta.skipDataQuery) {
|
||||
if (supportsDataQuery(plugin)) {
|
||||
tabs.push({ label: 'Data', value: InspectTab.Data });
|
||||
tabs.push({ label: 'Stats', value: InspectTab.Stats });
|
||||
}
|
||||
@@ -284,7 +285,7 @@ export class PanelInspectorUnconnected extends PureComponent<Props, State> {
|
||||
tabs.push({ label: 'Error', value: InspectTab.Error });
|
||||
}
|
||||
|
||||
if (dashboard.meta.canEdit) {
|
||||
if (dashboard.meta.canEdit && supportsDataQuery(plugin)) {
|
||||
tabs.push({ label: 'Query', value: InspectTab.Query });
|
||||
}
|
||||
return tabs;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { CopyToClipboard } from 'app/core/components/CopyToClipboard/CopyToClipb
|
||||
import { CoreEvents } from 'app/types';
|
||||
import { PanelModel } from 'app/features/dashboard/state';
|
||||
import { getPanelInspectorStyles } from './styles';
|
||||
import { supportsDataQuery } from '../PanelEditor/utils';
|
||||
|
||||
interface DsQuery {
|
||||
isLoading: boolean;
|
||||
@@ -188,6 +189,10 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
const styles = getPanelInspectorStyles();
|
||||
const haveData = Object.keys(response).length > 0;
|
||||
|
||||
if (!supportsDataQuery(this.props.panel.plugin)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div aria-label={selectors.components.PanelInspector.Query.content}>
|
||||
|
||||
Reference in New Issue
Block a user