mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Clean up old API methods in manage-dashboards/actions (#93329)
Chore: Deprecate createFolder() function, and remove other unused functions
This commit is contained in:
parent
c56870e511
commit
9fbd05773a
@ -3,7 +3,7 @@ import { getBackendSrv, getDataSourceSrv, isFetchError } from '@grafana/runtime'
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
import { createErrorNotification } from 'app/core/copy/appNotification';
|
||||
import { browseDashboardsAPI, ImportInputs } from 'app/features/browse-dashboards/api/browseDashboardsAPI';
|
||||
import { FolderInfo, PermissionLevelString, SearchQueryType, ThunkResult } from 'app/types';
|
||||
import { PermissionLevelString, SearchQueryType, ThunkResult } from 'app/types';
|
||||
|
||||
import {
|
||||
Input,
|
||||
@ -260,37 +260,11 @@ const getDataSourceDescription = (input: { usage?: InputUsage }): string | undef
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export async function moveFolders(folderUIDs: string[], toFolder: FolderInfo) {
|
||||
const result = {
|
||||
totalCount: folderUIDs.length,
|
||||
successCount: 0,
|
||||
};
|
||||
|
||||
for (const folderUID of folderUIDs) {
|
||||
try {
|
||||
const newFolderDTO = await moveFolder(folderUID, toFolder);
|
||||
if (newFolderDTO !== null) {
|
||||
result.successCount += 1;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to move a folder', err);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** @deprecated Use RTK Query methods from features/browse-dashboards/api/browseDashboardsAPI.ts instead */
|
||||
export function createFolder(payload: any) {
|
||||
return getBackendSrv().post('/api/folders', payload);
|
||||
}
|
||||
|
||||
export function moveFolder(uid: string, toFolder: FolderInfo) {
|
||||
const payload = {
|
||||
parentUid: toFolder.uid,
|
||||
};
|
||||
return getBackendSrv().post(`/api/folders/${uid}/move`, payload, { showErrorAlert: false });
|
||||
}
|
||||
|
||||
export const SLICE_FOLDER_RESULTS_TO = 1000;
|
||||
|
||||
export function searchFolders(
|
||||
|
Loading…
Reference in New Issue
Block a user