Remove ability to delete if last RP

pull/10616/head
Andrew Watkins 2017-03-23 16:12:59 -07:00
parent 2f34553b96
commit bf4583129b
2 changed files with 15 additions and 3 deletions

View File

@ -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,

View File

@ -61,6 +61,7 @@ const DatabaseTable = ({
onRemove={onRemoveRetentionPolicy}
onDelete={onDeleteRetentionPolicy}
isRFDisplayed={isRFDisplayed}
isDeletable={database.retentionPolicies.length > 1}
/>
)
})