-
Notifications
You must be signed in to change notification settings - Fork 31
✨ [Frontend] OEC to Support chat #8288
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 33 commits into
ITISFoundation:master
from
odeimaiz:feature/oec-to-support-chat
Sep 3, 2025
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
bc4d0df
UserThumbnail and UserDetails
odeimaiz 1c16217
minor
odeimaiz 7630abc
minor
odeimaiz 09cb300
Merge branch 'master' into feature/user-profile-details
odeimaiz b75cb30
Merge branch 'feature/user-profile-details' of github.com:odeimaiz/os…
odeimaiz 25544ad
UserDetails working
odeimaiz 7c79c57
last changes
odeimaiz 9b02b5a
Update services/static-webserver/client/source/class/osparc/user/User…
odeimaiz dfbb68e
init values
odeimaiz 864f05e
Merge branch 'feature/user-profile-details' of github.com:odeimaiz/os…
odeimaiz 804c18a
fix
odeimaiz 014a13a
Merge branch 'master' into feature/user-profile-details
odeimaiz f817ae9
Merge branch 'master' into feature/user-profile-details
odeimaiz 5aca687
Merge branch 'feature/user-profile-details' of github.com:odeimaiz/os…
odeimaiz e55362e
FlashMessageOEC
odeimaiz 15e2396
isSupportEnabled
odeimaiz 3146098
openSupportChat
odeimaiz b05f8ae
minor
odeimaiz a081457
minor
odeimaiz 86fed79
Merge branch 'master' into feature/oec-to-support-chat
odeimaiz 02e2d8d
Merge branch 'feature/oec-to-support-chat' of github.com:odeimaiz/osp…
odeimaiz 382a060
minor
odeimaiz 10319ee
populate support message
odeimaiz 447039c
minor
odeimaiz ae08c8a
Merge branch 'master' into feature/oec-to-support-chat
odeimaiz ffefc98
aesthetics
odeimaiz 1bdec7a
Merge branch 'feature/oec-to-support-chat' of github.com:odeimaiz/osp…
odeimaiz 7f7d761
refactor osparc.ui.window.Dialog
odeimaiz 8d713f3
ask for context
odeimaiz 26b68b4
minor
odeimaiz 74db1b4
__getSupportFriendlyContext
odeimaiz 9a33639
minor
odeimaiz 8f7a815
requests
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
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
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
158 changes: 158 additions & 0 deletions
158
services/static-webserver/client/source/class/osparc/ui/message/FlashMessageOEC.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,158 @@ | ||
/* ************************************************************************ | ||
|
||
osparc - the simcore frontend | ||
|
||
https://osparc.io | ||
|
||
Copyright: | ||
2025 IT'IS Foundation, https://itis.swiss | ||
|
||
License: | ||
MIT: https://opensource.org/licenses/MIT | ||
|
||
Authors: | ||
* Odei Maiz (odeimaiz) | ||
|
||
************************************************************************ */ | ||
|
||
qx.Class.define("osparc.ui.message.FlashMessageOEC", { | ||
extend: osparc.ui.message.FlashMessage, | ||
|
||
/** | ||
* Constructor for the FlashMessage. | ||
* | ||
* @param {String} message Message that the user will read. | ||
* @param {Number} duration | ||
* @param {String} supportId | ||
*/ | ||
construct: function(message, duration, supportId) { | ||
this.base(arguments, message, "ERROR", duration ? duration*2 : null); | ||
|
||
if (osparc.product.Utils.isSupportEnabled()) { | ||
this.getChildControl("contact-support"); | ||
} else { | ||
const oecAtom = this.getChildControl("oec-atom"); | ||
this.bind("supportId", oecAtom, "label"); | ||
} | ||
if (supportId) { | ||
this.setSupportId(supportId); | ||
} | ||
}, | ||
|
||
properties: { | ||
supportId: { | ||
check: "String", | ||
init: "", | ||
nullable: true, | ||
event: "changeSupportId", | ||
}, | ||
}, | ||
|
||
members: { | ||
_createChildControlImpl: function(id) { | ||
let control; | ||
switch (id) { | ||
case "oec-atom": | ||
control = new qx.ui.basic.Atom().set({ | ||
icon: "@FontAwesome5Solid/copy/10", | ||
iconPosition: "right", | ||
gap: 8, | ||
cursor: "pointer", | ||
alignX: "center", | ||
allowGrowX: false, | ||
}); | ||
control.addListener("tap", () => this.__copyToClipboard()); | ||
this.addWidget(control); | ||
break; | ||
case "contact-support": | ||
control = new qx.ui.basic.Atom().set({ | ||
label: this.tr("Contact Support"), | ||
icon: "@FontAwesome5Solid/comments/10", | ||
iconPosition: "left", | ||
gap: 8, | ||
cursor: "pointer", | ||
alignX: "center", | ||
allowGrowX: false, | ||
}); | ||
control.addListener("tap", () => this.__openSupportChat()); | ||
this.addWidget(control); | ||
break; | ||
} | ||
return control || this.base(arguments, id); | ||
}, | ||
|
||
__getContext: function() { | ||
const dataToClipboard = { | ||
message: this.getMessage(), | ||
supportId: this.getSupportId(), | ||
timestamp: new Date().toString(), | ||
url: window.location.href, | ||
releaseTag: osparc.utils.Utils.getReleaseTag(), | ||
} | ||
if (osparc.store.Store.getInstance().getCurrentStudy()) { | ||
dataToClipboard["projectId"] = osparc.store.Store.getInstance().getCurrentStudy().getUuid(); | ||
} | ||
return osparc.utils.Utils.prettifyJson(dataToClipboard); | ||
}, | ||
|
||
__getSupportFriendlyContext: function() { | ||
let curatedText = "Extra Context:"; | ||
curatedText += "\nError: " + this.getMessage(); | ||
curatedText += "\nSupportID: " + this.getSupportId(); | ||
curatedText += "\nTimestamp: " + new Date().toISOString(); | ||
curatedText += "\nURL: " + window.location.href; | ||
curatedText += "\nRelease Tag: " + osparc.utils.Utils.getReleaseTag(); | ||
if (osparc.store.Store.getInstance().getCurrentStudy()) { | ||
curatedText += "\nProject ID: " + osparc.store.Store.getInstance().getCurrentStudy().getUuid(); | ||
} | ||
return curatedText; | ||
}, | ||
|
||
__copyToClipboard: function() { | ||
osparc.utils.Utils.copyTextToClipboard(this.__getContext()); | ||
}, | ||
|
||
__openSupportChat: function() { | ||
const supportCenter = osparc.support.SupportCenter.openWindow(); | ||
supportCenter.openConversation(null); | ||
|
||
const textToAddMessageField = msg => { | ||
if ( | ||
supportCenter.getChildControl("conversation-page") && | ||
supportCenter.getChildControl("conversation-page").getChildControl("conversation-content") && | ||
supportCenter.getChildControl("conversation-page").getChildControl("conversation-content").getChildControl("add-message") && | ||
supportCenter.getChildControl("conversation-page").getChildControl("conversation-content").getChildControl("add-message").getChildControl("comment-field") | ||
) { | ||
supportCenter.getChildControl("conversation-page").getChildControl("conversation-content").getChildControl("add-message").getChildControl("comment-field").setText(msg); | ||
supportCenter.getChildControl("conversation-page").getChildControl("conversation-content").getChildControl("add-message").addComment(); | ||
} | ||
} | ||
|
||
const caption = this.tr("Something went wrong"); | ||
const introText = this.tr("Please describe what you were doing before the error (optional).\nThis will help our support team understand the context and resolve the issue faster."); | ||
const confirmationWindow = new osparc.ui.window.Confirmation(introText); | ||
confirmationWindow.setCaption(caption); | ||
confirmationWindow.getChildControl("message-label").setFont("text-13"); | ||
const extraContextTA = new qx.ui.form.TextArea().set({ | ||
font: "text-13", | ||
autoSize: true, | ||
minHeight: 70, | ||
maxHeight: 140 | ||
}); | ||
confirmationWindow.addWidget(extraContextTA); | ||
confirmationWindow.addCancelButton(); | ||
confirmationWindow.setConfirmText(this.tr("Send Report")); | ||
confirmationWindow.open(); | ||
confirmationWindow.addListener("close", () => { | ||
if (confirmationWindow.getConfirmed()) { | ||
const extraContext = extraContextTA.getValue() | ||
const friendlyContext = this.__getSupportFriendlyContext(); | ||
const text = "Dear Support Team,\n" + extraContext + "\n" + friendlyContext; | ||
textToAddMessageField(text); | ||
} else { | ||
supportCenter.close(); | ||
} | ||
}); | ||
}, | ||
} | ||
}); |
Oops, something went wrong.
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.