From c4b33673ad7b2e32a773d88b922dddea124afe61 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 19 Nov 2023 06:06:18 +0200 Subject: [PATCH] New: Confirmation before clearing blocklist (cherry picked from commit 366d8a4e78e024bc045e4791d3a51af391f4e95a) Closes #4316 --- frontend/src/Activity/Blocklist/Blocklist.js | 31 ++++++++++++++++++-- src/NzbDrone.Core/Localization/Core/en.json | 2 ++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/frontend/src/Activity/Blocklist/Blocklist.js b/frontend/src/Activity/Blocklist/Blocklist.js index 6668bee46..ab43c106d 100644 --- a/frontend/src/Activity/Blocklist/Blocklist.js +++ b/frontend/src/Activity/Blocklist/Blocklist.js @@ -36,6 +36,7 @@ class Blocklist extends Component { lastToggled: null, selectedState: {}, isConfirmRemoveModalOpen: false, + isConfirmClearModalOpen: false, items: props.items }; } @@ -90,6 +91,19 @@ class Blocklist extends Component { this.setState({ isConfirmRemoveModalOpen: false }); }; + onClearBlocklistPress = () => { + this.setState({ isConfirmClearModalOpen: true }); + }; + + onClearBlocklistConfirmed = () => { + this.props.onClearBlocklistPress(); + this.setState({ isConfirmClearModalOpen: false }); + }; + + onConfirmClearModalClose = () => { + this.setState({ isConfirmClearModalOpen: false }); + }; + // // Render @@ -105,7 +119,6 @@ class Blocklist extends Component { totalRecords, isRemoving, isClearingBlocklistExecuting, - onClearBlocklistPress, ...otherProps } = this.props; @@ -116,7 +129,8 @@ class Blocklist extends Component { allSelected, allUnselected, selectedState, - isConfirmRemoveModalOpen + isConfirmRemoveModalOpen, + isConfirmClearModalOpen } = this.state; const selectedIds = this.getSelectedIds(); @@ -136,8 +150,9 @@ class Blocklist extends Component { @@ -220,6 +235,16 @@ class Blocklist extends Component { onConfirm={this.onRemoveSelectedConfirmed} onCancel={this.onConfirmRemoveModalClose} /> + + ); } diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index ff3e449e7..96c9c6910 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -179,6 +179,8 @@ "ChownGroupHelpText": "Group name or gid. Use gid for remote file systems.", "ChownGroupHelpTextWarning": "This only works if the user running Lidarr is the owner of the file. It's better to ensure the download client uses the same group as Lidarr.", "Clear": "Clear", + "ClearBlocklist": "Clear blocklist", + "ClearBlocklistMessageText": "Are you sure you want to clear all items from the blocklist?", "ClickToChangeQuality": "Click to change quality", "ClickToChangeReleaseGroup": "Click to change release group", "ClientPriority": "Client Priority",