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

Explore: Run test datasource default selection when mounted #65864

Merged
merged 6 commits into from Apr 5, 2023

Conversation

gelicia
Copy link
Contributor

@gelicia gelicia commented Apr 3, 2023

What is this feature?

When the test datasource is selected, the query editor comes pre-populated with options where it can run without being changed. Because no changes can be made to the form for it to be a valid query, running "Run Queries" without editing anything is seen as an empty query and skipped. This updates the test data query editor on mount so the component picks up the default value.

Why do we need this feature?

Because opening the test datasource and finding the run query button to be non-responsive is a bad experience.

Which issue(s) does this PR fix?:

Fixes #65426

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@gelicia gelicia added this to the 10.0.0 milestone Apr 3, 2023
@gelicia gelicia added add to changelog no-backport Skip backport of PR labels Apr 3, 2023
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/pr-codeql-analysis-javascript.yml:analyze. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@gelicia gelicia marked this pull request as ready for review April 3, 2023 16:54
@gelicia gelicia requested review from a team as code owners April 3, 2023 16:54
@gelicia gelicia requested review from jackw, ashharrison90 and JoaoSilvaGrafana and removed request for a team April 3, 2023 16:54
@gelicia gelicia changed the title Explore: run test datasource default selection when mounted Explore: Run test datasource default selection when mounted Apr 3, 2023
Copy link
Member

@Elfo404 Elfo404 left a comment

Choose a reason for hiding this comment

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

tested it and i think the same can be achieved by adding

getDefaultQuery(): Partial<TestData> {
    return {
      scenarioId: TestDataQueryType.RandomWalk,
      seriesCount: 1,
    };
  }

to public/app/plugins/datasource/testdata/datasource.ts.

The however refers to -- Grafana -- datasource, so adding

  getDefaultQuery(): Partial<GrafanaQuery> {
    return {
      queryType: GrafanaQueryType.RandomWalk,
    };
  }

to public/app/plugins/datasource/grafana/datasource.ts would fix the issue also for that DS.

@gelicia gelicia requested a review from Elfo404 April 5, 2023 12:20
@gelicia
Copy link
Contributor Author

gelicia commented Apr 5, 2023

tested it and i think the same can be achieved by adding

@Elfo404 both an objectively better solution and on the right datasource (😅 ) thank you so much!

@gelicia gelicia merged commit 8dded02 into main Apr 5, 2023
12 checks passed
@gelicia gelicia deleted the kristina/test-datasource-run branch April 5, 2023 14:08
VikaCep pushed a commit that referenced this pull request Apr 5, 2023
* Run test datasource query when mounted

* Auto running test-datasource creates more query history entries

* Make exemplar query intercept more robust

* Delete unrelated query history queries

* Revert "Run test datasource query when mounted"

This reverts commit 28b37e4.

* Add default query to testdata and grafana datasources
@samjewell
Copy link
Contributor

Awesome 👏 , thanks for this @gelicia

@zerok zerok removed this from the 10.0.0 milestone May 31, 2023
@zerok zerok added this to the 10.0.0-preview milestone May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore: --Grafana-- Random Walk doesn't render
5 participants