2025-05-15 15:17:14 +08:00
|
|
|
import { Trans } from '@grafana/i18n';
|
|
|
|
|
|
2022-07-20 15:25:09 +08:00
|
|
|
import { GenericDataSourcePlugin } from '../types';
|
|
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
|
plugin?: GenericDataSourcePlugin | null;
|
|
|
|
|
pageId: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export function DataSourcePluginConfigPage({ plugin, pageId }: Props) {
|
|
|
|
|
if (!plugin || !plugin.configPages) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const page = plugin.configPages.find(({ id }) => id === pageId);
|
|
|
|
|
|
|
|
|
|
if (page) {
|
|
|
|
|
// TODO: Investigate if any plugins are using this? We should change this interface
|
|
|
|
|
return <page.body plugin={plugin} query={{}} />;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-22 18:02:01 +08:00
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Trans i18nKey="datasources.data-source-plugin-config-page.page-not-found">Page not found: {{ page }}</Trans>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2022-07-20 15:25:09 +08:00
|
|
|
}
|