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

[Backport 2.x] Fixing a bug with initial data source being set to local cluster #1190

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
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
10 changes: 7 additions & 3 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const LocalCluster: DataSourceOption = {
label: i18n.translate("dataSource.localCluster", {
defaultMessage: "Local cluster",
}),
id: "",
id: "Local",
};

export const dataSourceObservable = new BehaviorSubject<DataSourceOption>(LocalCluster);
Expand Down Expand Up @@ -231,8 +231,8 @@ export default class Main extends Component<MainProps, MainState> {
* empty string: using the local cluster.
* string: using the selected data source.
*/
dataSourceLoading: dataSourceId === undefined ? props.multiDataSourceEnabled : false,
};
dataSourceLoading: dataSourceId === undefined || dataSourceId === "Local" ? props.multiDataSourceEnabled : false,
}; //Checking for dataSourceId to be Local to ensure that we set the dataSource once so that if no Local cluster present then it is set to default data source
}

setDataSourceReadOnly = (readonly: boolean) => {
Expand Down Expand Up @@ -280,6 +280,10 @@ export default class Main extends Component<MainProps, MainState> {
}

onSelectedDataSources = (dataSources: DataSourceOption[]) => {
if (dataSources.length == 0) {
//No datasource selected
return;
}
const { id = "", label = "" } = dataSources[0] || {};
if (this.state.dataSourceId !== id || this.state.dataSourceLabel !== label) {
this.setState({
Expand Down
Loading