Skip to content

Commit 19fca81

Browse files
committed
refactor and reword
1 parent fefc7d9 commit 19fca81

File tree

4 files changed

+31
-19
lines changed

4 files changed

+31
-19
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ qx.Class.define("osparc.dashboard.AppBrowser", {
130130
});
131131
osparc.filter.UIFilterController.dispatch("searchBarFilter");
132132

133-
this._resourcesContainer.getNoResourcesFoundLabel().set({
134-
value: this.tr("No Apps found"),
135-
visibility: cards.length === 0 ? "visible" : "excluded",
136-
});
133+
this._resourcesContainer.evaluateNoResourcesFoundLabel(cards, this._resourceType);
137134
},
138135

139136
__itemClicked: function(card) {

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,32 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
139139
__nonGroupedContainer: null,
140140
__groupedContainers: null,
141141

142-
getNoResourcesFoundLabel: function() {
143-
return this.__noResourcesFound;
142+
evaluateNoResourcesFoundLabel: function(cards, context) {
143+
if (this.__noResourcesFound) {
144+
let text = null;
145+
switch (context) {
146+
case "studiesAndFolders":
147+
case "search":
148+
text = this.tr("No Projects found");
149+
break;
150+
case "templates":
151+
text = this.tr("No Templates found");
152+
break;
153+
case "public":
154+
text = this.tr("No Public Projects found");
155+
break;
156+
case "tutorial":
157+
text = this.tr("No Tutorials found");
158+
break;
159+
case "service":
160+
text = this.tr("No Apps found");
161+
break;
162+
}
163+
this.__noResourcesFound.set({
164+
value: text,
165+
visibility: text && cards.length === 0 ? "visible" : "excluded",
166+
});
167+
}
144168
},
145169

146170
addNonResourceCard: function(card) {

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
269269

270270
this._loadingResourcesBtn.setFetching(true);
271271
this._loadingResourcesBtn.setVisibility("visible");
272-
this._resourcesContainer.getNoResourcesFoundLabel().setVisibility("excluded");
272+
this._resourcesContainer.evaluateNoResourcesFoundLabel([]);
273273
return this.__getNextStudiesRequest()
274274
.then(resp => {
275275
// Context might have been changed while waiting for the response.
@@ -420,10 +420,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
420420

421421
osparc.filter.UIFilterController.dispatch("searchBarFilter");
422422

423-
this._resourcesContainer.getNoResourcesFoundLabel().set({
424-
value: this.tr("No Projects found"),
425-
visibility: cards.length === 0 ? "visible" : "excluded",
426-
});
423+
this._resourcesContainer.evaluateNoResourcesFoundLabel(cards, this.getCurrentContext());
427424
},
428425

429426
__reloadNewCards: function() {
@@ -433,10 +430,7 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
433430

434431
osparc.filter.UIFilterController.dispatch("searchBarFilter");
435432

436-
this._resourcesContainer.getNoResourcesFoundLabel().set({
437-
value: this.tr("No Tutorials found"),
438-
visibility: cards.length === 0 ? "visible" : "excluded",
439-
});
433+
this._resourcesContainer.evaluateNoResourcesFoundLabel(cards, this.getCurrentContext());
440434
},
441435

442436
// WORKSPACES

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,7 @@ qx.Class.define("osparc.dashboard.TutorialBrowser", {
117117
this.__evaluateUpdateAllButton();
118118
osparc.filter.UIFilterController.dispatch("searchBarFilter");
119119

120-
this._resourcesContainer.getNoResourcesFoundLabel().set({
121-
value: this.tr("No Tutorials found"),
122-
visibility: cards.length === 0 ? "visible" : "excluded",
123-
});
120+
this._resourcesContainer.evaluateNoResourcesFoundLabel(cards, this._resourceType);
124121
},
125122

126123
__itemClicked: function(card) {

0 commit comments

Comments
 (0)