-
Notifications
You must be signed in to change notification settings - Fork 917
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
[MD]Add default icon in multi-selectable picker #6357
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6357 +/- ##
===========================================
+ Coverage 55.58% 67.52% +11.93%
===========================================
Files 1199 3378 +2179
Lines 24259 65885 +41626
Branches 4087 10661 +6574
===========================================
+ Hits 13485 44487 +31002
- Misses 10133 18808 +8675
- Partials 641 2590 +1949
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -148,7 +153,14 @@ export const DataSourceFilterGroup: React.FC<DataSourceFilterGroupProps> = ({ | |||
showIcons={true} | |||
style={itemStyle} | |||
> | |||
{item.label} | |||
<EuiFlexGroup alignItems="center"> |
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 like the default icon can be extracted into its own module since it will be shared among multiple components
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.
would do
}); | ||
|
||
this.props.onSelectedDataSources(selectedOptions.filter((option) => option.checked === 'on')); |
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 like we can just send back selectedOptions since selectedOptions always have checked field being set to on
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.
Will make the change
643e663
to
5924364
Compare
defaultDataSource: string | null; | ||
} | ||
|
||
export const ShowDataSourceOption: React.FC<ShowDataSourceOptionProps> = ({ |
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.
Can we simply name it DataSourceOption and then DataSourceOptionProps
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.
Hi We have a type called DataSourceOption already. Let me rename it to DataSourceOptionItem as it shows each item
visible: true, | ||
}) | ||
); | ||
try { |
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.
why change from .catch()
to try {} catch(){}
, I didn't see the code logic differer from before
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.
Hi Zhongnan this is the original code(https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data_source_management/public/components/data_source_multi_selectable/data_source_multi_selectable.tsx#L46). It puts all the logic under if (fetchedDataSources?.length) {
I want to refactor the code, so i use the try{} catch {}
Now it is
try {
const fetchedDataSources = await getDataSourcesWithFields....
if (fetchedDataSources?.length) {
...
}
if (!this.props.hideLocalCluster) {
....
}
}.catch() {
}
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.
@zhyuanqi got you. this is fixing the bug that local host not able to render due to datasource.length = 0. Thanks!
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.
lgtm
95268bf
to
d2b8457
Compare
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]>
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]> (cherry picked from commit 87deeda) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]> (cherry picked from commit 87deeda) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
Signed-off-by: Yuanqi(Ella) Zhu <[email protected]> (cherry picked from commit 87deeda) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Add default icon in multi-selectable picker and fix a bug in when datasource length is 0, localcluster would not be added.
Screenshot
Screen.Recording.2024-04-05.at.2.55.15.PM.mov
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration