mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
Query Library: Use current namespace when calling API (#90423)
* Use the current namespace * Enable PeakQ API * Enable PeakQ API when Query API is enabled * Enable PeakQ API when Query API & Query Library are enabled
This commit is contained in:
parent
6750e881e3
commit
f14ba32ea6
@ -31,8 +31,9 @@ func NewPeakQAPIBuilder() *PeakQAPIBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RegisterAPIService(features featuremgmt.FeatureToggles, apiregistration builder.APIRegistrar, reg prometheus.Registerer) *PeakQAPIBuilder {
|
func RegisterAPIService(features featuremgmt.FeatureToggles, apiregistration builder.APIRegistrar, reg prometheus.Registerer) *PeakQAPIBuilder {
|
||||||
if !features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs) {
|
if !((features.IsEnabledGlobally(featuremgmt.FlagQueryService) && features.IsEnabledGlobally(featuremgmt.FlagQueryLibrary)) ||
|
||||||
return nil // skip registration unless opting into experimental apis
|
features.IsEnabledGlobally(featuremgmt.FlagGrafanaAPIServerWithExperimentalAPIs)) {
|
||||||
|
return nil // skip registration unless explicitly added (or all experimental are added)
|
||||||
}
|
}
|
||||||
builder := NewPeakQAPIBuilder()
|
builder := NewPeakQAPIBuilder()
|
||||||
apiregistration.RegisterAPI(NewPeakQAPIBuilder())
|
apiregistration.RegisterAPI(NewPeakQAPIBuilder())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { BaseQueryFn } from '@reduxjs/toolkit/query/react';
|
import { BaseQueryFn } from '@reduxjs/toolkit/query/react';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { BackendSrvRequest, getBackendSrv, isFetchError } from '@grafana/runtime/src/services/backendSrv';
|
import { BackendSrvRequest, getBackendSrv, isFetchError } from '@grafana/runtime/src/services/backendSrv';
|
||||||
|
|
||||||
import { DataQuerySpecResponse } from './types';
|
import { DataQuerySpecResponse } from './types';
|
||||||
@ -22,7 +23,7 @@ export enum QueryTemplateKinds {
|
|||||||
*
|
*
|
||||||
* @alpha
|
* @alpha
|
||||||
*/
|
*/
|
||||||
export const BASE_URL = `/apis/${API_VERSION}/namespaces/default/querytemplates/`;
|
export const BASE_URL = `/apis/${API_VERSION}/namespaces/${config.namespace}/querytemplates/`;
|
||||||
|
|
||||||
// URL is optional for these requests
|
// URL is optional for these requests
|
||||||
interface QueryLibraryBackendRequest extends Pick<BackendSrvRequest, 'data' | 'method'> {
|
interface QueryLibraryBackendRequest extends Pick<BackendSrvRequest, 'data' | 'method'> {
|
||||||
|
Loading…
Reference in New Issue
Block a user