The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/migrate-to-cloud/api/index.ts

62 lines
1.6 KiB

export * from './endpoints.gen';
import { BaseQueryFn, EndpointDefinition } from '@reduxjs/toolkit/dist/query';
import { generatedAPI } from './endpoints.gen';
export const cloudMigrationAPI = generatedAPI.enhanceEndpoints({
addTagTypes: ['cloud-migration-config', 'cloud-migration-run', 'cloud-migration-run-list'],
endpoints: {
// Cloud-side - create token
createCloudMigrationToken: suppressErrorsOnQuery,
// List Cloud Configs
getMigrationList: {
providesTags: ['cloud-migration-config'] /* should this be a -list? */,
},
// Create Cloud Config
createMigration(endpoint) {
suppressErrorsOnQuery(endpoint);
endpoint.invalidatesTags = ['cloud-migration-config'];
},
// Get one Cloud Config
getCloudMigration: {
providesTags: ['cloud-migration-config'],
},
// Delete one Cloud Config
deleteCloudMigration: {
invalidatesTags: ['cloud-migration-config'],
},
getCloudMigrationRunList: {
providesTags: ['cloud-migration-run-list'],
},
getCloudMigrationRun: {
providesTags: ['cloud-migration-run'],
},
runCloudMigration: {
invalidatesTags: ['cloud-migration-run-list'],
},
getDashboardByUid: suppressErrorsOnQuery,
},
});
function suppressErrorsOnQuery<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType>(
endpoint: EndpointDefinition<QueryArg, BaseQuery, TagTypes, ResultType>
) {
if (!endpoint.query) {
return;
}
const originalQuery = endpoint.query;
endpoint.query = (...args) => {
const baseQuery = originalQuery(...args);
baseQuery.showErrorAlert = false;
return baseQuery;
};
}