Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deprecated-apis): remove backendSrv.datasourceRequest #320

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

polomani
Copy link
Contributor

@polomani polomani commented Feb 2, 2024

Problem / User story

  • introduced Fetcher, a simple type with a fetch() method, to encapsulate an HTTP client
  • since we are mocking the fetcher in the tests, I made it possible to supply a custom one into the initSources method
  • resolved incompatibility issue where @grafana/runtime@^10.3.1 type didn't play well with the ~10.2 (by just updating the dependency)
  • resolved deprecation warning in which backendSrv.datasourceRequest should be replaced with backendSrv.fetch, ref https://community.grafana.com/t/how-to-migrate-from-backendsrv-datasourcerequest-to-backendsrv-fetch/58770

@polomani polomani changed the title [WIP] fix(deprecated-apis): remove backendSrv.datasourceRequest fix(deprecated-apis): remove backendSrv.datasourceRequest Feb 5, 2024
@polomani polomani marked this pull request as ready for review February 5, 2024 14:54
@polomani polomani requested a review from a team February 5, 2024 14:54
Comment on lines -87 to +110
this.connector = new Connector(
const connector = new Connector(
this.project,
url,
this.backendSrv,
defaultFetcher,
oauthPassThru,
oauthClientCreds,
enableTemplates,
enableEventsAdvancedFiltering,
enableFlexibleDataModelling,
enableExtractionPipelines
);
this.initSources(connector);
}

initSources (connector: Connector) {
this.connector = connector;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why to move the connector init to a separate method instead of keeping it in the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately constructor cannot accept any more params, seems like it's somehow forbidden by Grafana instance itself somewhere

@polomani polomani merged commit aed9b06 into master Feb 5, 2024
3 checks passed
@polomani polomani deleted the remove-backendSrv.datasourceRequest branch February 5, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants