Fixed: IncludeFiles if File Selection Modal

This commit is contained in:
Qstick 2019-04-05 22:51:32 -04:00
parent 3cd58d5866
commit 789ce8a58f
5 changed files with 58 additions and 20 deletions

View file

@ -111,6 +111,7 @@ class PathInput extends Component {
value,
placeholder,
paths,
includeFiles,
hasError,
hasWarning,
hasFileBrowser,
@ -171,6 +172,7 @@ class PathInput extends Component {
isOpen={this.state.isFileBrowserModalOpen}
name={name}
value={value}
includeFiles={includeFiles}
onChange={onChange}
onModalClose={this.onFileBrowserModalClose}
/>
@ -188,6 +190,7 @@ PathInput.propTypes = {
value: PropTypes.string,
placeholder: PropTypes.string,
paths: PropTypes.array.isRequired,
includeFiles: PropTypes.bool.isRequired,
hasError: PropTypes.bool,
hasWarning: PropTypes.bool,
hasFileBrowser: PropTypes.bool,

View file

@ -28,8 +28,8 @@ function createMapStateToProps() {
}
const mapDispatchToProps = {
fetchPaths,
clearPaths
dispatchFetchPaths: fetchPaths,
dispatchClearPaths: clearPaths
};
class PathInputConnector extends Component {
@ -38,11 +38,19 @@ class PathInputConnector extends Component {
// Listeners
onFetchPaths = (path) => {
this.props.fetchPaths({ path });
const {
includeFiles,
dispatchFetchPaths
} = this.props;
dispatchFetchPaths({
path,
includeFiles
});
}
onClearPaths = () => {
this.props.clearPaths();
this.props.dispatchClearPaths();
}
//
@ -60,8 +68,13 @@ class PathInputConnector extends Component {
}
PathInputConnector.propTypes = {
fetchPaths: PropTypes.func.isRequired,
clearPaths: PropTypes.func.isRequired
includeFiles: PropTypes.bool.isRequired,
dispatchFetchPaths: PropTypes.func.isRequired,
dispatchClearPaths: PropTypes.func.isRequired
};
PathInputConnector.defaultProps = {
includeFiles: false
};
export default connect(createMapStateToProps, mapDispatchToProps)(PathInputConnector);

View file

@ -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}
/>