mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-16 21:15:33 -04:00
Fixed: Movie Details Tab (#3564)
* History Added * History Cleanup * History Mark Failed Fix * History Lint Fix * Search Tab Initial * Interactive Search Cleanup * Files Tab + Small Backend change to MovieFile api * Reverse Movie History Items * Grabbed files are not grabbable again. * Partial movie title outline + Search not updating fix * Lint Fix + InteractiveSearch refactor * Rename movieLanguage.js to MovieLanguage.js * Fixes for qstick's comments * Rename language selector to allow for const languages * Qstick comment changes. * Activity Tabs - Language Column fixed * Movie Details - MoveStatusLabel fixed * Spaces + Lower Case added * fixed DownloadAllowed * Added padding to history and file tables * Fix class => className * Updated search to not refresh unless switching movie * lint fix * File Tab Converted to Inline Editting * FIles tab fix + Alt Titles tab implemented * lint fix * Cleanup via qstick request
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
/* eslint max-params: 0 */
|
||||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import getQualities from 'Utilities/Quality/getQualities';
|
||||
import createMovieSelector from 'Store/Selectors/createMovieSelector';
|
||||
import { deleteMovieFile, updateMovieFiles } from 'Store/Actions/movieFileActions';
|
||||
import { fetchQualityProfileSchema, fetchLanguages } from 'Store/Actions/settingsActions';
|
||||
import MovieFileEditorTableContent from './MovieFileEditorTableContent';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.movieFiles,
|
||||
(state) => state.settings.languages,
|
||||
(state) => state.settings.qualityProfiles,
|
||||
createMovieSelector(),
|
||||
(
|
||||
movieFiles,
|
||||
languageProfiles,
|
||||
qualityProfiles
|
||||
) => {
|
||||
const languages = languageProfiles.items;
|
||||
const qualities = getQualities(qualityProfiles.schema.items);
|
||||
|
||||
return {
|
||||
items: movieFiles.items,
|
||||
isDeleting: movieFiles.isDeleting,
|
||||
isSaving: movieFiles.isSaving,
|
||||
error: null,
|
||||
languages,
|
||||
qualities
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function createMapDispatchToProps(dispatch, props) {
|
||||
return {
|
||||
dispatchFetchQualityProfileSchema(name, path) {
|
||||
dispatch(fetchQualityProfileSchema());
|
||||
},
|
||||
|
||||
dispatchFetchLanguages(name, path) {
|
||||
dispatch(fetchLanguages());
|
||||
},
|
||||
|
||||
dispatchUpdateMovieFiles(updateProps) {
|
||||
dispatch(updateMovieFiles(updateProps));
|
||||
},
|
||||
|
||||
onDeletePress(movieFileId) {
|
||||
dispatch(deleteMovieFile(movieFileId));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
class MovieFileEditorTableContentConnector extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
|
||||
componentDidMount() {
|
||||
this.props.dispatchFetchLanguages();
|
||||
this.props.dispatchFetchQualityProfileSchema();
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onLanguageChange = (movieFileIds, languageId) => {
|
||||
const language = _.find(this.props.languages, { id: languageId });
|
||||
// TODO - Placeholder till we implement selection of multiple languages
|
||||
const languages = [language];
|
||||
this.props.dispatchUpdateMovieFiles({ movieFileIds, languages });
|
||||
}
|
||||
|
||||
onQualityChange = (movieFileIds, qualityId) => {
|
||||
const quality = {
|
||||
quality: _.find(this.props.qualities, { id: qualityId }),
|
||||
revision: {
|
||||
version: 1,
|
||||
real: 0
|
||||
}
|
||||
};
|
||||
|
||||
this.props.dispatchUpdateMovieFiles({ movieFileIds, quality });
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
dispatchFetchLanguages,
|
||||
dispatchFetchQualityProfileSchema,
|
||||
dispatchUpdateMovieFiles,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<MovieFileEditorTableContent
|
||||
{...otherProps}
|
||||
onLanguageChange={this.onLanguageChange}
|
||||
onQualityChange={this.onQualityChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
MovieFileEditorTableContentConnector.propTypes = {
|
||||
movieId: PropTypes.number.isRequired,
|
||||
languages: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
qualities: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
dispatchFetchLanguages: PropTypes.func.isRequired,
|
||||
dispatchFetchQualityProfileSchema: PropTypes.func.isRequired,
|
||||
dispatchUpdateMovieFiles: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, createMapDispatchToProps)(MovieFileEditorTableContentConnector);
|
||||
Reference in New Issue
Block a user