mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NestedFolders: Fix warning from tests, restore page default export (#66441)
NestedFolders: Fix warning from tests, and restore default export for page
This commit is contained in:
parent
2ea665a705
commit
0b2a4322db
@ -21,7 +21,7 @@ interface Props extends GrafanaRouteComponentProps<BrowseDashboardsPageRoutePara
|
|||||||
|
|
||||||
// New Browse/Manage/Search Dashboards views for nested folders
|
// New Browse/Manage/Search Dashboards views for nested folders
|
||||||
|
|
||||||
export const BrowseDashboardsPage = memo(({ match, location }: Props) => {
|
const BrowseDashboardsPage = memo(({ match, location }: Props) => {
|
||||||
const { uid: folderUID } = match.params;
|
const { uid: folderUID } = match.params;
|
||||||
|
|
||||||
const searchState = useMemo(() => {
|
const searchState = useMemo(() => {
|
||||||
@ -45,3 +45,4 @@ export const BrowseDashboardsPage = memo(({ match, location }: Props) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
BrowseDashboardsPage.displayName = 'BrowseDashboardsPage';
|
BrowseDashboardsPage.displayName = 'BrowseDashboardsPage';
|
||||||
|
export default BrowseDashboardsPage;
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
|
import { BaseQueryFn, createApi } from '@reduxjs/toolkit/query/react';
|
||||||
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
|
||||||
|
import { BackendSrvRequest, getBackendSrv } from '@grafana/runtime';
|
||||||
import { FolderDTO } from 'app/types';
|
import { FolderDTO } from 'app/types';
|
||||||
|
|
||||||
// interface RequestOptions extends BackendSrvRequest {
|
interface RequestOptions extends BackendSrvRequest {
|
||||||
// manageError?: (err: unknown) => { error: unknown };
|
manageError?: (err: unknown) => { error: unknown };
|
||||||
// showErrorAlert?: boolean;
|
showErrorAlert?: boolean;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// function createBackendSrvBaseQuery({ baseURL }: { baseURL: string }): BaseQueryFn<RequestOptions> {
|
function createBackendSrvBaseQuery({ baseURL }: { baseURL: string }): BaseQueryFn<RequestOptions> {
|
||||||
// async function backendSrvBaseQuery(requestOptions: RequestOptions) {
|
async function backendSrvBaseQuery(requestOptions: RequestOptions) {
|
||||||
// try {
|
try {
|
||||||
// const { data: responseData, ...meta } = await lastValueFrom(
|
const { data: responseData, ...meta } = await lastValueFrom(
|
||||||
// getBackendSrv().fetch({
|
getBackendSrv().fetch({
|
||||||
// ...requestOptions,
|
...requestOptions,
|
||||||
// url: baseURL + requestOptions.url,
|
url: baseURL + requestOptions.url,
|
||||||
// showErrorAlert: requestOptions.showErrorAlert,
|
showErrorAlert: requestOptions.showErrorAlert,
|
||||||
// })
|
})
|
||||||
// );
|
);
|
||||||
// return { data: responseData, meta };
|
return { data: responseData, meta };
|
||||||
// } catch (error) {
|
} catch (error) {
|
||||||
// return requestOptions.manageError ? requestOptions.manageError(error) : { error };
|
return requestOptions.manageError ? requestOptions.manageError(error) : { error };
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return backendSrvBaseQuery;
|
return backendSrvBaseQuery;
|
||||||
// }
|
}
|
||||||
|
|
||||||
export const browseDashboardsAPI = createApi({
|
export const browseDashboardsAPI = createApi({
|
||||||
reducerPath: 'browse-dashboards',
|
reducerPath: 'browse-dashboards',
|
||||||
baseQuery: fetchBaseQuery({ baseUrl: '/api' }),
|
baseQuery: createBackendSrvBaseQuery({ baseURL: '/api' }),
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
getFolder: builder.query<FolderDTO, string>({
|
getFolder: builder.query<FolderDTO, string>({
|
||||||
query: (folderUID) => `/folders/${folderUID}`,
|
query: (folderUID) => ({ url: `/folders/${folderUID}` }),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user