|
|
@ -26,24 +26,24 @@ class BulkActionBar extends React.Component {
|
|
|
|
this.state = {
|
|
|
|
this.state = {
|
|
|
|
selectedMultiple: false,
|
|
|
|
selectedMultiple: false,
|
|
|
|
selectedSingle: false,
|
|
|
|
selectedSingle: false,
|
|
|
|
deleteable: true,
|
|
|
|
canDelete: true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//This method is used to trigger delete request on selected devices
|
|
|
|
//This method checks whether NON-REMOVED devices are selected
|
|
|
|
onDeleteDeviceCall = () => {
|
|
|
|
onDeleteDeviceCall = () => {
|
|
|
|
let i;
|
|
|
|
let i;
|
|
|
|
for(i=0; i < this.props.selectedRows.length; i++){
|
|
|
|
for(i=0; i < this.props.selectedRows.length; i++){
|
|
|
|
if(this.props.selectedRows[i].enrolmentInfo.status != "REMOVED"){
|
|
|
|
if(this.props.selectedRows[i].enrolmentInfo.status != "REMOVED"){
|
|
|
|
this.setState({deletable:false});
|
|
|
|
this.setState({canDelete:false});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.setState({deletable:true});
|
|
|
|
this.setState({canDelete:true});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onConfirmDelete = () => {
|
|
|
|
onConfirmDelete = () => {
|
|
|
|
if (this.state.deletable) {
|
|
|
|
if (this.state.canDelete) {
|
|
|
|
this.props.deleteDevice();
|
|
|
|
this.props.deleteDevice();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -67,7 +67,7 @@ class BulkActionBar extends React.Component {
|
|
|
|
<Popconfirm
|
|
|
|
<Popconfirm
|
|
|
|
placement="topLeft"
|
|
|
|
placement="topLeft"
|
|
|
|
title={
|
|
|
|
title={
|
|
|
|
this.state.deletable ?
|
|
|
|
this.state.canDelete ?
|
|
|
|
"Are you sure you want to delete?" : "You can only delete disenrolled devices"}
|
|
|
|
"Are you sure you want to delete?" : "You can only delete disenrolled devices"}
|
|
|
|
onConfirm={this.onConfirmDelete}
|
|
|
|
onConfirm={this.onConfirmDelete}
|
|
|
|
okText="Ok"
|
|
|
|
okText="Ok"
|
|
|
|