Add empty initial states and adjust rendering logic.

This commit is contained in:
Kia Lam
2019-03-18 09:32:11 -04:00
parent a5683fb354
commit a4493cd02b

View File

@@ -104,6 +104,12 @@ class OrganizationAccessList extends React.Component {
sortedColumnKey: 'username', sortedColumnKey: 'username',
isCompact: false, isCompact: false,
showWarning: false, showWarning: false,
warningTitle: '',
warningMsg: '',
deleteType: '',
deleteRoleId: null,
deleteResourceId: null,
results: [],
}; };
this.fetchOrgAccessList = this.fetchOrgAccessList.bind(this); this.fetchOrgAccessList = this.fetchOrgAccessList.bind(this);
@@ -300,10 +306,10 @@ class OrganizationAccessList extends React.Component {
} = this.state; } = this.state;
return ( return (
<Fragment> <Fragment>
{!error && !results && ( {!error && results.length <= 0 && (
<h1>Loading...</h1> // TODO: replace with proper loading state <h1>Loading...</h1> // TODO: replace with proper loading state
)} )}
{error && !results && ( {error && results.length <= 0 && (
<Fragment> <Fragment>
<div>{error.message}</div> <div>{error.message}</div>
{error.response && ( {error.response && (
@@ -311,7 +317,7 @@ class OrganizationAccessList extends React.Component {
)} )}
</Fragment> // TODO: replace with proper error handling </Fragment> // TODO: replace with proper error handling
)} )}
{results && ( {results.length > 0 && (
<Fragment> <Fragment>
<DataListToolbar <DataListToolbar
sortedColumnKey={sortedColumnKey} sortedColumnKey={sortedColumnKey}