Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
dfb7602
Hypertools filter
odeimaiz May 12, 2025
a037701
service -> app
odeimaiz May 12, 2025
eadce48
[skip ci] minors
odeimaiz May 12, 2025
e65ec30
minor
odeimaiz May 12, 2025
6f13d5d
getAppAlias
odeimaiz May 12, 2025
b6d9f48
Hypertool filter
odeimaiz May 12, 2025
fb9fa32
fetch getTemplatesHypertools
odeimaiz May 12, 2025
cb581be
remove hypertool browser
odeimaiz May 12, 2025
9020af2
Sub Job fields
odeimaiz May 12, 2025
a7fe71c
pb-hypertool
odeimaiz May 12, 2025
3bb6198
[skip ci] more hypertooling
odeimaiz May 12, 2025
0b2aa6d
hypertools last
odeimaiz May 12, 2025
7326709
filtering working
odeimaiz May 12, 2025
c74ba13
filter working
odeimaiz May 12, 2025
bc54827
Merge branch 'master' into feature/hypertools-in-service-browser
odeimaiz May 13, 2025
949a886
enable features
odeimaiz May 13, 2025
fa4dabf
more refactoring
odeimaiz May 13, 2025
5c17038
refactor
odeimaiz May 13, 2025
95fad53
aesthetics
odeimaiz May 13, 2025
9cc4798
trying to say "Public"
odeimaiz May 13, 2025
ea01638
public
odeimaiz May 13, 2025
cd11d50
more public
odeimaiz May 13, 2025
200792f
public
odeimaiz May 13, 2025
89aea81
less code
odeimaiz May 13, 2025
27155ec
all users can share hypertool with ProductEveryone
odeimaiz May 13, 2025
272911d
__fireUpdateEvent
odeimaiz May 13, 2025
e2d9bf9
"updateHypertool" chain
odeimaiz May 13, 2025
50d486a
minor
odeimaiz May 13, 2025
3a6fcb3
Merge branch 'master' into feature/hypertools-in-service-browser
odeimaiz May 13, 2025
f0ff287
renaming columns
odeimaiz May 13, 2025
6304d4d
minor
odeimaiz May 13, 2025
3ce62f3
show osparcCredits
odeimaiz May 13, 2025
56322c9
Merge branch 'feature/hypertools-in-service-browser' of github.com:od…
odeimaiz May 13, 2025
90cfcce
Activity Center
odeimaiz May 13, 2025
b297201
logs button
odeimaiz May 13, 2025
7381687
Queued and more columns
odeimaiz May 13, 2025
1037fdd
Merge branch 'master' into feature/hypertools-in-service-browser
odeimaiz May 13, 2025
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 @@ -22,7 +22,7 @@
* @ignore(fetch)
*/

