grafana/public/app/features/dashboard/dashgrid/PanelPluginNotFound.tsx

69 lines
1.4 KiB
TypeScript
Raw Normal View History

// Libraries
2018-11-12 10:54:44 -06:00
import _ from 'lodash';
import React, { PureComponent } from 'react';
2019-02-15 05:55:35 -06:00
// Components
import { AlertBox } from 'app/core/components/AlertBox/AlertBox';
// Types
2019-02-15 05:55:35 -06:00
import { PanelPlugin, AppNotificationSeverity } from 'app/types';
import { PanelProps, ReactPanelPlugin } from '@grafana/ui';
2018-11-12 10:54:44 -06:00
interface Props {
pluginId: string;
}
2018-11-13 00:54:02 -06:00
class PanelPluginNotFound extends PureComponent<Props> {
2018-11-12 10:54:44 -06:00
constructor(props) {
super(props);
}
render() {
2018-11-13 00:54:02 -06:00
const style = {
display: 'flex',
2018-11-13 01:40:42 -06:00
alignItems: 'center',
2019-02-15 05:55:35 -06:00
justifyContent: 'center',
2018-11-13 00:54:02 -06:00
height: '100%',
};
return (
<div style={style}>
2019-02-21 09:07:07 -06:00
<AlertBox severity={AppNotificationSeverity.Error} title={`Panel plugin not found: ${this.props.pluginId}`} />
2018-11-13 00:54:02 -06:00
</div>
);
2018-11-12 10:54:44 -06:00
}
}
2018-11-13 00:54:02 -06:00
export function getPanelPluginNotFound(id: string): PanelPlugin {
const NotFound = class NotFound extends PureComponent<PanelProps> {
render() {
return <PanelPluginNotFound pluginId={id} />;
}
};
return {
id: id,
name: id,
sort: 100,
module: '',
baseUrl: '',
dataFormats: [],
info: {
author: {
name: '',
},
description: '',
links: [],
logos: {
large: '',
small: '',
},
screenshots: [],
updated: '',
version: '',
2018-11-13 00:54:02 -06:00
},
reactPlugin: new ReactPanelPlugin(NotFound),
angularPlugin: null,
2018-11-13 00:54:02 -06:00
};
}