Skip to content

Commit

Permalink
Fixing a bug with initial data source being set to local cluster (#1189
Browse files Browse the repository at this point in the history
…) (#1190) (#1196)

(cherry picked from commit 66abae3)




(cherry picked from commit d37f0b1)

Signed-off-by: Kshitij Tandon <tandonks@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent fe11b13 commit d5786d5
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit d5786d5

Please sign in to comment.