Skip to content

feat(ui): Add better loading state for Incidents list #13695

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

Merged
merged 2 commits into from
Jun 17, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Count from 'app/components/count';
import Duration from 'app/components/duration';
import EmptyStateWarning from 'app/components/emptyStateWarning';
import Link from 'app/components/links/link';
import LoadingIndicator from 'app/components/loadingIndicator';
import PageHeading from 'app/components/pageHeading';
import Pagination from 'app/components/pagination';
import getDynamicText from 'app/utils/getDynamicText';
Expand Down Expand Up @@ -76,8 +77,12 @@ class OrganizationIncidentsList extends AsyncComponent {
);
}

renderLoading() {
return this.renderBody();
}

renderBody() {
const {incidentList, incidentListPageLinks} = this.state;
const {loading, incidentList, incidentListPageLinks} = this.state;

return (
<React.Fragment>
Expand All @@ -91,9 +96,15 @@ class OrganizationIncidentsList extends AsyncComponent {
<div>{t('Total events')}</div>
</TableLayout>
</PanelHeader>

<PanelBody>
{incidentList.length === 0 && this.renderEmpty()}
{incidentList.map(incident => this.renderListItem(incident))}
{loading && <LoadingIndicator />}
{!loading && (
<React.Fragment>
{incidentList.length === 0 && this.renderEmpty()}
{incidentList.map(incident => this.renderListItem(incident))}
</React.Fragment>
)}
</PanelBody>
</Panel>
<Pagination pageLinks={incidentListPageLinks} />
Expand Down