Skip to content

Commit b9cc607

Browse files
committed
show OEC and copy object to clipboard
1 parent fef39e8 commit b9cc607

File tree

1 file changed

+15
-47
lines changed

1 file changed

+15
-47
lines changed

services/static-webserver/client/source/class/osparc/FlashMessenger.js

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -88,64 +88,32 @@ qx.Class.define("osparc.FlashMessenger", {
8888
const msg = this.extractMessage(error, defaultMessage);
8989
const flashMessage = this.getInstance().logAs(msg, "ERROR", duration);
9090
if (error && error["supportId"]) {
91-
flashMessage.addWidget(this.__createCopyEOCWidget(flashMessage, error["supportId"]));
91+
flashMessage.addWidget(this.__createCopyEOCWidget(msg, error["supportId"]));
9292
}
9393
return flashMessage;
9494
},
9595

96-
__createCopyEOCWidget: function(flashMessage, supportId) {
97-
const widget = new qx.ui.container.Composite(new qx.ui.layout.VBox()).set({
98-
paddingLeft: 8,
99-
paddingRight: 8,
100-
});
101-
const showErrorLabel = new qx.ui.basic.Atom().set({
102-
label: qx.locale.Manager.tr("Show Support ID"),
103-
icon: "@FontAwesome5Solid/chevron-right/10",
104-
cursor: "pointer",
105-
visibility: "visible",
106-
});
107-
widget.add(showErrorLabel);
108-
const hideErrorLabel = new qx.ui.basic.Atom().set({
109-
label: qx.locale.Manager.tr("Hide Support ID"),
110-
icon: "@FontAwesome5Solid/chevron-down/10",
111-
cursor: "pointer",
112-
visibility: "excluded",
113-
});
114-
widget.add(hideErrorLabel);
115-
const minorDoc = new qx.ui.basic.Label().set({
116-
value: qx.locale.Manager.tr("If you contact support, please include this Support ID so we can quickly locate the issue."),
117-
rich: true,
118-
wrap: true,
119-
visibility: "excluded",
120-
});
121-
widget.add(minorDoc);
96+
__createCopyEOCWidget: function(message, supportId) {
12297
const errorLabel = new qx.ui.basic.Atom().set({
12398
label: supportId,
12499
icon: "@FontAwesome5Solid/copy/10",
100+
iconPosition: "right",
101+
gap: 8,
125102
cursor: "pointer",
126-
visibility: "excluded",
103+
alignX: "center",
104+
allowGrowX: true,
127105
});
128-
widget.add(errorLabel);
129-
showErrorLabel.addListener("tap", () => {
130-
showErrorLabel.exclude();
131-
hideErrorLabel.show();
132-
minorDoc.show();
133-
errorLabel.show();
134-
135-
if (flashMessage.timer) {
136-
// let the user close it
137-
clearTimeout(flashMessage.timer);
138-
delete flashMessage.timer;
106+
errorLabel.addListener("tap", () => {
107+
const dataToClipboard = {
108+
message,
109+
supportId,
110+
timestamp: new Date().toString(),
111+
url: window.location.href,
112+
studyId: osparc.store.Store.getInstance().getCurrentStudy() ? osparc.store.Store.getInstance().getCurrentStudy().getUuid() : "",
139113
}
114+
osparc.utils.Utils.copyTextToClipboard(JSON.stringify(dataToClipboard));
140115
});
141-
hideErrorLabel.addListener("tap", () => {
142-
showErrorLabel.show();
143-
hideErrorLabel.exclude();
144-
minorDoc.exclude();
145-
errorLabel.exclude();
146-
});
147-
errorLabel.addListener("tap", () => osparc.utils.Utils.copyTextToClipboard(supportId));
148-
return widget;
116+
return errorLabel;
149117
},
150118
},
151119

0 commit comments

Comments
 (0)