Skip to content

Commit d300491

Browse files
committed
more progress
1 parent 24248f2 commit d300491

File tree

2 files changed

+8
-38
lines changed

2 files changed

+8
-38
lines changed

services/static-webserver/client/source/class/osparc/data/Converters.js

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,30 +138,15 @@ qx.Class.define("osparc.data.Converters", {
138138
},
139139

140140
createFileEntry: function(displayPath, location, path, fileMetaData) {
141-
if (displayPath === undefined) {
142-
displayPath = "Unknown label";
143-
}
144-
if (location === undefined) {
145-
location = "Unknown location";
146-
}
147-
if (fileId === undefined) {
148-
fileId = "Unknown fileId";
149-
}
150-
if (lastModified === undefined) {
151-
lastModified = (Math.floor(Math.random()*1000000)+1).toString();
152-
}
153-
if (size === undefined) {
154-
size = 0;
155-
}
156141
return {
157142
label: displayPath.split("/").slice(-1).pop(), // take last part of the display name
158143
displayPath,
159144
location,
160-
datasetId,
161-
fileId: path,
145+
path,
162146
itemId: path,
163-
lastModified,
164-
size
147+
fileId: fileMetaData["file_uuid"],
148+
lastModified: fileMetaData["last_modified"],
149+
size: fileMetaData["file_size"],
165150
};
166151
},
167152

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ qx.Class.define("osparc.file.FilesTree", {
131131

132132
members: {
133133
__locations: null,
134-
__paths: null,
135134
__pathModels: null,
136135
__loadPaths: null,
137136

@@ -217,10 +216,6 @@ qx.Class.define("osparc.file.FilesTree", {
217216
},
218217

219218
requestPathItems: function(locationId, path) {
220-
if (this.__paths.has(path)) {
221-
return;
222-
}
223-
224219
const dataStore = osparc.store.Data.getInstance();
225220
dataStore.getItemsByLocationAndPath(locationId, path)
226221
.then(items => {
@@ -233,7 +228,6 @@ qx.Class.define("osparc.file.FilesTree", {
233228

234229
__resetChecks: function() {
235230
this.__locations = new Set();
236-
this.__paths = new Set();
237231
},
238232

239233
__resetTree: function(treeName, itemId) {
@@ -322,7 +316,7 @@ qx.Class.define("osparc.file.FilesTree", {
322316
""
323317
);
324318
locationData["pathLabel"] = rootModel.getPathLabel().concat(locationData["label"]);
325-
const locationModel = qx.data.marshal.Json.createModel(locationData, true);
319+
const locationModel = this.__createModel(location.id, null, locationData);
326320
rootModel.getChildren().append(locationModel);
327321
if (this.__hasLocationNeedToBeLoaded(location.id)) {
328322
openThis = locationModel;
@@ -404,7 +398,7 @@ qx.Class.define("osparc.file.FilesTree", {
404398
},
405399

406400
__getModelFromPath: function(locationId, path) {
407-
const modelFound = this.__pathModels.find(entry => entry["locationId"] === locationId && entry["path"] === path);
401+
const modelFound = this.__pathModels.find(entry => entry["locationId"] == locationId && entry["path"] === path);
408402
if (modelFound) {
409403
return modelFound["model"];
410404
}
@@ -422,10 +416,6 @@ qx.Class.define("osparc.file.FilesTree", {
422416
},
423417

424418
__itemsToParentModel(locationId, datasetId, items, parentModel) {
425-
if (this.__paths.has(datasetId)) {
426-
return;
427-
}
428-
429419
if (parentModel) {
430420
parentModel.getChildren().removeAll();
431421
items.forEach(item => {
@@ -460,7 +450,6 @@ qx.Class.define("osparc.file.FilesTree", {
460450

461451
this.__rerender(parentModel);
462452

463-
this.__paths.add(datasetId);
464453
this.fireEvent("filesAddedToTree");
465454
}
466455

@@ -496,7 +485,7 @@ qx.Class.define("osparc.file.FilesTree", {
496485
);
497486
datasetData.loaded = false;
498487
datasetData["pathLabel"] = locationModel.getPathLabel().concat(datasetData["label"]);
499-
const datasetModel = qx.data.marshal.Json.createModel(datasetData, true);
488+
const datasetModel = this.__createModel(locationId, item["path"], datasetData);
500489
this.self().addLoadingChild(datasetModel);
501490
locationModel.getChildren().append(datasetModel);
502491

@@ -519,14 +508,11 @@ qx.Class.define("osparc.file.FilesTree", {
519508
},
520509

521510
__itemsToDataset: function(locationId, datasetId, files, model) {
522-
if (this.__paths.has(datasetId)) {
523-
return;
524-
}
525-
526511
const datasetModel = model ? model : this.__getModelFromPath(locationId, datasetId);
527512
if (datasetModel) {
528513
datasetModel.getChildren().removeAll();
529514
if (files.length) {
515+
// OM here
530516
const locationData = osparc.data.Converters.fromDSMToVirtualTreeModel(locationId, datasetId, files);
531517
const datasetData = locationData[0].children;
532518
datasetData[0].children.forEach(data => {
@@ -540,7 +526,6 @@ qx.Class.define("osparc.file.FilesTree", {
540526

541527
this.__rerender(datasetModel);
542528

543-
this.__paths.add(datasetId);
544529
this.fireEvent("filesAddedToTree");
545530
}
546531

0 commit comments

Comments
 (0)