1 import React from 'react';
2 import FontAwesome from 'react-fontawesome';
3 import store from 'sdc-app/AppStore.js';
4 import NotificationConstants from 'nfvo-components/notifications/NotificationConstants.js';
6 class ListEditorItem extends React.Component {
8 onSelect: React.PropTypes.func,
9 onDelete: React.PropTypes.func,
10 onEdit: React.PropTypes.func,
11 children: React.PropTypes.node,
12 isReadOnlyMode: React.PropTypes.bool
16 let {onDelete, onSelect, onEdit, children, isReadOnlyMode} = this.props;
17 let isAbilityToDelete = isReadOnlyMode === undefined ? true : !isReadOnlyMode;
19 <div className='list-editor-item-view'>
20 <div className='list-editor-item-view-content' onClick={onSelect}>
23 <div className='list-editor-item-view-controller'>
24 {onEdit && <FontAwesome name='sliders' onClick={() => this.onClickedItem(onEdit)}/>}
25 {onDelete && isAbilityToDelete && <FontAwesome name='trash-o' onClick={() => this.onClickedItem(onDelete)}/>}
31 onClickedItem(callBackFunc) {
32 if(typeof callBackFunc === 'function') {
33 let {isCheckedOut} = this.props;
34 if (isCheckedOut === false) {
36 type: NotificationConstants.NOTIFY_ERROR,
37 data: {title: 'Error', msg: 'This item is checkedin/submitted, Click Check Out to continue'}
47 export default ListEditorItem;