Skip to content

Commit 3146098

Browse files
committed
openSupportChat
1 parent 15e2396 commit 3146098

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

services/static-webserver/client/source/class/osparc/support/SupportCenter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ qx.Class.define("osparc.support.SupportCenter", {
3737

3838
this.getChildControl("conversations-intro-text");
3939
this.getChildControl("conversations-list");
40-
if (!osparc.store.Products.getInstance().amIASupportUser()) {
41-
this.getChildControl("ask-a-question-button");
42-
}
40+
this.getChildControl("ask-a-question-button");
4341
},
4442

4543
statics: {

services/static-webserver/client/source/class/osparc/ui/message/FlashMessageOEC.js

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ qx.Class.define("osparc.ui.message.FlashMessageOEC", {
2929
this.base(arguments, message, "ERROR", duration*2);
3030

3131
if (osparc.product.Utils.isSupportEnabled()) {
32-
console.log("bring it to support chat");
32+
this.getChildControl("contact-support");
3333
} else {
3434
const oecAtom = this.getChildControl("oec-atom");
3535
this.bind("supportId", oecAtom, "label");
@@ -40,6 +40,7 @@ qx.Class.define("osparc.ui.message.FlashMessageOEC", {
4040
properties: {
4141
supportId: {
4242
check: "String",
43+
init: "",
4344
nullable: true,
4445
event: "changeSupportId",
4546
},
@@ -58,22 +59,46 @@ qx.Class.define("osparc.ui.message.FlashMessageOEC", {
5859
alignX: "center",
5960
allowGrowX: false,
6061
});
61-
control.addListener("tap", () => {
62-
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy();
63-
const dataToClipboard = {
64-
message: this.getMessage(),
65-
supportId: this.getSupportId(),
66-
timestamp: new Date().toString(),
67-
url: window.location.href,
68-
releaseTag: osparc.utils.Utils.getReleaseTag(),
69-
studyId: currentStudy ? currentStudy.getUuid() : "",
70-
}
71-
osparc.utils.Utils.copyTextToClipboard(osparc.utils.Utils.prettifyJson(dataToClipboard));
62+
control.addListener("tap", () => this.__copyToClipboard());
63+
this.addWidget(control);
64+
break;
65+
case "contact-support":
66+
control = new qx.ui.basic.Atom().set({
67+
label: this.tr("Contact Support"),
68+
icon: "@FontAwesome5Solid/comments/10",
69+
iconPosition: "left",
70+
gap: 8,
71+
cursor: "pointer",
72+
alignX: "center",
73+
allowGrowX: false,
7274
});
75+
control.addListener("tap", () => this.__openSupportChat());
7376
this.addWidget(control);
7477
break;
7578
}
7679
return control || this.base(arguments, id);
7780
},
81+
82+
__getContext: function() {
83+
const currentStudy = osparc.store.Store.getInstance().getCurrentStudy();
84+
const dataToClipboard = {
85+
message: this.getMessage(),
86+
supportId: this.getSupportId(),
87+
timestamp: new Date().toString(),
88+
url: window.location.href,
89+
releaseTag: osparc.utils.Utils.getReleaseTag(),
90+
studyId: currentStudy ? currentStudy.getUuid() : "",
91+
}
92+
osparc.utils.Utils.prettifyJson(dataToClipboard);
93+
},
94+
95+
__copyToClipboard: function() {
96+
osparc.utils.Utils.copyTextToClipboard(this.__getContext());
97+
},
98+
99+
__openSupportChat: function() {
100+
console.log(this.__getContext());
101+
osparc.support.SupportCenter.openWindow();
102+
},
78103
}
79104
});

0 commit comments

Comments
 (0)