Skip to content

Commit 4585ae4

Browse files
authored
Merge branch 'master' into feature/listenToProjectDocumentWS
2 parents af18867 + 9845835 commit 4585ae4

File tree

15 files changed

+365
-133
lines changed

15 files changed

+365
-133
lines changed

packages/models-library/src/models_library/api_schemas_webserver/functions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
from typing import Annotated, TypeAlias
33

4-
from pydantic import Field
4+
from pydantic import Field, HttpUrl
55

66
from ..functions import (
77
Function,
@@ -116,6 +116,10 @@
116116

117117
class RegisteredSolverFunctionGet(RegisteredSolverFunction, OutputSchema):
118118
uid: Annotated[FunctionID, Field(alias="uuid")]
119+
created_at: Annotated[datetime.datetime, Field(alias="creationDate")]
120+
modified_at: Annotated[datetime.datetime, Field(alias="lastChangeDate")]
121+
access_rights: FunctionAccessRights | None = None
122+
thumbnail: HttpUrl | None = None
119123

120124

121125
class RegisteredProjectFunctionGet(RegisteredProjectFunction, OutputSchema):
@@ -124,7 +128,7 @@ class RegisteredProjectFunctionGet(RegisteredProjectFunction, OutputSchema):
124128
created_at: Annotated[datetime.datetime, Field(alias="creationDate")]
125129
modified_at: Annotated[datetime.datetime, Field(alias="lastChangeDate")]
126130
access_rights: FunctionAccessRights | None = None
127-
thumbnail: str | None = None
131+
thumbnail: HttpUrl | None = None
128132

129133

130134
class SolverFunctionToRegister(SolverFunction, InputSchema): ...

services/static-webserver/client/source/class/osparc/conversation/Conversation.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ qx.Class.define("osparc.conversation.Conversation", {
6464
__messages: null,
6565
__nextRequestParams: null,
6666
__messagesTitle: null,
67+
__messageScroll: null,
6768
__messagesList: null,
6869
__loadMoreMessages: null,
6970

@@ -147,10 +148,15 @@ qx.Class.define("osparc.conversation.Conversation", {
147148
this.__messagesTitle = new qx.ui.basic.Label();
148149
this._add(this.__messagesTitle);
149150

151+
// add spacer to keep the messages list at the bottom
152+
this._add(new qx.ui.core.Spacer(), {
153+
flex: 100 // high number to keep even a one message list at the bottom
154+
});
155+
150156
this.__messagesList = new qx.ui.container.Composite(new qx.ui.layout.VBox(5)).set({
151157
alignY: "middle"
152158
});
153-
const scrollView = new qx.ui.container.Scroll();
159+
const scrollView = this.__messageScroll = new qx.ui.container.Scroll();
154160
scrollView.add(this.__messagesList);
155161
this._add(scrollView, {
156162
flex: 1
@@ -197,7 +203,8 @@ qx.Class.define("osparc.conversation.Conversation", {
197203

198204
__reloadMessages: function(removeMessages = true) {
199205
if (this.getConversationId() === null) {
200-
this.__messagesTitle.setValue(this.tr("No messages yet"));
206+
// temporary conversation page
207+
this.__messagesTitle.setValue(this.tr("No Messages yet"));
201208
this.__messagesList.hide();
202209
this.__loadMoreMessages.hide();
203210
return;
@@ -226,7 +233,9 @@ qx.Class.define("osparc.conversation.Conversation", {
226233

227234
__updateMessagesNumber: function() {
228235
const nMessages = this.__messages.filter(msg => msg["type"] === "MESSAGE").length;
229-
if (nMessages === 1) {
236+
if (nMessages === 0) {
237+
this.__messagesTitle.setValue(this.tr("No Messages yet"));
238+
} else if (nMessages === 1) {
230239
this.__messagesTitle.setValue(this.tr("1 Message"));
231240
} else if (nMessages > 1) {
232241
this.__messagesTitle.setValue(nMessages + this.tr(" Messages"));
@@ -243,9 +252,9 @@ qx.Class.define("osparc.conversation.Conversation", {
243252
return;
244253
}
245254

246-
// determine insertion index for most‐recent‐first order
255+
// determine insertion index for latest‐first order
247256
const newTime = new Date(message["created"]);
248-
let insertAt = this.__messages.findIndex(m => new Date(m["created"]) < newTime);
257+
let insertAt = this.__messages.findIndex(m => new Date(m["created"]) > newTime);
249258
if (insertAt === -1) {
250259
insertAt = this.__messages.length;
251260
}
@@ -270,6 +279,12 @@ qx.Class.define("osparc.conversation.Conversation", {
270279
this.__messagesList.addAt(control, insertAt);
271280
}
272281

282+
// scroll to bottom
283+
// add timeout to ensure the scroll happens after the UI is updated
284+
setTimeout(() => {
285+
this.__messageScroll.scrollToY(this.__messageScroll.getChildControl("pane").getScrollMaxY());
286+
}, 50);
287+
273288
this.__updateMessagesNumber();
274289
},
275290

services/static-webserver/client/source/class/osparc/study/Conversations.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ qx.Class.define("osparc.study.Conversations", {
221221

222222
__addToPages: function(conversationPage) {
223223
const conversationsLayout = this.getChildControl("conversations-layout");
224+
if (conversationsLayout.getChildren().length === 1) {
225+
// remove the temporary conversation page
226+
if (conversationsLayout.getChildren()[0].getConversationId() === null) {
227+
conversationsLayout.remove(conversationsLayout.getChildren()[0]);
228+
}
229+
}
224230
conversationsLayout.add(conversationPage);
225231

226232
if (this.__newConversationButton === null) {
@@ -246,8 +252,11 @@ qx.Class.define("osparc.study.Conversations", {
246252
conversationsLayout.getChildControl("bar").add(newConversationButton);
247253
}
248254
// remove and add to move to last position
249-
conversationsLayout.getChildControl("bar").remove(this.__newConversationButton);
250-
conversationsLayout.getChildControl("bar").add(this.__newConversationButton);
255+
const bar = conversationsLayout.getChildControl("bar");
256+
if (bar.indexOf(this.__newConversationButton) > -1) {
257+
bar.remove(this.__newConversationButton);
258+
}
259+
bar.add(this.__newConversationButton);
251260
},
252261

253262
__removeConversationPage: function(conversationId, changeSelection = false) {

services/static-webserver/client/source/class/osparc/workbench/Annotation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ qx.Class.define("osparc.workbench.Annotation", {
277277
type: this.getType(),
278278
attributes: this.getAttributes(),
279279
color: this.getColor(), // TYPES.NOTE and TYPES.CONVERSATION do not need a color but backend expects it
280-
}
280+
};
281281
return serializeData;
282282
}
283283
}

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16078,6 +16078,9 @@ components:
1607816078
thumbnail:
1607916079
anyOf:
1608016080
- type: string
16081+
maxLength: 2083
16082+
minLength: 1
16083+
format: uri
1608116084
- type: 'null'
1608216085
title: Thumbnail
1608316086
type: object
@@ -16131,14 +16134,14 @@ components:
1613116134
type: string
1613216135
format: uuid
1613316136
title: Uuid
16134-
createdAt:
16137+
creationDate:
1613516138
type: string
1613616139
format: date-time
16137-
title: Createdat
16138-
modifiedAt:
16140+
title: Creationdate
16141+
lastChangeDate:
1613916142
type: string
1614016143
format: date-time
16141-
title: Modifiedat
16144+
title: Lastchangedate
1614216145
solverKey:
1614316146
type: string
1614416147
pattern: ^simcore/services/((comp|dynamic|frontend))/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$
@@ -16147,14 +16150,26 @@ components:
1614716150
type: string
1614816151
pattern: ^(0|[1-9]\d*)(\.(0|[1-9]\d*)){2}(-(0|[1-9]\d*|\d*[-a-zA-Z][-\da-zA-Z]*)(\.(0|[1-9]\d*|\d*[-a-zA-Z][-\da-zA-Z]*))*)?(\+[-\da-zA-Z]+(\.[-\da-zA-Z-]+)*)?$
1614916152
title: Solverversion
16153+
accessRights:
16154+
anyOf:
16155+
- $ref: '#/components/schemas/FunctionAccessRights'
16156+
- type: 'null'
16157+
thumbnail:
16158+
anyOf:
16159+
- type: string
16160+
maxLength: 2083
16161+
minLength: 1
16162+
format: uri
16163+
- type: 'null'
16164+
title: Thumbnail
1615016165
type: object
1615116166
required:
1615216167
- inputSchema
1615316168
- outputSchema
1615416169
- defaultInputs
1615516170
- uuid
16156-
- createdAt
16157-
- modifiedAt
16171+
- creationDate
16172+
- lastChangeDate
1615816173
- solverKey
1615916174
- solverVersion
1616016175
title: RegisteredSolverFunctionGet

0 commit comments

Comments
 (0)