Merge pull request #14 from Kareadita/feature/directories
Directory Picker
This commit is contained in:
commit
c84c56864e
1 changed files with 7 additions and 2 deletions
|
|
@ -59,18 +59,23 @@ export class DirectoryPickerComponent implements OnInit {
|
||||||
selectNode(folderName: string) {
|
selectNode(folderName: string) {
|
||||||
this.currentRoot = folderName;
|
this.currentRoot = folderName;
|
||||||
this.routeStack.push(folderName);
|
this.routeStack.push(folderName);
|
||||||
this.loadChildren(folderName);
|
const fullPath = this.routeStack.items.join('\\').replace('\\\\', '\\');
|
||||||
|
this.loadChildren(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
this.routeStack.pop();
|
this.routeStack.pop();
|
||||||
this.currentRoot = this.routeStack.peek();
|
this.currentRoot = this.routeStack.peek();
|
||||||
this.loadChildren(this.currentRoot);
|
const fullPath = this.routeStack.items.join('\\').replace('\\\\', '\\');
|
||||||
|
this.loadChildren(fullPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadChildren(path: string) {
|
loadChildren(path: string) {
|
||||||
this.libraryService.listDirectories(path).subscribe(folders => {
|
this.libraryService.listDirectories(path).subscribe(folders => {
|
||||||
this.folders = folders;
|
this.folders = folders;
|
||||||
|
}, err => {
|
||||||
|
// If there was an error, pop off last directory added to stack
|
||||||
|
this.routeStack.pop();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue