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'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 4 | import uuid from 'uuid-js'; |
| 5 | |
| 6 | export default class SelectActionTable extends React.Component { |
| 7 | |
| 8 | render() { |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 9 | let {columns, onAdd, isReadOnlyMode, children, onAddItem, numOfIcons} = this.props; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 10 | return ( |
| 11 | <div className={`select-action-table-view ${isReadOnlyMode ? 'disabled' : ''}`}> |
| 12 | <div className='select-action-table-controllers'> |
| 13 | {onAdd && onAddItem && <div data-test-id='select-action-table-add' onClick={onAdd}>{onAddItem}</div>} |
Avi Ziv | b8e2faf | 2017-07-18 19:45:38 +0300 | [diff] [blame] | 14 | <SVGIcon name='trashO' className='dummy-icon' /> |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 15 | </div> |
| 16 | <div className='select-action-table'> |
| 17 | <div className='select-action-table-headers'> |
| 18 | {columns.map(column => <div key={uuid.create()} className='select-action-table-header'>{i18n(column)}</div>)} |
Avi Ziv | 61070c9 | 2017-07-26 17:37:57 +0300 | [diff] [blame] | 19 | {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trashO' key={i} className='dummy-icon' />)} |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 20 | </div> |
| 21 | <div className='select-action-table-body'> |
| 22 | {children} |
| 23 | </div> |
| 24 | </div> |
| 25 | </div> |
| 26 | ); |
| 27 | } |
| 28 | } |