More file browsing improvements
This commit is contained in:
parent
5b2d0a2ade
commit
a63ca0f0e9
|
@ -42,8 +42,8 @@ function createMapStateToProps() {
|
|||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
fetchPaths,
|
||||
clearPaths
|
||||
dispatchFetchPaths: fetchPaths,
|
||||
dispatchClearPaths: clearPaths
|
||||
};
|
||||
|
||||
class FileBrowserModalContentConnector extends Component {
|
||||
|
@ -51,9 +51,16 @@ class FileBrowserModalContentConnector extends Component {
|
|||
// Lifecycle
|
||||
|
||||
componentDidMount() {
|
||||
this.props.fetchPaths({
|
||||
path: this.props.value,
|
||||
allowFoldersWithoutTrailingSlashes: true
|
||||
const {
|
||||
value,
|
||||
includeFiles,
|
||||
dispatchFetchPaths
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchPaths({
|
||||
path: value,
|
||||
allowFoldersWithoutTrailingSlashes: true,
|
||||
includeFiles
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,18 +68,24 @@ class FileBrowserModalContentConnector extends Component {
|
|||
// Listeners
|
||||
|
||||
onFetchPaths = (path) => {
|
||||
this.props.fetchPaths({
|
||||
const {
|
||||
includeFiles,
|
||||
dispatchFetchPaths
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchPaths({
|
||||
path,
|
||||
allowFoldersWithoutTrailingSlashes: true
|
||||
allowFoldersWithoutTrailingSlashes: true,
|
||||
includeFiles
|
||||
});
|
||||
}
|
||||
|
||||
onClearPaths = () => {
|
||||
// this.props.clearPaths();
|
||||
// this.props.dispatchClearPaths();
|
||||
}
|
||||
|
||||
onModalClose = () => {
|
||||
this.props.clearPaths();
|
||||
this.props.dispatchClearPaths();
|
||||
this.props.onModalClose();
|
||||
}
|
||||
|
||||
|
@ -93,9 +106,14 @@ class FileBrowserModalContentConnector extends Component {
|
|||
|
||||
FileBrowserModalContentConnector.propTypes = {
|
||||
value: PropTypes.string,
|
||||
fetchPaths: PropTypes.func.isRequired,
|
||||
clearPaths: PropTypes.func.isRequired,
|
||||
includeFiles: PropTypes.bool.isRequired,
|
||||
dispatchFetchPaths: PropTypes.func.isRequired,
|
||||
dispatchClearPaths: PropTypes.func.isRequired,
|
||||
onModalClose: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
FileBrowserModalContentConnector.defaultProps = {
|
||||
includeFiles: false
|
||||
};
|
||||
|
||||
export default connect(createMapStateToProps, mapDispatchToProps)(FileBrowserModalContentConnector);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -28,8 +28,8 @@ function createMapStateToProps() {
|
|||
}
|
||||
|
||||
const mapDispatchToProps = {
|
||||
fetchPaths,
|
||||
clearPaths
|
||||
dispatchFetchPaths: fetchPaths,
|
||||
dispatchClearPaths: clearPaths
|
||||
};
|
||||
|
||||
class PathInputConnector extends Component {
|
||||
|
@ -38,14 +38,19 @@ class PathInputConnector extends Component {
|
|||
// Listeners
|
||||
|
||||
onFetchPaths = (path) => {
|
||||
this.props.fetchPaths({
|
||||
const {
|
||||
includeFiles,
|
||||
dispatchFetchPaths
|
||||
} = this.props;
|
||||
|
||||
dispatchFetchPaths({
|
||||
path,
|
||||
includeFiles: this.props.includeFiles
|
||||
includeFiles
|
||||
});
|
||||
}
|
||||
|
||||
onClearPaths = () => {
|
||||
this.props.clearPaths();
|
||||
this.props.dispatchClearPaths();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -64,8 +69,8 @@ class PathInputConnector extends Component {
|
|||
|
||||
PathInputConnector.propTypes = {
|
||||
includeFiles: PropTypes.bool.isRequired,
|
||||
fetchPaths: PropTypes.func.isRequired,
|
||||
clearPaths: PropTypes.func.isRequired
|
||||
dispatchFetchPaths: PropTypes.func.isRequired,
|
||||
dispatchClearPaths: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
PathInputConnector.defaultProps = {
|
||||
|
|
Loading…
Reference in New Issue