diff options
Diffstat (limited to 'openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx')
-rw-r--r-- | openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx index 260d39d31c..1c2c1529f2 100644 --- a/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx +++ b/openecomp-ui/src/nfvo-components/table/SelectActionTableRow.jsx @@ -3,38 +3,65 @@ import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger.js'; import Tooltip from 'react-bootstrap/lib/Tooltip.js'; -function tooltip (msg) { - return ( - <Tooltip className='select-action-table-error-tooltip' id='error-tooltip'>{msg}</Tooltip> - ); -}; +function tooltip(msg) { + return ( + <Tooltip + className="select-action-table-error-tooltip" + id="error-tooltip"> + {msg} + </Tooltip> + ); +} -const IconWithOverlay = ({overlayMsg}) => ( - <OverlayTrigger placement='bottom' overlay={tooltip(overlayMsg)}> - <SVGIcon name='errorCircle' color='negative'/> - </OverlayTrigger> +const IconWithOverlay = ({ overlayMsg }) => ( + <OverlayTrigger placement="bottom" overlay={tooltip(overlayMsg)}> + <SVGIcon name="errorCircle" color="negative" /> + </OverlayTrigger> ); -function renderErrorOrCheck({hasError, overlayMsg}) { - if (hasError === undefined) { - return <SVGIcon name='angleRight' className='dummy-icon' />; - } +function renderErrorOrCheck({ hasError, overlayMsg }) { + if (hasError === undefined) { + return <SVGIcon name="angleRight" className="dummy-icon" />; + } - if (hasError) { - return overlayMsg ? <IconWithOverlay overlayMsg={overlayMsg}/> : <SVGIcon color='negative' name='errorCircle'/>; - } + if (hasError) { + return overlayMsg ? ( + <IconWithOverlay overlayMsg={overlayMsg} /> + ) : ( + <SVGIcon color="negative" name="errorCircle" /> + ); + } - return <SVGIcon name='checkCircle' color='positive'/>; + return <SVGIcon name="checkCircle" color="positive" />; } -const SelectActionTableRow = ({children, actionIcon, onAction, showAction, hasError, hasErrorIndication, overlayMsg}) => ( - <div className='select-action-table-row-wrapper'> - <div className={`select-action-table-row ${hasError ? 'has-error' : ''}`}> - {children} - </div> - {onAction && <SVGIcon color='secondary' name={actionIcon} data-test-id={`select-action-table-${actionIcon}`} onClick={onAction} iconClassName={(showAction) ? '' : 'hideDelete'}/>} - {hasErrorIndication && renderErrorOrCheck({hasError, overlayMsg})} - </div> +const SelectActionTableRow = ({ + children, + actionIcon, + onAction, + showAction, + hasError, + hasErrorIndication, + overlayMsg +}) => ( + <div className="select-action-table-row-wrapper"> + <div + className={`select-action-table-row ${ + hasError ? 'has-error' : '' + }`}> + {children} + </div> + {onAction && ( + <SVGIcon + color="secondary" + name={actionIcon} + data-test-id={`select-action-table-${actionIcon}`} + onClick={onAction} + iconClassName={showAction ? '' : 'hideDelete'} + /> + )} + {hasErrorIndication && renderErrorOrCheck({ hasError, overlayMsg })} + </div> ); export default SelectActionTableRow; |