Skip to content

Commit dbcc74d

Browse files
committed
setFolder after delete
1 parent 493488c commit dbcc74d

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ qx.Class.define("osparc.file.FilesTree", {
181181
newChildren[0].children[0].children.length) { // node
182182
const nodeData = newChildren[0].children[0].children[0];
183183
const nodeTreeName = nodeData.label;
184-
this.__resetTree(nodeTreeName);
184+
this.__resetTree(nodeTreeName, nodeId);
185185
const rootNodeModel = this.getModel();
186186
if (nodeData.children.length) {
187187
const nodeItemsOnly = nodeData.children;
@@ -253,12 +253,12 @@ qx.Class.define("osparc.file.FilesTree", {
253253
}
254254
},
255255

256-
__resetTree: function(treeName) {
257-
// FIXME: It is not resetting the model
256+
__resetTree: function(treeName, itemId) {
257+
itemId = itemId || treeName.replace(/\s/g, ""); // default to tree name without white spaces
258258
this.resetModel();
259259
const rootData = {
260260
label: treeName,
261-
itemId: treeName.replace(/\s/g, ""), // remove all white spaces
261+
itemId,
262262
location: null,
263263
path: null,
264264
pathLabel: [treeName],

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,14 @@ qx.Class.define("osparc.file.TreeFolderView", {
119119
let found = false;
120120
while (!found && path.length) {
121121
found = foldersTree.findItemId(path.join("/"));
122-
if (found) {
123-
foldersTree.openNodeAndParents(found);
124-
foldersTree.setSelection(new qx.data.Array([found]));
125-
foldersTree.fireEvent("selectionChanged");
126-
}
127122
// look for next parent
128123
path.pop();
129124
}
130-
if (!found) {
125+
if (found) {
126+
foldersTree.openNodeAndParents(found);
127+
foldersTree.setSelection(new qx.data.Array([found]));
128+
foldersTree.fireEvent("selectionChanged");
129+
} else {
131130
folderViewer.resetFolder();
132131
}
133132
}

services/static-webserver/client/source/class/osparc/widget/NodeDataManager.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ qx.Class.define("osparc.widget.NodeDataManager", {
125125
foldersTree.resetCache();
126126

127127
const openSameFolder = () => {
128+
if (!this.getStudyId()) {
129+
// drop first, which is the study id
130+
path.shift();
131+
}
128132
// drop last, which is the file
129133
path.pop();
130134
treeFolderView.openPath(path);

0 commit comments

Comments
 (0)