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

Fix inconsistency in default selected cluster #1523

Merged
merged 1 commit into from
Jun 29, 2023
Merged
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
6 changes: 4 additions & 2 deletions client/src/utils/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import Root from '../components/Root';
import KsqlDBList from '../containers/KsqlDB/KsqlDBList/KsqlDBList';
import KsqlDBStatement from '../containers/KsqlDB/KsqlDBStatement';
import KsqlDBQuery from '../containers/KsqlDB/KsqlDBQuery';
import sortBy from 'lodash/sortBy';

class Routes extends Root {
state = {
Expand All @@ -50,9 +51,10 @@ class Routes extends Root {
const { clusterId } = this.state;
try {
const resClusters = await this.getApi(uriClusters());
let sortedClusters = sortBy(resClusters.data || [], cluster => cluster.id);
this.setState({
clusters: resClusters.data,
clusterId: resClusters.data ? resClusters.data[0].id : '',
clusters: sortedClusters,
clusterId: sortedClusters ? sortedClusters[0].id : '',
loading: false
});
} catch (err) {
Expand Down