Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
this._populateCardMenu(card);
});
osparc.filter.UIFilterController.dispatch("searchBarFilter");

this._resourcesContainer.evaluateNoResourcesFoundLabel(cards, this._resourceType);
},

__itemClicked: function(card) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,16 @@ qx.Class.define("osparc.dashboard.ContextBreadcrumbs", {
this._removeAll();

const currentContext = osparc.store.Store.getInstance().getStudyBrowserContext();
if (currentContext !== "studiesAndFolders") {
return;
}

if (this.getCurrentFolderId()) {
const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId());
this.__createUpstreamButtons(currentFolder);
}
if (currentContext === "studiesAndFolders") {
if (this.getCurrentFolderId()) {
const currentFolder = osparc.store.Folders.getInstance().getFolder(this.getCurrentFolderId());
this.__createUpstreamButtons(currentFolder);
}

const currentFolderButton = this.__createCurrentFolderButton();
if (currentFolderButton) {
this._add(currentFolderButton);
const currentFolderButton = this.__createCurrentFolderButton();
if (currentFolderButton) {
this._add(currentFolderButton);
}
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,14 @@ qx.Class.define("osparc.dashboard.FolderButtonItem", {

const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext();
if (
studyBrowserContext === "search" ||
studyBrowserContext === "searchProjects" ||
studyBrowserContext === "studiesAndFolders"
) {
const editButton = new qx.ui.menu.Button(this.tr("Rename..."), "@FontAwesome5Solid/pencil-alt/12");
editButton.addListener("execute", () => this.__editFolder(), this);
menu.add(editButton);

if (studyBrowserContext === "search") {
if (studyBrowserContext === "searchProjects") {
const openLocationButton = new qx.ui.menu.Button(this.tr("Open location"), "@FontAwesome5Solid/external-link-alt/12");
openLocationButton.addListener("execute", () => {
const folder = this.getFolder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {

events: {
"templatesContext": "qx.event.type.Event",
"publicContext": "qx.event.type.Event",
"publicTemplatesContext": "qx.event.type.Event",
"trashContext": "qx.event.type.Event",
"changeTab": "qx.event.type.Data",
"trashStudyRequested": "qx.event.type.Data",
Expand Down Expand Up @@ -101,7 +101,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
this.__workspacesAndFoldersTree.contextChanged(context);

this.__templatesButton.setValue(context === "templates");
this.__publicProjectsButton.setValue(context === "public");
this.__publicProjectsButton.setValue(context === "publicTemplates");
this.__trashButton.setValue(context === "trash");
},

Expand Down Expand Up @@ -158,7 +158,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
publicProjectsButton.addListener("changeValue", e => {
const templatesEnabled = e.getData();
if (templatesEnabled) {
this.fireEvent("publicContext");
this.fireEvent("publicTemplatesContext");
}
});
return publicProjectsButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
this.__foldersList = [];
this.__resourcesList = [];
this.__groupedContainersList = [];
this.__resourceType = resourceType || "study";

if (resourceType === "study") {
const workspacesContainer = this.__workspacesContainer = new osparc.dashboard.CardContainer();
Expand Down Expand Up @@ -135,34 +136,48 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
__groupedContainersList: null,
__foldersContainer: null,
__workspacesContainer: null,
__noResourcesFound: null,
__nonGroupedContainer: null,
__groupedContainers: null,
__resourceType: null,
__noResourcesFound: null,

evaluateNoResourcesFoundLabel: function(cards, context) {
__evaluateNoResourcesFoundLabel: function() {
if (this.__noResourcesFound) {
let text = null;
switch (context) {
case "studiesAndFolders":
case "search":
text = this.tr("No Projects found");
break;
case "templates":
text = this.tr("No Templates found");
break;
case "public":
text = this.tr("No Public Projects found");
switch (this.__resourceType) {
case "study": {
const studyBrowserContext = osparc.store.Store.getInstance().getStudyBrowserContext();
switch (studyBrowserContext) {
case "studiesAndFolders":
case "searchProjects":
case "trash":
text = this.tr("No Projects found");
break;
case "templates":
case "searchTemplates":
text = this.tr("No Templates found");
break;
case "publicTemplates":
case "searchPublicTemplates":
text = this.tr("No Public Projects found");
break;
}
break;
}
case "template":
text = this.tr("No Tutorials found");
break;
case "service":
text = this.tr("No Apps found");
break;
default:
text = this.tr("No Resources found");
break;
}

this.__noResourcesFound.set({
value: text,
visibility: text && cards.length === 0 ? "visible" : "excluded",
visibility: text && this.__resourcesList.length === 0 ? "visible" : "excluded",
});
}
},
Expand Down Expand Up @@ -307,6 +322,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {

setResourcesToList: function(resourcesList) {
this.__resourcesList = resourcesList;

// delay it a bit to avoid the initial flickering
setTimeout(() => this.__evaluateNoResourcesFoundLabel(), 1000);
},

__cleanAll: function() {
Expand Down
Loading
Loading