Skip to content

Commit 9c241d6

Browse files
committed
listing files
1 parent a70c0e7 commit 9c241d6

File tree

1 file changed

+29
-19
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+29
-19
lines changed

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

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
447447
.then(streamData => {
448448
const items = streamData["data"]["items"] || [];
449449
if (items.length) {
450-
this.__setFilesToList(items);
450+
this.__addFilesToList(items);
451451
}
452452
const end = streamData["data"]["end"] || false;
453453
stream.setEnd(end);
@@ -515,24 +515,6 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
515515
});
516516
},
517517

518-
__setFoldersToList: function(folders) {
519-
this.__foldersList = folders;
520-
folders.forEach(folder => folder["resourceType"] = "folder");
521-
this.__reloadFolderCards();
522-
},
523-
524-
__setWorkspacesToList: function(workspaces) {
525-
this.__workspacesList = workspaces;
526-
workspaces.forEach(workspace => workspace["resourceType"] = "workspace");
527-
this.__reloadWorkspaceCards();
528-
},
529-
530-
__setFilesToList: function(files) {
531-
this.__filesList = files;
532-
files.forEach(file => file["resourceType"] = "file");
533-
this.__reloadFileCards();
534-
},
535-
536518
_reloadCards: function() {
537519
const fetching = this._loadingResourcesBtn ? this._loadingResourcesBtn.getFetching() : false;
538520
const visibility = this._loadingResourcesBtn ? this._loadingResourcesBtn.getVisibility() : "excluded";
@@ -565,6 +547,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
565547
},
566548

567549
// WORKSPACES
550+
__setWorkspacesToList: function(workspaces) {
551+
this.__workspacesList = workspaces;
552+
workspaces.forEach(workspace => workspace["resourceType"] = "workspace");
553+
this.__reloadWorkspaceCards();
554+
},
555+
568556
__reloadWorkspaceCards: function() {
569557
this._resourcesContainer.setWorkspacesToList(this.__workspacesList);
570558
this._resourcesContainer.reloadWorkspaces();
@@ -631,6 +619,12 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
631619
// /WORKSPACES
632620

633621
// FOLDERS
622+
__setFoldersToList: function(folders) {
623+
this.__foldersList = folders;
624+
folders.forEach(folder => folder["resourceType"] = "folder");
625+
this.__reloadFolderCards();
626+
},
627+
634628
__reloadFolderCards: function() {
635629
this._resourcesContainer.setFoldersToList(this.__foldersList);
636630
this._resourcesContainer.reloadFolders();
@@ -775,6 +769,22 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
775769
// /FOLDERS
776770

777771
// FILES
772+
__setFilesToList: function(files) {
773+
this.__filesList = files;
774+
files.forEach(file => file["resourceType"] = "file");
775+
this.__reloadFileCards();
776+
},
777+
778+
__addFilesToList: function(filesList) {
779+
filesList.forEach(fileData => {
780+
const idx = this.__filesList.findIndex(fl => fl["path"] === fileData["path"]);
781+
if (idx === -1) {
782+
this.__filesList.push(fileData);
783+
}
784+
});
785+
this.__reloadFileCards();
786+
},
787+
778788
__reloadFileCards: function() {
779789
this._resourcesContainer.setFilesToList(this.__filesList);
780790
this._resourcesContainer.reloadFiles();

0 commit comments

Comments
 (0)