Commit 119e94f7 by Torkel Ödegaard

wip: panel plugin not found

parent 7a30220d
......@@ -5,13 +5,14 @@ import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoa
import { importPluginModule } from 'app/features/plugins/plugin_loader';
import { AddPanelPanel } from './AddPanelPanel';
import { PanelPluginNotFound } from './PanelPluginNotFound';
import { DashboardRow } from './DashboardRow';
import { PanelPlugin } from 'app/types/plugins';
import { PanelChrome } from './PanelChrome';
import { PanelEditor } from './PanelEditor';
import { PanelModel } from '../panel_model';
import { DashboardModel } from '../dashboard_model';
import { PanelPlugin, PanelProps } from 'app/types';
export interface Props {
panel: PanelModel;
......@@ -70,7 +71,7 @@ export class DashboardPanel extends PureComponent<Props, State> {
// handle plugin loading & changing of plugin type
if (!this.state.plugin || this.state.plugin.id !== panel.type) {
const plugin = config.panels[panel.type];
const plugin = config.panels[panel.type] || this.getPanelPluginNotFound(panel.type);
if (plugin.exports) {
this.cleanUpAngularPanel();
......@@ -87,6 +88,22 @@ export class DashboardPanel extends PureComponent<Props, State> {
}
}
getPanelPluginNotFound(id: string): PanelPlugin {
const NotFound = class NotFound extends PureComponent<PanelProps> {
render() {
return <PanelPluginNotFound pluginId={id} />;
}
};
return {
id: id,
name: id,
exports: {
PanelComponent: NotFound,
},
};
}
componentDidMount() {
this.loadPlugin();
}
......
......@@ -81,7 +81,7 @@ export class EditorTabBody extends PureComponent<Props, State> {
{toolbarItems.map(item => this.renderButton(item))}
</div>
<div className="panel-editor__scroll">
<CustomScrollbar>
<CustomScrollbar autoHide={false}>
<div className="panel-editor__content">
<FadeIn in={openView !== null} duration={200}>
{openView && this.renderOpenView(openView)}
......
import _ from 'lodash';
import React, { PureComponent } from 'react';
interface Props {
pluginId: string;
}
export class PanelPluginNotFound extends PureComponent<Props> {
constructor(props) {
super(props);
}
render() {
return <h2>Panel plugin with id {this.props.id} could not be found</h2>;
}
}
......@@ -21,7 +21,7 @@ import {
DataQueryOptions,
} from './series';
import { PanelProps, PanelOptionsProps } from './panel';
import { PluginDashboard, PluginMeta, Plugin, PluginsState } from './plugins';
import { PluginDashboard, PluginMeta, Plugin, PanelPlugin, PluginsState } from './plugins';
import { Organization, OrganizationPreferences, OrganizationState } from './organization';
import {
AppNotification,
......@@ -69,6 +69,7 @@ export {
UsersState,
TimeRange,
LoadingState,
PanelPlugin,
PanelProps,
PanelOptionsProps,
TimeSeries,
......
......@@ -12,13 +12,13 @@ export interface PluginExports {
// Panel plugin
PanelCtrl?;
PanelComponent?: ComponentClass<PanelProps>;
PanelOptionsComponent: ComponentClass<PanelOptionsProps>;
PanelOptionsComponent?: ComponentClass<PanelOptionsProps>;
}
export interface PanelPlugin {
id: string;
name: string;
meta: any;
meta: PluginMeta;
hideFromList: boolean;
module: string;
baseUrl: string;
......
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