blob: 12e9a06623fd1ea418ca560a33c71637ac7c8f76 [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001import React from 'react';
2import i18n from 'nfvo-utils/i18n/i18n.js';
Avi Zivb8e2faf2017-07-18 19:45:38 +03003import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js';
AviZi280f8012017-06-09 02:39:56 +03004import uuid from 'uuid-js';
5
6export default class SelectActionTable extends React.Component {
7
8 render() {
Avi Zivb8e2faf2017-07-18 19:45:38 +03009 let {columns, onAdd, isReadOnlyMode, children, onAddItem, numOfIcons} = this.props;
AviZi280f8012017-06-09 02:39:56 +030010 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 Zivb8e2faf2017-07-18 19:45:38 +030014 <SVGIcon name='trashO' className='dummy-icon' />
AviZi280f8012017-06-09 02:39:56 +030015 </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 Ziv61070c92017-07-26 17:37:57 +030019 {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trashO' key={i} className='dummy-icon' />)}
AviZi280f8012017-06-09 02:39:56 +030020 </div>
21 <div className='select-action-table-body'>
22 {children}
23 </div>
24 </div>
25 </div>
26 );
27 }
28}