-
Notifications
You must be signed in to change notification settings - Fork 640
feat: default filters #14898
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
feat: default filters #14898
Conversation
| export type RequiredFilter = { | ||
| [key: string]: AnyType; | ||
| } & { | ||
| required?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we can accept all different values within [key: string] , required can't be used like this:
{
[key: string]: AnyType;
required?: boolean;
}
There is a small edge case, which is that you can't have a required: false filter on a required named dimension... A workaround would be to implement an alias (like req) but I'd wait until this becomes an issue...
92b48e8 to
3f813e1
Compare
M packages/common/src/types/filterGrammar.test.ts M packages/common/src/types/filterGrammar.ts M packages/common/src/utils/filters.ts M packages/frontend/src/components/Explorer/FiltersCard/FiltersCard.tsx M packages/frontend/src/components/common/Filters/index.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I put a question that I think I see the answer to.
But I left it just to ask: should we should some UI indication of the required filters?I guess it could be construed as a data-security problem to show that data is being silently filtered. But it could also be a bit confusing not to mention it.
| meta: | ||
| default_filters: | ||
| - timestamp: 'inThePast 5 years' | ||
| required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this timestamp one operate? Does it just basically work behind the scenes with no UI? I see the other one in the UI. Do we not expect to see any indication of this to users or am I just missing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, cool. Yup, I see it now!
| if (data && data.tables[tableName]) { | ||
| const requiredFilters = data.tables[tableName].requiredFilters; | ||
| // We only force required filters that are not explicitly set to false | ||
| // requiredFilters with required:false will be added on the UI, but not enforced on the backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this answers my other question
M packages/common/src/types/filterGrammar.test.ts M packages/common/src/types/filterGrammar.ts
M packages/common/src/types/filterGrammar.ts
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
|
API tests are failing because I modified content in jaffle shop |
|
Waiting until @almeidabbm confirms this is compatible with his filters with joins feature. |
All is working @rephus Including Only thing I noticed is that when you refresh dbt the UI doesn't update right away, we need to manually reload the page. |
|
🎉 This PR is included in version 0.1651.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Closes: #14809
Description:
This PR introduces the concept of "default filters" as an alternative to "required filters" with the ability to mark them as optional.
Key changes:
default_filtersin model metadata (alias forrequired_filters)required: falseflag for filters that should be suggested but not enforcedrequired: falseThis allows models to suggest default filters to users without forcing them to be applied, improving the user experience when creating new charts.
Example usage in YAML:
Screencast.from.2025-05-20.17-14-20.webm
Reviewer actions