@@ -84,14 +84,8 @@ qx.Class.define("osparc.support.ConversationPage", {
8484 } ) ;
8585 this . getChildControl ( "conversation-header-center-layout" ) . addAt ( control , 0 ) ;
8686 break ;
87- case "conversation-extra-content" :
88- control = new qx . ui . basic . Label ( ) . set ( {
89- font : "text-12" ,
90- textColor : "text-disabled" ,
91- rich : true ,
92- allowGrowX : true ,
93- selectable : true ,
94- } ) ;
87+ case "conversation-extra-layout" :
88+ control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 2 ) ) ;
9589 this . getChildControl ( "conversation-header-center-layout" ) . addAt ( control , 1 ) ;
9690 break ;
9791 case "open-project-button" :
@@ -159,40 +153,51 @@ qx.Class.define("osparc.support.ConversationPage", {
159153 title . setValue ( this . tr ( "Ask a Question" ) ) ;
160154 }
161155
162- const extraContextLabel = this . getChildControl ( "conversation-extra-content " ) ;
156+ const extraContextLayout = this . getChildControl ( "conversation-extra-layout " ) ;
163157 const amISupporter = osparc . store . Products . getInstance ( ) . amIASupportUser ( ) ;
164158 if ( conversation ) {
165- conversation . bind ( "extraContext" , extraContextLabel , "value" , {
166- converter : extraContext => {
167- let extraContextText = "" ;
168- if ( extraContext && Object . keys ( extraContext ) . length ) {
169- extraContextText = `Ticket ID: ${ conversation . getConversationId ( ) } ` ;
170- const contextProjectId = conversation . getContextProjectId ( ) ;
171- if ( contextProjectId && amISupporter ) {
172- extraContextText += `<br>Project ID: ${ contextProjectId } ` ;
173- }
174- const appointment = conversation . getAppointment ( ) ;
175- if ( appointment ) {
176- extraContextText += "<br>Appointment: " ;
177- if ( appointment === "requested" ) {
178- // still pending
179- extraContextText += appointment ;
180- } else {
181- // already set
182- extraContextText += osparc . utils . Utils . formatDateAndTime ( new Date ( appointment ) ) ;
183- }
159+ const createExtraContextLabel = text => {
160+ return new qx . ui . basic . Label ( text ) . set ( {
161+ font : "text-12" ,
162+ textColor : "text-disabled" ,
163+ rich : true ,
164+ allowGrowX : true ,
165+ selectable : true ,
166+ } ) ;
167+ } ;
168+ const updateExtraContext = ( ) => {
169+ extraContextLayout . removeAll ( ) ;
170+ const extraContext = conversation . getExtraContext ( ) ;
171+ if ( extraContext && Object . keys ( extraContext ) . length ) {
172+ const ticketIdLabel = createExtraContextLabel ( `Ticket ID: ${ conversation . getConversationId ( ) } ` ) ;
173+ extraContextLayout . add ( ticketIdLabel ) ;
174+ const contextProjectId = conversation . getContextProjectId ( ) ;
175+ if ( contextProjectId && amISupporter ) {
176+ const projectIdLabel = createExtraContextLabel ( `Project ID: ${ contextProjectId } ` ) ;
177+ extraContextLayout . add ( projectIdLabel ) ;
178+ }
179+ const appointment = conversation . getAppointment ( ) ;
180+ if ( appointment ) {
181+ const appointmentLabel = createExtraContextLabel ( ) ;
182+ let appointmentText = "Appointment: " ;
183+ if ( appointment === "requested" ) {
184+ // still pending
185+ appointmentText += appointment ;
186+ } else {
187+ // already set
188+ appointmentText += osparc . utils . Utils . formatDateAndTime ( new Date ( appointment ) ) ;
189+ appointmentLabel . set ( {
190+ cursor : "pointer" ,
191+ toolTipText : osparc . utils . Utils . formatDateWithCityAndTZ ( new Date ( appointment ) ) ,
192+ } ) ;
184193 }
194+ appointmentLabel . setValue ( appointmentText ) ;
195+ extraContextLayout . add ( appointmentLabel ) ;
185196 }
186- return extraContextText ;
187197 }
188- } ) ;
189- extraContextLabel . bind ( "value" , extraContextLabel , "visibility" , {
190- converter : extraContext => {
191- return extraContext ? "visible" : "excluded" ;
192- }
193- } ) ;
194- } else {
195- extraContextLabel . exclude ( ) ;
198+ } ;
199+ updateExtraContext ( ) ;
200+ conversation . addListener ( "changeExtraContext" , ( ) => updateExtraContext ( ) , this ) ;
196201 }
197202
198203 const openProjectButton = this . getChildControl ( "open-project-button" ) ;
0 commit comments