Fixed connector and alerts view flashing empty state before loading list (#58693)

This commit is contained in:
Yuliia Naumenko 2020-02-27 08:14:45 -08:00 committed by GitHub
parent a06cc31583
commit 515348438b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -14,6 +14,7 @@ import {
EuiEmptyPrompt,
EuiTitle,
EuiLink,
EuiLoadingSpinner,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
@ -370,8 +371,9 @@ export const ActionsConnectorsList: React.FunctionComponent = () => {
/>
<EuiSpacer size="m" />
{/* Render the view based on if there's data or if they can save */}
{(isLoadingActions || isLoadingActionTypes) && <EuiLoadingSpinner size="xl" />}
{data.length !== 0 && table}
{data.length === 0 && canSave && emptyPrompt}
{data.length === 0 && canSave && !isLoadingActions && !isLoadingActionTypes && emptyPrompt}
{data.length === 0 && !canSave && noPermissionPrompt}
<ActionsConnectorsContextProvider
value={{

View file

@ -17,6 +17,7 @@ import {
EuiSpacer,
EuiEmptyPrompt,
EuiLink,
EuiLoadingSpinner,
} from '@elastic/eui';
import { useHistory } from 'react-router-dom';
@ -389,7 +390,10 @@ export const AlertsList: React.FunctionComponent = () => {
<EuiSpacer size="m" />
{convertAlertsToTableItems(alertsState.data, alertTypesState.data).length !== 0 && table}
{convertAlertsToTableItems(alertsState.data, alertTypesState.data).length === 0 &&
!alertTypesState.isLoading &&
!alertsState.isLoading &&
emptyPrompt}
{(alertTypesState.isLoading || alertsState.isLoading) && <EuiLoadingSpinner size="xl" />}
<AlertsContextProvider
value={{
addFlyoutVisible: alertFlyoutVisible,