Skip to content

Commit eff2cb0

Browse files
committed
more cleanup
1 parent eb89050 commit eff2cb0

File tree

4 files changed

+2
-89
lines changed

4 files changed

+2
-89
lines changed

services/static-webserver/client/source/class/osparc/dashboard/DataBrowser.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ qx.Class.define("osparc.dashboard.DataBrowser", {
7676
reloadButton.addListener("execute", () => this.__reloadTree(), this);
7777

7878
const selectedFileLayout = treeFolderView.getChildControl("folder-viewer").getChildControl("selected-file-layout");
79-
selectedFileLayout.addListener("fileDeleted", e => this.__fileDeleted(e.getData()), this);
79+
selectedFileLayout.addListener("pathsDeleted", e => treeFolderView.pathsDeleted(e.getData()), this);
8080
},
8181

8282
__reloadTree: function() {
@@ -89,34 +89,5 @@ qx.Class.define("osparc.dashboard.DataBrowser", {
8989
const folderViewer = treeFolderView.getChildControl("folder-viewer");
9090
folderViewer.resetFolder();
9191
},
92-
93-
__fileDeleted: function(fileMetadata) {
94-
// After deleting a file, try to keep the user in the same folder.
95-
// If the folder doesn't longer exist, open the closest available parent
96-
97-
const pathParts = ("getPath" in fileMetadata ? fileMetadata.getPath() : fileMetadata["fileUuid"]).split("/");
98-
99-
const treeFolderView = this.getChildControl("tree-folder-view");
100-
const foldersTree = treeFolderView.getChildControl("folder-tree");
101-
const folderViewer = treeFolderView.getChildControl("folder-viewer");
102-
103-
const openSameFolder = () => {
104-
// drop last, which is the file
105-
pathParts.pop();
106-
treeFolderView.openPath(pathParts);
107-
};
108-
109-
folderViewer.resetFolder();
110-
const locationId = fileMetadata["locationId"];
111-
const path = pathParts[0];
112-
foldersTree.resetCache();
113-
foldersTree.populateLocations()
114-
.then(datasetPromises => {
115-
Promise.all(datasetPromises)
116-
.then(() => foldersTree.requestPathItems(locationId, path))
117-
.then(() => openSameFolder());
118-
})
119-
.catch(err => console.error(err));
120-
}
12192
}
12293
});

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* It is used together with a virtual tree of files where the selection is displayed
2222
* in the text field and the download and delete are related to that selection.
2323
* Download and deleted methods are also provided.
24-
* If a file is deleted it fires "fileDeleted" data event
24+
* If a file is deleted it fires "pathsDeleted" data event
2525
*
2626
* *Example*
2727
*
@@ -54,7 +54,6 @@ qx.Class.define("osparc.file.FileLabelWithActions", {
5454
},
5555

5656
events: {
57-
"fileDeleted": "qx.event.type.Data",
5857
"pathsDeleted": "qx.event.type.Data",
5958
},
6059

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -150,31 +150,6 @@ qx.Class.define("osparc.file.TreeFolderView", {
150150
});
151151
},
152152

153-
openPath: async function(pathParts) {
154-
console.log("openPath", pathParts);
155-
const foldersTree = this.getChildControl("folder-tree");
156-
const folderViewer = this.getChildControl("folder-viewer");
157-
158-
const locationId = 0;
159-
let found = false;
160-
for (let i=1; i<=pathParts.length; i++) {
161-
try {
162-
let path = pathParts.slice(0, i);
163-
path = path.join("/");
164-
found = await foldersTree.requestPathItems(locationId, path);
165-
} catch (err) {
166-
console.error(err);
167-
}
168-
}
169-
if (found) {
170-
foldersTree.openNodeAndParents(found);
171-
foldersTree.setSelection(new qx.data.Array([found]));
172-
foldersTree.fireEvent("selectionChanged");
173-
} else {
174-
folderViewer.resetFolder();
175-
}
176-
},
177-
178153
requestSize: function(pathId) {
179154
const totalSize = this.getChildControl("total-size-label");
180155
totalSize.getChildControl("icon").getContentElement().addClass("rotate");

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

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ qx.Class.define("osparc.widget.StudyDataManager", {
9696
treeFolderView.getChildControl("folder-tree").setBackgroundColor("window-popup-background");
9797

9898
const selectedFileLayout = treeFolderView.getChildControl("folder-viewer").getChildControl("selected-file-layout");
99-
selectedFileLayout.addListener("fileDeleted", e => this.__fileDeleted(e.getData()), this);
10099
selectedFileLayout.addListener("pathsDeleted", e => treeFolderView.pathsDeleted(e.getData()), this);
101100
},
102101

@@ -116,36 +115,5 @@ qx.Class.define("osparc.widget.StudyDataManager", {
116115
const folderViewer = treeFolderView.getChildControl("folder-viewer");
117116
folderViewer.resetFolder();
118117
},
119-
120-
__fileDeleted: function(fileMetadata) {
121-
// After deleting a file, try to keep the user in the same folder.
122-
// If the folder doesn't longer exist, open the closest available parent
123-
124-
const pathParts = ("getPath" in fileMetadata ? fileMetadata.getPath() : fileMetadata["fileUuid"]).split("/");
125-
126-
const treeFolderView = this.getChildControl("tree-folder-view");
127-
const foldersTree = treeFolderView.getChildControl("folder-tree");
128-
foldersTree.resetCache();
129-
130-
const openSameFolder = () => {
131-
if (!this.getStudyId()) {
132-
// drop first, which is the study id
133-
pathParts.shift();
134-
}
135-
// drop last, which is the file
136-
pathParts.pop();
137-
treeFolderView.openPath(pathParts);
138-
};
139-
140-
if (this.getNodeId()) {
141-
foldersTree.populateNodeTree(this.getStudyId(), this.getNodeId())
142-
.then(() => openSameFolder())
143-
.catch(err => console.error(err));
144-
} else if (this.getStudyId()) {
145-
foldersTree.populateStudyTree(this.getStudyId())
146-
.then(() => openSameFolder())
147-
.catch(err => console.error(err));
148-
}
149-
}
150118
}
151119
});

0 commit comments

Comments
 (0)