New: Add root folder select to EditSeriesModal
This commit is contained in:
parent
9218962e3c
commit
7123d914b1
|
@ -2,14 +2,22 @@ import PropTypes from 'prop-types';
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { clearPendingChanges } from 'Store/Actions/baseActions';
|
import { clearPendingChanges } from 'Store/Actions/baseActions';
|
||||||
|
import { fetchRootFolders } from 'Store/Actions/rootFolderActions';
|
||||||
import EditSeriesModal from './EditSeriesModal';
|
import EditSeriesModal from './EditSeriesModal';
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
clearPendingChanges
|
clearPendingChanges,
|
||||||
|
fetchRootFolders
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditSeriesModalConnector extends Component {
|
class EditSeriesModalConnector extends Component {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lifecycle
|
||||||
|
componentDidMount() {
|
||||||
|
this.props.fetchRootFolders();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
|
@ -34,7 +42,8 @@ class EditSeriesModalConnector extends Component {
|
||||||
EditSeriesModalConnector.propTypes = {
|
EditSeriesModalConnector.propTypes = {
|
||||||
...EditSeriesModal.propTypes,
|
...EditSeriesModal.propTypes,
|
||||||
onModalClose: PropTypes.func.isRequired,
|
onModalClose: PropTypes.func.isRequired,
|
||||||
clearPendingChanges: PropTypes.func.isRequired
|
clearPendingChanges: PropTypes.func.isRequired,
|
||||||
|
fetchRootFolders: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(undefined, mapDispatchToProps)(EditSeriesModalConnector);
|
export default connect(undefined, mapDispatchToProps)(EditSeriesModalConnector);
|
||||||
|
|
|
@ -77,6 +77,7 @@ class EditSeriesModalContent extends Component {
|
||||||
qualityProfileId,
|
qualityProfileId,
|
||||||
seriesType,
|
seriesType,
|
||||||
path,
|
path,
|
||||||
|
rootFolderPath,
|
||||||
tags
|
tags
|
||||||
} = item;
|
} = item;
|
||||||
|
|
||||||
|
@ -148,6 +149,23 @@ class EditSeriesModalContent extends Component {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('Root Folder')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.ROOT_FOLDER_SELECT}
|
||||||
|
name="rootFolderPath"
|
||||||
|
{...rootFolderPath}
|
||||||
|
includeNoChange={true}
|
||||||
|
includeNoChangeDisabled={false}
|
||||||
|
selectedValueOptions={{ includeFreeSpace: false }}
|
||||||
|
helpText={translate(
|
||||||
|
'Moving series to the same root folder can be used to rename series folders to match updated title or naming format'
|
||||||
|
)}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>Tags</FormLabel>
|
<FormLabel>Tags</FormLabel>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { createSelector } from 'reselect';
|
||||||
import { saveSeries, setSeriesValue } from 'Store/Actions/seriesActions';
|
import { saveSeries, setSeriesValue } from 'Store/Actions/seriesActions';
|
||||||
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
import createSeriesSelector from 'Store/Selectors/createSeriesSelector';
|
||||||
import selectSettings from 'Store/Selectors/selectSettings';
|
import selectSettings from 'Store/Selectors/selectSettings';
|
||||||
|
import combinePath from 'Utilities/String/combinePath';
|
||||||
import EditSeriesModalContent from './EditSeriesModalContent';
|
import EditSeriesModalContent from './EditSeriesModalContent';
|
||||||
|
|
||||||
function createIsPathChangingSelector() {
|
function createIsPathChangingSelector() {
|
||||||
|
@ -27,9 +28,10 @@ function createIsPathChangingSelector() {
|
||||||
function createMapStateToProps() {
|
function createMapStateToProps() {
|
||||||
return createSelector(
|
return createSelector(
|
||||||
(state) => state.series,
|
(state) => state.series,
|
||||||
|
(state) => state.system.status.item.isWindows,
|
||||||
createSeriesSelector(),
|
createSeriesSelector(),
|
||||||
createIsPathChangingSelector(),
|
createIsPathChangingSelector(),
|
||||||
(seriesState, series, isPathChanging) => {
|
(seriesState, isWindows, series, isPathChanging) => {
|
||||||
const {
|
const {
|
||||||
isSaving,
|
isSaving,
|
||||||
saveError,
|
saveError,
|
||||||
|
@ -42,6 +44,7 @@ function createMapStateToProps() {
|
||||||
'qualityProfileId',
|
'qualityProfileId',
|
||||||
'seriesType',
|
'seriesType',
|
||||||
'path',
|
'path',
|
||||||
|
'rootFolderPath',
|
||||||
'tags'
|
'tags'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -49,6 +52,7 @@ function createMapStateToProps() {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: series.title,
|
title: series.title,
|
||||||
|
isWindows,
|
||||||
isSaving,
|
isSaving,
|
||||||
saveError,
|
saveError,
|
||||||
isPathChanging,
|
isPathChanging,
|
||||||
|
@ -80,7 +84,20 @@ class EditSeriesModalContentConnector extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onInputChange = ({ name, value }) => {
|
onInputChange = ({ name, value }) => {
|
||||||
this.props.dispatchSetSeriesValue({ name, value });
|
const {
|
||||||
|
dispatchSetSeriesValue,
|
||||||
|
isWindows,
|
||||||
|
title,
|
||||||
|
item: { path }
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
dispatchSetSeriesValue({ name, value });
|
||||||
|
|
||||||
|
// Also update the path if the root folder path changes
|
||||||
|
if (name === 'rootFolderPath' && value !== 'noChange' && path.value.indexOf(value) === -1) {
|
||||||
|
const newPath = combinePath(isWindows, value, [title]);
|
||||||
|
dispatchSetSeriesValue({ name: 'path', value: newPath });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onSavePress = (moveFiles) => {
|
onSavePress = (moveFiles) => {
|
||||||
|
@ -106,7 +123,10 @@ class EditSeriesModalContentConnector extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
EditSeriesModalContentConnector.propTypes = {
|
EditSeriesModalContentConnector.propTypes = {
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
item: PropTypes.object.isRequired,
|
||||||
seriesId: PropTypes.number,
|
seriesId: PropTypes.number,
|
||||||
|
isWindows: PropTypes.bool.isRequired,
|
||||||
isSaving: PropTypes.bool.isRequired,
|
isSaving: PropTypes.bool.isRequired,
|
||||||
saveError: PropTypes.object,
|
saveError: PropTypes.object,
|
||||||
dispatchSetSeriesValue: PropTypes.func.isRequired,
|
dispatchSetSeriesValue: PropTypes.func.isRequired,
|
||||||
|
|
Loading…
Reference in New Issue