mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: rename vizPlugin to panelPlugin (#16802)
This commit is contained in:
parent
c5097e2ef3
commit
7dbe719fda
@ -10,7 +10,7 @@ export interface PanelPluginMeta extends PluginMeta {
|
|||||||
hideFromList?: boolean;
|
hideFromList?: boolean;
|
||||||
sort: number;
|
sort: number;
|
||||||
angularPlugin: AngularPanelPlugin | null;
|
angularPlugin: AngularPanelPlugin | null;
|
||||||
vizPlugin: PanelPlugin | null;
|
panelPlugin: PanelPlugin | null;
|
||||||
hasBeenImported?: boolean;
|
hasBeenImported?: boolean;
|
||||||
|
|
||||||
// if length>0 the query tab will show up
|
// if length>0 the query tab will show up
|
||||||
|
@ -101,7 +101,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
|
|||||||
if (importedPlugin instanceof AngularPanelPlugin) {
|
if (importedPlugin instanceof AngularPanelPlugin) {
|
||||||
plugin.angularPlugin = importedPlugin as AngularPanelPlugin;
|
plugin.angularPlugin = importedPlugin as AngularPanelPlugin;
|
||||||
} else if (importedPlugin instanceof PanelPlugin) {
|
} else if (importedPlugin instanceof PanelPlugin) {
|
||||||
plugin.vizPlugin = importedPlugin as PanelPlugin;
|
plugin.panelPlugin = importedPlugin as PanelPlugin;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
plugin = getPanelPluginNotFound(plugin.id);
|
plugin = getPanelPluginNotFound(plugin.id);
|
||||||
@ -209,7 +209,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
|
|||||||
onMouseLeave={this.onMouseLeave}
|
onMouseLeave={this.onMouseLeave}
|
||||||
style={styles}
|
style={styles}
|
||||||
>
|
>
|
||||||
{plugin.vizPlugin && this.renderReactPanel()}
|
{plugin.panelPlugin && this.renderReactPanel()}
|
||||||
{plugin.angularPlugin && this.renderAngularPanel()}
|
{plugin.angularPlugin && this.renderAngularPanel()}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -215,7 +215,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
|||||||
renderPanel(width: number, height: number): JSX.Element {
|
renderPanel(width: number, height: number): JSX.Element {
|
||||||
const { panel, plugin } = this.props;
|
const { panel, plugin } = this.props;
|
||||||
const { renderCounter, data, isFirstLoad } = this.state;
|
const { renderCounter, data, isFirstLoad } = this.state;
|
||||||
const PanelComponent = plugin.vizPlugin.panel;
|
const PanelComponent = plugin.panelPlugin.panel;
|
||||||
|
|
||||||
// This is only done to increase a counter that is used by backend
|
// This is only done to increase a counter that is used by backend
|
||||||
// image rendering (phantomjs/headless chrome) to know when to capture image
|
// image rendering (phantomjs/headless chrome) to know when to capture image
|
||||||
@ -236,7 +236,7 @@ export class PanelChrome extends PureComponent<Props, State> {
|
|||||||
<PanelComponent
|
<PanelComponent
|
||||||
data={data}
|
data={data}
|
||||||
timeRange={data.request ? data.request.range : this.timeSrv.timeRange()}
|
timeRange={data.request ? data.request.range : this.timeSrv.timeRange()}
|
||||||
options={panel.getOptions(plugin.vizPlugin.defaults)}
|
options={panel.getOptions(plugin.panelPlugin.defaults)}
|
||||||
width={width - 2 * config.theme.panelPadding.horizontal}
|
width={width - 2 * config.theme.panelPadding.horizontal}
|
||||||
height={height - PANEL_HEADER_HEIGHT - config.theme.panelPadding.vertical}
|
height={height - PANEL_HEADER_HEIGHT - config.theme.panelPadding.vertical}
|
||||||
renderCounter={renderCounter}
|
renderCounter={renderCounter}
|
||||||
|
@ -63,7 +63,7 @@ export function getPanelPluginNotFound(id: string): PanelPluginMeta {
|
|||||||
updated: '',
|
updated: '',
|
||||||
version: '',
|
version: '',
|
||||||
},
|
},
|
||||||
vizPlugin: new PanelPlugin(NotFound),
|
panelPlugin: new PanelPlugin(NotFound),
|
||||||
angularPlugin: null,
|
angularPlugin: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ export class VisualizationTab extends PureComponent<Props, State> {
|
|||||||
|
|
||||||
getReactPanelOptions = () => {
|
getReactPanelOptions = () => {
|
||||||
const { panel, plugin } = this.props;
|
const { panel, plugin } = this.props;
|
||||||
return panel.getOptions(plugin.vizPlugin.defaults);
|
return panel.getOptions(plugin.panelPlugin.defaults);
|
||||||
};
|
};
|
||||||
|
|
||||||
renderPanelOptions() {
|
renderPanelOptions() {
|
||||||
@ -64,8 +64,8 @@ export class VisualizationTab extends PureComponent<Props, State> {
|
|||||||
return <div ref={element => (this.element = element)} />;
|
return <div ref={element => (this.element = element)} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.vizPlugin) {
|
if (plugin.panelPlugin) {
|
||||||
const PanelEditor = plugin.vizPlugin.editor;
|
const PanelEditor = plugin.panelPlugin.editor;
|
||||||
|
|
||||||
if (PanelEditor) {
|
if (PanelEditor) {
|
||||||
return <PanelEditor options={this.getReactPanelOptions()} onOptionsChange={this.onPanelOptionsChanged} />;
|
return <PanelEditor options={this.getReactPanelOptions()} onOptionsChange={this.onPanelOptionsChanged} />;
|
||||||
|
@ -129,7 +129,7 @@ describe('PanelModel', () => {
|
|||||||
model.changePlugin(
|
model.changePlugin(
|
||||||
getPanelPlugin({
|
getPanelPlugin({
|
||||||
id: 'react',
|
id: 'react',
|
||||||
vizPlugin: reactPlugin,
|
panelPlugin: reactPlugin,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -255,10 +255,10 @@ export class PanelModel {
|
|||||||
pluginLoaded(plugin: PanelPluginMeta) {
|
pluginLoaded(plugin: PanelPluginMeta) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
|
||||||
if (plugin.vizPlugin && plugin.vizPlugin.onPanelMigration) {
|
if (plugin.panelPlugin && plugin.panelPlugin.onPanelMigration) {
|
||||||
const version = this.getPluginVersion(plugin);
|
const version = this.getPluginVersion(plugin);
|
||||||
if (version !== this.pluginVersion) {
|
if (version !== this.pluginVersion) {
|
||||||
this.options = plugin.vizPlugin.onPanelMigration(this);
|
this.options = plugin.panelPlugin.onPanelMigration(this);
|
||||||
this.pluginVersion = version;
|
this.pluginVersion = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ export class PanelModel {
|
|||||||
this.plugin = newPlugin;
|
this.plugin = newPlugin;
|
||||||
|
|
||||||
// Let panel plugins inspect options from previous panel and keep any that it can use
|
// Let panel plugins inspect options from previous panel and keep any that it can use
|
||||||
const reactPanel = newPlugin.vizPlugin;
|
const reactPanel = newPlugin.panelPlugin;
|
||||||
|
|
||||||
if (reactPanel) {
|
if (reactPanel) {
|
||||||
if (reactPanel.onPanelTypeChanged) {
|
if (reactPanel.onPanelTypeChanged) {
|
||||||
|
@ -57,7 +57,7 @@ export const getPanelPlugin = (options: Partial<PanelPluginMeta>): PanelPluginMe
|
|||||||
hideFromList: options.hideFromList === true,
|
hideFromList: options.hideFromList === true,
|
||||||
module: '',
|
module: '',
|
||||||
baseUrl: '',
|
baseUrl: '',
|
||||||
vizPlugin: options.vizPlugin,
|
panelPlugin: options.panelPlugin,
|
||||||
angularPlugin: options.angularPlugin,
|
angularPlugin: options.angularPlugin,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user