Skip to content

Commit fe0949b

Browse files
committed
openPath
1 parent b7c211a commit fe0949b

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

services/static-webserver/client/source/class/osparc/file/TreeFolderView.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,36 @@ qx.Class.define("osparc.file.TreeFolderView", {
139139
}, this);
140140
},
141141

142-
openPath: function(path) {
142+
openPath: async function(pathParts) {
143+
console.log("openPath", pathParts);
143144
const foldersTree = this.getChildControl("folder-tree");
144145
const folderViewer = this.getChildControl("folder-viewer");
146+
147+
const locationId = 0;
145148
let found = false;
146-
while (!found && path.length) {
147-
found = foldersTree.findItemId(path.join("/"));
149+
for (let i=1; i<=pathParts.length; i++) {
150+
try {
151+
let path = pathParts.slice(0, i);
152+
path = path.join("/");
153+
console.log("recursive load", path);
154+
found = await foldersTree.requestPathItems(locationId, path);
155+
foldersTree.openNodeAndParents(found);
156+
console.log("found", found);
157+
} catch (err) {
158+
console.error(err);
159+
}
160+
}
161+
if (found) {
162+
foldersTree.setSelection(new qx.data.Array([found]));
163+
foldersTree.fireEvent("selectionChanged");
164+
} else {
165+
folderViewer.resetFolder();
166+
}
167+
/*
168+
while (!found && pathParts.length) {
169+
found = foldersTree.findItemId(pathParts.join("/"));
148170
// look for next parent
149-
path.pop();
171+
pathParts.pop();
150172
}
151173
if (found) {
152174
foldersTree.openNodeAndParents(found);
@@ -155,6 +177,7 @@ qx.Class.define("osparc.file.TreeFolderView", {
155177
} else {
156178
folderViewer.resetFolder();
157179
}
180+
*/
158181
},
159182

160183
requestSize: function(pathId) {

0 commit comments

Comments
 (0)