blob: ee8a9dca455ea42972007f2d1083fbc7ce4776fe [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 {
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +02008 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 }
AviZi280f8012017-06-09 02:39:56 +030061}