1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Add List Exclusion from Movie Editor

Fixes #3775
This commit is contained in:
Qstick 2019-09-21 15:40:26 -04:00
parent 254561aeb1
commit 90e58e5a22
6 changed files with 40 additions and 17 deletions

View File

@ -42,8 +42,7 @@ class DeleteMovieModalContent extends Component {
const deleteFiles = this.state.deleteFiles; const deleteFiles = this.state.deleteFiles;
const addNetImportExclusion = this.state.addNetImportExclusion; const addNetImportExclusion = this.state.addNetImportExclusion;
this.setState({ deleteFiles: false }); this.setState({ deleteFiles: false, addNetImportExclusion: false });
this.setState({ addNetImportExclusion: false });
this.props.onDeletePress(deleteFiles, addNetImportExclusion); this.props.onDeletePress(deleteFiles, addNetImportExclusion);
} }

View File

@ -20,7 +20,8 @@ class DeleteMovieModalContent extends Component {
super(props, context); super(props, context);
this.state = { this.state = {
deleteFiles: false deleteFiles: false,
addNetImportExclusion: false
}; };
} }
@ -31,11 +32,16 @@ class DeleteMovieModalContent extends Component {
this.setState({ deleteFiles: value }); this.setState({ deleteFiles: value });
} }
onAddNetImportExclusionChange = ({ value }) => {
this.setState({ addNetImportExclusion: value });
}
onDeleteMovieConfirmed = () => { onDeleteMovieConfirmed = () => {
const deleteFiles = this.state.deleteFiles; const deleteFiles = this.state.deleteFiles;
const addNetImportExclusion = this.state.addNetImportExclusion;
this.setState({ deleteFiles: false }); this.setState({ deleteFiles: false, addNetImportExclusion: false });
this.props.onDeleteSelectedPress(deleteFiles); this.props.onDeleteSelectedPress(deleteFiles, addNetImportExclusion);
} }
// //
@ -46,7 +52,9 @@ class DeleteMovieModalContent extends Component {
movies, movies,
onModalClose onModalClose
} = this.props; } = this.props;
const deleteFiles = this.state.deleteFiles; const deleteFiles = this.state.deleteFiles;
const addNetImportExclusion = this.state.addNetImportExclusion;
return ( return (
<ModalContent onModalClose={onModalClose}> <ModalContent onModalClose={onModalClose}>
@ -68,6 +76,19 @@ class DeleteMovieModalContent extends Component {
onChange={this.onDeleteFilesChange} onChange={this.onDeleteFilesChange}
/> />
</FormGroup> </FormGroup>
<FormGroup>
<FormLabel>Add List Exclusion</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="addNetImportExclusion"
value={addNetImportExclusion}
helpText="Prevent movie from being added to Radarr by lists"
kind={kinds.DANGER}
onChange={this.onAddNetImportExclusionChange}
/>
</FormGroup>
</div> </div>
<div className={styles.message}> <div className={styles.message}>

View File

@ -31,10 +31,11 @@ function createMapStateToProps() {
function createMapDispatchToProps(dispatch, props) { function createMapDispatchToProps(dispatch, props) {
return { return {
onDeleteSelectedPress(deleteFiles) { onDeleteSelectedPress(deleteFiles, addNetImportExclusion) {
dispatch(bulkDeleteMovie({ dispatch(bulkDeleteMovie({
movieIds: props.movieIds, movieIds: props.movieIds,
deleteFiles deleteFiles,
addNetImportExclusion
})); }));
props.onModalClose(); props.onModalClose();

View File

@ -1,3 +1,4 @@
import $ from 'jquery';
import { createAction } from 'redux-actions'; import { createAction } from 'redux-actions';
import { batchActions } from 'redux-batched-actions'; import { batchActions } from 'redux-batched-actions';
import createAjaxRequest from 'Utilities/createAjaxRequest'; import createAjaxRequest from 'Utilities/createAjaxRequest';
@ -355,13 +356,18 @@ export const actionHandlers = handleThunks({
}, },
[BULK_DELETE_MOVIE]: function(getState, payload, dispatch) { [BULK_DELETE_MOVIE]: function(getState, payload, dispatch) {
const {
id,
...queryParams
} = payload;
dispatch(set({ dispatch(set({
section, section,
isDeleting: true isDeleting: true
})); }));
const promise = createAjaxRequest({ const promise = createAjaxRequest({
url: '/movie/editor', url: `/movie/editor?${$.param(queryParams, true)}`,
method: 'DELETE', method: 'DELETE',
data: JSON.stringify(payload), data: JSON.stringify(payload),
dataType: 'json' dataType: 'json'

View File

@ -89,9 +89,12 @@ private object DeleteMovies()
{ {
var resource = Request.Body.FromJson<MovieEditorResource>(); var resource = Request.Body.FromJson<MovieEditorResource>();
var addExclusion = Request.GetBooleanQueryParameter("addNetImportExclusion");
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
foreach (var id in resource.MovieIds) foreach (var id in resource.MovieIds)
{ {
_movieService.DeleteMovie(id, false, false); _movieService.DeleteMovie(id, deleteFiles, addExclusion);
} }
return new object(); return new object();

View File

@ -116,16 +116,9 @@ private void UpdateMovie(MovieResource moviesResource)
private void DeleteMovie(int id) private void DeleteMovie(int id)
{ {
var addExclusion = false; var addExclusion = Request.GetBooleanQueryParameter("addNetImportExclusion");
var addExclusionQuery = Request.Query.addNetImportExclusion;
var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles"); var deleteFiles = Request.GetBooleanQueryParameter("deleteFiles");
if (addExclusionQuery.HasValue)
{
addExclusion = Convert.ToBoolean(addExclusionQuery.Value);
}
_moviesService.DeleteMovie(id, deleteFiles, addExclusion); _moviesService.DeleteMovie(id, deleteFiles, addExclusion);
} }