Folder: Fix top folder creation (#59422)

fix top folder creation
This commit is contained in:
Leo 2022-11-30 18:51:14 +01:00 committed by GitHub
parent 93eb8cb51d
commit ce630b2dc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -35,8 +35,11 @@ const pageNav: NavModelItem = {
function NewDashboardsFolder({ createNewFolder }: Props) {
const [queryParams] = useQueryParams();
const onSubmit = (formData: FormModel) => {
createNewFolder(formData.folderName, String(queryParams['folderUid']));
const folderUid = typeof queryParams['folderUid'] === 'string' ? queryParams['folderUid'] : undefined;
createNewFolder(formData.folderName, folderUid);
};
const validateFolderName = (folderName: string) => {
return validationSrv
.validateNewFolderName(folderName)

View File

@ -18,7 +18,7 @@ export const DashboardActions: FC<Props> = ({ folderUid, canCreateFolders = fals
url = `dashboards/folder/new/`;
}
if ((isTypeNewFolder && config.featureToggles.nestedFolders) || folderUid) {
if (folderUid) {
url += `?folderUid=${folderUid}`;
}