1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-27 23:06:29 -04:00

New: Added Series Monitoring Toggle to Series Details

Closes #3991
This commit is contained in:
Robin Dadswell
2020-12-13 17:58:56 +00:00
committed by GitHub
parent 39589b8c02
commit 0ff889c3be
6 changed files with 350 additions and 2 deletions
+51 -2
View File
@@ -10,7 +10,8 @@ import createFetchHandler from './Creators/createFetchHandler';
import createSaveProviderHandler from './Creators/createSaveProviderHandler';
import createRemoveItemHandler from './Creators/createRemoveItemHandler';
import createHandleActions from './Creators/createHandleActions';
import { updateItem } from './baseActions';
import { updateItem, set } from './baseActions';
import { fetchEpisodes } from './episodeActions';
//
// Local
@@ -176,6 +177,7 @@ export const DELETE_SERIES = 'series/deleteSeries';
export const TOGGLE_SERIES_MONITORED = 'series/toggleSeriesMonitored';
export const TOGGLE_SEASON_MONITORED = 'series/toggleSeasonMonitored';
export const UPDATE_SERIES_MONITOR = 'series/updateSeriesMonitor';
//
// Action Creators
@@ -209,6 +211,7 @@ export const deleteSeries = createThunk(DELETE_SERIES, (payload) => {
export const toggleSeriesMonitored = createThunk(TOGGLE_SERIES_MONITORED);
export const toggleSeasonMonitored = createThunk(TOGGLE_SEASON_MONITORED);
export const updateSeriesMonitor = createThunk(UPDATE_SERIES_MONITOR);
export const setSeriesValue = createAction(SET_SERIES_VALUE, (payload) => {
return {
@@ -377,8 +380,54 @@ export const actionHandlers = handleThunks({
});
});
}, MONITOR_TIMEOUT);
}
},
[UPDATE_SERIES_MONITOR]: function(getState, payload, dispatch) {
const {
id,
monitor
} = payload;
const seriesToUpdate = { id };
if (monitor !== 'None') {
seriesToUpdate.monitored = true;
}
dispatch(set({
section,
isSaving: true
}));
const promise = createAjaxRequest({
url: '/seasonPass',
method: 'POST',
data: JSON.stringify({
series: [
seriesToUpdate
],
monitoringOptions: { monitor }
}),
dataType: 'json'
}).request;
promise.done((data) => {
dispatch(fetchEpisodes({ seriesId: id }));
dispatch(set({
section,
isSaving: false,
saveError: null
}));
});
promise.fail((xhr) => {
dispatch(set({
section,
isSaving: false,
saveError: xhr
}));
});
}
});
//