New: Allow Radarr List Sync by Source Tag

Fixes #4826
This commit is contained in:
Qstick
2020-08-18 23:21:44 -04:00
parent 5a1b82e195
commit 56184905a9
10 changed files with 79 additions and 19 deletions

View File

@@ -8,16 +8,28 @@ import DeviceInput from './DeviceInput';
function createMapStateToProps() {
return createSelector(
(state, { value }) => value,
(state, { name }) => name,
(state) => state.providerOptions,
(value, devices) => {
(value, name, devices) => {
const {
isFetching,
isPopulated,
error,
items
} = devices;
return {
...devices,
isFetching,
isPopulated,
error,
items: items[name] || [],
selectedDevices: value.map((valueDevice) => {
const sectionItems = items[name] || [];
// Disable equality ESLint rule so we don't need to worry about
// a type mismatch between the value items and the device ID.
// eslint-disable-next-line eqeqeq
const device = devices.items.find((d) => d.id == valueDevice);
const device = sectionItems.find((d) => d.id == valueDevice);
if (device) {
return {
@@ -61,11 +73,14 @@ class DeviceInputConnector extends Component {
const {
provider,
providerData,
dispatchFetchOptions
dispatchFetchOptions,
requestAction,
name
} = this.props;
dispatchFetchOptions({
action: 'getDevices',
action: requestAction,
itemSection: name,
provider,
providerData
});
@@ -94,6 +109,7 @@ class DeviceInputConnector extends Component {
DeviceInputConnector.propTypes = {
provider: PropTypes.string.isRequired,
providerData: PropTypes.object.isRequired,
requestAction: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
dispatchFetchOptions: PropTypes.func.isRequired,

View File

@@ -62,6 +62,7 @@ function ProviderFieldFormGroup(props) {
value,
type,
advanced,
requestAction,
hidden,
pending,
errors,
@@ -98,6 +99,7 @@ function ProviderFieldFormGroup(props) {
pending={pending}
includeFiles={type === 'filePath' ? true : undefined}
onChange={onChange}
requestAction={requestAction}
{...otherProps}
/>
</FormGroup>
@@ -118,6 +120,7 @@ ProviderFieldFormGroup.propTypes = {
value: PropTypes.any,
type: PropTypes.string.isRequired,
advanced: PropTypes.bool.isRequired,
requestAction: PropTypes.string,
hidden: PropTypes.string,
pending: PropTypes.bool.isRequired,
errors: PropTypes.arrayOf(PropTypes.object).isRequired,