qx.Class.define("osparc.dashboard.ServiceBrowser", {
qx.Class.define("osparc.dashboard.AppBrowser", {
extend: osparc.dashboard.ResourceBrowserBase,

construct: function() {
Expand All @@ -43,8 +43,12 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
this._resourcesInitialized = true;

this._resourcesList = [];
osparc.store.Services.getServicesLatest()
.then(services => {
Promise.all([
osparc.store.Services.getServicesLatest(),
osparc.store.Templates.getTemplatesHypertools(),
])
.then(resps => {
const services = resps[0];
// Show "Contact Us" message if services.length === 0
// Most probably is a product-stranger user (it can also be that the catalog is down)
if (Object.keys(services).length === 0) {
Expand All @@ -65,30 +69,52 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {

reloadResources: function() {
this.__loadServices();
this.__loadHypertools();
},

__loadServices: function() {
const excludeFrontend = true;
const excludeDeprecated = true
osparc.store.Services.getServicesLatestList(excludeFrontend, excludeDeprecated)
.then(servicesList => this.__setServicesToList(servicesList.filter(service => service !== null)));
.then(servicesList => {
servicesList.forEach(service => service["resourceType"] = "service");
this._resourcesList.push(...servicesList.filter(service => service !== null));
this.__sortAndReload();
});
},

__loadHypertools: function() {
osparc.store.Templates.getTemplatesHypertools()
.then(hypertoolsList => {
hypertoolsList.forEach(hypertool => hypertool["resourceType"] = "hypertool");
this._resourcesList.push(...hypertoolsList.filter(hypertool => hypertool !== null));
this.__sortAndReload();
});
},

__sortAndReload: function() {
osparc.service.Utils.sortObjectsBasedOn(this._resourcesList, this.__sortBy);
this._reloadCards();
},

_updateServiceData: function(serviceData) {
serviceData["resourceType"] = "service";
const servicesList = this._resourcesList;
const index = servicesList.findIndex(service => service["key"] === serviceData["key"] && service["version"] === serviceData["version"]);
const appsList = this._resourcesList;
const index = appsList.findIndex(service => service["key"] === serviceData["key"] && service["version"] === serviceData["version"]);
if (index !== -1) {
servicesList[index] = serviceData;
appsList[index] = serviceData;
this._reloadCards();
}
},

__setServicesToList: function(servicesList) {
servicesList.forEach(service => service["resourceType"] = "service");
osparc.service.Utils.sortObjectsBasedOn(servicesList, this.__sortBy);
this._resourcesList = servicesList;
this._reloadCards();
_updateHypertoolData: function(hypertoolData) {
hypertoolData["resourceType"] = "hypertool";
const appsList = this._resourcesList;
const index = appsList.findIndex(service => service["uuid"] === hypertoolData["uuid"]);
if (index !== -1) {
appsList[index] = hypertoolData;
this._reloadCards();
}
},

_reloadCards: function() {
Expand All @@ -103,8 +129,8 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
},

__itemClicked: function(card) {
const serviceData = card.getResourceData();
this._openResourceDetails(serviceData);
const appData = card.getResourceData();
this._openResourceDetails(appData);
this.resetSelection();
},

Expand All @@ -126,6 +152,28 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
return this._resourcesContainer;
},

__addSortingButtons: function() {
const containerSortButtons = new osparc.service.SortServicesButtons();
containerSortButtons.set({
appearance: "form-button-outlined"
});
containerSortButtons.addListener("sortBy", e => {
this.__sortBy = e.getData();
this.__sortAndReload();
}, this);
this._toolbar.add(containerSortButtons);
},

_populateCardMenu: function(card) {
const menu = card.getMenu();
const appData = card.getResourceData();

const openButton = this._getOpenMenuButton(appData);
if (openButton) {
menu.add(openButton);
}
},

__addNewServiceButtons: function() {
const platformName = osparc.store.StaticInfo.getInstance().getPlatformName();
const hasRights = osparc.data.Permissions.getInstance().canDo("studies.template.create.productAll");
Expand All @@ -140,7 +188,7 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
this._toolbar.add(testDataButton);
}

const addServiceButton = new qx.ui.form.Button(this.tr("Submit new service"), "@FontAwesome5Solid/plus-circle/14");
const addServiceButton = new qx.ui.form.Button(this.tr("Submit new app"), "@FontAwesome5Solid/plus-circle/14");
addServiceButton.set({
appearance: "form-button-outlined",
visibility: hasRights ? "visible" : "excluded"
Expand All @@ -149,30 +197,8 @@ qx.Class.define("osparc.dashboard.ServiceBrowser", {
this._toolbar.add(addServiceButton);
},

__addSortingButtons: function() {
const containerSortButtons = new osparc.service.SortServicesButtons();
containerSortButtons.set({
appearance: "form-button-outlined"
});
containerSortButtons.addListener("sortBy", e => {
this.__sortBy = e.getData();
this.__setServicesToList(this._resourcesList);
}, this);
this._toolbar.add(containerSortButtons);
},

_populateCardMenu: function(card) {
const menu = card.getMenu();
const serviceData = card.getResourceData();

const openButton = this._getOpenMenuButton(serviceData);
if (openButton) {
menu.add(openButton);
}
},

__displayServiceSubmissionForm: function(formData) {
const addServiceWindow = new osparc.ui.window.Window(this.tr("Submit a new service")).set({
const addServiceWindow = new osparc.ui.window.Window(this.tr("Submit a new app")).set({
modal: true,
autoDestroy: true,
showMinimize: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
"updateStudy": "qx.event.type.Data",
"updateTemplate": "qx.event.type.Data",
"updateService": "qx.event.type.Data",
"updateHypertool": "qx.event.type.Data",
"publishTemplate": "qx.event.type.Data",
"tagClicked": "qx.event.type.Data",
"emptyStudyClicked": "qx.event.type.Data"
Expand Down Expand Up @@ -160,10 +161,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
return false;
},

filterServiceType: function(resourceType, metadata, serviceType) {
if (serviceType && resourceType === "service") {
filterAppType: function(resourceType, metadata, appType) {
if (appType && ["service", "hypertool"].includes(resourceType)) {
if (metadata && metadata.type) {
const matches = metadata.type === serviceType;
const matches = metadata.type === appType;
return !matches;
}
return false;
Expand Down Expand Up @@ -221,11 +222,11 @@ qx.Class.define("osparc.dashboard.CardBase", {
const organizations = groupsStore.getOrganizations();
const myGroupId = groupsStore.getMyGroupId();

const sharedGrps = [];
const groups = [];
groups.push(groupEveryone);
groups.push(groupProductEveryone);
groups.push(...Object.values(organizations));
const sharedGrps = [];
groups.forEach(group => {
const idx = gids.indexOf(group.getGroupId());
if (idx > -1) {
Expand Down Expand Up @@ -260,7 +261,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
sharedGrpLabels.push("...");
break;
}
const sharedGrpLabel = sharedGrps[i].getLabel();
let sharedGrpLabel = sharedGrps[i].getLabel();
if ([groupEveryone, groupProductEveryone].includes(sharedGrps[i])) {
sharedGrpLabel = "Public";
}
if (!sharedGrpLabels.includes(sharedGrpLabel)) {
sharedGrpLabels.push(sharedGrpLabel);
}
Expand Down Expand Up @@ -315,7 +319,12 @@ qx.Class.define("osparc.dashboard.CardBase", {
},

resourceType: {
check: ["study", "template", "service"],
check: [
"study",
"template",
"service",
"hypertool",
],
init: true,
nullable: true,
event: "changeResourceType"
Expand Down Expand Up @@ -506,11 +515,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
let icon = null;
switch (resourceData["resourceType"]) {
case "study":
uuid = resourceData.uuid ? resourceData.uuid : null;
owner = resourceData.prjOwner ? resourceData.prjOwner : "";
workbench = resourceData.workbench ? resourceData.workbench : {};
break;
case "template":
case "hypertool":
uuid = resourceData.uuid ? resourceData.uuid : null;
owner = resourceData.prjOwner ? resourceData.prjOwner : "";
workbench = resourceData.workbench ? resourceData.workbench : {};
Expand Down Expand Up @@ -543,7 +549,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
workbench
});

if (resourceData["resourceType"] === "study" || resourceData["resourceType"] === "template") {
if (["study", "template", "hypertool"].includes(resourceData["resourceType"])) {
osparc.store.Services.getStudyServices(resourceData.uuid)
.then(resp => {
const services = resp["services"];
Expand Down Expand Up @@ -993,7 +999,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
[
"updateStudy",
"updateTemplate",
"updateService"
"updateService",
"updateHypertool",
].forEach(ev => {
resourceDetails.addListener(ev, e => this.fireDataEvent(ev, e.getData()));
});
Expand Down Expand Up @@ -1045,6 +1052,8 @@ qx.Class.define("osparc.dashboard.CardBase", {
toolTipText += osparc.product.Utils.getStudyAlias();
} else if (this.isResourceType("template")) {
toolTipText += osparc.product.Utils.getTemplateAlias();
} else if (this.isResourceType("hypertool")) {
toolTipText += osparc.product.Utils.getAppAlias();
}
const control = new qx.ui.basic.Image().set({
source: "@FontAwesome5Solid/times-circle/14",
Expand Down Expand Up @@ -1103,10 +1112,10 @@ qx.Class.define("osparc.dashboard.CardBase", {
return this.self().filterSharedWith(checks, sharedWith);
},

_filterServiceType: function(serviceType) {
__filterAppType: function(appType) {
const resourceType = this.getResourceType();
const resourceData = this.getResourceData();
return this.self().filterServiceType(resourceType, resourceData, serviceType);
return this.self().filterAppType(resourceType, resourceData, appType);
},

_filterClassifiers: function(classifiers) {
Expand All @@ -1117,7 +1126,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
_shouldApplyFilter: function(data) {
let filterId = "searchBarFilter";
if (this.isPropertyInitialized("resourceType")) {
filterId += "-" + this.getResourceType();
switch (this.getResourceType()) {
case "hypertool":
filterId += "-service";
break;
default:
filterId += "-" + this.getResourceType();
break;
}
}
data = filterId in data ? data[filterId] : data;
if (this._filterText(data.text)) {
Expand All @@ -1129,7 +1145,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
if (this._filterSharedWith(data.sharedWith)) {
return true;
}
if (this._filterServiceType(data.serviceType)) {
if (this.__filterAppType(data.appType)) {
return true;
}
if (this._filterClassifiers(data.classifiers)) {
Expand All @@ -1141,7 +1157,14 @@ qx.Class.define("osparc.dashboard.CardBase", {
_shouldReactToFilter: function(data) {
let filterId = "searchBarFilter";
if (this.isPropertyInitialized("resourceType")) {
filterId += "-" + this.getResourceType();
switch (this.getResourceType()) {
case "hypertool":
filterId += "-service";
break;
default:
filterId += "-" + this.getResourceType();
break;
}
}
data = filterId in data ? data[filterId] : data;
if (data.text && data.text.length > 1) {
Expand All @@ -1153,7 +1176,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
if (data.sharedWith) {
return true;
}
if ("serviceType" in data) {
if ("appType" in data) {
return true;
}
if (data.classifiers && data.classifiers.length) {
Expand Down
Loading
Loading