Skip to content
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
19 changes: 15 additions & 4 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,17 +982,27 @@ class Browser extends DashboardView {
}

async handleFetchedSchema() {
const counts = this.state.counts;
if (this.state.computingClassCounts === false) {
this.setState({ computingClassCounts: true });

const promises = [];
for (const parseClass of this.props.schema.data.get('classes')) {
const [className] = parseClass;
counts[className] = await this.context.getClassCount(className);
const promise = this.context.getClassCount(className).then(count => {
this.setState(prevState => ({
counts: {
...prevState.counts,
[className]: count
}
}));
});
promises.push(promise);
}

await Promise.all(promises);

this.setState({
clp: this.props.schema.data.get('CLPs').toJS(),
counts,
computingClassCounts: false,
});
}
Expand Down Expand Up @@ -2192,7 +2202,8 @@ class Browser extends DashboardView {
classes.forEach((value, key) => {
let count = this.state.counts[key];
if (count === undefined) {
count = '';
// Show loading indicator while counts are being computed, empty string if computation is done
count = this.state.computingClassCounts ? '...' : '';
} else if (count >= 1000) {
count = prettyNumber(count);
}
Expand Down
Loading