Skip to content

Commit

Permalink
fix(ui): loading all topics to produce to topic UI (#1825)
Browse files Browse the repository at this point in the history
close #1824
  • Loading branch information
jacek-bukowski authored Jun 27, 2024
1 parent d7dd14b commit cbe1f6e
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions client/src/containers/Topic/TopicProduce/TopicProduce.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
uriTopics,
uriTopicsPartitions,
uriTopicsProduce,
uriAllSchema
uriAllSchema, uriTopicsName
} from '../../../utils/endpoints';
import moment from 'moment';
import DatePicker from '../../../components/DatePicker';
Expand Down Expand Up @@ -101,19 +101,12 @@ class TopicProduce extends Form {
async initAvailableTopics() {
const { clusterId } = this.props.params;

const topics = [];
let page = 0;
let topicResponseData = {};
do {
page = page + 1;
topicResponseData = await this.getApi(uriTopics(clusterId, '', '', page)).then(
res => res.data
);
topicResponseData.results.forEach(topicData => topics.push(topicData.name));
} while (page < topicResponseData.pages);

this.setState({
topics
this.getApi(uriTopicsName(clusterId))
.then(res => {
this.setState({ topics: res.data });
})
.catch(err => {
console.error('Error:', err);
});
}

Expand Down

0 comments on commit cbe1f6e

Please sign in to comment.