Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 [Frontend] Make version display more prominent #6096

Merged
merged 27 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9e59b1a
fix
odeimaiz Jul 23, 2024
f88c2f8
use dev PATCH
odeimaiz Jul 23, 2024
c2f9fe2
edit only if I can write
odeimaiz Jul 23, 2024
d629d43
Merge branch 'master' into fix/version-selector
odeimaiz Jul 23, 2024
bbad91f
Merge branch 'master' into fix/version-selector
odeimaiz Jul 23, 2024
3c095f4
cache serviceResources
odeimaiz Jul 23, 2024
dbc9b89
growSelectBox
odeimaiz Jul 23, 2024
3b8a33d
minor
odeimaiz Jul 23, 2024
d7cfb61
fix getMinVisibleInputs
odeimaiz Jul 23, 2024
6be1436
Merge branch 'fix/version-selector' of github.com:odeimaiz/osparc-sim…
odeimaiz Jul 23, 2024
141e9f4
Merge branch 'master' into fix/version-selector
odeimaiz Jul 23, 2024
108ca86
don't show dangling info buttons
odeimaiz Jul 23, 2024
c4e734f
versionDisplay in version selector
odeimaiz Jul 23, 2024
e61e909
Use Service Model
odeimaiz Jul 23, 2024
a335d7f
more Service model
odeimaiz Jul 23, 2024
245297e
minor fix
odeimaiz Jul 23, 2024
6e75c05
Show display version only
odeimaiz Jul 23, 2024
68bfba8
refactor
odeimaiz Jul 23, 2024
1c1387b
patch also cache
odeimaiz Jul 23, 2024
de89142
minor
odeimaiz Jul 23, 2024
3646e9e
minor
odeimaiz Jul 23, 2024
c61c7ac
key is optional
odeimaiz Jul 23, 2024
7ab47dc
Merge branch 'master' into fix/version-selector
odeimaiz Jul 23, 2024
65fecd7
Merge branch 'master' into fix/version-selector
odeimaiz Jul 23, 2024
01e2797
Merge branch 'master' into fix/version-selector
odeimaiz Jul 24, 2024
6f44ac3
more properties to service model
odeimaiz Jul 24, 2024
5352486
Merge branch 'fix/version-selector' of github.com:odeimaiz/osparc-sim…
odeimaiz Jul 24, 2024
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 @@ -248,6 +248,7 @@ qx.Class.define("osparc.dashboard.ResourceDetails", {
versionsBox.setSelection([selectedItem]);
}
});
osparc.utils.Utils.growSelectBox(versionsBox, 200);

