Skip to content

Commit

Permalink
Merge branch 'master' into add-tags-to-rut
Browse files Browse the repository at this point in the history
  • Loading branch information
matusdrobuliak66 authored Nov 1, 2024
2 parents 5be720c + 0bc2185 commit 76a9009
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,33 +77,26 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
MODIFIED: {
row: 0,
column: 0,
rowSpan: 1,
colSpan: 2
},
UI_MODE: {
row: 0,
column: 3,
colSpan: 1
column: 1,
},
UPDATES: {
row: 0,
column: 4,
colSpan: 1
column: 2,
},
TSR: {
row: 1,
column: 0,
colSpan: 2
},
HITS: {
row: 1,
column: 2,
colSpan: 1
column: 1,
},
PERMISSION: {
row: 1,
column: 4,
colSpan: 1
column: 2,
}
}
},
Expand Down Expand Up @@ -173,7 +166,6 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
case "footer": {
const fgrid = new qx.ui.layout.Grid();
fgrid.setSpacing(2);
fgrid.setRowFlex(2, 1);
fgrid.setColumnFlex(0, 1);
control = new qx.ui.container.Composite().set({
backgroundColor: "background-card-overlay",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -924,8 +924,9 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
if (filterData.text) {
this.__changeContext("search");
} else {
// Back to My Workspace
this.__changeContext("studiesAndFolders", null, null);
const workspaceId = this.getCurrentWorkspaceId();
const folderId = this.getCurrentFolderId();
this.__changeContext("studiesAndFolders", workspaceId, folderId);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,21 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
return control || this.base(arguments, id);
},

__titleTapped: function() {
const workspaceId = this.getCurrentWorkspaceId();
const folderId = null;
this.setCurrentFolderId(folderId);
this.fireDataEvent("locationChanged", {
workspaceId,
folderId,
});
},

__buildLayout: function() {
this.getChildControl("icon");
const title = this.getChildControl("workspace-title");
title.resetCursor();
title.removeListener("tap", this.__titleTapped, this);
this.getChildControl("breadcrumbs");
this.getChildControl("edit-button").exclude();
this.resetAccessRights();
Expand All @@ -198,27 +210,16 @@ qx.Class.define("osparc.dashboard.StudyBrowserHeader", {
this.__setIcon("@FontAwesome5Solid/search/24");
title.set({
value: this.tr("Search results"),
cursor: "auto",
});
} else if (currentContext === "workspaces") {
this.__setIcon(osparc.store.Workspaces.iconPath(32));
title.set({
value: this.tr("Shared Workspaces"),
cursor: "auto",
})
} else if (currentContext === "studiesAndFolders") {
const workspaceId = this.getCurrentWorkspaceId();
title.set({
cursor: "pointer"
});
title.addListener("tap", () => {
const folderId = null;
this.setCurrentFolderId(folderId);
this.fireDataEvent("locationChanged", {
workspaceId,
folderId,
});
});
title.setCursor("pointer");
title.addListener("tap", this.__titleTapped, this);
const workspace = osparc.store.Workspaces.getInstance().getWorkspace(workspaceId);
if (workspace) {
const thumbnail = workspace.getThumbnail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ qx.Class.define("osparc.data.model.Study", {

workspaceId: {
check: "Number",
init: true,
init: null,
nullable: true,
event: "changeWorkspaceId"
},

folderId: {
check: "Number",
init: true,
init: null,
nullable: true,
event: "changeFolderId"
},
Expand All @@ -103,9 +103,9 @@ qx.Class.define("osparc.data.model.Study", {

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

prjOwner: {
Expand Down Expand Up @@ -356,11 +356,7 @@ qx.Class.define("osparc.data.model.Study", {
jsonObject[key] = this.getUi().serialize();
return;
}
const value = this.get(key);
if (value !== null) {
// only put the value in the payload if there is a value
jsonObject[key] = value;
}
jsonObject[key] = this.get(key);
});
return jsonObject;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,16 @@ qx.Class.define("osparc.service.PricingUnitsList", {
__populateList: function(pricingUnits) {
this.getChildControl("pricing-units-container").removeAll();

if (pricingUnits.length === 0) {
if (pricingUnits.length) {
const pUnits = new osparc.study.PricingUnits(pricingUnits, null, false);
this.getChildControl("pricing-units-container").add(pUnits);
} else {
const notFound = new qx.ui.basic.Label().set({
value: this.tr("No Tiers found"),
font: "text-14"
});
this.getChildControl("pricing-units-container").add(notFound);
return;
}

pricingUnits.forEach(pricingUnit => {
const pUnit = new osparc.study.PricingUnit(pricingUnit).set({
allowGrowY: false
});
this.getChildControl("pricing-units-container").add(pUnit);
});

const buttons = this.getChildControl("pricing-units-container").getChildren();
const keepDefaultSelected = () => {
buttons.forEach(btn => {
btn.setValue(btn.getUnitData().isDefault());
});
};
keepDefaultSelected();
buttons.forEach(btn => btn.addListener("execute", () => keepDefaultSelected()));
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
qx.Class.define("osparc.study.PricingUnits", {
extend: qx.ui.container.Composite,

construct: function(pricingUnits, preselectedPricingUnit) {
construct: function(pricingUnits, preselectedPricingUnit, changeSelectionAllowed = true) {
this.base(arguments);

this.set({
layout: new qx.ui.layout.HBox(5)
layout: new qx.ui.layout.HBox(5),
allowGrowY: false,
});

this.__buildLayout(pricingUnits, preselectedPricingUnit);
this.__buildLayout(pricingUnits, preselectedPricingUnit, changeSelectionAllowed);
},

properties: {
Expand All @@ -38,7 +39,7 @@ qx.Class.define("osparc.study.PricingUnits", {
},

members: {
__buildLayout: function(pricingUnits, preselectedPricingUnit) {
__buildLayout: function(pricingUnits, preselectedPricingUnit, changeSelectionAllowed) {
const buttons = [];
pricingUnits.forEach(pricingUnit => {
const button = new osparc.study.PricingUnit(pricingUnit);
Expand All @@ -47,7 +48,12 @@ qx.Class.define("osparc.study.PricingUnits", {
});

const groupOptions = new qx.ui.form.RadioGroup();
buttons.forEach(btn => groupOptions.add(btn));
buttons.forEach(btn => {
groupOptions.add(btn);
btn.bind("value", btn, "backgroundColor", {
converter: selected => selected ? "background-main-1" : "transparent"
});
});

if (preselectedPricingUnit) {
const buttonFound = buttons.find(button => button.getUnitData().getPricingUnitId() === preselectedPricingUnit["pricingUnitId"]);
Expand All @@ -63,12 +69,19 @@ qx.Class.define("osparc.study.PricingUnits", {
});
}

buttons.forEach(button => button.addListener("changeValue", e => {
if (e.getData()) {
const selectedUnitId = button.getUnitData().getPricingUnitId();
this.setSelectedUnitId(selectedUnitId);
buttons.forEach(button => {
if (!changeSelectionAllowed) {
button.setCursor("default");
}
}));
button.addListener("execute", () => {
if (changeSelectionAllowed) {
const selectedUnitId = button.getUnitData().getPricingUnitId();
this.setSelectedUnitId(selectedUnitId);
} else {
buttons.forEach(btn => btn.setValue(btn.getUnitData().isDefault()));
}
});
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,34 @@ qx.Class.define("osparc.widget.NodeOutputs", {
for (let i=0; i<portKeys.length; i++) {
const portKey = portKeys[i];
const value = (portKey in outputs && "value" in outputs[portKey]) ? outputs[portKey]["value"] : null;
if (value && typeof value === "object" && "store" in value && "eTag" in value) {
// it's a file in storage.
// check if the eTag changed before requesting the presigned link again
const eTag = value["eTag"];
const valueWidget = this.__getValueWidget(i);
if (eTag && valueWidget && valueWidget.eTag && eTag === valueWidget.eTag) {
continue;
}
}
this.__valueToGrid(value, i);
}
},

__getValueWidget: function(row) {
const children = this.__gridLayout.getChildren();
for (let i=0; i<children.length; i++) {
const child = children[i];
const layoutProps = child.getLayoutProperties();
if (
layoutProps.row === row &&
layoutProps.column === this.self().POS.VALUE
) {
return child;
}
}
return null;
},

__valueToGrid: function(value, row) {
let valueWidget = null;
if (value && typeof value === "object") {
Expand All @@ -179,6 +203,7 @@ qx.Class.define("osparc.widget.NodeOutputs", {
const fileId = value.path;
const filename = value.filename || osparc.file.FilePicker.getFilenameFromPath(value);
valueWidget.setValue(filename);
valueWidget.eTag = value["eTag"];
osparc.store.Data.getInstance().getPresignedLink(download, locationId, fileId)
.then(presignedLinkData => {
if ("resp" in presignedLinkData && presignedLinkData.resp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ qx.Class.define("osparc.workbench.DiskUsageController", {
let freeSpace = osparc.utils.Utils.bytesToSize(diskHostUsage.free);
let warningLevel = this.__getWarningLevel(diskHostUsage.free);

if ("STATE_VOLUMES" in data.usage) {
const diskVolsUsage = data.usage["STATE_VOLUMES"];
if ("STATES_VOLUMES" in data.usage) {
const diskVolsUsage = data.usage["STATES_VOLUMES"];
if (diskVolsUsage["used_percent"] > diskHostUsage["used_percent"]) {
// "STATE_VOLUMES" is more critical so it takes over
// "STATES_VOLUMES" is more critical so it takes over
freeSpace = osparc.utils.Utils.bytesToSize(diskVolsUsage.free);
warningLevel = this.__getWarningLevel(diskVolsUsage.free);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ qx.Class.define("osparc.workbench.DiskUsageIndicator", {
let progress = `${diskHostUsage["used_percent"]}%`;
let labelDiskSize = osparc.utils.Utils.bytesToSize(diskHostUsage.free);
let toolTipText = this.tr("Disk usage");
if ("STATE_VOLUMES" in diskUsage["usage"]) {
const diskVolsUsage = diskUsage["usage"]["STATE_VOLUMES"];
if ("STATES_VOLUMES" in diskUsage["usage"]) {
const diskVolsUsage = diskUsage["usage"]["STATES_VOLUMES"];
if (diskVolsUsage["used_percent"] > diskHostUsage["used_percent"]) {
// "STATE_VOLUMES" is more critical so it takes over
// "STATES_VOLUMES" is more critical so it takes over
color1 = this.__getIndicatorColor(diskVolsUsage.free);
progress = `${diskVolsUsage["used_percent"]}%`;
labelDiskSize = osparc.utils.Utils.bytesToSize(diskVolsUsage.free);
Expand Down

0 comments on commit 76a9009

Please sign in to comment.