blob: 3f8dbba53add92236b8b804fe7063868f602788a [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';
az2497644017c2017-08-10 17:49:40 +03004import Button from 'sdc-ui/lib/react/Button.js';
AviZi280f8012017-06-09 02:39:56 +03005import uuid from 'uuid-js';
6
7export default class SelectActionTable extends React.Component {
8
9 render() {
Avi Zivb8e2faf2017-07-18 19:45:38 +030010 let {columns, onAdd, isReadOnlyMode, children, onAddItem, numOfIcons} = this.props;
AviZi280f8012017-06-09 02:39:56 +030011 return (
12 <div className={`select-action-table-view ${isReadOnlyMode ? 'disabled' : ''}`}>
13 <div className='select-action-table-controllers'>
az2497644017c2017-08-10 17:49:40 +030014 {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 Zivb8e2faf2017-07-18 19:45:38 +030016 <SVGIcon name='trashO' className='dummy-icon' />
AviZi280f8012017-06-09 02:39:56 +030017 </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>)}
az2497644017c2017-08-10 17:49:40 +030021 {Array(numOfIcons).fill().map((e, i) => <SVGIcon name='trash-o' key={i} className='dummy-icon' />)}
AviZi280f8012017-06-09 02:39:56 +030022 </div>
23 <div className='select-action-table-body'>
24 {children}
25 </div>
26 </div>
27 </div>
28 );
29 }
30}