mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Remove dataFormats key and add skipDataQuery (#16984)
This commit is contained in:
parent
4a9aff0b00
commit
56702902a1
@ -7,18 +7,9 @@ import { PluginMeta, GrafanaPlugin } from './plugin';
|
||||
export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;
|
||||
|
||||
export interface PanelPluginMeta extends PluginMeta {
|
||||
skipDataQuery?: boolean;
|
||||
hideFromList?: boolean;
|
||||
sort: number;
|
||||
|
||||
// if length>0 the query tab will show up
|
||||
// Before 6.2 this could be table and/or series, but 6.2+ supports both transparently
|
||||
// so it will be deprecated soon
|
||||
dataFormats?: PanelDataFormat[];
|
||||
}
|
||||
|
||||
export enum PanelDataFormat {
|
||||
Table = 'table',
|
||||
TimeSeries = 'time_series',
|
||||
}
|
||||
|
||||
export interface PanelData {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/log"
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
@ -161,7 +162,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
|
||||
"info": panel.Info,
|
||||
"hideFromList": panel.HideFromList,
|
||||
"sort": getPanelSort(panel.Id),
|
||||
"dataFormats": panel.DataFormats,
|
||||
"skipDataQuery": panel.SkipDataQuery,
|
||||
"state": panel.State,
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import "encoding/json"
|
||||
|
||||
type PanelPlugin struct {
|
||||
FrontendPluginBase
|
||||
DataFormats []string `json:"dataFormats"`
|
||||
SkipDataQuery bool `json:"skipDataQuery"`
|
||||
}
|
||||
|
||||
func (p *PanelPlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
||||
@ -16,10 +16,6 @@ func (p *PanelPlugin) Load(decoder *json.Decoder, pluginDir string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if p.DataFormats == nil {
|
||||
p.DataFormats = []string{"time_series", "table"}
|
||||
}
|
||||
|
||||
Panels[p.Id] = p
|
||||
return nil
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
get wantsQueryExecution() {
|
||||
return this.props.plugin.meta.dataFormats.length > 0 && !this.hasPanelSnapshot;
|
||||
return !(this.props.plugin.meta.skipDataQuery || this.hasPanelSnapshot);
|
||||
}
|
||||
|
||||
renderPanel(width: number, height: number): JSX.Element {
|
||||
|
@ -49,7 +49,6 @@ export function getPanelPluginNotFound(id: string): PanelPlugin {
|
||||
type: PluginType.panel,
|
||||
module: '',
|
||||
baseUrl: '',
|
||||
dataFormats: [],
|
||||
info: {
|
||||
author: {
|
||||
name: '',
|
||||
|
@ -105,7 +105,7 @@ export class PanelEditor extends PureComponent<PanelEditorProps> {
|
||||
];
|
||||
|
||||
// handle panels that do not have queries tab
|
||||
if (plugin.meta.dataFormats.length === 0) {
|
||||
if (!plugin.meta.skipDataQuery) {
|
||||
// remove queries tab
|
||||
tabs.shift();
|
||||
// switch tab
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PanelPluginMeta, PluginMeta, PluginType, PanelDataFormat, PanelPlugin, PanelProps } from '@grafana/ui';
|
||||
import { PanelPluginMeta, PluginMeta, PluginType, PanelPlugin, PanelProps } from '@grafana/ui';
|
||||
import { ComponentType } from 'enzyme';
|
||||
|
||||
export const getMockPlugins = (amount: number): PluginMeta[] => {
|
||||
@ -46,7 +46,6 @@ export const getPanelPlugin = (
|
||||
type: PluginType.panel,
|
||||
name: options.id,
|
||||
sort: options.sort || 1,
|
||||
dataFormats: [PanelDataFormat.TimeSeries],
|
||||
info: {
|
||||
author: {
|
||||
name: options.id + 'name',
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Alert List",
|
||||
"id": "alertlist",
|
||||
|
||||
"dataFormats": [],
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"description": "Shows list of alerts and their current status",
|
||||
|
@ -4,8 +4,6 @@
|
||||
"id": "bargauge",
|
||||
"state": "beta",
|
||||
|
||||
"dataFormats": ["time_series"],
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
"name": "Grafana Project",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Dashboard list",
|
||||
"id": "dashlist",
|
||||
|
||||
"dataFormats": [],
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"description": "List of dynamic links to other dashboards",
|
||||
|
@ -3,8 +3,6 @@
|
||||
"name": "Gauge",
|
||||
"id": "gauge",
|
||||
|
||||
"dataFormats": ["time_series"],
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
"name": "Grafana Project",
|
||||
|
@ -3,8 +3,6 @@
|
||||
"name": "Graph",
|
||||
"id": "graph",
|
||||
|
||||
"dataFormats": ["time_series", "table"],
|
||||
|
||||
"info": {
|
||||
"description": "Graph Panel for Grafana",
|
||||
"author": {
|
||||
|
@ -3,8 +3,6 @@
|
||||
"name": "Heatmap",
|
||||
"id": "heatmap",
|
||||
|
||||
"dataFormats": ["time_series"],
|
||||
|
||||
"info": {
|
||||
"description": "Heatmap Panel for Grafana",
|
||||
"author": {
|
||||
|
@ -4,8 +4,6 @@
|
||||
"id": "piechart",
|
||||
"state": "alpha",
|
||||
|
||||
"dataFormats": ["time_series"],
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
"name": "Grafana Project",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Plugin list",
|
||||
"id": "pluginlist",
|
||||
|
||||
"dataFormats": [],
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"description": "Plugin List for Grafana",
|
||||
|
@ -3,8 +3,6 @@
|
||||
"name": "Singlestat",
|
||||
"id": "singlestat",
|
||||
|
||||
"dataFormats": ["time_series", "table"],
|
||||
|
||||
"info": {
|
||||
"description": "Singlestat Panel for Grafana",
|
||||
"author": {
|
||||
|
@ -4,8 +4,6 @@
|
||||
"id": "singlestat2",
|
||||
"state": "alpha",
|
||||
|
||||
"dataFormats": ["time_series", "table"],
|
||||
|
||||
"info": {
|
||||
"description": "Singlestat Panel for Grafana",
|
||||
"author": {
|
||||
|
@ -3,8 +3,6 @@
|
||||
"name": "Table",
|
||||
"id": "table",
|
||||
|
||||
"dataFormats": ["table", "time_series"],
|
||||
|
||||
"info": {
|
||||
"description": "Table Panel for Grafana",
|
||||
"author": {
|
||||
|
@ -4,8 +4,6 @@
|
||||
"id": "table2",
|
||||
"state": "alpha",
|
||||
|
||||
"dataFormats": ["table"],
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
"name": "Grafana Project",
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "Text",
|
||||
"id": "text",
|
||||
|
||||
"dataFormats": [],
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
|
@ -4,7 +4,7 @@
|
||||
"id": "text2",
|
||||
"state": "alpha",
|
||||
|
||||
"dataFormats": [],
|
||||
"skipDataQuery": true,
|
||||
|
||||
"info": {
|
||||
"author": {
|
||||
|
Loading…
Reference in New Issue
Block a user