import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { config } from '@grafana/runtime'; import { SceneComponentProps } from '@grafana/scenes'; import { Alert, ClipboardButton, Divider, Stack, Text, useStyles2 } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; import { getDashboardSceneFor } from '../../utils/utils'; import ShareInternallyConfiguration from '../ShareInternallyConfiguration'; import { ShareLinkTab, ShareLinkTabState } from '../ShareLinkTab'; import { SharePanelPreview } from './SharePanelPreview'; export class SharePanelInternally extends ShareLinkTab { static Component = SharePanelInternallyRenderer; constructor(state: Partial) { super(state); } public getTabLabel() { return t('share-panel.drawer.share-link-title', 'Link settings'); } } function SharePanelInternallyRenderer({ model }: SceneComponentProps) { const styles = useStyles2(getStyles); const { useLockedTime, useShortUrl, selectedTheme, isBuildUrlLoading, imageUrl, panelRef } = model.useState(); const panelTitle = panelRef?.resolve().state.title; const dashboard = getDashboardSceneFor(model); const isDashboardSaved = Boolean(dashboard.state.uid); return (
Create a personalized, direct link to share your panel within your organization, with the following customization settings:
Copy link
{!isDashboardSaved && ( To render a panel image, you must save the dashboard first. )} {!config.rendererAvailable && ( To render a panel image, you must install the{' '} Grafana image renderer plugin . Please contact your Grafana administrator to install the plugin. )}
); } const getStyles = (theme: GrafanaTheme2) => ({ configurationContainer: css({ marginTop: theme.spacing(2), }), });