Skip to content
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
82db9ba
FUNCTIONS
odeimaiz Jul 16, 2025
40a7672
StudyBrowser
odeimaiz Jul 16, 2025
0b7a2d1
showFunctions
odeimaiz Jul 16, 2025
a519254
minor
odeimaiz Jul 16, 2025
6515bc4
minor
odeimaiz Jul 16, 2025
7637521
minor
odeimaiz Jul 16, 2025
de43e87
checkFunctionPermissions
odeimaiz Jul 16, 2025
923171e
Functions store
odeimaiz Jul 16, 2025
a2ac3f7
invalidateFunctions
odeimaiz Jul 16, 2025
6aba3cd
__dummyResponse
odeimaiz Jul 16, 2025
73c6692
not needed
odeimaiz Jul 16, 2025
6dfe4f4
showing card
odeimaiz Jul 16, 2025
2de533d
no menu button
odeimaiz Jul 16, 2025
01b5096
fetchFunction
odeimaiz Jul 16, 2025
0396cd3
Function model
odeimaiz Jul 16, 2025
c5af08f
minor
odeimaiz Jul 16, 2025
2535a3b
functionedTemplate
odeimaiz Jul 16, 2025
101ea8e
set function
odeimaiz Jul 16, 2025
938ebfb
minor
odeimaiz Jul 16, 2025
6daa51e
minor
odeimaiz Jul 16, 2025
71ab85d
more
odeimaiz Jul 16, 2025
eaeddc5
FunctionLarge
odeimaiz Jul 16, 2025
95700cf
canIWrite
odeimaiz Jul 16, 2025
d69e828
minor
odeimaiz Jul 16, 2025
808b236
expand dummy
odeimaiz Jul 16, 2025
ce13d34
inputs, default inputs and outputs
odeimaiz Jul 16, 2025
a4eceb9
new message from MMUX
odeimaiz Jul 16, 2025
7a9e478
Merge branch 'master' into feature/functinos-browser
odeimaiz Jul 17, 2025
a9a972b
Merge branch 'feature/functinos-browser' of github.com:odeimaiz/ospar…
odeimaiz Jul 17, 2025
66af5ed
fetch services
odeimaiz Jul 17, 2025
8420c55
minor
odeimaiz Jul 17, 2025
a73dfd9
WorkbenchUIPreview2
odeimaiz Jul 17, 2025
c31f73f
minor
odeimaiz Jul 17, 2025
293819b
__buildPreview
odeimaiz Jul 17, 2025
c4b6e98
Function preview
odeimaiz Jul 17, 2025
06c0cda
to build the preview page we need the underlying template data
odeimaiz Jul 17, 2025
e95dfb9
updateFunctionData
odeimaiz Jul 17, 2025
2196795
Merge branch 'master' into feature/functinos-browser
odeimaiz Jul 17, 2025
ddda87b
Merge branch 'feature/functinos-browser' of github.com:odeimaiz/ospar…
odeimaiz Jul 17, 2025
7966ca8
minor
odeimaiz Jul 17, 2025
5fefda0
last changes
odeimaiz Jul 17, 2025
969fb4f
robot is right
odeimaiz Jul 17, 2025
2d58bb3
pb-function
odeimaiz Jul 17, 2025
287b3a1
list view for functions
odeimaiz Jul 17, 2025
f38b297
Merge branch 'master' into feature/functinos-browser
odeimaiz Jul 17, 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 @@ -49,6 +49,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
"updateStudy": "qx.event.type.Data",
"updateTemplate": "qx.event.type.Data",
"updateTutorial": "qx.event.type.Data",
"updateFunction": "qx.event.type.Data",
"updateService": "qx.event.type.Data",
"updateHypertool": "qx.event.type.Data",
"publishTemplate": "qx.event.type.Data",
Expand Down Expand Up @@ -334,6 +335,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
check: [
"study",
"template",
"function",
"tutorial",
"hypertool",
"service",
Expand Down Expand Up @@ -535,6 +537,11 @@ qx.Class.define("osparc.dashboard.CardBase", {
owner = resourceData.prjOwner ? resourceData.prjOwner : "";
workbench = resourceData.workbench ? resourceData.workbench : {};
break;
case "function":
uuid = resourceData.uuid ? resourceData.uuid : null;
owner = "";
workbench = resourceData.workbench ? resourceData.workbench : {};
break;
case "service":
uuid = resourceData.key ? resourceData.key : null;
owner = resourceData.owner ? resourceData.owner : resourceData.contact;
Expand Down Expand Up @@ -563,26 +570,31 @@ qx.Class.define("osparc.dashboard.CardBase", {
workbench
});

if ([
"study",
"template",
"tutorial",
"hypertool"
].includes(resourceData["resourceType"])) {
osparc.store.Services.getStudyServices(resourceData.uuid)
.then(resp => {
const services = resp["services"];
resourceData["services"] = services;
this.setServices(services);
})
.catch(err => {
resourceData["services"] = null;
this.setServices(null);
console.error(err);
});
switch (resourceData["resourceType"]) {
case "study":
case "template":
case "tutorial":
case "hypertool": {
osparc.store.Services.getStudyServices(resourceData.uuid)
.then(resp => {
const services = resp["services"];
resourceData["services"] = services;
this.setServices(services);
})
.catch(err => {
resourceData["services"] = null;
this.setServices(null);
console.error(err);
});

osparc.study.Utils.guessIcon(resourceData)
.then(iconSource => this.setIcon(iconSource));

osparc.study.Utils.guessIcon(resourceData)
.then(iconSource => this.setIcon(iconSource));
break;
}
case "function":
this.setIcon(osparc.data.model.StudyUI.PIPELINE_ICON);
break;
}
},

Expand Down Expand Up @@ -1081,6 +1093,7 @@ qx.Class.define("osparc.dashboard.CardBase", {
"updateStudy",
"updateTemplate",
"updateTutorial",
"updateFunction",
"updateService",
"updateHypertool",
].forEach(ev => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ qx.Class.define("osparc.dashboard.GridButtonItem", {
"template",
"tutorial",
"hypertool",
"function",
].includes(this.getResourceType())) {
const dateBy = this.getChildControl("date-by");
dateBy.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
resourcesContainer.addListener("updateStudy", e => this._updateStudyData(e.getData()));
resourcesContainer.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
resourcesContainer.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
resourcesContainer.addListener("updateFunction", e => this._updateFunctionData(e.getData()));
resourcesContainer.addListener("updateService", e => this._updateServiceData(e.getData()));
resourcesContainer.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
resourcesContainer.addListener("publishTemplate", e => this.fireDataEvent("publishTemplate", e.getData()));
Expand Down Expand Up @@ -692,7 +693,11 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
}
},

updateTutorialData: function(tutorialData) {
_updateTutorialData: function(tutorialData) {
throw new Error("Abstract method called!");
},

_updateFunctionData: function(functionData) {
throw new Error("Abstract method called!");
},

Expand Down Expand Up @@ -926,6 +931,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserBase", {
resourceDetails.addListener("updateStudy", e => this._updateStudyData(e.getData()));
resourceDetails.addListener("updateTemplate", e => this._updateTemplateData(e.getData()));
resourceDetails.addListener("updateTutorial", e => this._updateTutorialData(e.getData()));
resourceDetails.addListener("updateFunction", e => this._updateFunctionData(e.getData()));
resourceDetails.addListener("updateService", e => this._updateServiceData(e.getData()));
resourceDetails.addListener("updateHypertool", e => this._updateHypertoolData(e.getData()));
resourceDetails.addListener("publishTemplate", e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
events: {
"templatesContext": "qx.event.type.Event",
"publicTemplatesContext": "qx.event.type.Event",
"functionsContext": "qx.event.type.Event",
"trashContext": "qx.event.type.Event",
"changeTab": "qx.event.type.Data",
"trashStudyRequested": "qx.event.type.Data",
Expand All @@ -50,6 +51,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
__workspacesAndFoldersTree: null,
__templatesButton: null,
__publicProjectsButton: null,
__functionsButton: null,
__trashButton: null,
__sharedWithButtons: null,
__tagButtons: null,
Expand All @@ -66,6 +68,9 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
if (osparc.product.Utils.showPublicProjects()) {
this._add(this.__createPublicProjects());
}
if (osparc.product.Utils.showFunctions()) {
this._add(this.__createFunctions());
}
this._add(this.__createTrashBin());
this._add(filtersSpacer);
const scrollView = new qx.ui.container.Scroll();
Expand Down Expand Up @@ -102,6 +107,7 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {

this.__templatesButton.setValue(context === osparc.dashboard.StudyBrowser.CONTEXT.TEMPLATES);
this.__publicProjectsButton.setValue(context === osparc.dashboard.StudyBrowser.CONTEXT.PUBLIC_TEMPLATES);
this.__functionsButton.setValue(context === osparc.dashboard.StudyBrowser.CONTEXT.FUNCTIONS);
this.__trashButton.setValue(context === osparc.dashboard.StudyBrowser.CONTEXT.TRASH);
},

Expand Down Expand Up @@ -164,6 +170,24 @@ qx.Class.define("osparc.dashboard.ResourceBrowserFilter", {
return publicProjectsButton;
},

__createFunctions: function() {
const functionsButton = this.__functionsButton = new qx.ui.toolbar.RadioButton().set({
value: false,
appearance: "filter-toggle-button",
label: this.tr("Functions"),
icon: "@MaterialIcons/functions/20",
paddingLeft: 10, // align it with the context
});
osparc.utils.Utils.setIdToWidget(functionsButton, "functionsFilterItem");
functionsButton.addListener("changeValue", e => {
const functionsEnabled = e.getData();
if (functionsEnabled) {
this.fireEvent("functionsContext");
}
});
return functionsButton;
},

/* TRASH BIN */
__createTrashBin: function() {
const trashButton = this.__trashButton = new qx.ui.toolbar.RadioButton().set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
"updateStudy": "qx.event.type.Data",
"updateTemplate": "qx.event.type.Data",
"updateTutorial": "qx.event.type.Data",
"updateFunction": "qx.event.type.Data",
"updateService": "qx.event.type.Data",
"updateHypertool": "qx.event.type.Data",
"publishTemplate": "qx.event.type.Data",
Expand Down Expand Up @@ -161,6 +162,9 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
case osparc.dashboard.StudyBrowser.CONTEXT.SEARCH_PUBLIC_TEMPLATES:
text = this.tr("No Public Projects found");
break;
case osparc.dashboard.StudyBrowser.CONTEXT.FUNCTIONS:
text = this.tr("No Functions found");
break;
}
break;
}
Expand Down Expand Up @@ -297,6 +301,7 @@ qx.Class.define("osparc.dashboard.ResourceContainerManager", {
"updateStudy",
"updateTemplate",
"updateTutorial",
"updateFunction",
"updateService",
"updateHypertool",
"publishTemplate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
latestPromise = osparc.store.Study.getInstance().getOne(resourceData["uuid"]);
break;
}
case "function": {
case "functionedTemplate": {
latestPromise = osparc.store.Templates.fetchTemplate(resourceData["uuid"]);
break;
}
case "function":
latestPromise = osparc.store.Functions.fetchFunction(resourceData["uuid"]);
break;
case "service": {
latestPromise = osparc.store.Services.getService(resourceData["key"], resourceData["version"]);
break;
Expand All @@ -57,7 +60,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
case "template":
case "tutorial":
case "hypertool":
case "function":
case "functionedTemplate":
// when getting the latest study data, the debt information was lost
if (osparc.study.Utils.isInDebt(this.__resourceData)) {
const studyStore = osparc.store.Study.getInstance();
Expand All @@ -69,8 +72,20 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
this.__resourceModel["resourceType"] = resourceData["resourceType"];
this.__resourceData["services"] = resourceData["services"];
this.__addPages();
})
});
break;
case "function": {
// use function's underlying template info to fetch services metadata
// osparc.store.Templates.fetchTemplate(resourceData["uuid"]);
osparc.store.Services.getStudyServicesMetadata(latestResourceData)
.finally(() => {
this.__resourceModel = new osparc.data.model.Function(latestResourceData);
this.__resourceModel["resourceType"] = resourceData["resourceType"];
this.__resourceData["services"] = resourceData["services"];
this.__addPages();
});
break;
}
case "service": {
this.__resourceModel = new osparc.data.model.Service(latestResourceData);
this.__resourceModel["resourceType"] = resourceData["resourceType"];
Expand All @@ -92,6 +107,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
"updateStudy": "qx.event.type.Data",
"updateTemplate": "qx.event.type.Data",
"updateTutorial": "qx.event.type.Data",
"updateFunction": "qx.event.type.Data",
"updateService": "qx.event.type.Data",
"updateHypertool": "qx.event.type.Data",
"publishTemplate": "qx.event.type.Data",
Expand Down Expand Up @@ -157,6 +173,10 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
__addToolbarButtons: function(page) {
const resourceData = this.__resourceData;

if (this.__resourceData["resourceType"] === "function") {
return; // no toolbar buttons for functions
}

const toolbar = this.self().createToolbar();
page.addToHeader(toolbar);

Expand Down Expand Up @@ -370,11 +390,17 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
// removeAll
osparc.utils.Utils.removeAllChildren(tabsView);

if (this.__resourceData["resourceType"] === "function") {
if (this.__resourceData["resourceType"] === "functionedTemplate") {
// for now, we only want the preview page
this.__addPreviewPage();
this.fireEvent("pagesAdded");
return;
} else if (this.__resourceData["resourceType"] === "function") {
this.__addInfoPage();
// to build the preview page we need the underlying template data
// this.__addPreviewPage();
this.fireEvent("pagesAdded");
return;
}

this.__addInfoPage();
Expand Down Expand Up @@ -417,6 +443,9 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
case "tutorial":
this.fireDataEvent("updateTutorial", updatedData);
break;
case "function":
this.fireDataEvent("updateFunction", updatedData);
break;
case "hypertool":
this.fireDataEvent("updateHypertool", updatedData);
break;
Expand Down Expand Up @@ -448,6 +477,12 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
const updatedData = e.getData();
this.__fireUpdateEvent(resourceData, updatedData);
});
} else if (osparc.utils.Resources.isFunction(resourceData)) {
infoCard = new osparc.info.FunctionLarge(resourceModel);
infoCard.addListener("updateFunction", e => {
const updatedData = e.getData();
this.__fireUpdateEvent(resourceData, updatedData);
});
} else {
infoCard = new osparc.info.StudyLarge(resourceModel, false);
infoCard.addListener("updateStudy", e => {
Expand Down
Loading
Loading