mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-20 13:06:57 +00:00
Fixed: Batch Monitor/Unmonitor on Wanted Pages
This commit is contained in:
parent
b99b23b4bb
commit
9f079fb8ba
12 changed files with 43 additions and 43 deletions
|
@ -15,7 +15,7 @@ function createMapStateToProps() {
|
|||
createCommandsSelector(),
|
||||
(albumId, sceneSeasonNumber, artist, commands) => {
|
||||
const isSearching = _.some(commands, (command) => {
|
||||
const episodeSearch = command.name === commandNames.EPISODE_SEARCH;
|
||||
const episodeSearch = command.name === commandNames.ALBUM_SEARCH;
|
||||
|
||||
if (!episodeSearch) {
|
||||
return false;
|
||||
|
@ -37,7 +37,7 @@ function createMapDispatchToProps(dispatch, props) {
|
|||
return {
|
||||
onSearchPress(name, path) {
|
||||
dispatch(executeCommand({
|
||||
name: commandNames.EPISODE_SEARCH,
|
||||
name: commandNames.ALBUM_SEARCH,
|
||||
albumIds: [props.albumId]
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ class EpisodeSearchConnector extends Component {
|
|||
|
||||
onQuickSearchPress = () => {
|
||||
this.props.executeCommand({
|
||||
name: commandNames.EPISODE_SEARCH,
|
||||
name: commandNames.ALBUM_SEARCH,
|
||||
albumIds: [this.props.albumId]
|
||||
});
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ export const BACKUP = 'Backup';
|
|||
export const CHECK_FOR_FINISHED_DOWNLOAD = 'CheckForFinishedDownload';
|
||||
export const CLEAR_BLACKLIST = 'ClearBlacklist';
|
||||
export const CLEAR_LOGS = 'ClearLog';
|
||||
export const CUTOFF_UNMET_EPISODE_SEARCH = 'CutoffUnmetAlbumSearch';
|
||||
export const CUTOFF_UNMET_ALBUM_SEARCH = 'CutoffUnmetAlbumSearch';
|
||||
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
||||
export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles';
|
||||
export const DOWNLOADED_ALBUMS_SCAN = 'DownloadedAlbumsScan';
|
||||
export const EPISODE_SEARCH = 'AlbumSearch';
|
||||
export const ALBUM_SEARCH = 'AlbumSearch';
|
||||
export const INTERACTIVE_IMPORT = 'ManualImport';
|
||||
export const MISSING_ALBUM_SEARCH = 'MissingAlbumSearch';
|
||||
export const REFRESH_ARTIST = 'RefreshArtist';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import updateEpisodes from 'Utilities/Episode/updateEpisodes';
|
||||
import updateAlbums from 'Utilities/Album/updateAlbums';
|
||||
|
||||
function createBatchToggleEpisodeMonitoredHandler(section, getFromState) {
|
||||
function createBatchToggleAlbumMonitoredHandler(section, getFromState) {
|
||||
return function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
|
@ -11,26 +11,26 @@ function createBatchToggleEpisodeMonitoredHandler(section, getFromState) {
|
|||
|
||||
const state = getFromState(getState());
|
||||
|
||||
updateEpisodes(dispatch, section, state.items, albumIds, {
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: true
|
||||
});
|
||||
|
||||
const promise = $.ajax({
|
||||
url: '/episode/monitor',
|
||||
url: '/album/monitor',
|
||||
method: 'PUT',
|
||||
data: JSON.stringify({ albumIds, monitored }),
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
promise.done(() => {
|
||||
updateEpisodes(dispatch, section, state.items, albumIds, {
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: false,
|
||||
monitored
|
||||
});
|
||||
});
|
||||
|
||||
promise.fail(() => {
|
||||
updateEpisodes(dispatch, section, state.items, albumIds, {
|
||||
updateAlbums(dispatch, section, state.items, albumIds, {
|
||||
isSaving: false
|
||||
});
|
||||
});
|
||||
|
@ -38,4 +38,4 @@ function createBatchToggleEpisodeMonitoredHandler(section, getFromState) {
|
|||
};
|
||||
}
|
||||
|
||||
export default createBatchToggleEpisodeMonitoredHandler;
|
||||
export default createBatchToggleAlbumMonitoredHandler;
|
|
@ -1,7 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import updateEpisodes from 'Utilities/Episode/updateEpisodes';
|
||||
import updateAlbums from 'Utilities/Album/updateAlbums';
|
||||
|
||||
function createToggleEpisodeMonitoredHandler(section, getFromState) {
|
||||
function createToggleAlbumMonitoredHandler(section, getFromState) {
|
||||
return function(payload) {
|
||||
return function(dispatch, getState) {
|
||||
const {
|
||||
|
@ -11,26 +11,26 @@ function createToggleEpisodeMonitoredHandler(section, getFromState) {
|
|||
|
||||
const state = getFromState(getState());
|
||||
|
||||
updateEpisodes(dispatch, section, state.items, [albumId], {
|
||||
updateAlbums(dispatch, section, state.items, [albumId], {
|
||||
isSaving: true
|
||||
});
|
||||
|
||||
const promise = $.ajax({
|
||||
url: `/episode/${albumId}`,
|
||||
url: `/album/${albumId}`,
|
||||
method: 'PUT',
|
||||
data: JSON.stringify({ monitored }),
|
||||
dataType: 'json'
|
||||
});
|
||||
|
||||
promise.done(() => {
|
||||
updateEpisodes(dispatch, section, state.items, [albumId], {
|
||||
updateAlbums(dispatch, section, state.items, [albumId], {
|
||||
isSaving: false,
|
||||
monitored
|
||||
});
|
||||
});
|
||||
|
||||
promise.fail(() => {
|
||||
updateEpisodes(dispatch, section, state.items, [albumId], {
|
||||
updateAlbums(dispatch, section, state.items, [albumId], {
|
||||
isSaving: false
|
||||
});
|
||||
});
|
||||
|
@ -38,4 +38,4 @@ function createToggleEpisodeMonitoredHandler(section, getFromState) {
|
|||
};
|
||||
}
|
||||
|
||||
export default createToggleEpisodeMonitoredHandler;
|
||||
export default createToggleAlbumMonitoredHandler;
|
|
@ -103,7 +103,7 @@ export const DELETE_TRACK_FILES = 'DELETE_TRACK_FILES';
|
|||
export const UPDATE_TRACK_FILES = 'UPDATE_TRACK_FILES';
|
||||
|
||||
//
|
||||
// Episode History
|
||||
// Album History
|
||||
|
||||
export const FETCH_ALBUM_HISTORY = 'FETCH_ALBUM_HISTORY';
|
||||
export const CLEAR_ALBUM_HISTORY = 'CLEAR_ALBUM_HISTORY';
|
||||
|
@ -195,7 +195,7 @@ export const SET_MISSING_FILTER = 'SET_MISSING_FILTER';
|
|||
export const SET_MISSING_TABLE_OPTION = 'SET_MISSING_TABLE_OPTION';
|
||||
export const CLEAR_MISSING = 'CLEAR_MISSING';
|
||||
|
||||
export const BATCH_TOGGLE_MISSING_EPISODES = 'BATCH_TOGGLE_MISSING_EPISODES';
|
||||
export const BATCH_TOGGLE_MISSING_ALBUMS = 'BATCH_TOGGLE_MISSING_ALBUMS';
|
||||
|
||||
export const FETCH_CUTOFF_UNMET = 'FETCH_CUTOFF_UNMET';
|
||||
export const GOTO_FIRST_CUTOFF_UNMET_PAGE = 'GOTO_FIRST_CUTOFF_UNMET_PAGE';
|
||||
|
@ -208,7 +208,7 @@ export const SET_CUTOFF_UNMET_FILTER = 'SET_CUTOFF_UNMET_FILTER';
|
|||
export const SET_CUTOFF_UNMET_TABLE_OPTION = 'SET_CUTOFF_UNMET_TABLE_OPTION';
|
||||
export const CLEAR_CUTOFF_UNMET = 'CLEAR_CUTOFF_UNMET';
|
||||
|
||||
export const BATCH_TOGGLE_CUTOFF_UNMET_EPISODES = 'BATCH_TOGGLE_CUTOFF_UNMET_EPISODES';
|
||||
export const BATCH_TOGGLE_CUTOFF_UNMET_ALBUMS = 'BATCH_TOGGLE_CUTOFF_UNMET_ALBUMS';
|
||||
|
||||
//
|
||||
// Settings
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import serverSideCollectionHandlers from 'Utilities/serverSideCollectionHandlers';
|
||||
import createBatchToggleEpisodeMonitoredHandler from './Creators/createBatchToggleEpisodeMonitoredHandler';
|
||||
import createBatchToggleAlbumMonitoredHandler from './Creators/createBatchToggleAlbumMonitoredHandler';
|
||||
import createServerSideCollectionHandlers from './Creators/createServerSideCollectionHandlers';
|
||||
import * as types from './actionTypes';
|
||||
|
||||
|
@ -15,7 +15,7 @@ const wantedActionHandlers = {
|
|||
[serverSideCollectionHandlers.FILTER]: types.SET_MISSING_FILTER
|
||||
}),
|
||||
|
||||
[types.BATCH_TOGGLE_MISSING_EPISODES]: createBatchToggleEpisodeMonitoredHandler('missing', (state) => state.wanted.missing),
|
||||
[types.BATCH_TOGGLE_MISSING_ALBUMS]: createBatchToggleAlbumMonitoredHandler('missing', (state) => state.wanted.missing),
|
||||
|
||||
...createServerSideCollectionHandlers('cutoffUnmet', '/wanted/cutoff', (state) => state.wanted, {
|
||||
[serverSideCollectionHandlers.FETCH]: types.FETCH_CUTOFF_UNMET,
|
||||
|
@ -28,7 +28,7 @@ const wantedActionHandlers = {
|
|||
[serverSideCollectionHandlers.FILTER]: types.SET_CUTOFF_UNMET_FILTER
|
||||
}),
|
||||
|
||||
[types.BATCH_TOGGLE_CUTOFF_UNMET_EPISODES]: createBatchToggleEpisodeMonitoredHandler('cutoffUnmet', (state) => state.wanted.cutoffUnmet)
|
||||
[types.BATCH_TOGGLE_CUTOFF_UNMET_ALBUMS]: createBatchToggleAlbumMonitoredHandler('cutoffUnmet', (state) => state.wanted.cutoffUnmet)
|
||||
};
|
||||
|
||||
export default wantedActionHandlers;
|
||||
|
|
|
@ -16,7 +16,7 @@ export const setMissingFilter = wantedActionHandlers[types.SET_MISSING_FILTER];
|
|||
export const setMissingTableOption = createAction(types.SET_MISSING_TABLE_OPTION);
|
||||
export const clearMissing = createAction(types.CLEAR_MISSING);
|
||||
|
||||
export const batchToggleMissingEpisodes = wantedActionHandlers[types.BATCH_TOGGLE_MISSING_EPISODES];
|
||||
export const batchToggleMissingAlbums = wantedActionHandlers[types.BATCH_TOGGLE_MISSING_ALBUMS];
|
||||
|
||||
//
|
||||
// Cutoff Unmet
|
||||
|
@ -32,4 +32,4 @@ export const setCutoffUnmetFilter = wantedActionHandlers[types.SET_CUTOFF_UNMET_
|
|||
export const setCutoffUnmetTableOption= createAction(types.SET_CUTOFF_UNMET_TABLE_OPTION);
|
||||
export const clearCutoffUnmet= createAction(types.CLEAR_CUTOFF_UNMET);
|
||||
|
||||
export const batchToggleCutoffUnmetEpisodes = wantedActionHandlers[types.BATCH_TOGGLE_CUTOFF_UNMET_EPISODES];
|
||||
export const batchToggleCutoffUnmetAlbums = wantedActionHandlers[types.BATCH_TOGGLE_CUTOFF_UNMET_ALBUMS];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import { update } from 'Store/Actions/baseActions';
|
||||
|
||||
function updateEpisodes(dispatch, section, episodes, albumIds, options) {
|
||||
function updateAlbums(dispatch, section, episodes, albumIds, options) {
|
||||
const data = _.reduce(episodes, (result, item) => {
|
||||
if (albumIds.indexOf(item.id) > -1) {
|
||||
result.push({
|
||||
|
@ -18,4 +18,4 @@ function updateEpisodes(dispatch, section, episodes, albumIds, options) {
|
|||
dispatch(update({ section, data }));
|
||||
}
|
||||
|
||||
export default updateEpisodes;
|
||||
export default updateAlbums;
|
|
@ -109,7 +109,7 @@ class CutoffUnmet extends Component {
|
|||
columns,
|
||||
totalRecords,
|
||||
isSearchingForAlbums,
|
||||
isSearchingForCutoffUnmetEpisodes,
|
||||
isSearchingForCutoffUnmetAlbums,
|
||||
isSaving,
|
||||
filterKey,
|
||||
filterValue,
|
||||
|
@ -150,7 +150,7 @@ class CutoffUnmet extends Component {
|
|||
<PageToolbarButton
|
||||
label="Search All"
|
||||
iconName={icons.SEARCH}
|
||||
isSpinning={isSearchingForCutoffUnmetEpisodes}
|
||||
isSpinning={isSearchingForCutoffUnmetAlbums}
|
||||
onPress={this.onSearchAllCutoffUnmetPress}
|
||||
/>
|
||||
|
||||
|
@ -272,7 +272,7 @@ CutoffUnmet.propTypes = {
|
|||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
totalRecords: PropTypes.number,
|
||||
isSearchingForAlbums: PropTypes.bool.isRequired,
|
||||
isSearchingForCutoffUnmetEpisodes: PropTypes.bool.isRequired,
|
||||
isSearchingForCutoffUnmetAlbums: PropTypes.bool.isRequired,
|
||||
isSaving: PropTypes.bool.isRequired,
|
||||
filterKey: PropTypes.string,
|
||||
filterValue: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),
|
||||
|
|
|
@ -19,12 +19,12 @@ function createMapStateToProps() {
|
|||
(state) => state.wanted.cutoffUnmet,
|
||||
createCommandsSelector(),
|
||||
(cutoffUnmet, commands) => {
|
||||
const isSearchingForAlbums = _.some(commands, { name: commandNames.EPISODE_SEARCH });
|
||||
const isSearchingForCutoffUnmetEpisodes = _.some(commands, { name: commandNames.CUTOFF_UNMET_EPISODE_SEARCH });
|
||||
const isSearchingForAlbums = _.some(commands, { name: commandNames.ALBUM_SEARCH });
|
||||
const isSearchingForCutoffUnmetAlbums = _.some(commands, { name: commandNames.CUTOFF_UNMET_ALBUM_SEARCH });
|
||||
|
||||
return {
|
||||
isSearchingForAlbums,
|
||||
isSearchingForCutoffUnmetEpisodes,
|
||||
isSearchingForCutoffUnmetAlbums,
|
||||
isSaving: _.some(cutoffUnmet.items, { isSaving: true }),
|
||||
...cutoffUnmet
|
||||
};
|
||||
|
@ -119,7 +119,7 @@ class CutoffUnmetConnector extends Component {
|
|||
|
||||
onSearchSelectedPress = (selected) => {
|
||||
this.props.executeCommand({
|
||||
name: commandNames.EPISODE_SEARCH,
|
||||
name: commandNames.ALBUM_SEARCH,
|
||||
albumIds: selected
|
||||
});
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class CutoffUnmetConnector extends Component {
|
|||
filterValue
|
||||
} = this.props;
|
||||
|
||||
this.props.batchToggleCutoffUnmetEpisodes({
|
||||
this.props.batchToggleCutoffUnmetAlbums({
|
||||
albumIds: selected,
|
||||
monitored: filterKey !== 'monitored' || !filterValue
|
||||
});
|
||||
|
@ -138,7 +138,7 @@ class CutoffUnmetConnector extends Component {
|
|||
|
||||
onSearchAllCutoffUnmetPress = () => {
|
||||
this.props.executeCommand({
|
||||
name: commandNames.CUTOFF_UNMET_EPISODE_SEARCH
|
||||
name: commandNames.CUTOFF_UNMET_ALBUM_SEARCH
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ CutoffUnmetConnector.propTypes = {
|
|||
setCutoffUnmetSort: PropTypes.func.isRequired,
|
||||
setCutoffUnmetFilter: PropTypes.func.isRequired,
|
||||
setCutoffUnmetTableOption: PropTypes.func.isRequired,
|
||||
batchToggleCutoffUnmetEpisodes: PropTypes.func.isRequired,
|
||||
batchToggleCutoffUnmetAlbums: PropTypes.func.isRequired,
|
||||
clearCutoffUnmet: PropTypes.func.isRequired,
|
||||
executeCommand: PropTypes.func.isRequired,
|
||||
fetchQueueDetails: PropTypes.func.isRequired,
|
||||
|
|
|
@ -18,7 +18,7 @@ function createMapStateToProps() {
|
|||
(state) => state.wanted.missing,
|
||||
createCommandsSelector(),
|
||||
(missing, commands) => {
|
||||
const isSearchingForAlbums = _.some(commands, { name: commandNames.EPISODE_SEARCH });
|
||||
const isSearchingForAlbums = _.some(commands, { name: commandNames.ALBUM_SEARCH });
|
||||
const isSearchingForMissingAlbums = _.some(commands, { name: commandNames.MISSING_ALBUM_SEARCH });
|
||||
|
||||
return {
|
||||
|
@ -109,7 +109,7 @@ class MissingConnector extends Component {
|
|||
|
||||
onSearchSelectedPress = (selected) => {
|
||||
this.props.executeCommand({
|
||||
name: commandNames.EPISODE_SEARCH,
|
||||
name: commandNames.ALBUM_SEARCH,
|
||||
albumIds: selected
|
||||
});
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class MissingConnector extends Component {
|
|||
filterValue
|
||||
} = this.props;
|
||||
|
||||
this.props.batchToggleMissingEpisodes({
|
||||
this.props.batchToggleMissingAlbums({
|
||||
albumIds: selected,
|
||||
monitored: filterKey !== 'monitored' || !filterValue
|
||||
});
|
||||
|
@ -169,7 +169,7 @@ MissingConnector.propTypes = {
|
|||
setMissingFilter: PropTypes.func.isRequired,
|
||||
setMissingTableOption: PropTypes.func.isRequired,
|
||||
clearMissing: PropTypes.func.isRequired,
|
||||
batchToggleMissingEpisodes: PropTypes.func.isRequired,
|
||||
batchToggleMissingAlbums: PropTypes.func.isRequired,
|
||||
executeCommand: PropTypes.func.isRequired,
|
||||
fetchQueueDetails: PropTypes.func.isRequired,
|
||||
clearQueueDetails: PropTypes.func.isRequired
|
||||
|
|
Loading…
Reference in a new issue