Fixed: Bad RootPath Added on List Add from Collection

pull/2/head
Qstick 4 years ago
parent c9a9babdf3
commit 9d913899ca

@ -1,30 +1,65 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React, { Component } from 'react';
import MonitorToggleButton from 'Components/MonitorToggleButton'; import MonitorToggleButton from 'Components/MonitorToggleButton';
import EditNetImportModalConnector from 'Settings/NetImport/NetImport/EditNetImportModalConnector';
import styles from './MovieCollection.css'; import styles from './MovieCollection.css';
function MovieCollection(props) { class MovieCollection extends Component {
const {
name, //
collectionList, // Lifecycle
isSaving,
onMonitorTogglePress constructor(props, context) {
} = props; super(props, context);
const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto; this.state = {
hasPosterError: false,
return ( isEditNetImportModalOpen: false
<div> };
<MonitorToggleButton }
className={styles.monitorToggleButton}
monitored={monitored} onAddNetImportPress = (monitored) => {
isSaving={isSaving} if (this.props.collectionList) {
size={15} this.props.onMonitorTogglePress(monitored);
onPress={onMonitorTogglePress} } else {
/> this.props.onMonitorTogglePress(monitored);
{name} this.setState({ isEditNetImportModalOpen: true });
</div> }
); }
onEditNetImportModalClose = () => {
this.setState({ isEditNetImportModalOpen: false });
}
render() {
const {
name,
collectionList,
isSaving
} = this.props;
const monitored = collectionList !== undefined && collectionList.enabled && collectionList.enableAuto;
const netImportId = collectionList ? collectionList.id : 0;
return (
<div>
<MonitorToggleButton
className={styles.monitorToggleButton}
monitored={monitored}
isSaving={isSaving}
size={15}
onPress={this.onAddNetImportPress}
/>
{name}
<EditNetImportModalConnector
id={netImportId}
isOpen={this.state.isEditNetImportModalOpen}
onModalClose={this.onEditNetImportModalClose}
onDeleteNetImportPress={this.onDeleteNetImportPress}
/>
</div>
);
}
} }
MovieCollection.propTypes = { MovieCollection.propTypes = {

@ -16,7 +16,6 @@ function createMapStateToProps() {
const { const {
monitored, monitored,
qualityProfileId, qualityProfileId,
path,
minimumAvailability minimumAvailability
} = movie; } = movie;
@ -24,7 +23,6 @@ function createMapStateToProps() {
collectionList, collectionList,
monitored, monitored,
qualityProfileId, qualityProfileId,
path,
minimumAvailability, minimumAvailability,
isSaving: netImports.isSaving isSaving: netImports.isSaving
}; };
@ -55,11 +53,9 @@ class MovieCollectionConnector extends Component {
this.props.setNetImportValue({ name: 'enabled', value: true }); this.props.setNetImportValue({ name: 'enabled', value: true });
this.props.setNetImportValue({ name: 'enableAuto', value: true }); this.props.setNetImportValue({ name: 'enableAuto', value: true });
this.props.setNetImportValue({ name: 'name', value: `${this.props.name} - ${this.props.tmdbId}` }); this.props.setNetImportValue({ name: 'name', value: `${this.props.name} - ${this.props.tmdbId}` });
this.props.setNetImportValue({ name: 'rootFolderPath', value: this.props.path });
this.props.setNetImportValue({ name: 'qualityProfileId', value: this.props.qualityProfileId }); this.props.setNetImportValue({ name: 'qualityProfileId', value: this.props.qualityProfileId });
this.props.setNetImportValue({ name: 'monitored', value: this.props.monitored }); this.props.setNetImportValue({ name: 'monitored', value: this.props.monitored });
this.props.setNetImportValue({ name: 'minimumAvailability', value: this.props.minimumAvailability }); this.props.setNetImportValue({ name: 'minimumAvailability', value: this.props.minimumAvailability });
this.props.saveNetImport();
} }
} }
@ -83,7 +79,6 @@ MovieCollectionConnector.propTypes = {
collectionList: PropTypes.object, collectionList: PropTypes.object,
monitored: PropTypes.bool.isRequired, monitored: PropTypes.bool.isRequired,
qualityProfileId: PropTypes.number.isRequired, qualityProfileId: PropTypes.number.isRequired,
path: PropTypes.string.isRequired,
minimumAvailability: PropTypes.string.isRequired, minimumAvailability: PropTypes.string.isRequired,
isSaving: PropTypes.bool.isRequired, isSaving: PropTypes.bool.isRequired,
selectNetImportSchema: PropTypes.func.isRequired, selectNetImportSchema: PropTypes.func.isRequired,

Loading…
Cancel
Save