Skip to content

Commit

Permalink
🎨 [Frontend] Highlight workbench elements (#6670)
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz authored Nov 5, 2024
1 parent e1354ea commit 2f0cfb0
Show file tree
Hide file tree
Showing 19 changed files with 98 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ qx.Class.define("osparc.file.FileDrop", {
}
}
return files;
}
},

ONE_FILE_ONLY: qx.locale.Manager.tr("Only one file at a time is accepted.") + "<br>" + qx.locale.Manager.tr("Please zip all files together."),
},

events: {
Expand Down Expand Up @@ -299,7 +301,7 @@ qx.Class.define("osparc.file.FileDrop", {
pos: this.__pointerFileEventToScreenPos(e)
});
} else {
osparc.FlashMessenger.getInstance().logAs(this.tr("Only one file at a time is accepted."), "ERROR");
osparc.FlashMessenger.getInstance().logAs(osparc.file.FileDrop.ONE_FILE_ONLY, "ERROR");
}
} else {
osparc.FlashMessenger.getInstance().logAs(this.tr("Folders are not accepted. You might want to upload a zip file."), "ERROR");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ qx.Class.define("osparc.file.FilePicker", {
},

uploadPendingFiles: function(files) {
if (files.length > 0) {
if (files.length) {
if (files.length === 1) {
const fileUploader = new osparc.file.FileUploader(this.getNode());
fileUploader.addListener("uploadAborted", () => this.__resetOutput());
Expand All @@ -428,7 +428,7 @@ qx.Class.define("osparc.file.FilePicker", {
fileUploader.retrieveUrlAndUpload(files[0]);
return true;
}
osparc.FlashMessenger.getInstance().logAs(this.tr("Only one file is accepted"), "ERROR");
osparc.FlashMessenger.getInstance().logAs(osparc.file.FileDrop.ONE_FILE_ONLY, "ERROR");
}
return false;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ qx.Class.define("osparc.form.renderer.PropForm", {
},

events: {
"highlightEdge": "qx.event.type.Data",
"linkFieldModified": "qx.event.type.Data",
"fileRequested": "qx.event.type.Data",
"filePickerRequested": "qx.event.type.Data",
Expand Down Expand Up @@ -928,6 +929,17 @@ qx.Class.define("osparc.form.renderer.PropForm", {
nodeUuid: fromNodeId,
output: fromPortId
};
const highlightEdgeUI = highlight => {
this.fireDataEvent("highlightEdge", {
highlight,
toNodeId: this.getNode().getNodeId(),
toPortId,
fromNodeId,
fromPortId,
});
};
ctrlLink.addListener("mouseover", () => highlightEdgeUI(true));
ctrlLink.addListener("mouseout", () => highlightEdgeUI(false));

const workbench = study.getWorkbench();
const fromNode = workbench.getNode(fromNodeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ qx.Class.define("osparc.info.StudyMedium", {
const title = this.tr("Study Information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height).set({
maxHeight: height
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ qx.Class.define("osparc.metadata.ServicesInStudy", {
const title = this.tr("Service information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height).set({
maxHeight: height
});
}, this);
this._servicesGrid.add(infoButton, {
row: i,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ qx.Class.define("osparc.navigation.StudyTitleWOptions", {
const title = this.tr("Information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(widget, title, width, height);
osparc.ui.window.Window.popUpInWindow(widget, title, width, height).set({
maxHeight: height
});
});
break;
case "study-menu-download-logs":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ qx.Class.define("osparc.node.slideshow.BaseNodeView", {
const title = this.tr("Service information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height).set({
maxHeight: height
});
},

__openInstructions: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ qx.Class.define("osparc.service.ServiceListItem", {
const title = this.tr("Service information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height).set({
maxHeight: height
});
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ qx.Theme.define("osparc.theme.Appearance", {
WINDOW-SMALL-CAP CHOOSER
---------------------------------------------------------------------------
*/
"window-small-cap": {
"node-ui-cap": {
include: "window", // get all the settings from window
alias: "window", // redirect kids to window/kid
style: function(states) {
return {
backgroundColor: states.selected ? "node-selected-background" : "node-background",
textColor: states.selected ? "text-selected" : "text",
decorator: states.maximized ? "window-small-cap-maximized" : "window-small-cap"
decorator: states.maximized ? "node-ui-cap-maximized" : "node-ui-cap"
};
}
},

"window-small-cap/captionbar": {
"node-ui-cap/captionbar": {
include: "window/captionbar", // load defaults from window captionbar
alias: "window/captionbar", // redirect kids
style: function(states) {
Expand All @@ -217,7 +217,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/title": {
"node-ui-cap/title": {
include: "window/title",
style: function(states) {
return {
Expand All @@ -228,7 +228,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/minimize-button": {
"node-ui-cap/minimize-button": {
alias: "window/minimize-button",
include: "window/minimize-button",
style: function(states) {
Expand All @@ -238,7 +238,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/restore-button": {
"node-ui-cap/restore-button": {
alias: "window/restore-button",
include: "window/restore-button",
style: function(states) {
Expand All @@ -248,7 +248,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/maximize-button": {
"node-ui-cap/maximize-button": {
alias: "window/maximize-button",
include: "window/maximize-button",
style: function(states) {
Expand All @@ -258,7 +258,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/close-button": {
"node-ui-cap/close-button": {
alias: "window/close-button",
include: "window/close-button",
style: function(states) {
Expand All @@ -268,7 +268,7 @@ qx.Theme.define("osparc.theme.Appearance", {
}
},

"window-small-cap/progress": "progressbar",
"node-ui-cap/progress": "progressbar",

"service-window": {
include: "window",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ qx.Theme.define("osparc.theme.ColorDark", {
"window-caption-background-active": "background-main-3",
"window-caption-text": "text",
"window-caption-text-active": "c12",
"window-border": "background-main-2",
"window-border-inner": "background-main-1",

// material-button
"material-button-background": "fab-background",
Expand Down Expand Up @@ -111,10 +113,6 @@ qx.Theme.define("osparc.theme.ColorDark", {
"button-box-pressed": "background-main-4",
"border-lead": "c07",

// window
"window-border": "background-main-2",
"window-border-inner": "background-main-1",

// group box
"white-box-border": "background-main-2",

Expand Down Expand Up @@ -172,7 +170,7 @@ qx.Theme.define("osparc.theme.ColorDark", {
"workbench-start-hint": "#505050",

"node-background": "rgba(113, 157, 181, 0.5)",
"node-selected-background": "background-selected",
"node-selected-background": "strong-main",
"node-title-text": "text-selected",
"node-port-text": "#454545",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ qx.Theme.define("osparc.theme.ColorLight", {
"window-caption-background-active": "background-main-3",
"window-caption-text": "text",
"window-caption-text-active": "c12",
"window-border": "background-main-2",
"window-border-inner": "background-main-1",

// material-button
"material-button-background": "fab-background",
Expand Down Expand Up @@ -111,10 +113,6 @@ qx.Theme.define("osparc.theme.ColorLight", {
"button-box-pressed": "background-main-4",
"border-lead": "c07",

// window
"window-border": "background-main-2",
"window-border-inner": "background-main-1",

// group box
"white-box-border": "background-main-2",

Expand Down Expand Up @@ -172,7 +170,7 @@ qx.Theme.define("osparc.theme.ColorLight", {
"workbench-start-hint": "#AFAFAF",

"node-background": "rgba(113, 157, 181, 0.35)",
"node-selected-background": "background-selected",
"node-selected-background": "strong-main",
"node-title-text": "#232323",
"node-port-text": "#454545",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ qx.Theme.define("osparc.theme.Decoration", {
}
},

"window-small-cap": {
"node-ui-cap": {
include: "service-window",
style: {
shadowBlurRadius: 0,
Expand All @@ -150,7 +150,7 @@ qx.Theme.define("osparc.theme.Decoration", {
}
},

"window-small-cap-maximized": {
"node-ui-cap-maximized": {
include: "service-window-maximized",
style: {
width: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ qx.Class.define("osparc.widget.NodesTree", {
if (nodeId === study.getUuid()) {
const studyDetails = new osparc.info.StudyLarge(study);
const title = this.tr("Study Information");
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height).set({
maxHeight: height
});
} else {
const node = study.getWorkbench().getNode(nodeId);
const serviceDetails = new osparc.info.ServiceLarge(node.getMetaData(), {
Expand All @@ -294,7 +296,9 @@ qx.Class.define("osparc.widget.NodesTree", {
studyId: study.getUuid()
});
const title = this.tr("Service information");
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height).set({
maxHeight: height
});
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ qx.Class.define("osparc.widget.Renamer", {
const minWidth = 150;
const labelWidth = oldLabel ? Math.min(Math.max(parseInt(oldLabel.length*4), minWidth), maxWidth) : minWidth;
this.set({
appearance: "window-small-cap",
layout: new qx.ui.layout.VBox(5),
autoDestroy: true,
padding: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ qx.Class.define("osparc.widget.StudyTitleOnlyTree", {
const title = this.tr("Study Information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(studyDetails, title, width, height).set({
maxHeight: height
});
},

selectStudyItem: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ qx.Class.define("osparc.workbench.BaseNodeUI", {
grid.setColumnFlex(1, 1);

this.set({
appearance: "node-ui-cap",
layout: grid,
showMinimize: false,
showMaximize: false,
Expand Down Expand Up @@ -84,11 +85,6 @@ qx.Class.define("osparc.workbench.BaseNodeUI", {
nullable: false
},

appearance: {
init: "window-small-cap",
refine: true
},

isMovable: {
check: "Boolean",
init: true,
Expand All @@ -113,8 +109,8 @@ qx.Class.define("osparc.workbench.BaseNodeUI", {
},

captionHeight: function() {
return osparc.theme.Appearance.appearances["window-small-cap/captionbar"].style().height ||
osparc.theme.Appearance.appearances["window-small-cap/captionbar"].style().minHeight;
return osparc.theme.Appearance.appearances["node-ui-cap/captionbar"].style().height ||
osparc.theme.Appearance.appearances["node-ui-cap/captionbar"].style().minHeight;
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ qx.Class.define("osparc.workbench.EdgeUI", {
}
},

setHighlighted: function(highlight) {
if (highlight) {
const strongColor = qx.theme.manager.Color.getInstance().resolve("strong-main");
osparc.wrapper.Svg.updateCurveColor(this.getRepresentation(), strongColor);
} else {
this.__updateEdgeState();
}
},

getEdgeId: function() {
return this.getEdge().getEdgeId();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ qx.Class.define("osparc.workbench.ServiceCatalog", {
const title = this.tr("Service information");
const width = osparc.info.CardLarge.WIDTH;
const height = osparc.info.CardLarge.HEIGHT;
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height);
osparc.ui.window.Window.popUpInWindow(serviceDetails, title, width, height).set({
maxHeight: height,
});
},

__onCancel: function() {
Expand Down
Loading

0 comments on commit 2f0cfb0

Please sign in to comment.