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:
Josh Hunt 2024-09-13 15:11:41 +01:00 committed by GitHub
parent c56870e511
commit 9fbd05773a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(