Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions src/dashboard/Data/Browser/DeleteRowsDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ export default class DeleteRowsDialog extends React.Component {
}

valid() {
if (this.state.confirmation === this.props.className) {
const selectionLength = Object.keys(this.props.selection).length;

if (this.props.selection['*'] && this.state.confirmation.toLowerCase() === 'delete all') {
return true;
}
if (selectionLength >= 10 && this.state.confirmation.toLowerCase() === 'delete selected') {
return true;
}
if (!this.props.selection['*'] && Object.keys(this.props.selection).length < 10) {
if (!this.props.selection['*'] && selectionLength < 10) {
return true;
}
return false;
Expand All @@ -33,17 +38,35 @@ export default class DeleteRowsDialog extends React.Component {
render() {
let content = null;
let selectionLength = Object.keys(this.props.selection).length;
if (this.props.selection['*'] || selectionLength >= 10) {

if (selectionLength >= 10) {
content = (
<Field
label={
<Label
text='Confirm this action'
description='Enter "delete selected" word to continue.' />
}
input={
<TextInput
placeholder='delete selected'
value={this.state.confirmation}
onChange={(confirmation) => this.setState({ confirmation })} />
} />
);
}

if (this.props.selection['*']) {
content = (
<Field
label={
<Label
text='Confirm this action'
description='Enter the current class name to continue.' />
description='Enter "delete all" to continue.' />
}
input={
<TextInput
placeholder='Current class name'
placeholder='delete all'
value={this.state.confirmation}
onChange={(confirmation) => this.setState({ confirmation })} />
} />
Expand Down