Skip to content

Commit b6d9f48

Browse files
committed
Hypertool filter
1 parent 6f13d5d commit b6d9f48

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
160160
return false;
161161
},
162162

163-
filterServiceType: function(resourceType, metadata, serviceType) {
163+
filterAppType: function(resourceType, metadata, serviceType) {
164164
if (serviceType && resourceType === "service") {
165165
if (metadata && metadata.type) {
166166
const matches = metadata.type === serviceType;
@@ -1103,10 +1103,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
11031103
return this.self().filterSharedWith(checks, sharedWith);
11041104
},
11051105

1106-
_filterServiceType: function(serviceType) {
1106+
__filterAppType: function(appType) {
11071107
const resourceType = this.getResourceType();
11081108
const resourceData = this.getResourceData();
1109-
return this.self().filterServiceType(resourceType, resourceData, serviceType);
1109+
return this.self().filterAppType(resourceType, resourceData, appType);
11101110
},
11111111

11121112
_filterClassifiers: function(classifiers) {
@@ -1129,7 +1129,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
11291129
if (this._filterSharedWith(data.sharedWith)) {
11301130
return true;
11311131
}
1132-
if (this._filterServiceType(data.serviceType)) {
1132+
if (this.__filterAppType(data.appType)) {
11331133
return true;
11341134
}
11351135
if (this._filterClassifiers(data.classifiers)) {
@@ -1153,7 +1153,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
11531153
if (data.sharedWith) {
11541154
return true;
11551155
}
1156-
if ("serviceType" in data) {
1156+
if ("appType" in data) {
11571157
return true;
11581158
}
11591159
if (data.classifiers && data.classifiers.length) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
432432
this._searchBarFilter.setTagsActiveFilter(selectedTagIds);
433433
}, this);
434434

435-
resourceFilter.addListener("changeServiceType", e => {
436-
const serviceType = e.getData();
437-
this._searchBarFilter.setServiceTypeActiveFilter(serviceType.appType, serviceType.label);
435+
resourceFilter.addListener("changeAppType", e => {
436+
const appType = e.getData();
437+
this._searchBarFilter.setAppTypeActiveFilter(appType.appType, appType.label);
438438
}, this);
439439

440440
this._searchBarFilter.addListener("filterChanged", e => {

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
2727
this.__resourceType = resourceType;
2828
this.__sharedWithButtons = [];
2929
this.__tagButtons = [];
30-
this.__serviceTypeButtons = [];
30+
this.__appTypeButtons = [];
3131

3232
this._setLayout(new qx.ui.layout.VBox(15));
3333
this.__buildLayout();
@@ -40,7 +40,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
4040
"trashFolderRequested": "qx.event.type.Data",
4141
"changeSharedWith": "qx.event.type.Data",
4242
"changeSelectedTags": "qx.event.type.Data",
43-
"changeServiceType": "qx.event.type.Data"
43+
"changeAppType": "qx.event.type.Data",
4444
},
4545

4646
members: {
@@ -49,7 +49,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
4949
__trashButton: null,
5050
__sharedWithButtons: null,
5151
__tagButtons: null,
52-
__serviceTypeButtons: null,
52+
__appTypeButtons: null,
5353

5454
__buildLayout: function() {
5555
const filtersSpacer = new qx.ui.core.Spacer(10, 10);
@@ -81,7 +81,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
8181
// this._add(this.__createResourceTypeContextButtons());
8282
this._add(filtersSpacer);
8383
this._add(this.__createSharedWithFilterLayout());
84-
this._add(this.__createServiceTypeFilterLayout());
84+
this._add(this.__createAppTypeFilterLayout());
8585
break;
8686
}
8787
},
@@ -442,7 +442,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
442442
/* /TAGS */
443443

444444
/* SERVICE TYPE */
445-
__createServiceTypeFilterLayout: function() {
445+
__createAppTypeFilterLayout: function() {
446446
const layout = new qx.ui.container.Composite(new qx.ui.layout.VBox(2));
447447

448448
const radioGroup = new qx.ui.form.RadioGroup();
@@ -458,15 +458,15 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
458458
const button = new qx.ui.toolbar.RadioButton(serviceType.label, serviceType.icon+iconSize);
459459
button.appType = serviceId;
460460
osparc.utils.Utils.setIdToWidget(button, this.__resourceType + "-serviceTypeFilterItem");
461-
this.__serviceTypeButtons.push(button);
461+
this.__appTypeButtons.push(button);
462462
});
463463

464464
// hypertools filter
465465
const button = new qx.ui.toolbar.RadioButton("Hypertools", "@FontAwesome5Solid/wrench/"+iconSize);
466466
button.appType = "hypertool";
467-
this.__serviceTypeButtons.push(button);
467+
this.__appTypeButtons.push(button);
468468

469-
this.__serviceTypeButtons.forEach(btn => {
469+
this.__appTypeButtons.forEach(btn => {
470470
btn.set({
471471
appearance: "filter-toggle-button",
472472
value: false
@@ -475,7 +475,7 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
475475
radioGroup.add(btn);
476476
btn.addListener("execute", () => {
477477
const checked = btn.getValue();
478-
this.fireDataEvent("changeServiceType", {
478+
this.fireDataEvent("changeAppType", {
479479
appType: checked ? btn.appType : null,
480480
label: checked ? btn.getLabel() : null
481481
});
@@ -498,9 +498,9 @@ qx.Class.define("osparc.dashboard.ResourceFilter", {
498498
btn.setValue(filterData["tags"].includes(btn.id));
499499
});
500500
}
501-
if ("serviceType" in filterData) {
502-
this.__serviceTypeButtons.forEach(btn => {
503-
btn.setValue(filterData["serviceType"] === btn.id);
501+
if ("appType" in filterData) {
502+
this.__appTypeButtons.forEach(btn => {
503+
btn.setValue(filterData["appType"] === btn.appType);
504504
});
505505
}
506506
}

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
147147
this.__addSharedWith(sharedWithButton);
148148
menu.add(sharedWithButton);
149149

150-
if (this.__resourceType !== "service") {
150+
if (["study", "template"].includes(this.__resourceType)) {
151151
const tagsButton = new qx.ui.menu.Button(this.tr("Tags"), "@FontAwesome5Solid/tags/12");
152152
osparc.utils.Utils.setIdToWidget(tagsButton, "searchBarFilter-tags-button");
153153
this.__addTags(tagsButton);
@@ -159,9 +159,9 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
159159
}
160160

161161
if (this.__resourceType === "service") {
162-
const serviceTypeButton = new qx.ui.menu.Button(this.tr("Service Type"), "@FontAwesome5Solid/cogs/12");
163-
this.__addServiceTypes(serviceTypeButton);
164-
menu.add(serviceTypeButton);
162+
const appTypeButton = new qx.ui.menu.Button(this.tr("App Type"), "@FontAwesome5Solid/cogs/12");
163+
this.__addAppTypes(appTypeButton);
164+
menu.add(appTypeButton);
165165
}
166166
},
167167

@@ -258,20 +258,26 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
258258
}
259259
},
260260

261-
__addServiceTypes: function(menuButton) {
261+
__addAppTypes: function(menuButton) {
262262
const serviceTypeMenu = new qx.ui.menu.Menu();
263263
menuButton.setMenu(serviceTypeMenu);
264+
265+
const iconSize = 12;
264266
const serviceTypes = osparc.service.Utils.TYPES;
265267
Object.keys(serviceTypes).forEach(serviceId => {
266268
if (!["computational", "dynamic"].includes(serviceId)) {
267269
return;
268270
}
269271
const serviceType = serviceTypes[serviceId];
270-
const iconSize = 12;
271272
const serviceTypeButton = new qx.ui.menu.Button(serviceType.label, serviceType.icon+iconSize);
272273
serviceTypeMenu.add(serviceTypeButton);
273-
serviceTypeButton.addListener("execute", () => this.__addChip("service-type", serviceId, serviceType.label), this);
274+
serviceTypeButton.addListener("execute", () => this.__addChip("app-type", serviceId, serviceType.label), this);
274275
});
276+
277+
// hypertools filter
278+
const hypertoolTypeButton = new qx.ui.menu.Button("Hypertools", "@FontAwesome5Solid/wrench/"+iconSize);
279+
serviceTypeMenu.add(hypertoolTypeButton);
280+
hypertoolTypeButton.addListener("execute", () => this.__addChip("app-type", "hypertool", "Hypertools"), this);
275281
},
276282

277283
addTagActiveFilter: function(tag) {
@@ -300,10 +306,10 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
300306
}
301307
},
302308

303-
setServiceTypeActiveFilter: function(appType, optionLabel) {
304-
this.__removeChips("service-type");
309+
setAppTypeActiveFilter: function(appType, optionLabel) {
310+
this.__removeChips("app-type");
305311
if (appType && optionLabel) {
306-
this.__addChip("service-type", appType, optionLabel);
312+
this.__addChip("app-type", appType, optionLabel);
307313
} else {
308314
this.__filter();
309315
}
@@ -369,7 +375,7 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
369375
tags: [],
370376
classifiers: [],
371377
sharedWith: null,
372-
serviceType: null,
378+
appType: null,
373379
text: ""
374380
};
375381
const textFilter = this.getTextFilterValue();
@@ -385,8 +391,8 @@ qx.Class.define("osparc.dashboard.SearchBarFilter", {
385391
case "shared-with":
386392
filterData.sharedWith = chip.id === "show-all" ? null : chip.id;
387393
break;
388-
case "service-type":
389-
filterData.serviceType = chip.id;
394+
case "app-type":
395+
filterData.appType = chip.id;
390396
break;
391397
}
392398
});

0 commit comments

Comments
 (0)