Added: Allow folders without trailing slashes in file browser

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
Qstick 2018-08-10 20:46:34 -04:00
parent ef107fc63d
commit 36b2942cef
6 changed files with 83 additions and 55 deletions

View file

@ -143,22 +143,22 @@ class FileBrowserModalContent extends Component {
<TableBody>
{
emptyParent &&
<FileBrowserRow
type="computer"
name="My Computer"
path={parent}
onPress={this.onRowPress}
/>
<FileBrowserRow
type="computer"
name="My Computer"
path={parent}
onPress={this.onRowPress}
/>
}
{
!emptyParent && parent &&
<FileBrowserRow
type="parent"
name="..."
path={parent}
onPress={this.onRowPress}
/>
<FileBrowserRow
type="parent"
name="..."
path={parent}
onPress={this.onRowPress}
/>
}
{

View file

@ -48,14 +48,20 @@ class FileBrowserModalContentConnector extends Component {
// Lifecycle
componentDidMount() {
this.props.fetchPaths({ path: this.props.value });
this.props.fetchPaths({
path: this.props.value,
allowFoldersWithoutTrailingSlashes: true
});
}
//
// Listeners
onFetchPaths = (path) => {
this.props.fetchPaths({ path });
this.props.fetchPaths({
path,
allowFoldersWithoutTrailingSlashes: true
});
}
onClearPaths = () => {

View file

@ -44,15 +44,21 @@ export const actionHandlers = handleThunks({
[FETCH_PATHS]: function(getState, payload, dispatch) {
dispatch(set({ section, isFetching: true }));
const {
path,
allowFoldersWithoutTrailingSlashes = false
} = payload;
const promise = $.ajax({
url: '/filesystem',
data: {
path: payload.path
path,
allowFoldersWithoutTrailingSlashes
}
});
promise.done((data) => {
dispatch(updatePaths({ path: payload.path, ...data }));
dispatch(updatePaths({ path, ...data }));
dispatch(set({
section,