import { css } from '@emotion/css'; import { PropsWithChildren } from 'react'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; import { SceneObjectRef, VizPanel } from '@grafana/scenes'; import { Alert, Button, Divider, Field, RadioButtonGroup, Stack, Text, useStyles2 } from '@grafana/ui'; import { Input } from '@grafana/ui/src/components/Input/Input'; import { t, Trans } from 'app/core/internationalization'; import { getExpireOptions } from '../../ShareSnapshotTab'; const DASHBOARD_SNAPSHOT_URL = 'https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/#share-a-snapshot'; const PANEL_SNAPSHOT_URL = 'https://grafana.com/docs/grafana/next/dashboards/share-dashboards-panels/#panel-snapshot'; interface Props { name: string; selectedExpireOption: SelectableValue; onNameChange: (v: string) => void; onExpireChange: (v: number) => void; panelRef?: SceneObjectRef; disableInputs: boolean; } export function UpsertSnapshot({ name, onNameChange, onExpireChange, selectedExpireOption, panelRef, disableInputs, children, }: Props & PropsWithChildren) { const styles = useStyles2(getStyles); return (
{panelRef ? ( A Grafana panel snapshot publicly shares a panel while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot. ) : ( A Grafana dashboard snapshot publicly shares a dashboard while removing sensitive data such as queries and panel links, leaving only visible metrics and series names. Anyone with the link can access the snapshot. )}
onNameChange(e.currentTarget.value)} /> id="expire-select-input" options={getExpireOptions()} value={selectedExpireOption?.value} onChange={onExpireChange} />
{children}
); } const getStyles = (theme: GrafanaTheme2) => ({ container: css({ paddingBottom: theme.spacing(2), }), });