// then listen to changes
versionsBox.addListener("changeSelection", e => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ qx.Class.define("osparc.data.Resources", {
* SERVICES DEV
*/
"servicesDev": {
useCache: false, // handled in its store
useCache: false, // handled in osparc.service.Store
idField: ["key", "version"],
endpoints: {
get: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ qx.Class.define("osparc.data.model.Node", {
},

getMinVisibleInputs: function(metadata) {
return ("min-visible-inputs" in metadata) ? metadata["min-visible-inputs"] : null;
return ("minVisibleInputs" in metadata) ? metadata["minVisibleInputs"] : null;
},

getOutput: function(outputs, outputKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@ qx.Class.define("osparc.data.model.Service", {
extend: qx.core.Object,

/**
* @param serviceData {Object} Object containing the serialized Study Data
* @param serviceData {Object} Object containing the serialized Service Data
*/
construct: function(serviceData) {
this.base(arguments);

this.set({
key: serviceData.key,
version: serviceData.version,
versionDisplay: serviceData.versionDisplay,
name: serviceData.name,
description: serviceData.description,
thumbnail: serviceData.thumbnail,
serviceType: serviceData.type,
contact: serviceData.contact,
authors: serviceData.authors,
owner: serviceData.owner || "",
accessRights: serviceData.accessRights,
bootOptions: serviceData.bootOptions,
classifiers: serviceData.classifiers || [],
quality: serviceData.quality || null,
hits: serviceData.hits || 0
Expand All @@ -49,6 +55,20 @@ qx.Class.define("osparc.data.model.Service", {
init: null
},

version: {
check: "String",
nullable: false,
event: "changeVersion",
init: null
},

versionDisplay: {
check: "String",
nullable: true,
event: "changeVersionDisplay",
init: null
},

name: {
check: "String",
nullable: false,
Expand All @@ -58,14 +78,42 @@ qx.Class.define("osparc.data.model.Service", {

description: {
check: "String",
nullable: false,
nullable: true,
event: "changeDescription",
init: null
},

thumbnail: {
check: "String",
nullable: true,
event: "changeThumbnail",
init: null
},

serviceType: {
check: "String",
nullable: true,
event: "changeServiceType",
init: ""
},

contact: {
check: "String",
nullable: true,
event: "changeContact",
init: ""
},

authors: {
check: "Object",
nullable: true,
event: "changeAuthors",
init: {}
},

owner: {
check: "String",
nullable: false,
nullable: true,
event: "changeOwner",
init: ""
},
Expand All @@ -77,11 +125,11 @@ qx.Class.define("osparc.data.model.Service", {
init: {}
},

thumbnail: {
check: "String",
nullable: true,
event: "changeThumbnail",
init: null
bootOptions: {
check: "Object",
init: {},
event: "changeBootOptions",
nullable: true
},

classifiers: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ qx.Class.define("osparc.desktop.organizations.ServicesList", {
}

const gid = orgModel.getGid();
osparc.service.Store.getServicesLatest(false, false)
.then(latestServices => {
osparc.service.Store.getServicesLatest()
.then(servicesLatest => {
const orgServices = [];
latestServices.forEach(latestService => {
if (gid in latestService["accessRights"]) {
orgServices.push(latestService);
Object.keys(servicesLatest).forEach(key => {
const serviceLatest = servicesLatest[key];
if (gid in serviceLatest["accessRights"]) {
orgServices.push(serviceLatest);
}
});
orgServices.forEach(orgService => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,23 @@ qx.Class.define("osparc.form.renderer.PropFormBase", {
const extendedVersion = firstColumnWidth > 300;

const inputs = this.getNode().getInputs();
for (const portId in inputs) {
Object.keys(inputs).forEach((portId, idx) => {
if (inputs[portId].description) {
this._getLabelFieldChild(portId).child.set({
value: extendedVersion ? inputs[portId].label + ". " + inputs[portId].description + ":" : inputs[portId].label,
toolTipText: extendedVersion ? inputs[portId].label + "<br>" + inputs[portId].description : inputs[portId].label
});

this._getInfoFieldChild(portId).child.setVisibility(extendedVersion ? "hidden" : "visible");
if (grid.getRowHeight(idx) === 0) {
// the port might be hidden
this._getInfoFieldChild(portId).child.setVisibility("hidden");
} else {
this._getInfoFieldChild(portId).child.setVisibility(extendedVersion ? "hidden" : "visible");
}

grid.setColumnMinWidth(this.self().GRID_POS.CTRL_FIELD, extendedVersion ? 150 : 50);
}
}
});
},

getValues: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,17 @@ qx.Class.define("osparc.info.MergedLarge", {
}
});

if (osparc.data.Permissions.getInstance().isTester()) {
extraInfo.splice(i++, 0, {
label: this.tr("Service Integration Version"),
view: this.__createIntegrationVersion(),
action: null
});
}

extraInfo.splice(i++, 0, {
label: this.tr("Service Version"),
view: this.__createVersion(),
view: this.__createDisplayVersion(),
action: null
});

Expand Down Expand Up @@ -247,8 +255,12 @@ qx.Class.define("osparc.info.MergedLarge", {
return osparc.info.ServiceUtils.createKey(this.getNode().getKey());
},

__createVersion: function() {
return osparc.info.ServiceUtils.createVersion(this.getNode().getVersion() + "TODO: version display");
__createIntegrationVersion: function() {
return osparc.info.ServiceUtils.createVersion(this.getNode().getVersion());
},

__createDisplayVersion: function() {
return osparc.info.ServiceUtils.createVersionDisplay(this.getNode().getKey(), this.getNode().getVersion());
},

__createOwner: function() {
Expand Down Expand Up @@ -313,13 +325,7 @@ qx.Class.define("osparc.info.MergedLarge", {
};
promise = osparc.data.Resources.get("nodesInStudyResources", params);
} else {
const params = {
url: osparc.data.Resources.getServiceUrl(
this.getNode().getKey(),
this.getNode().getVersion()
)
};
promise = osparc.data.Resources.get("serviceResources", params);
promise = osparc.service.Store.getResources(this.getNode().getKey(), this.getNode().getVersion())
}
promise
.then(serviceResources => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,19 @@ qx.Class.define("osparc.info.ServiceLarge", {
callback: this.__copyKeyToClipboard,
ctx: this
}
}, {
});

if (osparc.data.Permissions.getInstance().isTester()) {
extraInfo.push({
label: this.tr("INTEGRATION VERSION"),
view: this.__createIntegrationVersion(),
action: null
});
}

extraInfo.push({
label: this.tr("VERSION"),
view: this.__createVersion(),
action: null
}, {
label: this.tr("VERSION DISPLAY"),
view: this.__createVersionDisplay(),
view: this.__createDisplayVersion(),
action: {
button: osparc.service.Utils.canIWrite(this.getService()["accessRights"]) ? osparc.utils.Utils.getEditButton() : null,
callback: this.__openVersionDisplayEditor,
Expand Down Expand Up @@ -284,17 +290,12 @@ qx.Class.define("osparc.info.ServiceLarge", {
return osparc.info.ServiceUtils.createKey(this.getService()["key"]);
},

__createVersion: function() {
__createIntegrationVersion: function() {
return osparc.info.ServiceUtils.createVersion(this.getService()["version"]);
},

__createVersionDisplay: function() {
const versionDisplayLabel = osparc.info.ServiceUtils.createVersionDisplay(this.getService()["key"], this.getService()["version"]);
if (versionDisplayLabel.getValue() || osparc.service.Utils.canIWrite(this.getService()["accessRights"])) {
// show it if it has a value or if the user can write (useful when it is still empty)
return versionDisplayLabel;
}
return null;
__createDisplayVersion: function() {
return osparc.info.ServiceUtils.createVersionDisplay(this.getService()["key"], this.getService()["version"]);
},

__createReleasedDate: function() {
Expand Down Expand Up @@ -359,13 +360,7 @@ qx.Class.define("osparc.info.ServiceLarge", {
};
promise = osparc.data.Resources.get("nodesInStudyResources", params);
} else {
const params = {
url: osparc.data.Resources.getServiceUrl(
this.getService()["key"],
this.getService()["version"]
)
};
promise = osparc.data.Resources.get("serviceResources", params);
promise = osparc.service.Store.getResources(this.getService()["key"], this.getService()["version"])
}
promise
.then(serviceResources => {
Expand Down Expand Up @@ -479,7 +474,7 @@ qx.Class.define("osparc.info.ServiceLarge", {

__patchService: function(key, value) {
const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.getService());
osparc.info.ServiceUtils.patchServiceData(serviceDataCopy, key, value)
osparc.service.Store.patchServiceData(serviceDataCopy, key, value)
.then(() => {
this.setService(serviceDataCopy);
this.fireDataEvent("updateService", this.getService());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ qx.Class.define("osparc.info.ServiceUtils", {
version.set({
value: serviceVersion
});
osparc.utils.Utils.setIdToWidget(version, "serviceVersion");
return version;
},

createVersionDisplay: function(key, version) {
return new qx.ui.basic.Label(osparc.service.Utils.getVersionDisplay(key, version));
const versionDisplay = osparc.service.Utils.getVersionDisplay(key, version);
const label = new qx.ui.basic.Label(versionDisplay ? versionDisplay : version);
osparc.utils.Utils.setIdToWidget(label, "serviceVersion");
return label;
},

createReleasedDate: function(key, version) {
Expand Down Expand Up @@ -295,22 +297,6 @@ qx.Class.define("osparc.info.ServiceUtils", {
const title = serviceData["name"] + " - " + qx.locale.Manager.tr("Quality Assessment");
osparc.ui.window.Window.popUpInWindow(qualityEditor, title, 650, 700);
return qualityEditor;
},

patchServiceData: function(serviceData, fieldKey, value) {
const patchData = {};
patchData[fieldKey] = value;
const params = {
url: osparc.data.Resources.getServiceUrl(
serviceData["key"],
serviceData["version"]
),
data: patchData
};
return osparc.data.Resources.fetch("servicesDev", "patch", params)
.then(() => {
serviceData[fieldKey] = value;
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ qx.Class.define("osparc.metadata.ClassifiersEditor", {
});
} else {
const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.__resourceData);
osparc.info.ServiceUtils.patchServiceData(serviceDataCopy, "classifiers", newClassifiers)
osparc.service.Store.patchServiceData(serviceDataCopy, "classifiers", newClassifiers)
.then(() => {
osparc.FlashMessenger.getInstance().logAs(this.tr("Classifiers successfully edited"));
saveBtn.setFetching(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ qx.Class.define("osparc.metadata.QualityEditor", {
btn.setFetching(true);
if (osparc.utils.Resources.isService(this.__resourceData)) {
const serviceDataCopy = osparc.utils.Utils.deepCloneObject(this.__resourceData);
osparc.info.ServiceUtils.patchServiceData(serviceDataCopy, "quality", newQuality)
osparc.service.Store.patchServiceData(serviceDataCopy, "quality", newQuality)
.then(() => {
this.__initResourceData(serviceDataCopy);
this.fireDataEvent("updateQuality", serviceDataCopy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ qx.Class.define("osparc.pricing.ServicesList", {
const version = service["serviceVersion"];
const serviceMetadata = osparc.service.Store.getMetadata(key, version);
if (serviceMetadata) {
sList.push(qx.data.marshal.Json.createModel(serviceMetadata));
sList.push(new osparc.data.model.Service(serviceMetadata));
}
});

Expand All @@ -108,7 +108,6 @@ qx.Class.define("osparc.pricing.ServicesList", {
srvCat.addListener("addService", e => {
const data = e.getData();
const service = data.service;
console.log(service);
const params = {
url: {
pricingPlanId: this.getPricingPlanId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ qx.Class.define("osparc.service.ServiceList", {
group.add(button);
this._add(button);
button.addListener("dbltap", () => {
this.fireDataEvent("serviceAdd", button.getServiceModel());
this.fireDataEvent("serviceAdd", button.getService());
}, this);
button.addListener("keypress", e => {
if (e.getKeyIdentifier() === "Enter") {
this.fireDataEvent("serviceAdd", button.getServiceModel());
this.fireDataEvent("serviceAdd", button.getService());
}
}, this);
});
Expand All @@ -89,7 +89,7 @@ qx.Class.define("osparc.service.ServiceList", {
*/
getSelected: function() {
if (this.__buttonGroup && this.__buttonGroup.getSelection().length) {
return this.__buttonGroup.getSelection()[0].getServiceModel();
return this.__buttonGroup.getSelection()[0].getService();
}
return null;
},
Expand Down
Loading
Loading