Skip to content

Commit 2246675

Browse files
committed
addConversation
1 parent 1fb5fce commit 2246675

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

services/static-webserver/client/source/class/osparc/store/ConversationsSupport.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ qx.Class.define("osparc.store.ConversationsSupport", {
2424
"conversationDeleted": "qx.event.type.Data",
2525
},
2626

27+
statics: {
28+
TYPES: {
29+
SUPPORT: "SUPPORT",
30+
},
31+
},
32+
2733
members: {
2834
getConversations: function() {
2935
const params = {
@@ -52,7 +58,7 @@ qx.Class.define("osparc.store.ConversationsSupport", {
5258
return osparc.data.Resources.fetch("conversationsSupport", "getConversation", params);
5359
},
5460

55-
addConversation: function(name = "new 1", type = osparc.study.Conversations.TYPES.PROJECT_STATIC) {
61+
addConversation: function(name = "", type = osparc.store.ConversationsSupport.TYPES.SUPPORT) {
5662
const params = {
5763
data: {
5864
name,

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ qx.Class.define("osparc.support.SupportCenter", {
105105
break;
106106
}
107107
case "ask-a-question-button":
108-
control = new qx.ui.form.Button(this.tr("Ask a Question")).set({
108+
control = new osparc.ui.form.FetchButton(this.tr("Ask a Question")).set({
109109
appearance: "strong-button",
110110
center: true,
111111
});
@@ -150,14 +150,21 @@ qx.Class.define("osparc.support.SupportCenter", {
150150
},
151151

152152
__openConversation: function(conversationId) {
153-
this.getChildControl("conversation-back-button").show();
154153
const conversationContent = this.getChildControl("conversation-content");
155154
if (conversationId) {
156155
conversationContent.setConversationId(conversationId);
156+
this.__showConversation();
157157
} else {
158-
conversationContent.setConversationId(null);
158+
this.getChildControl("ask-a-question-button").setFetching(true);
159+
osparc.store.ConversationsSupport.getInstance().addConversation()
160+
.then(data => {
161+
conversationContent.setConversationId(data["conversationId"]);
162+
this.__showConversation();
163+
})
164+
.finally(() => {
165+
this.getChildControl("ask-a-question-button").setFetching(false);
166+
});
159167
}
160-
this.__showConversation();
161168
},
162169
}
163170
});

0 commit comments

Comments
 (0)