New: Renamed Blacklist to Blocklist

This commit is contained in:
Robin Dadswell 2021-08-19 22:35:06 +01:00 committed by Qstick
parent 0d7b6f8a4f
commit 8573065a4e
38 changed files with 360 additions and 332 deletions

View file

@ -18,9 +18,9 @@ import getSelectedIds from 'Utilities/Table/getSelectedIds';
import removeOldSelectedState from 'Utilities/Table/removeOldSelectedState';
import selectAll from 'Utilities/Table/selectAll';
import toggleSelected from 'Utilities/Table/toggleSelected';
import BlacklistRowConnector from './BlacklistRowConnector';
import BlocklistRowConnector from './BlocklistRowConnector';
class Blacklist extends Component {
class Blocklist extends Component {
//
// Lifecycle
@ -102,8 +102,8 @@ class Blacklist extends Component {
columns,
totalRecords,
isRemoving,
isClearingBlacklistExecuting,
onClearBlacklistPress,
isClearingBlocklistExecuting,
onClearBlocklistPress,
...otherProps
} = this.props;
@ -120,7 +120,7 @@ class Blacklist extends Component {
const selectedIds = this.getSelectedIds();
return (
<PageContent title="Blacklist">
<PageContent title="Blocklist">
<PageToolbar>
<PageToolbarSection>
<PageToolbarButton
@ -134,8 +134,8 @@ class Blacklist extends Component {
<PageToolbarButton
label="Clear"
iconName={icons.CLEAR}
isSpinning={isClearingBlacklistExecuting}
onPress={onClearBlacklistPress}
isSpinning={isClearingBlocklistExecuting}
onPress={onClearBlocklistPress}
/>
</PageToolbarSection>
@ -160,13 +160,13 @@ class Blacklist extends Component {
{
!isAnyFetching && !!error &&
<div>Unable to load blacklist</div>
<div>Unable to load blocklist</div>
}
{
isAllPopulated && !error && !items.length &&
<div>
No history blacklist
No history blocklist
</div>
}
@ -185,7 +185,7 @@ class Blacklist extends Component {
{
items.map((item) => {
return (
<BlacklistRowConnector
<BlocklistRowConnector
key={item.id}
isSelected={selectedState[item.id] || false}
columns={columns}
@ -211,7 +211,7 @@ class Blacklist extends Component {
isOpen={isConfirmRemoveModalOpen}
kind={kinds.DANGER}
title="Remove Selected"
message={'Are you sure you want to remove the selected items from the blacklist?'}
message={'Are you sure you want to remove the selected items from the blocklist?'}
confirmLabel="Remove Selected"
onConfirm={this.onRemoveSelectedConfirmed}
onCancel={this.onConfirmRemoveModalClose}
@ -221,7 +221,7 @@ class Blacklist extends Component {
}
}
Blacklist.propTypes = {
Blocklist.propTypes = {
isArtistFetching: PropTypes.bool.isRequired,
isArtistPopulated: PropTypes.bool.isRequired,
isFetching: PropTypes.bool.isRequired,
@ -231,9 +231,9 @@ Blacklist.propTypes = {
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
totalRecords: PropTypes.number,
isRemoving: PropTypes.bool.isRequired,
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
onRemoveSelected: PropTypes.func.isRequired,
onClearBlacklistPress: PropTypes.func.isRequired
onClearBlocklistPress: PropTypes.func.isRequired
};
export default Blacklist;
export default Blocklist;

View file

@ -4,34 +4,34 @@ import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import * as commandNames from 'Commands/commandNames';
import withCurrentPage from 'Components/withCurrentPage';
import * as blacklistActions from 'Store/Actions/blacklistActions';
import * as blocklistActions from 'Store/Actions/blocklistActions';
import { executeCommand } from 'Store/Actions/commandActions';
import createCommandExecutingSelector from 'Store/Selectors/createCommandExecutingSelector';
import { registerPagePopulator, unregisterPagePopulator } from 'Utilities/pagePopulator';
import Blacklist from './Blacklist';
import Blocklist from './Blocklist';
function createMapStateToProps() {
return createSelector(
(state) => state.blacklist,
(state) => state.blocklist,
(state) => state.artist,
createCommandExecutingSelector(commandNames.CLEAR_BLACKLIST),
(blacklist, artist, isClearingBlacklistExecuting) => {
createCommandExecutingSelector(commandNames.CLEAR_BLOCKLIST),
(blocklist, artist, isClearingBlocklistExecuting) => {
return {
isArtistFetching: artist.isFetching,
isArtistPopulated: artist.isPopulated,
isClearingBlacklistExecuting,
...blacklist
isClearingBlocklistExecuting,
...blocklist
};
}
);
}
const mapDispatchToProps = {
...blacklistActions,
...blocklistActions,
executeCommand
};
class BlacklistConnector extends Component {
class BlocklistConnector extends Component {
//
// Lifecycle
@ -39,27 +39,27 @@ class BlacklistConnector extends Component {
componentDidMount() {
const {
useCurrentPage,
fetchBlacklist,
gotoBlacklistFirstPage
fetchBlocklist,
gotoBlocklistFirstPage
} = this.props;
registerPagePopulator(this.repopulate);
if (useCurrentPage) {
fetchBlacklist();
fetchBlocklist();
} else {
gotoBlacklistFirstPage();
gotoBlocklistFirstPage();
}
}
componentDidUpdate(prevProps) {
if (prevProps.isClearingBlacklistExecuting && !this.props.isClearingBlacklistExecuting) {
this.props.gotoBlacklistFirstPage();
if (prevProps.isClearingBlocklistExecuting && !this.props.isClearingBlocklistExecuting) {
this.props.gotoBlocklistFirstPage();
}
}
componentWillUnmount() {
this.props.clearBlacklist();
this.props.clearBlocklist();
unregisterPagePopulator(this.repopulate);
}
@ -67,49 +67,49 @@ class BlacklistConnector extends Component {
// Control
repopulate = () => {
this.props.fetchBlacklist();
this.props.fetchBlocklist();
}
//
// Listeners
onFirstPagePress = () => {
this.props.gotoBlacklistFirstPage();
this.props.gotoBlocklistFirstPage();
}
onPreviousPagePress = () => {
this.props.gotoBlacklistPreviousPage();
this.props.gotoBlocklistPreviousPage();
}
onNextPagePress = () => {
this.props.gotoBlacklistNextPage();
this.props.gotoBlocklistNextPage();
}
onLastPagePress = () => {
this.props.gotoBlacklistLastPage();
this.props.gotoBlocklistLastPage();
}
onPageSelect = (page) => {
this.props.gotoBlacklistPage({ page });
this.props.gotoBlocklistPage({ page });
}
onRemoveSelected = (ids) => {
this.props.removeBlacklistItems({ ids });
this.props.removeBlocklistItems({ ids });
}
onSortPress = (sortKey) => {
this.props.setBlacklistSort({ sortKey });
this.props.setBlocklistSort({ sortKey });
}
onTableOptionChange = (payload) => {
this.props.setBlacklistTableOption(payload);
this.props.setBlocklistTableOption(payload);
if (payload.pageSize) {
this.props.gotoBlacklistFirstPage();
this.props.gotoBlocklistFirstPage();
}
}
onClearBlacklistPress = () => {
this.props.executeCommand({ name: commandNames.CLEAR_BLACKLIST });
onClearBlocklistPress = () => {
this.props.executeCommand({ name: commandNames.CLEAR_BLOCKLIST });
}
//
@ -117,7 +117,7 @@ class BlacklistConnector extends Component {
render() {
return (
<Blacklist
<Blocklist
onFirstPagePress={this.onFirstPagePress}
onPreviousPagePress={this.onPreviousPagePress}
onNextPagePress={this.onNextPagePress}
@ -126,30 +126,30 @@ class BlacklistConnector extends Component {
onRemoveSelected={this.onRemoveSelected}
onSortPress={this.onSortPress}
onTableOptionChange={this.onTableOptionChange}
onClearBlacklistPress={this.onClearBlacklistPress}
onClearBlocklistPress={this.onClearBlocklistPress}
{...this.props}
/>
);
}
}
BlacklistConnector.propTypes = {
BlocklistConnector.propTypes = {
useCurrentPage: PropTypes.bool.isRequired,
isClearingBlacklistExecuting: PropTypes.bool.isRequired,
isClearingBlocklistExecuting: PropTypes.bool.isRequired,
items: PropTypes.arrayOf(PropTypes.object).isRequired,
fetchBlacklist: PropTypes.func.isRequired,
gotoBlacklistFirstPage: PropTypes.func.isRequired,
gotoBlacklistPreviousPage: PropTypes.func.isRequired,
gotoBlacklistNextPage: PropTypes.func.isRequired,
gotoBlacklistLastPage: PropTypes.func.isRequired,
gotoBlacklistPage: PropTypes.func.isRequired,
removeBlacklistItems: PropTypes.func.isRequired,
setBlacklistSort: PropTypes.func.isRequired,
setBlacklistTableOption: PropTypes.func.isRequired,
clearBlacklist: PropTypes.func.isRequired,
fetchBlocklist: PropTypes.func.isRequired,
gotoBlocklistFirstPage: PropTypes.func.isRequired,
gotoBlocklistPreviousPage: PropTypes.func.isRequired,
gotoBlocklistNextPage: PropTypes.func.isRequired,
gotoBlocklistLastPage: PropTypes.func.isRequired,
gotoBlocklistPage: PropTypes.func.isRequired,
removeBlocklistItems: PropTypes.func.isRequired,
setBlocklistSort: PropTypes.func.isRequired,
setBlocklistTableOption: PropTypes.func.isRequired,
clearBlocklist: PropTypes.func.isRequired,
executeCommand: PropTypes.func.isRequired
};
export default withCurrentPage(
connect(createMapStateToProps, mapDispatchToProps)(BlacklistConnector)
connect(createMapStateToProps, mapDispatchToProps)(BlocklistConnector)
);

View file

@ -9,7 +9,7 @@ import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
class BlacklistDetailsModal extends Component {
class BlocklistDetailsModal extends Component {
//
// Render
@ -77,7 +77,7 @@ class BlacklistDetailsModal extends Component {
}
}
BlacklistDetailsModal.propTypes = {
BlocklistDetailsModal.propTypes = {
isOpen: PropTypes.bool.isRequired,
sourceTitle: PropTypes.string.isRequired,
protocol: PropTypes.string.isRequired,
@ -86,4 +86,4 @@ BlacklistDetailsModal.propTypes = {
onModalClose: PropTypes.func.isRequired
};
export default BlacklistDetailsModal;
export default BlocklistDetailsModal;

View file

@ -8,10 +8,10 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
import TableRow from 'Components/Table/TableRow';
import { icons, kinds } from 'Helpers/Props';
import BlacklistDetailsModal from './BlacklistDetailsModal';
import styles from './BlacklistRow.css';
import BlocklistDetailsModal from './BlocklistDetailsModal';
import styles from './BlocklistRow.css';
class BlacklistRow extends Component {
class BlocklistRow extends Component {
//
// Lifecycle
@ -141,7 +141,7 @@ class BlacklistRow extends Component {
/>
<IconButton
title="Remove from blacklist"
title="Remove from blocklist"
name={icons.REMOVE}
kind={kinds.DANGER}
onPress={onRemovePress}
@ -154,7 +154,7 @@ class BlacklistRow extends Component {
})
}
<BlacklistDetailsModal
<BlocklistDetailsModal
isOpen={this.state.isDetailsModalOpen}
sourceTitle={sourceTitle}
protocol={protocol}
@ -168,7 +168,7 @@ class BlacklistRow extends Component {
}
BlacklistRow.propTypes = {
BlocklistRow.propTypes = {
id: PropTypes.number.isRequired,
artist: PropTypes.object.isRequired,
sourceTitle: PropTypes.string.isRequired,
@ -183,4 +183,4 @@ BlacklistRow.propTypes = {
onRemovePress: PropTypes.func.isRequired
};
export default BlacklistRow;
export default BlocklistRow;

View file

@ -1,8 +1,8 @@
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { removeBlacklistItem } from 'Store/Actions/blacklistActions';
import { removeBlocklistItem } from 'Store/Actions/blocklistActions';
import createArtistSelector from 'Store/Selectors/createArtistSelector';
import BlacklistRow from './BlacklistRow';
import BlocklistRow from './BlocklistRow';
function createMapStateToProps() {
return createSelector(
@ -18,9 +18,9 @@ function createMapStateToProps() {
function createMapDispatchToProps(dispatch, props) {
return {
onRemovePress() {
dispatch(removeBlacklistItem({ id: props.id }));
dispatch(removeBlocklistItem({ id: props.id }));
}
};
}
export default connect(createMapStateToProps, createMapDispatchToProps)(BlacklistRow);
export default connect(createMapStateToProps, createMapDispatchToProps)(BlocklistRow);

View file

@ -42,14 +42,14 @@ class QueueRow extends Component {
this.setState({ isRemoveQueueItemModalOpen: true });
}
onRemoveQueueItemModalConfirmed = (blacklist, skipredownload) => {
onRemoveQueueItemModalConfirmed = (blocklist, skipredownload) => {
const {
onRemoveQueueItemPress,
onQueueRowModalOpenOrClose
} = this.props;
onQueueRowModalOpenOrClose(false);
onRemoveQueueItemPress(blacklist, skipredownload);
onRemoveQueueItemPress(blocklist, skipredownload);
this.setState({ isRemoveQueueItemModalOpen: false });
}

View file

@ -21,7 +21,7 @@ class RemoveQueueItemModal extends Component {
this.state = {
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
};
}
@ -32,7 +32,7 @@ class RemoveQueueItemModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
});
}
@ -44,8 +44,8 @@ class RemoveQueueItemModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onSkipReDownloadChange = ({ value }) => {
@ -74,7 +74,7 @@ class RemoveQueueItemModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist, skipredownload } = this.state;
const { remove, blocklist, skipredownload } = this.state;
return (
<Modal
@ -108,19 +108,19 @@ class RemoveQueueItemModal extends Component {
</FormGroup>
<FormGroup>
<FormLabel>Blacklist Release</FormLabel>
<FormLabel>Blocklist Release</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
name="blocklist"
value={blocklist}
helpText="Prevents Lidarr from automatically grabbing this release again"
onChange={this.onBlacklistChange}
onChange={this.onBlocklistChange}
/>
</FormGroup>
{
blacklist &&
blocklist &&
<FormGroup>
<FormLabel>Skip Redownload</FormLabel>
<FormInputGroup

View file

@ -22,7 +22,7 @@ class RemoveQueueItemsModal extends Component {
this.state = {
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
};
}
@ -33,7 +33,7 @@ class RemoveQueueItemsModal extends Component {
resetState = function() {
this.setState({
remove: true,
blacklist: false,
blocklist: false,
skipredownload: false
});
}
@ -45,8 +45,8 @@ class RemoveQueueItemsModal extends Component {
this.setState({ remove: value });
}
onBlacklistChange = ({ value }) => {
this.setState({ blacklist: value });
onBlocklistChange = ({ value }) => {
this.setState({ blocklist: value });
}
onSkipReDownloadChange = ({ value }) => {
@ -75,7 +75,7 @@ class RemoveQueueItemsModal extends Component {
canIgnore
} = this.props;
const { remove, blacklist, skipredownload } = this.state;
const { remove, blocklist, skipredownload } = this.state;
return (
<Modal
@ -110,20 +110,20 @@ class RemoveQueueItemsModal extends Component {
<FormGroup>
<FormLabel>
Blacklist Release{selectedCount > 1 ? 's' : ''}
Blocklist Release{selectedCount > 1 ? 's' : ''}
</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="blacklist"
value={blacklist}
name="blocklist"
value={blocklist}
helpText="Prevents Lidarr from automatically grabbing these files again"
onChange={this.onBlacklistChange}
onChange={this.onBlocklistChange}
/>
</FormGroup>
{
blacklist &&
blocklist &&
<FormGroup>
<FormLabel>Skip Redownload</FormLabel>
<FormInputGroup