mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-10 15:23:40 -07:00
New: Unmapped files view (#888)
* New: Unmapped files view Displays all trackfiles that haven't been matched to a track. Generalised the file details component and adds it to the album details screen. * Add sorting by quality * New: MediaServiceTests & MediaRepoTests
This commit is contained in:
parent
74cb2a6f52
commit
4413c7e46c
36 changed files with 1507 additions and 404 deletions
77
frontend/src/TrackFile/FileDetailsConnector.js
Normal file
77
frontend/src/TrackFile/FileDetailsConnector.js
Normal file
|
@ -0,0 +1,77 @@
|
|||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import getErrorMessage from 'Utilities/Object/getErrorMessage';
|
||||
import { fetchTrackFiles } from 'Store/Actions/trackFileActions';
|
||||
import FileDetails from './FileDetails';
|
||||
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state) => state.trackFiles,
|
||||
(trackFiles) => {
|
||||
return {
|
||||
...trackFiles
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
fetchTrackFiles
|
||||
};
|
||||
|
||||
class FileDetailsConnector extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchTrackFiles({ id: this.props.id });
|
||||
}
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
const {
|
||||
items,
|
||||
id,
|
||||
isFetching,
|
||||
error
|
||||
} = this.props;
|
||||
|
||||
const item = _.find(items, { id });
|
||||
const errorMessage = getErrorMessage(error, 'Unable to load manual import items');
|
||||
|
||||
if (isFetching || !item.audioTags) {
|
||||
return (
|
||||
<LoadingIndicator />
|
||||
);
|
||||
} else if (error) {
|
||||
return (
|
||||
<div>{errorMessage}</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<FileDetails
|
||||
audioTags={item.audioTags}
|
||||
filename={item.path}
|
||||
/>
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
FileDetailsConnector.propTypes = {
|
||||
fetchTrackFiles: PropTypes.func.isRequired,
|
||||
items: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
id: PropTypes.number.isRequired,
|
||||
isFetching: PropTypes.bool.isRequired,
|
||||
error: PropTypes.object
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(FileDetailsConnector);
|
Loading…
Add table
Add a link
Reference in a new issue