[MD]Add default icon in multi-selectable picker#6357
[MD]Add default icon in multi-selectable picker#6357zhongnansu merged 1 commit intoopensearch-project:mainfrom
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. |
| style={itemStyle} | ||
| > | ||
| {item.label} | ||
| <EuiFlexGroup alignItems="center"> |
There was a problem hiding this comment.
Looks like the default icon can be extracted into its own module since it will be shared among multiple components
| defaultDataSource, | ||
| }); | ||
|
|
||
| this.props.onSelectedDataSources(selectedOptions.filter((option) => option.checked === 'on')); |
There was a problem hiding this comment.
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.
Will make the change
643e663 to
5924364
Compare
| defaultDataSource: string | null; | ||
| } | ||
|
|
||
| export const ShowDataSourceOption: React.FC<ShowDataSourceOptionProps> = ({ |
There was a problem hiding this comment.
Can we simply name it DataSourceOption and then DataSourceOptionProps
There was a problem hiding this comment.
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.
why change from .catch() to try {} catch(){}, I didn't see the code logic differer from before
There was a problem hiding this comment.
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.
@zhyuanqi got you. this is fixing the bug that local host not able to render due to datasource.length = 0. Thanks!
95268bf to
d2b8457
Compare
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com>
Signed-off-by: Yuanqi(Ella) Zhu <zhyuanqi@amazon.com> (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 <zhyuanqi@amazon.com> (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 <zhyuanqi@amazon.com> (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:jestyarn test:jest_integration