-
Notifications
You must be signed in to change notification settings - Fork 31
🐛 [Frontend] Redesign Logger log renderer #9044
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
Merged
odeimaiz
merged 18 commits into
ITISFoundation:master
from
odeimaiz:fix/prj-conversation
Apr 20, 2026
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6ca6f24
fix
odeimaiz 1993050
Merge branch 'master' into fix/prj-conversation
odeimaiz 1efc466
PopUpLogMessage
odeimaiz fdefb86
colors
odeimaiz b90d89d
Merge branch 'fix/prj-conversation' of github.com:odeimaiz/osparc-sim…
odeimaiz 76ca305
log level
odeimaiz 9a2974e
copyToClipboard
odeimaiz 0812819
better practices
odeimaiz bdcc4bc
positioning
odeimaiz 8dfc1c9
rename
odeimaiz 9a2b1a8
aesthetics
odeimaiz 1b2be40
colors
odeimaiz 9f9beaa
minors
odeimaiz 4add03a
2000 logs max
odeimaiz 0bc670d
Update services/static-webserver/client/source/class/osparc/widget/lo…
odeimaiz 2fcf00b
Update services/static-webserver/client/source/class/osparc/ui/table/…
odeimaiz 9db3526
Merge branch 'fix/prj-conversation' of github.com:odeimaiz/osparc-sim…
odeimaiz ecd7da6
copilot reviews
odeimaiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
270 changes: 270 additions & 0 deletions
270
services/static-webserver/client/source/class/osparc/ui/table/rowrenderer/PopUpLogMessage.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,270 @@ | ||
| /* ************************************************************************ | ||
|
|
||
| osparc - the simcore frontend | ||
|
|
||
| https://osparc.io | ||
|
|
||
| Copyright: | ||
| 2026 IT'IS Foundation, https://itis.swiss | ||
|
|
||
| License: | ||
| MIT: https://opensource.org/licenses/MIT | ||
|
|
||
| Authors: | ||
| * Odei Maiz (odeimaiz) | ||
|
|
||
| ************************************************************************ */ | ||
|
|
||
| /** | ||
| * Row renderer for the Logger table that shows a popup with | ||
| * the full log message, timestamp, Node label, and log level when a row is clicked. | ||
| * | ||
| * The popup is added to the application root to avoid | ||
| * qooxdoo table pane clipping constraints (overflow:hidden at multiple levels). | ||
| */ | ||
| qx.Class.define("osparc.ui.table.rowrenderer.PopUpLogMessage", { | ||
| extend: qx.ui.table.rowrenderer.Default, | ||
|
|
||
| construct: function(table, messageColPos) { | ||
| this.base(arguments); | ||
|
|
||
| this.__table = table; | ||
| this.__messageColPos = messageColPos; | ||
| }, | ||
|
|
||
| statics: { | ||
| LOG_LEVEL_INFO: { | ||
| "-1": { | ||
| label: "DEBUG", | ||
| textColor: "white", | ||
| bgColor: "product-color" | ||
| }, | ||
| "0": { | ||
| label: "INFO", | ||
| textColor: "white", | ||
| bgColor: "product-color" | ||
| }, | ||
| "1": { | ||
| label: "WARNING", | ||
| textColor: "black", | ||
| bgColor: "warning-yellow" | ||
| }, | ||
| "2": { | ||
| label: "ERROR", | ||
| textColor: "black", | ||
| bgColor: "failed-red" | ||
| }, | ||
| }, | ||
| }, | ||
|
|
||
| members: { | ||
| __table: null, | ||
| __messageColPos: null, | ||
| __popup: null, | ||
| __activeRowIndex: null, | ||
| __scrollHandler: null, | ||
| __clickHandler: null, | ||
|
|
||
| __removeGlobalListeners: function() { | ||
| if (this.__scrollHandler) { | ||
| document.removeEventListener("scroll", this.__scrollHandler, true); | ||
| this.__scrollHandler = null; | ||
| } | ||
| if (this.__clickHandler) { | ||
| document.removeEventListener("mousedown", this.__clickHandler, true); | ||
| this.__clickHandler = null; | ||
| } | ||
| }, | ||
|
|
||
| __closePopup: function() { | ||
| this.__removeGlobalListeners(); | ||
| if (this.__popup) { | ||
| const root = qx.core.Init.getApplication().getRoot(); | ||
| if (root.indexOf(this.__popup) >= 0) { | ||
| root.remove(this.__popup); | ||
| } | ||
| this.__popup.dispose(); | ||
| this.__popup = null; | ||
| } | ||
| this.__activeRowIndex = null; | ||
| }, | ||
|
|
||
| __createBadge: function(rowData) { | ||
| if (!rowData || rowData.logLevel == null) { | ||
| return null; | ||
| } | ||
| const entry = this.self().LOG_LEVEL_INFO[String(rowData.logLevel)]; | ||
| if (!entry) { | ||
| return null; | ||
| } | ||
| const badge = new qx.ui.basic.Label(entry.label).set({ | ||
| font: "text-10", | ||
| padding: [2, 8], | ||
| textColor: entry.textColor, | ||
| backgroundColor: entry.bgColor, | ||
| decorator: "rounded", | ||
| allowGrowY: false, | ||
| allowGrowX: false, | ||
| }); | ||
| return badge; | ||
| }, | ||
|
|
||
| __showPopup: function(rowElem, rowIndex, rowData) { | ||
| this.__closePopup(); | ||
|
|
||
| const rect = rowElem.getBoundingClientRect(); | ||
|
|
||
| // Container | ||
| const popup = new qx.ui.container.Composite(new qx.ui.layout.VBox(4)).set({ | ||
| backgroundColor: "background-main-1", | ||
| padding: 8, | ||
| maxHeight: Math.round(window.innerHeight * 0.5), | ||
| width: Math.round(rect.width), | ||
| zIndex: osparc.utils.Utils.FLOATING_Z_INDEX, | ||
| }); | ||
|
|
||
| // Header | ||
| const header = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({ | ||
| alignY: "middle", | ||
| })).set({ | ||
| paddingBottom: 4, | ||
| }); | ||
|
|
||
| // Log level badge | ||
| const badge = this.__createBadge(rowData); | ||
| if (badge) { | ||
| header.add(badge); | ||
| } | ||
|
|
||
| // Timestamp | ||
| if (rowData && rowData.timeStamp) { | ||
| header.add(new qx.ui.basic.Label(String(rowData.timeStamp)).set({ | ||
| font: "text-11", | ||
| textColor: "text-opa70", | ||
| })); | ||
| } | ||
|
|
||
| // Node | ||
| if (rowData && rowData.label) { | ||
| header.add(new qx.ui.basic.Label(rowData.label).set({ | ||
| font: "text-11", | ||
| textColor: "text-opa70", | ||
| })); | ||
| } | ||
|
|
||
| // Spacer | ||
| header.add(new qx.ui.core.Spacer(), { | ||
| flex: 1 | ||
| }); | ||
|
|
||
| // Copy button | ||
| const copyBtn = osparc.utils.Utils.getCopyButton().set({ | ||
| backgroundColor: "transparent", | ||
| padding: 2, | ||
| }); | ||
| copyBtn.addListener("execute", () => { | ||
| const text = osparc.widget.logger.LoggerView.printRow(rowData); | ||
| osparc.utils.Utils.copyTextToClipboard(text); | ||
| }); | ||
| header.add(copyBtn); | ||
|
|
||
| // Close button | ||
| const closeBtn = new qx.ui.form.Button(null, "@MaterialIcons/close/14").set({ | ||
| backgroundColor: "transparent", | ||
| allowGrowY: false, | ||
| padding: 2, | ||
| }); | ||
| closeBtn.addListener("execute", () => this.__closePopup()); | ||
| header.add(closeBtn); | ||
|
|
||
| popup.add(header); | ||
|
|
||
| // Divider | ||
| const divider = new qx.ui.core.Widget().set({ | ||
| height: 1, | ||
| backgroundColor: "text-opa30", | ||
| allowGrowY: false, | ||
| }); | ||
| popup.add(divider); | ||
|
|
||
| // Message body (scrollable) | ||
| const scroll = new qx.ui.container.Scroll(); | ||
| const messageLabel = new qx.ui.basic.Label(rowData.msgRich || rowData.msg || "").set({ | ||
| rich: true, | ||
| selectable: true, | ||
| wrap: true, | ||
| }); | ||
| scroll.add(messageLabel); | ||
| popup.add(scroll, { flex: 1 }); | ||
|
|
||
| // Position: anchor to row, flip above if near bottom | ||
| const root = qx.core.Init.getApplication().getRoot(); | ||
| const viewportHeight = window.innerHeight; | ||
| let top; | ||
| if (rect.bottom > viewportHeight * 0.65) { | ||
| // Place above: we'll adjust after rendering | ||
| top = Math.max(0, Math.round(rect.top) - 200); | ||
| } else { | ||
| top = Math.round(rect.top); | ||
| } | ||
| root.add(popup, { | ||
| left: Math.round(rect.left), | ||
| top: top, | ||
| }); | ||
|
|
||
| // Adjust position after popup is rendered and has actual height | ||
| if (rect.bottom > viewportHeight * 0.65) { | ||
| popup.addListenerOnce("appear", () => { | ||
| const bounds = popup.getBounds(); | ||
| if (bounds) { | ||
| const adjustedTop = Math.max(0, Math.round(rect.bottom) - bounds.height); | ||
| popup.setLayoutProperties({ | ||
| left: Math.round(rect.left), | ||
| top: adjustedTop, | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| this.__popup = popup; | ||
| this.__activeRowIndex = rowIndex; | ||
|
|
||
| // Close on scroll since the fixed position becomes stale | ||
| this.__scrollHandler = () => this.__closePopup(); | ||
| document.addEventListener("scroll", this.__scrollHandler, true); | ||
|
|
||
| // Close on click outside | ||
| this.__clickHandler = e => { | ||
| if (popup.isDisposed()) { | ||
| this.__removeGlobalListeners(); | ||
| return; | ||
| } | ||
| const popupElem = popup.getContentElement().getDomElement(); | ||
| if (popupElem && !popupElem.contains(e.target)) { | ||
| this.__closePopup(); | ||
| } | ||
| }; | ||
| popup.addListenerOnce("appear", () => { | ||
| setTimeout(() => document.addEventListener("mousedown", this.__clickHandler, true), 0); | ||
| }); | ||
| }, | ||
|
|
||
| // overridden | ||
| updateDataRowElement: function(rowInfo, rowElem) { | ||
| this.base(arguments, rowInfo, rowElem); | ||
|
|
||
| const self = this; | ||
| const rowIndex = rowInfo.row; | ||
| // Capture rowData now — rowInfo is a shared mutable object reused across rows | ||
| const rowData = rowInfo.rowData; | ||
| rowElem.style.cursor = "pointer"; | ||
| rowElem.onclick = function() { | ||
| if (self.__activeRowIndex === rowIndex) { | ||
| self.__closePopup(); | ||
| } else { | ||
| self.__showPopup(rowElem, rowIndex, rowData); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.