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 { |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame^] | 8 | render() { |
| 9 | let { |
| 10 | columns, |
| 11 | onAdd, |
| 12 | isReadOnlyMode, |
| 13 | children, |
| 14 | onAddItem, |
| 15 | numOfIcons |
| 16 | } = this.props; |
| 17 | return ( |
| 18 | <div |
| 19 | className={`select-action-table-view ${ |
| 20 | isReadOnlyMode ? 'disabled' : '' |
| 21 | }`}> |
| 22 | <div className="select-action-table-controllers"> |
| 23 | {onAdd && |
| 24 | onAddItem && ( |
| 25 | <Button |
| 26 | btnType="link" |
| 27 | disabled={isReadOnlyMode === true} |
| 28 | color="primary" |
| 29 | iconName="plus" |
| 30 | data-test-id="select-action-table-add" |
| 31 | onClick={onAdd}> |
| 32 | {onAddItem} |
| 33 | </Button> |
| 34 | )} |
| 35 | <SVGIcon name="trashO" className="dummy-icon" /> |
| 36 | </div> |
| 37 | <div className="select-action-table"> |
| 38 | <div className="select-action-table-headers"> |
| 39 | {columns.map(column => ( |
| 40 | <div |
| 41 | key={uuid.create()} |
| 42 | className="select-action-table-header"> |
| 43 | {i18n(column)} |
| 44 | </div> |
| 45 | ))} |
| 46 | {Array(numOfIcons) |
| 47 | .fill() |
| 48 | .map((e, i) => ( |
| 49 | <SVGIcon |
| 50 | name="trash-o" |
| 51 | key={i} |
| 52 | className="dummy-icon" |
| 53 | /> |
| 54 | ))} |
| 55 | </div> |
| 56 | <div className="select-action-table-body">{children}</div> |
| 57 | </div> |
| 58 | </div> |
| 59 | ); |
| 60 | } |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 61 | } |