Skip to content
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] skip data source view when pick default #2574

Merged
merged 1 commit into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* [Vis Builder] Fixes visualization shift when editing agg ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
* [Vis Builder] Renames "Histogram" to "Bar" in vis type picker ([2401](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2401))
* [MD] Add data source param to low-level search call in Discover ([#2431](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2431))
* [Multi DataSource] Skip data source view in index pattern step when pick default ([#2574](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2574))

### 🚞 Infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ export const Header: React.FC<HeaderProps> = ({
<EuiFlexGroup>
<EuiFlexItem>
<EuiForm isInvalid={isInputInvalid}>
{dataSourceEnabled
{dataSourceEnabled && dataSourceRef?.title
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we only check if the dataSourceRef is defined, instead of using title. Is there a case that dataSouceRef comes without title?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not today, but not sure in future, that's why I prefer to do the safer check -- also the UX only uses the title section and it does not make sense to show data source when it's not presented.

? renderDataSourceAndIndexPatternInput(
isInputInvalid,
errors,
characterList,
query,
onQueryChanged,
dataSourceRef!
dataSourceRef.title
)
: renderIndexPatternInput(
isInputInvalid,
Expand Down Expand Up @@ -216,7 +216,7 @@ const renderDataSourceAndIndexPatternInput = (
characterList: string,
query: string,
onQueryChanged: (e: React.ChangeEvent<HTMLInputElement>) => void,
dataSourceRef: DataSourceRef
dataSourceTitle: string
) => {
return (
<EuiFlexGroup gutterSize="none">
Expand All @@ -239,7 +239,7 @@ const renderDataSourceAndIndexPatternInput = (
defaultMessage: 'Data source name',
}
)}
value={dataSourceRef!.title}
value={dataSourceTitle}
isInvalid={isInputInvalid}
disabled={true}
data-test-subj="createIndexPatternDataSourceName"
Expand Down