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

improved way of disable datasets #93

Merged
merged 8 commits into from
May 8, 2024
Merged

Conversation

gwdawson
Copy link
Member

@gwdawson gwdawson commented Apr 18, 2024

currently if you want to disable datasets you need to do the following:

  1. pass the enableDatasets = false prop into SqlQueryEditor.
  2. provide a custom toRawSql function, that doesn't expect a dataset

this pr removes the need for code duplication in all datasources with disabled datasets by no longer requiring a custom toRawSql function.

this pr also also changes where you declare disableDatasets, this is now declared in datasource.ts opposed to previously this was just a prop in the builder component.


after this pr is merged, the only thing you need to do is add the flag disableDatasets: true to the getDB function inside of datasource.ts.

getDB(): DB {
  return {
    {... your other database options}
    disableDatasets: true, // <---- just add this line here
  };
}

@gwdawson gwdawson self-assigned this Apr 18, 2024
@gwdawson gwdawson requested a review from gabor April 30, 2024 12:24
Copy link

@gabor gabor left a comment

Choose a reason for hiding this comment

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

LGTM 👍

src/components/QueryEditor/utils/sql.utils.ts Outdated Show resolved Hide resolved
@gwdawson gwdawson requested review from a team and removed request for yesoreyeram and alyssabull May 3, 2024 11:50
@gwdawson
Copy link
Member Author

gwdawson commented May 3, 2024

@grafana/enterprise-datasources can i please get a review from your side also, nothing needs to change in your datasources as the default behaviour is still to "use datasets"

src/components/QueryEditor/QueryEditor.tsx Outdated Show resolved Hide resolved
@gwdawson gwdawson merged commit 59afdd6 into main May 8, 2024
1 check passed
@gwdawson gwdawson deleted the gareth/dataset-improvements branch May 8, 2024 15:37
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.

None yet

3 participants