Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3030929
book-a-call-button
odeimaiz Sep 3, 2025
4294b91
minor
odeimaiz Sep 3, 2025
362dba4
refactor
odeimaiz Sep 3, 2025
1983b3c
msg
odeimaiz Sep 3, 2025
e5d091f
renameConversation
odeimaiz Sep 3, 2025
5b0fced
patchExtraContext
odeimaiz Sep 3, 2025
884d066
returns
odeimaiz Sep 3, 2025
9fbff0b
use promise
odeimaiz Sep 3, 2025
7e7e460
minor
odeimaiz Sep 3, 2025
b8367ef
patchConversation
odeimaiz Sep 3, 2025
b608a55
Appointment
odeimaiz Sep 3, 2025
6ff873c
Merge branch 'master' into feature/sc-request-call
odeimaiz Sep 3, 2025
b36e7d9
getAddMessageField
odeimaiz Sep 3, 2025
12c3aec
Update services/static-webserver/client/source/class/osparc/ui/messag…
odeimaiz Sep 3, 2025
0038982
Merge branch 'feature/sc-request-call' of github.com:odeimaiz/osparc-…
odeimaiz Sep 3, 2025
13b73a6
minor
odeimaiz Sep 3, 2025
750367d
minor
odeimaiz Sep 3, 2025
48da413
DateTimeField
odeimaiz Sep 3, 2025
8f93e8c
set-appointment-button
odeimaiz Sep 3, 2025
f76c165
popup
odeimaiz Sep 3, 2025
0d4c079
avoid past dates
odeimaiz Sep 3, 2025
19e1e33
enh
odeimaiz Sep 3, 2025
ab579cd
DateTimeField working
odeimaiz Sep 3, 2025
0ad22a1
Merge branch 'master' into feature/sc-request-call
odeimaiz Sep 4, 2025
f30d308
Merge branch 'feature/sc-request-call' of github.com:odeimaiz/osparc-…
odeimaiz Sep 4, 2025
efdf2c7
setvalue
odeimaiz Sep 4, 2025
8407d9e
DateTimeChooser
odeimaiz Sep 4, 2025
158a8ed
Supporters are not allowed to patch the conversation metadata yet
odeimaiz Sep 4, 2025
0f124d0
comment
odeimaiz Sep 4, 2025
c17735e
Merge branch 'master' into feature/sc-request-call
odeimaiz Sep 4, 2025
26639f2
formatDateWithCity
odeimaiz Sep 4, 2025
b7974d5
minor
odeimaiz Sep 4, 2025
6eae4ad
formatDateWithCityAndTZ
odeimaiz Sep 4, 2025
41893e5
Merge branch 'feature/sc-request-call' of github.com:odeimaiz/osparc-…
odeimaiz Sep 4, 2025
32a9f00
minor
odeimaiz Sep 4, 2025
0e5b629
tooltip and pointer formatDateWithCityAndTZ
odeimaiz Sep 4, 2025
1588ad4
Merge branch 'master' into feature/sc-request-call
odeimaiz Sep 4, 2025
4733135
Merge branch 'master' into feature/sc-request-call
odeimaiz Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ qx.Class.define("osparc.conversation.AddMessage", {
addComment: function() {
const conversationId = this.getConversationId();
if (conversationId) {
this.__postMessage();
return this.__postMessage();
} else {
const studyData = this.getStudyData();
let promise = null;
Expand All @@ -191,10 +191,10 @@ qx.Class.define("osparc.conversation.AddMessage", {
}
promise = osparc.store.ConversationsSupport.getInstance().postConversation(extraContext);
}
promise
return promise
.then(data => {
this.setConversationId(data["conversationId"]);
this.__postMessage();
return this.__postMessage();
});
}
},
Expand All @@ -211,12 +211,14 @@ qx.Class.define("osparc.conversation.AddMessage", {
} else {
promise = osparc.store.ConversationsSupport.getInstance().postMessage(conversationId, content);
}
promise
return promise
.then(data => {
this.fireDataEvent("messageAdded", data);
commentField.getChildControl("text-area").setValue("");
return data;
});
}
return Promise.reject();
},

__editComment: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ qx.Class.define("osparc.data.Resources", {
method: "GET",
url: statics.API + "/conversations/{conversationId}"
},
renameConversation: {
patchConversation: {
method: "PATCH",
url: statics.API + "/conversations/{conversationId}"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ qx.Class.define("osparc.data.model.Conversation", {
});
},

patchExtraContext: function(extraContext) {
osparc.store.ConversationsSupport.getInstance().patchExtraContext(this.getConversationId(), extraContext)
.then(() => {
this.setExtraContext(extraContext);
});
},

addMessage: function(message) {
if (message) {
const found = this.__messages.find(msg => msg["messageId"] === message["messageId"]);
Expand Down Expand Up @@ -284,6 +291,27 @@ qx.Class.define("osparc.data.model.Conversation", {
return this.getExtraContext()["projectId"];
}
return null;
}
},

getAppointment: function() {
if (this.getExtraContext() && "appointment" in this.getExtraContext()) {
return this.getExtraContext()["appointment"];
}
return null;
},

setAppointment: function(appointment) {
const extraContext = this.getExtraContext() || {};
extraContext["appointment"] = appointment ? appointment.toISOString() : null;
// OM Supporters are not allowed to patch the conversation metadata yet
const backendAllowsPatch = osparc.store.Products.getInstance().amIASupportUser() ? false : true;
if (backendAllowsPatch) {
return osparc.store.ConversationsSupport.getInstance().patchExtraContext(this.getConversationId(), extraContext)
.then(() => {
this.setExtraContext(Object.assign({}, extraContext));
});
}
return Promise.resolve(this.setExtraContext(Object.assign({}, extraContext)));
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,19 @@ qx.Class.define("osparc.store.ConversationsSupport", {
name,
}
};
return osparc.data.Resources.fetch("conversationsSupport", "renameConversation", params);
return osparc.data.Resources.fetch("conversationsSupport", "patchConversation", params);
},

patchExtraContext: function(conversationId, extraContext) {
const params = {
url: {
conversationId,
},
data: {
extraContext,
}
};
return osparc.data.Resources.fetch("conversationsSupport", "patchConversation", params);
},

fetchLastMessage: function(conversationId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ qx.Class.define("osparc.support.ConversationPage", {
control.addListener("execute", () => this.__openProjectDetails());
this.getChildControl("conversation-header-layout").addAt(control, 2);
break;
case "set-appointment-button": {
control = new qx.ui.form.Button().set({
maxWidth: 26,
maxHeight: 24,
padding: [0, 6],
alignX: "center",
alignY: "middle",
icon: "@FontAwesome5Solid/clock/12",
});
control.addListener("execute", () => this.__openAppointmentDetails());
this.getChildControl("conversation-header-layout").addAt(control, 3);
break;
}
case "conversation-options": {
control = new qx.ui.form.MenuButton().set({
maxWidth: 24,
Expand All @@ -123,7 +136,7 @@ qx.Class.define("osparc.support.ConversationPage", {
});
renameButton.addListener("execute", () => this.__renameConversation());
menu.add(renameButton);
this.getChildControl("conversation-header-layout").addAt(control, 3);
this.getChildControl("conversation-header-layout").addAt(control, 4);
break;
}
case "conversation-content":
Expand All @@ -148,26 +161,52 @@ qx.Class.define("osparc.support.ConversationPage", {

const extraContextLabel = this.getChildControl("conversation-extra-content");
const amISupporter = osparc.store.Products.getInstance().amIASupportUser();
if (conversation && amISupporter) {
const extraContext = conversation.getExtraContext();
if (extraContext && Object.keys(extraContext).length) {
let extraContextText = `Ticket ID: ${conversation.getConversationId()}`;
const contextProjectId = conversation.getContextProjectId();
if (contextProjectId) {
extraContextText += `<br>Project ID: ${contextProjectId}`;
if (conversation) {
conversation.bind("extraContext", extraContextLabel, "value", {
converter: extraContext => {
let extraContextText = "";
if (extraContext && Object.keys(extraContext).length) {
extraContextText = `Ticket ID: ${conversation.getConversationId()}`;
const contextProjectId = conversation.getContextProjectId();
if (contextProjectId && amISupporter) {
extraContextText += `<br>Project ID: ${contextProjectId}`;
}
const appointment = conversation.getAppointment();
if (appointment) {
extraContextText += "<br>Appointment: ";
if (appointment === "requested") {
// still pending
extraContextText += appointment;
} else {
// already set
extraContextText += osparc.utils.Utils.formatDateAndTime(new Date(appointment));
}
}
}
return extraContextText;
}
extraContextLabel.setValue(extraContextText);
}
extraContextLabel.show();
});
extraContextLabel.bind("value", extraContextLabel, "visibility", {
converter: extraContext => {
return extraContext ? "visible" : "excluded";
}
});
} else {
extraContextLabel.exclude();
}

const openButton = this.getChildControl("open-project-button");
const openProjectButton = this.getChildControl("open-project-button");
if (conversation && conversation.getContextProjectId()) {
openButton.show();
openProjectButton.show();
} else {
openProjectButton.exclude();
}

const setAppointmentButton = this.getChildControl("set-appointment-button");
if (conversation && conversation.getAppointment() && amISupporter) {
setAppointmentButton.show();
} else {
openButton.exclude();
setAppointmentButton.exclude();
}

const options = this.getChildControl("conversation-options");
Expand All @@ -193,6 +232,17 @@ qx.Class.define("osparc.support.ConversationPage", {
}
},

__openAppointmentDetails: function() {
const win = new osparc.widget.DateTimeChooser();
win.addListener("dateChanged", e => {
const newValue = e.getData()["newValue"];
this.getConversation().setAppointment(newValue)
.catch(err => console.error(err));
win.close();
}, this);
win.open();
},

__renameConversation: function() {
let oldName = this.getConversation().getName();
if (oldName === "null") {
Expand All @@ -207,5 +257,19 @@ qx.Class.define("osparc.support.ConversationPage", {
renamer.center();
renamer.open();
},

__getAddMessageField: function() {
return this.getChildControl("conversation-content") &&
this.getChildControl("conversation-content").getChildControl("add-message");
},

postMessage: function(message) {
const addMessage = this.__getAddMessageField();
if (addMessage && addMessage.getChildControl("comment-field")) {
addMessage.getChildControl("comment-field").setText(message);
return addMessage.addComment();
}
return Promise.reject();
},
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ qx.Class.define("osparc.support.SupportCenter", {
this.getChildControl("conversations-intro-text");
this.getChildControl("conversations-list");
this.getChildControl("ask-a-question-button");
this.getChildControl("book-a-call-button");
},

statics: {
WINDOW_WIDTH: 430,
REQUEST_CALL_MESSAGE: "Dear Support,\nI would like to make an appointment for a support call.",

getMaxHeight: function() {
// height: max 80% of screen, or 600px
Expand Down Expand Up @@ -112,15 +114,29 @@ qx.Class.define("osparc.support.SupportCenter", {
});
break;
}
case "buttons-layout":
control = new qx.ui.container.Composite(new qx.ui.layout.HBox(10).set({
alignX: "center",
}));
this.getChildControl("conversations-layout").add(control);
break;
case "ask-a-question-button":
control = new osparc.ui.form.FetchButton(this.tr("Ask a Question")).set({
appearance: "strong-button",
allowGrowX: false,
center: true,
alignX: "center",
});
control.addListener("execute", () => this.openConversation(null), this);
this.getChildControl("conversations-layout").add(control);
this.getChildControl("buttons-layout").add(control);
break;
case "book-a-call-button":
control = new osparc.ui.form.FetchButton(this.tr("Book a Call")).set({
appearance: "strong-button",
allowGrowX: false,
center: true,
});
control.addListener("execute", () => this.createConversationBookCall(null), this);
this.getChildControl("buttons-layout").add(control);
break;
case "conversation-page":
control = new osparc.support.ConversationPage();
Expand Down Expand Up @@ -152,5 +168,30 @@ qx.Class.define("osparc.support.SupportCenter", {
this.__showConversation();
}
},

createConversationBookCall: function() {
const conversationPage = this.getChildControl("conversation-page");
conversationPage.setConversation(null);
this.__showConversation();
conversationPage.postMessage(osparc.support.SupportCenter.REQUEST_CALL_MESSAGE)
.then(data => {
const conversationId = data["conversationId"];
osparc.store.ConversationsSupport.getInstance().getConversation(conversationId)
.then(conversation => {
// update conversation name and patch extra_context
conversation.renameConversation("Book a call");
conversation.patchExtraContext({
...conversation.getExtraContext(),
"appointment": "requested"
});
// This should be an automatic response in the chat
const msg = this.tr("Your request has been sent.<br>Our support team will get back to you.");
osparc.FlashMessenger.logAs(msg, "INFO");
});
})
.catch(err => {
console.error("Error sending request call message", err);
});
},
}
});
Loading
Loading