Skip to content

Commit

Permalink
Revert "display warning state when status check has no data (#22178) (#…
Browse files Browse the repository at this point in the history
…22321)" (#22709)

This reverts commit 711671c.
  • Loading branch information
nreese authored Sep 5, 2018
1 parent 63355cb commit a73eb66
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,13 @@ exports[`statusCheckState checking status 1`] = `
component="div"
grow={true}
>
<Content
text="custom status check description"
/>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
Expand Down Expand Up @@ -292,9 +296,13 @@ exports[`statusCheckState failed status check - error 1`] = `
component="div"
grow={true}
>
<Content
text="custom status check description"
/>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
Expand Down Expand Up @@ -322,7 +330,7 @@ exports[`statusCheckState failed status check - error 1`] = `
/>
</UNDEFINED>,
"key": "checkStatusStep",
"status": "danger",
"status": "complete",
"title": "custom title",
},
]
Expand Down Expand Up @@ -420,9 +428,13 @@ exports[`statusCheckState failed status check - no data 1`] = `
component="div"
grow={true}
>
<Content
text="custom status check description"
/>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
Expand Down Expand Up @@ -450,7 +462,7 @@ exports[`statusCheckState failed status check - no data 1`] = `
/>
</UNDEFINED>,
"key": "checkStatusStep",
"status": "warning",
"status": "complete",
"title": "custom title",
},
]
Expand Down Expand Up @@ -548,9 +560,13 @@ exports[`statusCheckState initial state - no check has been attempted 1`] = `
component="div"
grow={true}
>
<Content
text="custom status check description"
/>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
Expand Down Expand Up @@ -671,9 +687,13 @@ exports[`statusCheckState successful status check 1`] = `
component="div"
grow={true}
>
<Content
text="custom status check description"
/>
<EuiText
grow={true}
>
<p>
custom status check description
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem
component="div"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
} from '@kbn/ui-framework/components';
import { Instruction } from './instruction';
import { ParameterForm } from './parameter_form';
import { Content } from './content';
import { getDisplayText } from '../../../../common/tutorials/instruction_variant';
import {
EuiTabs,
Expand All @@ -35,6 +34,7 @@ import {
EuiSteps,
EuiFlexGroup,
EuiFlexItem,
EuiText,
EuiButton,
EuiCallOut,
} from '@elastic/eui';
Expand Down Expand Up @@ -110,32 +110,17 @@ export class InstructionSet extends React.Component {
);
}

getStepStatus(statusCheckState) {
switch (statusCheckState) {
case undefined:
case StatusCheckStates.NOT_CHECKED:
case StatusCheckStates.FETCHING:
return 'incomplete';
case StatusCheckStates.HAS_DATA:
return 'complete';
case StatusCheckStates.NO_DATA:
return 'warning';
case StatusCheckStates.ERROR:
return 'danger';
default:
throw new Error(`Unexpected status check state ${statusCheckState}`);
}
}

renderStatusCheck() {
const { statusCheckState, statusCheckConfig, onStatusCheck } = this.props;
const checkStatusStep = (
<Fragment>
<EuiFlexGroup justifyContent="spaceBetween" alignItems="center">
<EuiFlexItem>
<Content
text={statusCheckConfig.text}
/>
<EuiText>
<p>
{statusCheckConfig.text}
</p>
</EuiText>
</EuiFlexItem>

<EuiFlexItem
Expand All @@ -156,9 +141,11 @@ export class InstructionSet extends React.Component {
</Fragment>
);

const stepStatus = statusCheckState === StatusCheckStates.NOT_CHECKED ||
statusCheckState === StatusCheckStates.FETCHING ? 'incomplete' : 'complete';
return {
title: statusCheckConfig.title || 'Status Check',
status: this.getStepStatus(statusCheckState),
status: stepStatus,
children: checkStatusStep,
key: 'checkStatusStep'
};
Expand Down

0 comments on commit a73eb66

Please sign in to comment.