mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudMonitoring: Migrate to use backend plugin SDK contracts (#38650)
* Use SDK contracts for cloudmonitoring * Get build running, tests passing and do some refactoring (#38754) * fix build+tests and refactor * remove alerting stuff * remove unused field * fix plugin fetch * end to end * resp rename * tidy annotations * reformatting * update refID * reformat imports * fix styling * clean up unmarshalling * uncomment + fix tests * appease linter * remove spaces * remove old cruft * add check for empty queries * update tests * remove pm as dep * adjust proxy route contract * fix service loading * use UNIX val * fix endpoint + resp * h@ckz for frontend * fix resp * fix interval * always set custom meta * remove unused param * fix labels fetch * fix linter * fix test + remove unused field * apply pr feedback * fix grafana-auto intervals * fix tests * resolve conflicts * fix bad merge * fix conflicts * remove bad logger import Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> Co-authored-by: Will Browne <will.browne@grafana.com>
This commit is contained in:
@@ -70,7 +70,7 @@ export default class Api {
|
||||
|
||||
post(data: Record<string, any>): Observable<FetchResponse<PostResponse>> {
|
||||
return getBackendSrv().fetch<PostResponse>({
|
||||
url: '/api/tsdb/query',
|
||||
url: '/api/ds/query',
|
||||
method: 'POST',
|
||||
data,
|
||||
});
|
||||
|
||||
@@ -163,11 +163,10 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
|
||||
});
|
||||
}),
|
||||
map(({ data }) => {
|
||||
return data;
|
||||
}),
|
||||
map((response) => {
|
||||
const result = response.results[refId];
|
||||
return result && result.meta ? result.meta.labels : {};
|
||||
const dataQueryResponse = toDataQueryResponse({
|
||||
data: data,
|
||||
});
|
||||
return dataQueryResponse?.data[0]?.meta?.custom?.labels ?? {};
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -219,9 +218,10 @@ export default class CloudMonitoringDatasource extends DataSourceWithBackend<
|
||||
})
|
||||
.pipe(
|
||||
map(({ data }) => {
|
||||
return data && data.results && data.results.getGCEDefaultProject && data.results.getGCEDefaultProject.meta
|
||||
? data.results.getGCEDefaultProject.meta.defaultProject
|
||||
: '';
|
||||
const dataQueryResponse = toDataQueryResponse({
|
||||
data: data,
|
||||
});
|
||||
return dataQueryResponse?.data[0]?.meta?.custom?.defaultProject ?? '';
|
||||
}),
|
||||
catchError((err) => {
|
||||
return throwError(err.data.error);
|
||||
|
||||
Reference in New Issue
Block a user