mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Fix: Redirect to correct url after creating a folder (#26160)
This commit is contained in:
parent
2ac1bfcc79
commit
9948e9298f
@ -1,13 +1,12 @@
|
||||
import { AppEvents } from '@grafana/data';
|
||||
import { AppEvents, locationUtil } from '@grafana/data';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { FolderState, ThunkResult } from 'app/types';
|
||||
import { DashboardAcl, DashboardAclUpdateDTO, NewDashboardAclItem, PermissionLevel } from 'app/types/acl';
|
||||
|
||||
import { updateLocation, updateNavIndex } from 'app/core/actions';
|
||||
import { buildNavModel } from './navModel';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { loadFolder, loadFolderPermissions } from './reducers';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
|
||||
export function getFolderByUid(uid: string): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
@ -122,9 +121,8 @@ export function addFolderPermission(newItem: NewDashboardAclItem): ThunkResult<v
|
||||
|
||||
export function createNewFolder(folderName: string): ThunkResult<void> {
|
||||
return async dispatch => {
|
||||
// @ts-ignore
|
||||
const newFolder = await getBackendSrv().createFolder({ title: folderName });
|
||||
const newFolder = await getBackendSrv().post('/api/folders', { title: folderName });
|
||||
appEvents.emit(AppEvents.alertSuccess, ['Folder Created', 'OK']);
|
||||
dispatch(updateLocation({ path: newFolder.url }));
|
||||
dispatch(updateLocation({ path: locationUtil.stripBaseFromUrl(newFolder.url) }));
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user