-
Notifications
You must be signed in to change notification settings - Fork 805
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
[Multiple Datasource]DataSourceView add switch to default data source button #6610
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6610 +/- ##
==========================================
- Coverage 67.43% 67.37% -0.07%
==========================================
Files 3444 3446 +2
Lines 67847 67906 +59
Branches 11035 11047 +12
==========================================
- Hits 45755 45750 -5
- Misses 19426 19491 +65
+ Partials 2666 2665 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
5 ci group failed somehow, re-running now |
What's the input for the data source component? Also can we show the popover? |
The toast message should change too and can you double check the requirement? |
Can we add test for when invalid datasource id gets passed in and there is default data source, we should the right popover with toast and be able to switch to use default data source? |
Test 5.2 cover this case |
Test 2 cover this |
5dea762
to
0ef40a5
Compare
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
52bc664
to
c219834
Compare
src/plugins/data_source_management/public/components/data_source_view/data_source_view.tsx
Outdated
Show resolved
Hide resolved
1a3d93c
to
db706f0
Compare
if (optionId === '' && !this.props.hideLocalCluster) { | ||
this.setState({ | ||
selectedOption: [LocalCluster], | ||
defaultDataSource, | ||
defaultDataSource: filteredDefaultDataSourceOption, |
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 changing default data source?
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 might miss this comment before, but for optionId === ' ' && !this.props.hideLocalCluster
, we only update the defaultDataSource ( type of string ) as previous logic
defaultDataSource: string | null | ||
) { | ||
const selectedDataSource = await this.getSelectedDataSource(dataSourceId, defaultDataSource); | ||
if (!this._isMounted) return; |
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.
do we need this check?
} | ||
|
||
await this.getAndSetDefaultDataSourceOption(dataSourceId, defaultDataSource); | ||
this.handleInvalidDataSourceError(dataSourceId); |
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.
are we calling this.handleInvalidDataSourceError twice if there is exception in this.getAndSetDefaultDataSourceOption
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.
Woops, it did call twice then, let me update the getAndSetDefaultDataSourceOption to only return error not call handleInvalidDataSourceError
} | ||
this.clearSelectedOptionState(); |
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.
should this be same as handle invalid data source?
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.
what clearSelectedOptionState does:
- clear the state for selectedOption
- pass empty array to
onSelectedDataSources
if it exist
what handle invalid data source does: - show error state
- set defaultDataSourceOption
- show notification
- pass empty array to
onSelectedDataSources
if it exist - show switch to default option if the defaultOption exist
the only overlap ispass empty array to
onSelectedDataSourcesif it exist
, therefore, I think they are different
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Signed-off-by: yujin-emma <yujin.emma.work@gmail.com>
Description
Add switch to default data source when pass in invalid data source id for DataSourceView
We expect to see
When pass in invalid data source id
Issues Resolved
Screenshot
Testing the changes
Happy case:
when pass in valid id without label, the DataSourceView can display the correct label
Happy case but the result got filter out, we treat it as invalid id error:
Overall Test Result:
When pass in invalid data source id
test input:
1. When hide local cluster, and there is no default data source
2. When hide local cluster, and there is default data source
3. Test mobile view
4. Test iphone SE View
5. When not hide local cluster:
5.1. When no default data source - both the popover and toast should not display the button to switch the default data source
5.2. When there is default data source - both the popover and toast should display the switch button to switch to the default data source
6. If only pass in valid data source id, the DataSourceView will render the correct data source title, if click the header button, the popover will show up and only checked with the activeOption, there is no error toast, no switch to default button
Test input from examples:
Changelog
Check List
yarn test:jest
yarn test:jest_integration