From c3a6e0104020b80f9598eeea183ae1dbede8b63e Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 23 Mar 2019 13:03:39 -0700 Subject: [PATCH] Fix file browser when files should be included --- frontend/src/Components/Form/PathInputConnector.js | 6 +++++- frontend/src/Components/Form/ProviderFieldFormGroup.js | 4 +++- frontend/src/Store/Actions/pathActions.js | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/frontend/src/Components/Form/PathInputConnector.js b/frontend/src/Components/Form/PathInputConnector.js index 4916daec8..add45f78f 100644 --- a/frontend/src/Components/Form/PathInputConnector.js +++ b/frontend/src/Components/Form/PathInputConnector.js @@ -38,7 +38,10 @@ class PathInputConnector extends Component { // Listeners onFetchPaths = (path) => { - this.props.fetchPaths({ path }); + this.props.fetchPaths({ + path, + includeFiles: this.props.includeFiles + }); } onClearPaths = () => { @@ -60,6 +63,7 @@ class PathInputConnector extends Component { } PathInputConnector.propTypes = { + includeFiles: PropTypes.bool.isRequired, fetchPaths: PropTypes.func.isRequired, clearPaths: PropTypes.func.isRequired }; diff --git a/frontend/src/Components/Form/ProviderFieldFormGroup.js b/frontend/src/Components/Form/ProviderFieldFormGroup.js index 98922dae4..84268806f 100644 --- a/frontend/src/Components/Form/ProviderFieldFormGroup.js +++ b/frontend/src/Components/Form/ProviderFieldFormGroup.js @@ -20,6 +20,8 @@ function getType(type) { return inputTypes.NUMBER; case 'path': return inputTypes.PATH; + case 'filepath': + return inputTypes.PATH; case 'select': return inputTypes.SELECT; case 'tag': @@ -84,7 +86,7 @@ function ProviderFieldFormGroup(props) { errors={errors} warnings={warnings} pending={pending} - hasFileBrowser={false} + includeFiles={type === 'filepath' ? true : undefined} onChange={onChange} {...otherProps} /> diff --git a/frontend/src/Store/Actions/pathActions.js b/frontend/src/Store/Actions/pathActions.js index 56b741867..139ab9e23 100644 --- a/frontend/src/Store/Actions/pathActions.js +++ b/frontend/src/Store/Actions/pathActions.js @@ -46,14 +46,16 @@ export const actionHandlers = handleThunks({ const { path, - allowFoldersWithoutTrailingSlashes = false + allowFoldersWithoutTrailingSlashes = false, + includeFiles = false } = payload; const promise = createAjaxRequest({ url: '/filesystem', data: { path, - allowFoldersWithoutTrailingSlashes + allowFoldersWithoutTrailingSlashes, + includeFiles } }).request;