forked from p15670423/monkey
ui: code readability improvements
This commit is contained in:
parent
1440121aef
commit
9f12702c3e
|
@ -52,18 +52,13 @@ function ChildCheckbox(props) {
|
||||||
safe
|
safe
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
let displayLabel = [<span key={'label'} className={'option-text'}>{label}</span>];
|
|
||||||
|
|
||||||
if (!safe) {
|
|
||||||
displayLabel.push(<WarningIcon key="warning-icon"/>)
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form.Group onClick={() => onPaneClick(value)}>
|
<Form.Group onClick={() => onPaneClick(value)}>
|
||||||
<Button value={value} variant={'link'} disabled={disabled} onClick={() => onClick(value)}>
|
<Button value={value} variant={'link'} disabled={disabled} onClick={() => onClick(value)}>
|
||||||
<FontAwesomeIcon icon={checkboxState ? faCheckSquare : faSquare}/>
|
<FontAwesomeIcon icon={checkboxState ? faCheckSquare : faSquare}/>
|
||||||
</Button>
|
</Button>
|
||||||
{displayLabel}
|
<span key={'label'} className={'option-text'}>{label}</span>
|
||||||
|
{!safe && <WarningIcon key="warning-icon"/>}
|
||||||
</Form.Group>
|
</Form.Group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,37 +60,38 @@ function getSubtitle(props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBody(props) {
|
function getBody(props) {
|
||||||
let body = [<span key={'body'}>{props.body}</span>];
|
|
||||||
|
|
||||||
if (props.warningType !== WarningType.NONE) {
|
|
||||||
body.push(getWarning(props.warningType));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card.Body className={'pane-body'}>
|
<Card.Body className={'pane-body'}>
|
||||||
{body}
|
<span key={'body'}>{props.body}</span>
|
||||||
|
{props.warningType !== WarningType.NONE && getWarning(props.warningType)}
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWarning(warningType) {
|
function getWarning(warningType) {
|
||||||
if (warningType === WarningType.SINGLE) {
|
|
||||||
var warning = <span>This option may cause a system to become unstable or
|
|
||||||
may change a system's state in undesirable ways. Therefore, this option
|
|
||||||
is not recommended for use in production or other sensitive
|
|
||||||
environments.</span>;
|
|
||||||
} else {
|
|
||||||
warning = <span>Some options have been selected that may cause a system
|
|
||||||
to become unstable or may change a system's state in undesirable ways.
|
|
||||||
Running Infection Monkey in a production or other sensitive environment
|
|
||||||
with this configuration is not recommended.</span>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'info-pane-warning'} key={'warning'}>
|
<div className={'info-pane-warning'} key={'warning'}>
|
||||||
<WarningIcon/>{warning}
|
<WarningIcon/>{warningType === WarningType.SINGLE ? getSingleOptionWarning() : getMultipleOptionsWarning()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSingleOptionWarning() {
|
||||||
|
return (
|
||||||
|
<span>This option may cause a system to become unstable or
|
||||||
|
may change a system's state in undesirable ways. Therefore, this option
|
||||||
|
is not recommended for use in production or other sensitive
|
||||||
|
environments.</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMultipleOptionsWarning() {
|
||||||
|
return (
|
||||||
|
<span>Some options have been selected that may cause a system
|
||||||
|
to become unstable or may change a system's state in undesirable ways.
|
||||||
|
Running Infection Monkey in a production or other sensitive environment
|
||||||
|
with this configuration is not recommended.</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export {getDefaultPaneParams, InfoPane, WarningType}
|
export {getDefaultPaneParams, InfoPane, WarningType}
|
||||||
|
|
Loading…
Reference in New Issue