Merge branch '1.3.x_branch' of bitbucket.org:blockstorage/repertory-ui into 1.3.x_branch
This commit is contained in:
@@ -34,7 +34,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
|
|||||||
state = {
|
state = {
|
||||||
active_directory: '/',
|
active_directory: '/',
|
||||||
items: [],
|
items: [],
|
||||||
previous_directory: '',
|
previous: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -89,11 +89,16 @@ export default connect(mapStateToProps, mapDispatchToProps)(class extends IPCCon
|
|||||||
<div key={'dir_' + idx} style={{...style}}>
|
<div key={'dir_' + idx} style={{...style}}>
|
||||||
<Button buttonStyles={{textAlign: 'left'}}
|
<Button buttonStyles={{textAlign: 'left'}}
|
||||||
clicked={() => {
|
clicked={() => {
|
||||||
const current_path = path === '..' ? '' : this.state.active_directory;
|
const previous = [...this.state.previous];
|
||||||
|
if (path === '..') {
|
||||||
|
path = previous.pop();
|
||||||
|
} else {
|
||||||
|
previous.push(this.state.active_directory);
|
||||||
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
items: [],
|
items: [],
|
||||||
active_directory: path === '..' ? this.state.previous_directory : path,
|
active_directory: path,
|
||||||
previous_directory: current_path,
|
previous,
|
||||||
}, () => {
|
}, () => {
|
||||||
this.grabDirectoryItems();
|
this.grabDirectoryItems();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,10 +3,15 @@ const fs = require('fs');
|
|||||||
const helpers = require('../../helpers');
|
const helpers = require('../../helpers');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
const getDirectories = source =>
|
const getDirectories = source => {
|
||||||
fs.readdirSync(source, {withFileTypes: true})
|
try {
|
||||||
.filter(dirent => dirent.isDirectory())
|
return fs.readdirSync(source, {withFileTypes: true})
|
||||||
.map(dirent => dirent.name)
|
.filter(dirent => dirent.isDirectory())
|
||||||
|
.map(dirent => dirent.name);
|
||||||
|
} catch {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const addListeners = ipcMain => {
|
const addListeners = ipcMain => {
|
||||||
ipcMain.on(Constants.IPC_Get_State, event => {
|
ipcMain.on(Constants.IPC_Get_State, event => {
|
||||||
|
|||||||
Reference in New Issue
Block a user