New: Confirmation before clearing blocklist
This commit is contained in:
parent
b248163df5
commit
366d8a4e78
|
@ -36,6 +36,7 @@ class Blocklist extends Component {
|
||||||
lastToggled: null,
|
lastToggled: null,
|
||||||
selectedState: {},
|
selectedState: {},
|
||||||
isConfirmRemoveModalOpen: false,
|
isConfirmRemoveModalOpen: false,
|
||||||
|
isConfirmClearModalOpen: false,
|
||||||
items: props.items
|
items: props.items
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -90,6 +91,19 @@ class Blocklist extends Component {
|
||||||
this.setState({ isConfirmRemoveModalOpen: false });
|
this.setState({ isConfirmRemoveModalOpen: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onClearBlocklistPress = () => {
|
||||||
|
this.setState({ isConfirmClearModalOpen: true });
|
||||||
|
};
|
||||||
|
|
||||||
|
onClearBlocklistConfirmed = () => {
|
||||||
|
this.props.onClearBlocklistPress();
|
||||||
|
this.setState({ isConfirmClearModalOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
|
onConfirmClearModalClose = () => {
|
||||||
|
this.setState({ isConfirmClearModalOpen: false });
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Render
|
// Render
|
||||||
|
|
||||||
|
@ -103,7 +117,6 @@ class Blocklist extends Component {
|
||||||
totalRecords,
|
totalRecords,
|
||||||
isRemoving,
|
isRemoving,
|
||||||
isClearingBlocklistExecuting,
|
isClearingBlocklistExecuting,
|
||||||
onClearBlocklistPress,
|
|
||||||
...otherProps
|
...otherProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
@ -111,7 +124,8 @@ class Blocklist extends Component {
|
||||||
allSelected,
|
allSelected,
|
||||||
allUnselected,
|
allUnselected,
|
||||||
selectedState,
|
selectedState,
|
||||||
isConfirmRemoveModalOpen
|
isConfirmRemoveModalOpen,
|
||||||
|
isConfirmClearModalOpen
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const selectedIds = this.getSelectedIds();
|
const selectedIds = this.getSelectedIds();
|
||||||
|
@ -131,8 +145,9 @@ class Blocklist extends Component {
|
||||||
<PageToolbarButton
|
<PageToolbarButton
|
||||||
label={translate('Clear')}
|
label={translate('Clear')}
|
||||||
iconName={icons.CLEAR}
|
iconName={icons.CLEAR}
|
||||||
|
isDisabled={!items.length}
|
||||||
isSpinning={isClearingBlocklistExecuting}
|
isSpinning={isClearingBlocklistExecuting}
|
||||||
onPress={onClearBlocklistPress}
|
onPress={this.onClearBlocklistPress}
|
||||||
/>
|
/>
|
||||||
</PageToolbarSection>
|
</PageToolbarSection>
|
||||||
|
|
||||||
|
@ -215,6 +230,16 @@ class Blocklist extends Component {
|
||||||
onConfirm={this.onRemoveSelectedConfirmed}
|
onConfirm={this.onRemoveSelectedConfirmed}
|
||||||
onCancel={this.onConfirmRemoveModalClose}
|
onCancel={this.onConfirmRemoveModalClose}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ConfirmModal
|
||||||
|
isOpen={isConfirmClearModalOpen}
|
||||||
|
kind={kinds.DANGER}
|
||||||
|
title={translate('ClearBlocklist')}
|
||||||
|
message={translate('ClearBlocklistMessageText')}
|
||||||
|
confirmLabel={translate('Clear')}
|
||||||
|
onConfirm={this.onClearBlocklistConfirmed}
|
||||||
|
onCancel={this.onConfirmClearModalClose}
|
||||||
|
/>
|
||||||
</PageContent>
|
</PageContent>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,8 @@
|
||||||
"ChownGroupHelpText": "Group name or gid. Use gid for remote file systems.",
|
"ChownGroupHelpText": "Group name or gid. Use gid for remote file systems.",
|
||||||
"ChownGroupHelpTextWarning": "This only works if the user running sonarr is the owner of the file. It's better to ensure the download client uses the same group as sonarr.",
|
"ChownGroupHelpTextWarning": "This only works if the user running sonarr is the owner of the file. It's better to ensure the download client uses the same group as sonarr.",
|
||||||
"Clear": "Clear",
|
"Clear": "Clear",
|
||||||
|
"ClearBlocklist": "Clear blocklist",
|
||||||
|
"ClearBlocklistMessageText": "Are you sure you want to clear all items from the blocklist?",
|
||||||
"ClickToChangeEpisode": "Click to change episode",
|
"ClickToChangeEpisode": "Click to change episode",
|
||||||
"ClickToChangeLanguage": "Click to change language",
|
"ClickToChangeLanguage": "Click to change language",
|
||||||
"ClickToChangeQuality": "Click to change quality",
|
"ClickToChangeQuality": "Click to change quality",
|
||||||
|
|
Loading…
Reference in New Issue