mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Use new NestedFolderPicker in SaveDashboardAsForm (#72189)
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
import { Button, Input, Switch, Form, Field, InputControl, HorizontalGroup } from '@grafana/ui';
|
||||
import { NestedFolderPicker } from 'app/core/components/NestedFolderPicker/NestedFolderPicker';
|
||||
import { OldFolderPicker } from 'app/core/components/Select/OldFolderPicker';
|
||||
import { FolderPicker } from 'app/core/components/Select/FolderPicker';
|
||||
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
|
||||
import { validationSrv } from 'app/features/manage-dashboards/services/ValidationSrv';
|
||||
|
||||
@@ -110,23 +108,17 @@ export const SaveDashboardAsForm = ({
|
||||
</Field>
|
||||
<Field label="Folder">
|
||||
<InputControl
|
||||
render={({ field: { ref, ...field } }) =>
|
||||
config.featureToggles.nestedFolderPicker ? (
|
||||
<NestedFolderPicker
|
||||
{...field}
|
||||
onChange={(uid: string, title: string) => field.onChange({ uid, title })}
|
||||
value={field.value?.uid}
|
||||
/>
|
||||
) : (
|
||||
<OldFolderPicker
|
||||
{...field}
|
||||
dashboardId={dashboard.id}
|
||||
initialFolderUid={dashboard.meta.folderUid}
|
||||
initialTitle={dashboard.meta.folderTitle}
|
||||
enableCreateNew
|
||||
/>
|
||||
)
|
||||
}
|
||||
render={({ field: { ref, ...field } }) => (
|
||||
<FolderPicker
|
||||
{...field}
|
||||
onChange={(uid: string, title: string) => field.onChange({ uid, title })}
|
||||
value={field.value?.uid}
|
||||
// Old folder picker fields
|
||||
initialTitle={dashboard.meta.folderTitle}
|
||||
dashboardId={dashboard.id}
|
||||
enableCreateNew
|
||||
/>
|
||||
)}
|
||||
control={control}
|
||||
name="$folder"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user