AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | import React from 'react'; |
| 2 | import i18n from 'nfvo-utils/i18n/i18n.js'; |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 3 | import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js'; |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame^] | 4 | import Button from 'sdc-ui/lib/react/Button.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 5 | import uuid from 'uuid-js'; |
| 6 | |
| 7 | export default class SelectActionTable extends React.Component { |
| 8 | |
| 9 | render() { |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 10 | let {columns, onAdd, isReadOnlyMode, children, onAddItem, numOfIcons} = this.props; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 11 | return ( |
| 12 | <div className={`select-action-table-view ${isReadOnlyMode ? 'disabled' : ''}`}> |
| 13 | <div className='select-action-table-controllers'> |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame^] | 14 | {onAdd && onAddItem && |
| 15 | <Button btnType='link' disabled={isReadOnlyMode === true} color='primary' iconName='plus' data-test-id='select-action-table-add' onClick={onAdd}>{onAddItem}</Button>} |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 16 | <SVGIcon name='trashO' className='dummy-icon' /> |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 17 | </div> |
| 18 | <div className='select-action-table'> |
| 19 | <div className='select-action-table-headers'> |
| 20 | {columns.map(column => <div key={uuid.create()} className='select-action-table-header'>{i18n(column)}</div>)} |
az2497 | 644017c | 2017-08-10 17:49:40 +0300 | [diff] [blame^] | 21 | {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trash-o' key={i} className='dummy-icon' />)} |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 22 | </div> |
| 23 | <div className='select-action-table-body'> |
| 24 | {children} |
| 25 | </div> |
| 26 | </div> |
| 27 | </div> |
| 28 | ); |
| 29 | } |
| 30 | } |