Skip to content

Commit

Permalink
Merge branch 'master' into feature/max-studies
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 29, 2022
2 parents e440533 + 5d3fdaa commit 847278a
Show file tree
Hide file tree
Showing 28 changed files with 1,319 additions and 1,035 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,12 @@ qx.Class.define("osparc.component.editor.ThumbnailEditor", {
}
case "scroll-thumbnails": {
const thumbnailsLayout = this.getChildControl("thumbnails-layout");
control = new qx.ui.container.SlideBar().set({
control = new osparc.component.widget.SlideBar().set({
alignX: "center",
maxHeight: 170
});
control.setButtonsWidth(30);
thumbnailsLayout.add(control);
[
control.getChildControl("button-backward"),
control.getChildControl("button-forward")
].forEach(btn => {
btn.set({
maxWidth: 30,
maxHeight: 30,
alignY: "middle",
marginLeft: 5,
marginRight: 5,
icon: "@FontAwesome5Solid/ellipsis-h/16",
backgroundColor: "transparent"
});
});
control.setLayout(new qx.ui.layout.HBox(5).set({
alignX: "center"
}));
break;
}
case "buttons-layout":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ qx.Class.define("osparc.component.metadata.ServicesInStudy", {
this.base(arguments);

const grid = new qx.ui.layout.Grid(20, 5);
grid.setColumnMinWidth(this.self().GRID_POS.LABEL, 100);
grid.setColumnMaxWidth(this.self().GRID_POS.LABEL, 200);
grid.setColumnMinWidth(this.self().GRID_POS.LABEL, 80);
grid.setColumnMaxWidth(this.self().GRID_POS.LABEL, 180);
grid.setColumnFlex(this.self().GRID_POS.LABEL, 1);
grid.setColumnAlign(this.self().GRID_POS.LABEL, "left", "middle");
grid.setColumnAlign(this.self().GRID_POS.NAME, "left", "middle");
grid.setColumnMinWidth(this.self().GRID_POS.NAME, 80);
grid.setColumnMaxWidth(this.self().GRID_POS.NAME, 180);
this._setLayout(grid);

this._studyData = osparc.data.model.Study.deepCloneStudyObject(studyData);
Expand Down Expand Up @@ -157,6 +159,7 @@ qx.Class.define("osparc.component.metadata.ServicesInStudy", {
});

const labelLabel = new qx.ui.basic.Label(node["label"]).set({
toolTipText: node["label"],
font: "text-14"
});
this._add(labelLabel, {
Expand All @@ -170,8 +173,8 @@ qx.Class.define("osparc.component.metadata.ServicesInStudy", {
break;
}
const nameLabel = new qx.ui.basic.Label(nodeMetaData["name"]).set({
font: "text-14",
toolTipText: node["key"]
toolTipText: node["key"],
font: "text-14"
});
this._add(nameLabel, {
row: i,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,130 +16,66 @@
************************************************************************ */

qx.Class.define("osparc.component.service.SortServicesButtons", {
extend: qx.ui.core.Widget,
extend: qx.ui.form.MenuButton,

construct: function() {
this.base(arguments);
this.base(arguments, this.tr("Sort"), "@FontAwesome5Solid/chevron-down/10");

this._setLayout(new qx.ui.layout.HBox(4));
this.set({
marginRight: 8
});

const hitsBtn = this.__hitsBtn = new qx.ui.form.ToggleButton().set({
toolTipText: this.tr("Sort by Hits")
const sortByMenu = new qx.ui.menu.Menu().set({
font: "text-14"
});
hitsBtn.sortBy = "hits";
const nameBtn = this.__nameBtn = new qx.ui.form.ToggleButton().set({
toolTipText: this.tr("Sort by Name")
});
nameBtn.sortBy = "name";
this.setMenu(sortByMenu);

const hitsDesc = new qx.ui.menu.RadioButton(this.tr("Hits Desc"));
hitsDesc["sortBy"] = "hits";
hitsDesc["orderBy"] = "down";
const hitsAsc = new qx.ui.menu.RadioButton(this.tr("Hits Asc"));
hitsAsc["sortBy"] = "hits";
hitsAsc["orderBy"] = "up";
const nameAsc = new qx.ui.menu.RadioButton(this.tr("Name Asc"));
nameAsc["sortBy"] = "name";
nameAsc["orderBy"] = "down";
const nameDesc = new qx.ui.menu.RadioButton(this.tr("Name Desc"));
nameDesc["sortBy"] = "name";
nameDesc["orderBy"] = "up";
hitsDesc.addListener("execute", () => this.__btnExecuted(hitsDesc));
hitsAsc.addListener("execute", () => this.__btnExecuted(hitsAsc));
nameAsc.addListener("execute", () => this.__btnExecuted(nameAsc));
nameDesc.addListener("execute", () => this.__btnExecuted(nameDesc));

const sortByGroup = new qx.ui.form.RadioGroup();
[
hitsBtn,
nameBtn
hitsDesc,
hitsAsc,
nameAsc,
nameDesc
].forEach(btn => {
this._add(btn);
btn.getContentElement().setStyles({
"border-radius": "8px"
});
btn.addListener("tap", () => this.__btnExecuted(btn));
sortByMenu.add(btn);
sortByGroup.add(btn);
});

this.__hitsBtn.tristate = 1;
this.__nameBtn.tristate = 0;
this.__updateState();
},

events: {
"sortBy": "qx.event.type.Data"
},

statics: {
NUMERIC_ICON_DOWN: "@FontAwesome5Solid/sort-numeric-down/14",
NUMERIC_ICON_UP: "@FontAwesome5Solid/sort-numeric-up/14",
ALPHA_ICON_DOWN: "@FontAwesome5Solid/sort-alpha-down/14",
ALPHA_ICON_UP: "@FontAwesome5Solid/sort-alpha-up/14",
DefaultSorting: {
"sort": "hits",
"order": "down"
}
},

members: {
__hitsBtn: null,
__nameBtn: null,

__btnExecuted: function(btn) {
if (btn === this.__hitsBtn) {
this.__hitsBtn.tristate++;
if (this.__hitsBtn.tristate === 3) {
this.__hitsBtn.tristate = 1;
}
this.__nameBtn.tristate = 0;
} else if (btn === this.__nameBtn) {
this.__hitsBtn.tristate = 0;
this.__nameBtn.tristate++;
if (this.__nameBtn.tristate === 3) {
this.__nameBtn.tristate = 1;
}
}
this.__updateState();
this.__announceSortChange();
},

__updateState: function() {
switch (this.__hitsBtn.tristate) {
case 0:
this.__hitsBtn.set({
value: false,
icon: this.self().NUMERIC_ICON_DOWN
});
break;
case 1:
this.__hitsBtn.set({
value: true,
icon: this.self().NUMERIC_ICON_DOWN
});
break;
case 2:
this.__hitsBtn.set({
value: true,
icon: this.self().NUMERIC_ICON_UP
});
break;
}

switch (this.__nameBtn.tristate) {
case 0:
this.__nameBtn.set({
value: false,
icon: this.self().ALPHA_ICON_DOWN
});
break;
case 1:
this.__nameBtn.set({
value: true,
icon: this.self().ALPHA_ICON_DOWN
});
break;
case 2:
this.__nameBtn.set({
value: true,
icon: this.self().ALPHA_ICON_UP
});
break;
}
},

__announceSortChange: function() {
const data = {};
if (this.__hitsBtn.tristate > 0) {
data["sort"] = "hits";
data["order"] = this.__hitsBtn.tristate === 1 ? "down" : "up";
} else if (this.__nameBtn.tristate > 0) {
data["sort"] = "name";
data["order"] = this.__nameBtn.tristate === 1 ? "down" : "up";
}
const data = {
"sort": btn["sortBy"],
"order": btn["orderBy"]
};
this.fireDataEvent("sortBy", data);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ qx.Class.define("osparc.component.widget.NodesTree", {
const study = this.getStudy();
if (nodeId === study.getUuid()) {
const studyDetails = new osparc.studycard.Large(study);
const title = this.tr("Study Details");
const title = this.tr("Study Information");
const width = 500;
const height = 500;
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height);
Expand Down
Loading

0 comments on commit 847278a

Please sign in to comment.