blob: 1baf0484d2860f7e1bc9d83261665a77ab25ff7a [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001import React from 'react';
2import i18n from 'nfvo-utils/i18n/i18n.js';
Arielka51eac02019-07-07 12:56:11 +03003import { SVGIcon, Button } from 'onap-ui-react';
AviZi280f8012017-06-09 02:39:56 +03004import uuid from 'uuid-js';
5
6export default class SelectActionTable extends React.Component {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +02007 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 }
AviZi280f8012017-06-09 02:39:56 +030060}