Remove ability to delete if last RP
parent
2f34553b96
commit
bf4583129b
|
@ -103,15 +103,25 @@ class DatabaseRow extends Component {
|
|||
{
|
||||
isDeleting ?
|
||||
<YesNoButtons onConfirm={() => onDelete(database, retentionPolicy)} onCancel={this.handleEndDelete} /> :
|
||||
<button className="btn btn-xs btn-danger admin-table--delete" onClick={this.handleStartDelete}>
|
||||
{`Delete ${name}`}
|
||||
</button>
|
||||
this.renderDeleteButton()
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
|
||||
renderDeleteButton() {
|
||||
if (!this.props.isDeletable) {
|
||||
return
|
||||
}
|
||||
|
||||
return (
|
||||
<button className="btn btn-xs btn-danger admin-table--delete" onClick={this.handleStartDelete}>
|
||||
{`Delete ${name}`}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
handleClickOutside() {
|
||||
this.handleEndEdit()
|
||||
this.handleEndDelete()
|
||||
|
@ -219,6 +229,7 @@ DatabaseRow.propTypes = {
|
|||
isDefault: bool,
|
||||
isEditing: bool,
|
||||
}),
|
||||
isDeletable: bool,
|
||||
database: shape(),
|
||||
onRemove: func,
|
||||
onCreate: func,
|
||||
|
|
|
@ -61,6 +61,7 @@ const DatabaseTable = ({
|
|||
onRemove={onRemoveRetentionPolicy}
|
||||
onDelete={onDeleteRetentionPolicy}
|
||||
isRFDisplayed={isRFDisplayed}
|
||||
isDeletable={database.retentionPolicies.length > 1}
|
||||
/>
|
||||
)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue