diff --git a/src/common/table-column.js b/src/common/table-column.js
index 9d77606..460eb4b 100644
--- a/src/common/table-column.js
+++ b/src/common/table-column.js
@@ -23,7 +23,9 @@ class TableColumn extends Component {
modifier: null,
width: null,
editButton: false,
+ showEditButton: null,
deleteButton: false,
+ showDeleteButton: null,
exportButton: false,
duplicateButton: false,
link: '/',
diff --git a/src/common/table.js b/src/common/table.js
index d5c750c..f54335e 100644
--- a/src/common/table.js
+++ b/src/common/table.js
@@ -124,26 +124,34 @@ class CustomTable extends Component {
}
// add buttons
- if (child.props.editButton === true) {
- cell.push(
- Edit }>
-
- );
+ let showEditButton = true
+ if (child.props.showEditButton !== null)
+ {
+ showEditButton = child.props.showEditButton(index)
}
+ if(showEditButton){
+ if (child.props.editButton) {
+ cell.push(
+ Edit }>
+
+ );
+ }
+ }
+
if (child.props.checkbox) {
const checkboxKey = child.props.checkboxKey;
let isDisabled = false;
if (child.props.checkboxDisabled != null){
- isDisabled = !child.props.checkboxDisabled(index)
+ isDisabled = child.props.checkboxDisabled(index)
}
cell.push(
);
}
- if (child.props.deleteButton === true) {
- cell.push(
- Delete } >
-
- );
+ let showDeleteButton = true;
+ if (child.props.showDeleteButton !== null){
+ showDeleteButton = child.props.showDeleteButton(index)
}
+ if (showDeleteButton){
+ if (child.props.deleteButton) {
+ cell.push(
+ Delete } >
+
+ );
+ }
+ }
+
+
+
return cell;
} // addCell
diff --git a/src/ic/ics.js b/src/ic/ics.js
index 026695b..bb97ef1 100644
--- a/src/ic/ics.js
+++ b/src/ic/ics.js
@@ -393,9 +393,9 @@ class InfrastructureComponents extends Component {
}
}
- isExternalIC(index, ics){
+ isLocalIC(index, ics){
let ic = ics[index]
- return ic.managedexternally
+ return !ic.managedexternally
}
getICCategoryTable(ics, editable, title){
@@ -405,7 +405,7 @@ class InfrastructureComponents extends Component {
this.isExternalIC(index, ics) === true}
+ checkboxDisabled={(index) => this.isLocalIC(index, ics) === true}
onChecked={(ic, event) => this.onICChecked(ic, event)}
width='30'
/>
@@ -438,9 +438,11 @@ class InfrastructureComponents extends Component {
{this.state.currentUser.role === "Admin" ?
this.isExternalIC(index, ics) !== true}
+ editButton
+ showEditButton ={(index) => this.isLocalIC(index, ics)}
exportButton
- deleteButton = {(index) => this.isExternalIC(index, ics) !== true}
+ deleteButton
+ showDeleteButton = {(index) => this.isLocalIC(index, ics)}
onEdit={index => this.setState({editModal: true, modalIC: ics[index], modalIndex: index})}
onExport={index => this.exportIC(index)}
onDelete={index => this.setState({deleteModal: true, modalIC: ics[index], modalIndex: index})}