New: Add/remove individual albums

This commit is contained in:
ta264 2019-12-16 21:21:32 +00:00 committed by Qstick
parent 8da53ae6aa
commit 0bde5fd9e5
128 changed files with 2796 additions and 743 deletions

View file

@ -4,6 +4,7 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import sortByName from 'Utilities/Array/sortByName';
import { metadataProfileNames } from 'Helpers/Props';
import SelectInput from './SelectInput';
function createMapStateToProps() {
@ -11,14 +12,26 @@ function createMapStateToProps() {
(state) => state.settings.metadataProfiles,
(state, { includeNoChange }) => includeNoChange,
(state, { includeMixed }) => includeMixed,
(metadataProfiles, includeNoChange, includeMixed) => {
const values = _.map(metadataProfiles.items.sort(sortByName), (metadataProfile) => {
(state, { includeNone }) => includeNone,
(metadataProfiles, includeNoChange, includeMixed, includeNone) => {
const profiles = metadataProfiles.items.filter((item) => item.name !== metadataProfileNames.NONE);
const noneProfile = metadataProfiles.items.find((item) => item.name === metadataProfileNames.NONE);
const values = _.map(profiles.sort(sortByName), (metadataProfile) => {
return {
key: metadataProfile.id,
value: metadataProfile.name
};
});
if (includeNone) {
values.push({
key: noneProfile.id,
value: noneProfile.name
});
}
if (includeNoChange) {
values.unshift({
key: 'noChange',
@ -88,6 +101,7 @@ MetadataProfileSelectInputConnector.propTypes = {
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
values: PropTypes.arrayOf(PropTypes.object).isRequired,
includeNoChange: PropTypes.bool.isRequired,
includeNone: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired
};

View file

@ -209,7 +209,7 @@ class ArtistSearchInput extends Component {
}
suggestionGroups.push({
title: 'Add New Artist',
title: 'Add New Item',
suggestions: [
{
type: ADD_NEW_TYPE,

View file

@ -58,7 +58,7 @@ function createMapDispatchToProps(dispatch, props) {
},
onGoToAddNewArtist(query) {
dispatch(push(`${window.Lidarr.urlBase}/add/new?term=${encodeURIComponent(query)}`));
dispatch(push(`${window.Lidarr.urlBase}/add/search?term=${encodeURIComponent(query)}`));
}
};
}

View file

@ -26,7 +26,7 @@ const links = [
children: [
{
title: 'Add New',
to: '/add/new'
to: '/add/search'
},
{
title: 'Import',

View file

@ -176,12 +176,20 @@ class SignalRConnector extends Component {
}
handleAlbum = (body) => {
if (body.action === 'updated') {
const action = body.action;
const section = 'albums';
if (action === 'updated') {
this.props.dispatchUpdateItem({
section: 'albums',
section,
updateOnly: true,
...body.resource
});
} else if (action === 'deleted') {
this.props.dispatchRemoveItem({
section,
id: body.resource.id
});
}
}