-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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(native-filters): add support for preselect filters #15427
feat(native-filters): add support for preselect filters #15427
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15427 +/- ##
==========================================
- Coverage 77.22% 77.21% -0.02%
==========================================
Files 975 975
Lines 50634 50681 +47
Branches 6222 6239 +17
==========================================
+ Hits 39104 39133 +29
- Misses 11319 11337 +18
Partials 211 211
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -195,6 +197,10 @@ const FilterValue: React.FC<FilterProps> = ({ | |||
/> | |||
); | |||
} | |||
const filterState = { ...filter.dataMask?.filterState }; | |||
if (filterState.value === undefined && preselection) { | |||
filterState.value = preselection; |
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 in previous PR someone added regression for validation, but because your changes affect this place also, can you add here like:
const isMissingRequiredValue = checkIsMissingRequiredValue(
filter,
filter.dataMask?.filterState,
);
...
filterState={{
...filter.dataMask?.filterState,
validateMessage: isMissingRequiredValue && t('Value is required'),
}}
or may be we can create separate PR for 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.
Checked locally, works ok
* feat(native-filters): add support for sharing preselected filters * abc * add serialization (cherry picked from commit 4630abb)
* feat(native-filters): add support for sharing preselected filters * abc * add serialization
* feat(native-filters): add support for sharing preselected filters * abc * add serialization
* feat(native-filters): add support for sharing preselected filters * abc * add serialization
SUMMARY
This PR adds support for opening a dashboard with predefined filters passed via URL params. When clicking on "Copy dashboard URL" or "Share dashboard by email" in the Dashboard menu, a shortcut to an URL with RISON encoded filter state is created, which can be used to share the currently selected filters.
SCREENSHOTS
When opening up the link, the dashboard opens up with the predefined filter selection. Notice
native_filters
in the URL params:TESTING INSTRUCTIONS
dev-server
mode. So remember to manually update this to 9000 when testing locally)ADDITIONAL INFORMATION