@@ -30,6 +30,11 @@ qx.Class.define("osparc.Application", {
30
30
qx . locale . MTranslation
31
31
] ,
32
32
33
+ statics : {
34
+ MIN_WIDTH : 1240 ,
35
+ MIN_HEIGHT : 700
36
+ } ,
37
+
33
38
members : {
34
39
__current : null ,
35
40
__mainPage : null ,
@@ -61,15 +66,9 @@ qx.Class.define("osparc.Application", {
61
66
}
62
67
63
68
const webSocket = osparc . wrapper . WebSocket . getInstance ( ) ;
64
- webSocket . addListener ( "connect" , ( ) => {
65
- osparc . io . WatchDog . getInstance ( ) . setOnLine ( true ) ;
66
- } ) ;
67
- webSocket . addListener ( "disconnect" , ( ) => {
68
- osparc . io . WatchDog . getInstance ( ) . setOnLine ( false ) ;
69
- } ) ;
70
- webSocket . addListener ( "logout" , e => {
71
- this . logout ( ) ;
72
- } ) ;
69
+ webSocket . addListener ( "connect" , ( ) => osparc . io . WatchDog . getInstance ( ) . setOnLine ( true ) ) ;
70
+ webSocket . addListener ( "disconnect" , ( ) => osparc . io . WatchDog . getInstance ( ) . setOnLine ( false ) ) ;
71
+ webSocket . addListener ( "logout" , ( ) => this . logout ( ) ) ;
73
72
// alert the users that they are about to navigate away
74
73
// from osparc. unfortunately it is not possible
75
74
// to provide our own message here
@@ -88,15 +87,62 @@ qx.Class.define("osparc.Application", {
88
87
}
89
88
90
89
// Setting up auth manager
91
- osparc . auth . Manager . getInstance ( ) . addListener ( "logout" , function ( ) {
92
- this . __restart ( ) ;
93
- } , this ) ;
90
+ osparc . auth . Manager . getInstance ( ) . addListener ( "logout" , ( ) => this . __restart ( ) , this ) ;
94
91
95
92
this . __initRouting ( ) ;
96
93
this . __loadCommonCss ( ) ;
97
94
98
95
this . __updateTabName ( ) ;
99
96
this . __checkCookiesAccepted ( ) ;
97
+
98
+ // onload, load, DOMContentLoaded, appear... didn't work
99
+ // bit of a hack
100
+ setTimeout ( ( ) => this . __checkScreenSize ( ) , 100 ) ;
101
+ window . addEventListener ( "resize" , ( ) => this . __checkScreenSize ( ) ) ;
102
+ } ,
103
+
104
+ __checkScreenSize : function ( ) {
105
+ const title = this . tr ( "Oops, the window is a bit too small!" ) ;
106
+ const tooSmallWindow = new osparc . ui . window . SingletonWindow ( "tooSmallScreen" , title ) . set ( {
107
+ height : 100 ,
108
+ width : 400 ,
109
+ layout : new qx . ui . layout . VBox ( ) ,
110
+ appearance : "service-window" ,
111
+ showMinimize : false ,
112
+ showMaximize : false ,
113
+ showClose : false ,
114
+ resizable : false ,
115
+ modal : true ,
116
+ contentPadding : 10
117
+ } ) ;
118
+ const w = document . documentElement . clientWidth ;
119
+ const h = document . documentElement . clientHeight ;
120
+ if ( this . self ( ) . MIN_WIDTH > w || this . self ( ) . MIN_HEIGHT > h ) {
121
+ const msg = this . tr ( `
122
+ oSPARC is designed for slightly bigger window size.<br>\
123
+ A mininum window size of ${ this . self ( ) . MIN_WIDTH } x${ this . self ( ) . MIN_HEIGHT } is recommended<br>\
124
+ Touch devices are not fully supported.
125
+ ` ) ;
126
+ const label = new qx . ui . basic . Label ( ) . set ( {
127
+ value : msg ,
128
+ rich : true
129
+ } ) ;
130
+ tooSmallWindow . add ( label , {
131
+ flex : 1
132
+ } ) ;
133
+ const okBtn = new qx . ui . form . Button ( this . tr ( "Got it" ) ) . set ( {
134
+ allowGrowX : false ,
135
+ allowGrowY : false ,
136
+ alignX : "right"
137
+ } ) ;
138
+ okBtn . addListener ( "execute" , ( ) => tooSmallWindow . close ( ) ) ;
139
+ tooSmallWindow . add ( okBtn ) ;
140
+ setTimeout ( ( ) => tooSmallWindow . center ( ) , 100 ) ;
141
+ tooSmallWindow . center ( ) ;
142
+ tooSmallWindow . open ( ) ;
143
+ } else {
144
+ tooSmallWindow . close ( ) ;
145
+ }
100
146
} ,
101
147
102
148
__initRouting : function ( ) {
@@ -262,9 +308,7 @@ qx.Class.define("osparc.Application", {
262
308
__loadLoginPage : function ( ) {
263
309
this . __disconnectWebSocket ( ) ;
264
310
const view = new osparc . auth . LoginPage ( ) ;
265
- view . addListener ( "done" , function ( msg ) {
266
- this . __restart ( ) ;
267
- } , this ) ;
311
+ view . addListener ( "done" , ( ) => this . __restart ( ) , this ) ;
268
312
this . __loadView ( view , {
269
313
top : "10%"
270
314
} ) ;
0 commit comments