LibraryPanels: Use new folder picker when creating a library panel (#89228)

LibraryPanels: Use new folder picker when creating a Library Panel
This commit is contained in:
Josh Hunt 2024-06-17 10:19:57 +01:00 committed by GitHub
parent 0107754da8
commit d4bba872a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,7 +4,7 @@ import { useAsync, useDebounce } from 'react-use';
import { FetchError, isFetchError } from '@grafana/runtime';
import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen';
import { Button, Field, Input, Modal } from '@grafana/ui';
import { OldFolderPicker } from 'app/core/components/Select/OldFolderPicker';
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
import { t, Trans } from 'app/core/internationalization';
import { PanelModel } from '../../../dashboard/state';
@ -36,6 +36,7 @@ export const AddLibraryPanelContents = ({
const onCreate = useCallback(() => {
panel.libraryPanel = { uid: '', name: panelName };
saveLibraryPanel(panel, folderUid!).then((res: LibraryPanel | FetchError) => {
if (!isFetchError(res)) {
onDismiss?.();
@ -84,9 +85,9 @@ export const AddLibraryPanelContents = ({
'Library panel permissions are derived from the folder permissions'
)}
>
<OldFolderPicker
onChange={({ uid }) => setFolderUid(uid)}
initialFolderUid={initialFolderUid}
<FolderPicker
onChange={(uid) => setFolderUid(uid)}
value={folderUid}
inputId="share-panel-library-panel-folder-picker"
/>
</Field>