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