@@ -31,18 +31,18 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
3131
3232 this . _setLayout ( new qx . ui . layout . VBox ( 15 ) ) ;
3333
34- this . __userProfileData = { } ;
35- this . __userPrivacyData = { } ;
36-
37- this . __fetchProfile ( ) ;
38-
3934 this . _add ( this . __createProfileUser ( ) ) ;
4035 this . _add ( this . __createPrivacySection ( ) ) ;
4136 if ( osparc . store . StaticInfo . is2FARequired ( ) ) {
4237 this . _add ( this . __create2FASection ( ) ) ;
4338 }
4439 this . _add ( this . __createPasswordSection ( ) ) ;
4540 this . _add ( this . __createDeleteAccount ( ) ) ;
41+
42+ this . __userProfileData = { } ;
43+ this . __userPrivacyData = { } ;
44+
45+ this . __fetchProfile ( ) ;
4646 } ,
4747
4848 statics : {
@@ -61,6 +61,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
6161 __userProfileData : null ,
6262 __userProfileModel : null ,
6363 __userProfileRenderer : null ,
64+ __privacyRenderer : null ,
6465 __updateProfileBtn : null ,
6566 __userPrivacyData : null ,
6667 __userPrivacyModel : null ,
@@ -69,10 +70,14 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
6970 __sms2FAItem : null ,
7071
7172 __fetchProfile : function ( ) {
73+ this . __userProfileRenderer . setEnabled ( false ) ;
74+ this . __privacyRenderer . setEnabled ( false ) ;
7275 osparc . data . Resources . getOne ( "profile" , { } , null , false )
7376 . then ( profile => {
7477 this . __setDataToProfile ( profile ) ;
7578 this . __setDataToPrivacy ( profile [ "privacy" ] ) ;
79+ this . __userProfileRenderer . setEnabled ( true ) ;
80+ this . __privacyRenderer . setEnabled ( true ) ;
7681 } )
7782 . catch ( err => console . error ( err ) ) ;
7883 } ,
@@ -124,7 +129,7 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
124129 const updatePhoneNumberButton = new qx . ui . form . Button ( null , "@FontAwesome5Solid/pencil-alt/12" ) . set ( {
125130 padding : [ 1 , 5 ] ,
126131 } ) ;
127- updatePhoneNumberButton . addListener ( "execute" , this . __openPhoneNumberUpdater ) ;
132+ updatePhoneNumberButton . addListener ( "execute" , ( ) => this . __openPhoneNumberUpdater ( ) , this ) ;
128133 widgets [ pos . PHONE ] = updatePhoneNumberButton ;
129134 }
130135 this . __userProfileRenderer . setWidgets ( widgets ) ;
@@ -169,8 +174,8 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
169174 if ( osparc . store . StaticInfo . is2FARequired ( ) ) {
170175 profileForm . add ( phoneNumber , "Phone Number" , null , "phoneNumber" ) ;
171176 }
172- const singleWithWidget = this . __userProfileRenderer = new osparc . ui . form . renderer . SingleWithWidget ( profileForm ) ;
173- box . add ( singleWithWidget ) ;
177+ this . __userProfileRenderer = new osparc . ui . form . renderer . SingleWithWidget ( profileForm ) ;
178+ box . add ( this . __userProfileRenderer ) ;
174179
175180 const expirationLayout = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 5 ) ) . set ( {
176181 paddingLeft : 16 ,
@@ -287,7 +292,6 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
287292 lastName . getValue ( ) !== this . __userProfileData [ "last_name" ] ;
288293 updateProfileBtn . setEnabled ( anyChanged ) ;
289294 } ;
290- valueChanged ( ) ;
291295 profileFields . forEach ( privacyField => privacyField . addListener ( "changeValue" , ( ) => valueChanged ( ) ) ) ;
292296
293297 return box ;
@@ -326,7 +330,8 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
326330 privacyForm . add ( hideUsername , "Hide Username" , null , "hideUsername" ) ;
327331 privacyForm . add ( hideFullname , "Hide Full Name" , null , "hideFullname" ) ;
328332 privacyForm . add ( hideEmail , "Hide Email" , null , "hideEmail" ) ;
329- box . add ( new qx . ui . form . renderer . Single ( privacyForm ) ) ;
333+ this . __privacyRenderer = new qx . ui . form . renderer . Single ( privacyForm ) ;
334+ box . add ( this . __privacyRenderer ) ;
330335
331336 const privacyModelCtrl = new qx . data . controller . Object ( privacyModel ) ;
332337 privacyModelCtrl . addTarget ( hideUsername , "value" , "hideUsername" , true ) ;
@@ -416,7 +421,6 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
416421 optOutMessage . exclude ( ) ;
417422 }
418423 } ;
419- valueChanged ( ) ;
420424 privacyFields . forEach ( privacyField => privacyField . addListener ( "changeValue" , ( ) => valueChanged ( ) ) ) ;
421425
422426 return box ;
@@ -603,11 +607,15 @@ qx.Class.define("osparc.desktop.account.ProfilePage", {
603607 } ) ;
604608 verifyPhoneNumberView . getChildControl ( "title" ) . exclude ( ) ;
605609 verifyPhoneNumberView . getChildControl ( "send-via-email-button" ) . exclude ( ) ;
606- osparc . ui . window . Window . popUpInWindow ( verifyPhoneNumberView , this . tr ( "Update Phone Number" ) , 330 , 135 ) . set ( {
610+ const win = osparc . ui . window . Window . popUpInWindow ( verifyPhoneNumberView , this . tr ( "Update Phone Number" ) , 330 , 135 ) . set ( {
607611 clickAwayClose : false ,
608612 resizable : false ,
609613 showClose : true
610614 } ) ;
615+ verifyPhoneNumberView . addListener ( "done" , ( ) => {
616+ win . close ( ) ;
617+ this . __fetchProfile ( ) ;
618+ } , this ) ;
611619 } ,
612620 }
613621} ) ;
0 commit comments