mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
Fixed: IncludeFiles if File Selection Modal
This commit is contained in:
parent
3cd58d5866
commit
789ce8a58f
5 changed files with 58 additions and 20 deletions
|
@ -42,8 +42,8 @@ function createMapStateToProps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
fetchPaths,
|
dispatchFetchPaths: fetchPaths,
|
||||||
clearPaths
|
dispatchClearPaths: clearPaths
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileBrowserModalContentConnector extends Component {
|
class FileBrowserModalContentConnector extends Component {
|
||||||
|
@ -51,9 +51,16 @@ class FileBrowserModalContentConnector extends Component {
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchPaths({
|
const {
|
||||||
path: this.props.value,
|
value,
|
||||||
allowFoldersWithoutTrailingSlashes: true
|
includeFiles,
|
||||||
|
dispatchFetchPaths
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
dispatchFetchPaths({
|
||||||
|
path: value,
|
||||||
|
allowFoldersWithoutTrailingSlashes: true,
|
||||||
|
includeFiles
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,18 +68,24 @@ class FileBrowserModalContentConnector extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onFetchPaths = (path) => {
|
onFetchPaths = (path) => {
|
||||||
this.props.fetchPaths({
|
const {
|
||||||
|
includeFiles,
|
||||||
|
dispatchFetchPaths
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
dispatchFetchPaths({
|
||||||
path,
|
path,
|
||||||
allowFoldersWithoutTrailingSlashes: true
|
allowFoldersWithoutTrailingSlashes: true,
|
||||||
|
includeFiles
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onClearPaths = () => {
|
onClearPaths = () => {
|
||||||
// this.props.clearPaths();
|
// this.props.dispatchClearPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
onModalClose = () => {
|
onModalClose = () => {
|
||||||
this.props.clearPaths();
|
this.props.dispatchClearPaths();
|
||||||
this.props.onModalClose();
|
this.props.onModalClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,9 +106,14 @@ class FileBrowserModalContentConnector extends Component {
|
||||||
|
|
||||||
FileBrowserModalContentConnector.propTypes = {
|
FileBrowserModalContentConnector.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
fetchPaths: PropTypes.func.isRequired,
|
includeFiles: PropTypes.bool.isRequired,
|
||||||
clearPaths: PropTypes.func.isRequired,
|
dispatchFetchPaths: PropTypes.func.isRequired,
|
||||||
|
dispatchClearPaths: PropTypes.func.isRequired,
|
||||||
onModalClose: PropTypes.func.isRequired
|
onModalClose: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FileBrowserModalContentConnector.defaultProps = {
|
||||||
|
includeFiles: false
|
||||||
|
};
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(FileBrowserModalContentConnector);
|
export default connect(createMapStateToProps, mapDispatchToProps)(FileBrowserModalContentConnector);
|
||||||
|
|
|
@ -111,6 +111,7 @@ class PathInput extends Component {
|
||||||
value,
|
value,
|
||||||
placeholder,
|
placeholder,
|
||||||
paths,
|
paths,
|
||||||
|
includeFiles,
|
||||||
hasError,
|
hasError,
|
||||||
hasWarning,
|
hasWarning,
|
||||||
hasFileBrowser,
|
hasFileBrowser,
|
||||||
|
@ -171,6 +172,7 @@ class PathInput extends Component {
|
||||||
isOpen={this.state.isFileBrowserModalOpen}
|
isOpen={this.state.isFileBrowserModalOpen}
|
||||||
name={name}
|
name={name}
|
||||||
value={value}
|
value={value}
|
||||||
|
includeFiles={includeFiles}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onModalClose={this.onFileBrowserModalClose}
|
onModalClose={this.onFileBrowserModalClose}
|
||||||
/>
|
/>
|
||||||
|
@ -188,6 +190,7 @@ PathInput.propTypes = {
|
||||||
value: PropTypes.string,
|
value: PropTypes.string,
|
||||||
placeholder: PropTypes.string,
|
placeholder: PropTypes.string,
|
||||||
paths: PropTypes.array.isRequired,
|
paths: PropTypes.array.isRequired,
|
||||||
|
includeFiles: PropTypes.bool.isRequired,
|
||||||
hasError: PropTypes.bool,
|
hasError: PropTypes.bool,
|
||||||
hasWarning: PropTypes.bool,
|
hasWarning: PropTypes.bool,
|
||||||
hasFileBrowser: PropTypes.bool,
|
hasFileBrowser: PropTypes.bool,
|
||||||
|
|
|
@ -28,8 +28,8 @@ function createMapStateToProps() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = {
|
const mapDispatchToProps = {
|
||||||
fetchPaths,
|
dispatchFetchPaths: fetchPaths,
|
||||||
clearPaths
|
dispatchClearPaths: clearPaths
|
||||||
};
|
};
|
||||||
|
|
||||||
class PathInputConnector extends Component {
|
class PathInputConnector extends Component {
|
||||||
|
@ -38,11 +38,19 @@ class PathInputConnector extends Component {
|
||||||
// Listeners
|
// Listeners
|
||||||
|
|
||||||
onFetchPaths = (path) => {
|
onFetchPaths = (path) => {
|
||||||
this.props.fetchPaths({ path });
|
const {
|
||||||
|
includeFiles,
|
||||||
|
dispatchFetchPaths
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
|
dispatchFetchPaths({
|
||||||
|
path,
|
||||||
|
includeFiles
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onClearPaths = () => {
|
onClearPaths = () => {
|
||||||
this.props.clearPaths();
|
this.props.dispatchClearPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -60,8 +68,13 @@ class PathInputConnector extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
PathInputConnector.propTypes = {
|
PathInputConnector.propTypes = {
|
||||||
fetchPaths: PropTypes.func.isRequired,
|
includeFiles: PropTypes.bool.isRequired,
|
||||||
clearPaths: PropTypes.func.isRequired
|
dispatchFetchPaths: PropTypes.func.isRequired,
|
||||||
|
dispatchClearPaths: PropTypes.func.isRequired
|
||||||
|
};
|
||||||
|
|
||||||
|
PathInputConnector.defaultProps = {
|
||||||
|
includeFiles: false
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(createMapStateToProps, mapDispatchToProps)(PathInputConnector);
|
export default connect(createMapStateToProps, mapDispatchToProps)(PathInputConnector);
|
||||||
|
|
|
@ -20,6 +20,8 @@ function getType(type) {
|
||||||
return inputTypes.NUMBER;
|
return inputTypes.NUMBER;
|
||||||
case 'path':
|
case 'path':
|
||||||
return inputTypes.PATH;
|
return inputTypes.PATH;
|
||||||
|
case 'filepath':
|
||||||
|
return inputTypes.PATH;
|
||||||
case 'select':
|
case 'select':
|
||||||
return inputTypes.SELECT;
|
return inputTypes.SELECT;
|
||||||
case 'tag':
|
case 'tag':
|
||||||
|
@ -84,7 +86,7 @@ function ProviderFieldFormGroup(props) {
|
||||||
errors={errors}
|
errors={errors}
|
||||||
warnings={warnings}
|
warnings={warnings}
|
||||||
pending={pending}
|
pending={pending}
|
||||||
hasFileBrowser={false}
|
includeFiles={type === 'filepath' ? true : undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -46,14 +46,16 @@ export const actionHandlers = handleThunks({
|
||||||
|
|
||||||
const {
|
const {
|
||||||
path,
|
path,
|
||||||
allowFoldersWithoutTrailingSlashes = false
|
allowFoldersWithoutTrailingSlashes = false,
|
||||||
|
includeFiles = false
|
||||||
} = payload;
|
} = payload;
|
||||||
|
|
||||||
const promise = createAjaxRequest({
|
const promise = createAjaxRequest({
|
||||||
url: '/filesystem',
|
url: '/filesystem',
|
||||||
data: {
|
data: {
|
||||||
path,
|
path,
|
||||||
allowFoldersWithoutTrailingSlashes
|
allowFoldersWithoutTrailingSlashes,
|
||||||
|
includeFiles
|
||||||
}
|
}
|
||||||
}).request;
|
}).request;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue