2022-06-27 12:33:30 -03:00
|
|
|
import React, { useEffect } from 'react';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2022-06-27 12:33:30 -03:00
|
|
|
import { reportInteraction } from '@grafana/runtime/src';
|
2022-10-06 16:34:04 +01:00
|
|
|
import { Trans } from 'app/core/internationalization';
|
2021-04-15 08:29:34 +01:00
|
|
|
import { AddLibraryPanelContents } from 'app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal';
|
2022-04-22 14:33:13 +01:00
|
|
|
|
2021-10-15 08:57:55 +02:00
|
|
|
import { ShareModalTabProps } from './types';
|
2021-04-15 08:29:34 +01:00
|
|
|
|
2021-10-15 08:57:55 +02:00
|
|
|
interface Props extends ShareModalTabProps {
|
2022-11-17 09:22:57 +01:00
|
|
|
initialFolderUid?: string;
|
2021-04-15 08:29:34 +01:00
|
|
|
}
|
|
|
|
|
|
2022-11-17 09:22:57 +01:00
|
|
|
export const ShareLibraryPanel = ({ panel, initialFolderUid, onDismiss }: Props) => {
|
2022-06-27 12:33:30 -03:00
|
|
|
useEffect(() => {
|
|
|
|
|
reportInteraction('grafana_dashboards_library_panel_share_viewed');
|
|
|
|
|
}, []);
|
|
|
|
|
|
2021-04-15 08:29:34 +01:00
|
|
|
if (!panel) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2021-04-26 07:18:46 +02:00
|
|
|
<>
|
2022-08-04 16:43:49 +01:00
|
|
|
<p className="share-modal-info-text">
|
2022-10-06 16:34:04 +01:00
|
|
|
<Trans i18nKey="share-modal.library.info">Create library panel.</Trans>
|
2022-08-04 16:43:49 +01:00
|
|
|
</p>
|
2022-11-17 09:22:57 +01:00
|
|
|
<AddLibraryPanelContents panel={panel} initialFolderUid={initialFolderUid} onDismiss={onDismiss!} />
|
2021-04-26 07:18:46 +02:00
|
|
|
</>
|
2021-04-15 08:29:34 +01:00
|
|
|
);
|
|
|
|
|
};
|