diff --git a/public/app/features/alerting/unified/api/onCallApi.ts b/public/app/features/alerting/unified/api/onCallApi.ts index 6a71824a4fa..fdb08f9f991 100644 --- a/public/app/features/alerting/unified/api/onCallApi.ts +++ b/public/app/features/alerting/unified/api/onCallApi.ts @@ -38,13 +38,13 @@ export interface OnCallConfigChecks { is_integration_chatops_connected: boolean; } -const getProxyApiUrl = (path: string) => `/api/plugin-proxy/${SupportedPlugin.OnCall}${path}`; +const getProxyApiUrl = (path: string) => `/api/plugins/${SupportedPlugin.OnCall}/resources${path}`; export const onCallApi = alertingApi.injectEndpoints({ endpoints: (build) => ({ grafanaOnCallIntegrations: build.query({ query: () => ({ - url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/'), + url: getProxyApiUrl('/alert_receive_channels/'), // legacy_grafana_alerting is necessary for OnCall. // We do NOT need to differentiate between these two on our side params: { @@ -64,14 +64,14 @@ export const onCallApi = alertingApi.injectEndpoints({ }), validateIntegrationName: build.query({ query: (name) => ({ - url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/validate_name/'), + url: getProxyApiUrl('/alert_receive_channels/validate_name/'), params: { verbal_name: name }, showErrorAlert: false, }), }), createIntegration: build.mutation({ query: (integration) => ({ - url: getProxyApiUrl('/api/internal/v1/alert_receive_channels/'), + url: getProxyApiUrl('/alert_receive_channels/'), data: integration, method: 'POST', showErrorAlert: true, @@ -80,13 +80,13 @@ export const onCallApi = alertingApi.injectEndpoints({ }), features: build.query({ query: () => ({ - url: getProxyApiUrl('/api/internal/v1/features/'), + url: getProxyApiUrl('/features/'), showErrorAlert: false, }), }), onCallConfigChecks: build.query({ query: () => ({ - url: getProxyApiUrl('/api/internal/v1/organization/config-checks/'), + url: getProxyApiUrl('/organization/config-checks/'), showErrorAlert: false, }), }), diff --git a/public/app/features/alerting/unified/mocks/server/handlers/plugins/grafana-oncall.ts b/public/app/features/alerting/unified/mocks/server/handlers/plugins/grafana-oncall.ts index b1d042f54a4..e015cf80f80 100644 --- a/public/app/features/alerting/unified/mocks/server/handlers/plugins/grafana-oncall.ts +++ b/public/app/features/alerting/unified/mocks/server/handlers/plugins/grafana-oncall.ts @@ -2,22 +2,22 @@ import { HttpResponse, http } from 'msw'; import { ONCALL_INTEGRATION_V2_FEATURE, OnCallIntegrationDTO } from 'app/features/alerting/unified/api/onCallApi'; -const BASE_URL = `/api/plugin-proxy/grafana-oncall-app`; +const BASE_URL = `/api/plugins/grafana-oncall-app/resources`; export const getOnCallIntegrationsHandler = (receiveChannels: OnCallIntegrationDTO[] = []) => - http.get(`${BASE_URL}/api/internal/v1/alert_receive_channels`, () => { + http.get(`${BASE_URL}/alert_receive_channels`, () => { return HttpResponse.json(receiveChannels); }); export const getFeaturesHandler = (features = [ONCALL_INTEGRATION_V2_FEATURE]) => - http.get(`${BASE_URL}/api/internal/v1/features`, () => { + http.get(`${BASE_URL}/features`, () => { return HttpResponse.json(features); }); const validateIntegrationNameHandler = ( invalidNames: string[] = ['grafana-integration', 'alertmanager-integration'] ) => { - return http.get(`${BASE_URL}/api/internal/v1/alert_receive_channels/validate_name`, ({ request }) => { + return http.get(`${BASE_URL}/alert_receive_channels/validate_name`, ({ request }) => { const url = new URL(request.url); const isValid = !invalidNames.includes(url.searchParams.get('verbal_name') ?? ''); return HttpResponse.json(isValid, {