mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Command line arguments for Custom Scripts are no longer supported
This commit is contained in:
parent
b8b8f064c7
commit
b9d240924f
15 changed files with 170 additions and 126 deletions
|
@ -2,13 +2,13 @@ import PropTypes from 'prop-types';
|
|||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { fetchDevices, clearDevices } from 'Store/Actions/deviceActions';
|
||||
import { fetchOptions, clearOptions } from 'Store/Actions/providerOptionActions';
|
||||
import DeviceInput from './DeviceInput';
|
||||
|
||||
function createMapStateToProps() {
|
||||
return createSelector(
|
||||
(state, { value }) => value,
|
||||
(state) => state.devices,
|
||||
(state) => state.providerOptions,
|
||||
(value, devices) => {
|
||||
|
||||
return {
|
||||
|
@ -37,8 +37,8 @@ function createMapStateToProps() {
|
|||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
dispatchFetchDevices: fetchDevices,
|
||||
dispatchClearDevices: clearDevices
|
||||
dispatchFetchOptions: fetchOptions,
|
||||
dispatchClearOptions: clearOptions
|
||||
};
|
||||
|
||||
class DeviceInputConnector extends Component {
|
||||
|
@ -51,7 +51,7 @@ class DeviceInputConnector extends Component {
|
|||
}
|
||||
|
||||
componentWillUnmount = () => {
|
||||
// this.props.dispatchClearDevices();
|
||||
this.props.dispatchClearOptions();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -61,10 +61,14 @@ class DeviceInputConnector extends Component {
|
|||
const {
|
||||
provider,
|
||||
providerData,
|
||||
dispatchFetchDevices
|
||||
dispatchFetchOptions
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchDevices({ provider, providerData });
|
||||
dispatchFetchOptions({
|
||||
action: 'getDevices',
|
||||
provider,
|
||||
providerData
|
||||
});
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -92,8 +96,8 @@ DeviceInputConnector.propTypes = {
|
|||
providerData: PropTypes.object.isRequired,
|
||||
name: PropTypes.string.isRequired,
|
||||
onChange: PropTypes.func.isRequired,
|
||||
dispatchFetchDevices: PropTypes.func.isRequired,
|
||||
dispatchClearDevices: PropTypes.func.isRequired
|
||||
dispatchFetchOptions: PropTypes.func.isRequired,
|
||||
dispatchClearOptions: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(DeviceInputConnector);
|
||||
|
|
|
@ -20,7 +20,7 @@ function getType(type) {
|
|||
return inputTypes.NUMBER;
|
||||
case 'path':
|
||||
return inputTypes.PATH;
|
||||
case 'filepath':
|
||||
case 'filePath':
|
||||
return inputTypes.PATH;
|
||||
case 'select':
|
||||
return inputTypes.SELECT;
|
||||
|
@ -60,6 +60,7 @@ function ProviderFieldFormGroup(props) {
|
|||
value,
|
||||
type,
|
||||
advanced,
|
||||
hidden,
|
||||
pending,
|
||||
errors,
|
||||
warnings,
|
||||
|
@ -68,6 +69,13 @@ function ProviderFieldFormGroup(props) {
|
|||
...otherProps
|
||||
} = props;
|
||||
|
||||
if (
|
||||
hidden === 'hidden' ||
|
||||
(hidden === 'hiddenIfNotSet' && !value)
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
advancedSettings={advancedSettings}
|
||||
|
@ -86,7 +94,7 @@ function ProviderFieldFormGroup(props) {
|
|||
errors={errors}
|
||||
warnings={warnings}
|
||||
pending={pending}
|
||||
includeFiles={type === 'filepath' ? true : undefined}
|
||||
includeFiles={type === 'filePath' ? true : undefined}
|
||||
onChange={onChange}
|
||||
{...otherProps}
|
||||
/>
|
||||
|
@ -108,6 +116,7 @@ ProviderFieldFormGroup.propTypes = {
|
|||
value: PropTypes.any,
|
||||
type: PropTypes.string.isRequired,
|
||||
advanced: PropTypes.bool.isRequired,
|
||||
hidden: PropTypes.string,
|
||||
pending: PropTypes.bool.isRequired,
|
||||
errors: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
warnings: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import * as addArtist from './addArtistActions';
|
||||
import * as app from './appActions';
|
||||
import * as blacklist from './blacklistActions';
|
||||
import * as calendar from './calendarActions';
|
||||
import * as captcha from './captchaActions';
|
||||
import * as customFilters from './customFilterActions';
|
||||
import * as devices from './deviceActions';
|
||||
import * as calendar from './calendarActions';
|
||||
import * as commands from './commandActions';
|
||||
import * as albums from './albumActions';
|
||||
import * as trackFiles from './trackFileActions';
|
||||
|
@ -16,6 +15,7 @@ import * as oAuth from './oAuthActions';
|
|||
import * as organizePreview from './organizePreviewActions';
|
||||
import * as retagPreview from './retagPreviewActions';
|
||||
import * as paths from './pathActions';
|
||||
import * as providerOptions from './providerOptionActions';
|
||||
import * as queue from './queueActions';
|
||||
import * as releases from './releaseActions';
|
||||
import * as rootFolders from './rootFolderActions';
|
||||
|
@ -38,7 +38,6 @@ export default [
|
|||
calendar,
|
||||
commands,
|
||||
customFilters,
|
||||
devices,
|
||||
albums,
|
||||
trackFiles,
|
||||
albumHistory,
|
||||
|
@ -49,6 +48,7 @@ export default [
|
|||
organizePreview,
|
||||
retagPreview,
|
||||
paths,
|
||||
providerOptions,
|
||||
queue,
|
||||
releases,
|
||||
rootFolders,
|
||||
|
|
|
@ -8,7 +8,7 @@ import { set } from './baseActions';
|
|||
//
|
||||
// Variables
|
||||
|
||||
export const section = 'devices';
|
||||
export const section = 'providerOptions';
|
||||
|
||||
//
|
||||
// State
|
||||
|
@ -23,32 +23,27 @@ export const defaultState = {
|
|||
//
|
||||
// Actions Types
|
||||
|
||||
export const FETCH_DEVICES = 'devices/fetchDevices';
|
||||
export const CLEAR_DEVICES = 'devices/clearDevices';
|
||||
export const FETCH_OPTIONS = 'devices/fetchOptions';
|
||||
export const CLEAR_OPTIONS = 'devices/clearOptions';
|
||||
|
||||
//
|
||||
// Action Creators
|
||||
|
||||
export const fetchDevices = createThunk(FETCH_DEVICES);
|
||||
export const clearDevices = createAction(CLEAR_DEVICES);
|
||||
export const fetchOptions = createThunk(FETCH_OPTIONS);
|
||||
export const clearOptions = createAction(CLEAR_OPTIONS);
|
||||
|
||||
//
|
||||
// Action Handlers
|
||||
|
||||
export const actionHandlers = handleThunks({
|
||||
|
||||
[FETCH_DEVICES]: function(getState, payload, dispatch) {
|
||||
const actionPayload = {
|
||||
action: 'getDevices',
|
||||
...payload
|
||||
};
|
||||
|
||||
[FETCH_OPTIONS]: function(getState, payload, dispatch) {
|
||||
dispatch(set({
|
||||
section,
|
||||
isFetching: true
|
||||
}));
|
||||
|
||||
const promise = requestAction(actionPayload);
|
||||
const promise = requestAction(payload);
|
||||
|
||||
promise.done((data) => {
|
||||
dispatch(set({
|
||||
|
@ -56,7 +51,7 @@ export const actionHandlers = handleThunks({
|
|||
isFetching: false,
|
||||
isPopulated: true,
|
||||
error: null,
|
||||
items: data.devices || []
|
||||
items: data.options || []
|
||||
}));
|
||||
});
|
||||
|
||||
|
@ -76,7 +71,7 @@ export const actionHandlers = handleThunks({
|
|||
|
||||
export const reducers = createHandleActions({
|
||||
|
||||
[CLEAR_DEVICES]: function(state) {
|
||||
[CLEAR_OPTIONS]: function(state) {
|
||||
return updateSectionState(state, section, defaultState);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue