Canvas: Support template variables in base URL of actions (#91227)

This commit is contained in:
Nathan Marrs
2024-07-30 17:21:57 -07:00
committed by GitHub
parent 0a34b51055
commit a71dfd3109
@@ -12,7 +12,8 @@ type IsLoadingCallback = (loading: boolean) => void;
export const callApi = (api: APIEditorConfig, updateLoadingStateCallback?: IsLoadingCallback) => {
if (api && api.endpoint) {
// If API endpoint origin matches Grafana origin, don't call it.
if (requestMatchesGrafanaOrigin(api.endpoint)) {
const interpolatedUrl = interpolateVariables(api.endpoint);
if (requestMatchesGrafanaOrigin(interpolatedUrl)) {
appEvents.emit(AppEvents.alertError, ['Cannot call API at Grafana origin.']);
updateLoadingStateCallback && updateLoadingStateCallback(false);
return;