import { css, cx } from '@emotion/css'; import React from 'react'; import { AppPlugin, GrafanaTheme2, UrlQueryMap } from '@grafana/data'; import { useStyles2 } from '@grafana/ui'; import { VersionList } from '../components/VersionList'; import { usePluginConfig } from '../hooks/usePluginConfig'; import { CatalogPlugin, PluginTabIds } from '../types'; import { AppConfigCtrlWrapper } from './AppConfigWrapper'; import { PluginDashboards } from './PluginDashboards'; type Props = { plugin: CatalogPlugin; queryParams: UrlQueryMap; pageId: string; }; export function PluginDetailsBody({ plugin, queryParams, pageId }: Props): JSX.Element { const styles = useStyles2(getStyles); const { value: pluginConfig } = usePluginConfig(plugin); if (pageId === PluginTabIds.OVERVIEW) { return (
); } if (pageId === PluginTabIds.VERSIONS) { return (
); } if (pageId === PluginTabIds.CONFIG && pluginConfig?.angularConfigCtrl) { return (
); } if (pluginConfig?.configPages) { for (const configPage of pluginConfig.configPages) { if (pageId === configPage.id) { return (
); } } } if (pageId === PluginTabIds.DASHBOARDS && pluginConfig) { return (
); } return (

Page not found.

); } export const getStyles = (theme: GrafanaTheme2) => ({ container: css` padding: ${theme.spacing(3, 4)}; `, readme: css` & img { max-width: 100%; } h1, h2, h3 { margin-top: ${theme.spacing(3)}; margin-bottom: ${theme.spacing(2)}; } *:first-child { margin-top: 0; } li { margin-left: ${theme.spacing(2)}; & > p { margin: ${theme.spacing()} 0; } } a { color: ${theme.colors.text.link}; &:hover { color: ${theme.colors.text.link}; text-decoration: underline; } } `, });