12
12
use app \models \ContactForm ;
13
13
use app \models \ServiceAutoaccept ;
14
14
use app \models \OndemandAutoaccept ;
15
+ use app \models \JupyterAutoaccept ;
15
16
use app \models \ColdStorageAutoaccept ;
16
17
use app \models \ServiceLimits ;
17
18
use app \models \OndemandLimits ;
19
+ use app \models \JupyterLimits ;
20
+ use app \models \JupyterServer ;
18
21
use app \models \ColdStorageLimits ;
19
22
use app \models \Configuration ;
20
23
use app \models \Openstack ;
@@ -110,13 +113,18 @@ public function actionConfigure()
110
113
$ smtp = Smtp::find ()->one ();
111
114
$ openstack =Openstack::find ()->one ();
112
115
$ openstackMachines =OpenstackMachines::find ()->one ();
116
+ $ jupyter =JupyterAutoaccept::find ()->where (['user_type ' =>$ currentUser ])->one ();
117
+ $ jupyterLimits =JupyterLimits::find ()->where (['user_type ' =>$ currentUser ])->one ();
118
+
119
+
120
+
113
121
114
122
115
123
$ general =Configuration::find ()->one ();
116
124
$ pages =Page::getPagesDropdown ();
117
125
118
- $ activeButtons =['' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ];
119
- $ activeTabs =['' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ];
126
+ $ activeButtons =['' ,'' ,'' ,'' ,'' ,'' ,'' ,'' , '' ];
127
+ $ activeTabs =['' ,'' ,'' ,'' ,'' ,'' ,'' ,'' , '' ];
120
128
121
129
if (!isset ($ _POST ['hidden-active-button ' ]))
122
130
{
@@ -148,6 +156,7 @@ public function actionConfigure()
148
156
&& ($ coldStorageLimits ->load (Yii::$ app ->request ->post ())) && ($ serviceLimits ->load (Yii::$ app ->request ->post ()))
149
157
&& ($ ondemandLimits ->load (Yii::$ app ->request ->post ())) && ($ smtp ->load (Yii::$ app ->request ->post ()))
150
158
&& ($ openstack ->load (Yii::$ app ->request ->post ())) && $ openstackMachines ->load (Yii::$ app ->request ->post ())
159
+ && ($ jupyter ->load (Yii::$ app ->request ->post ())) && ($ jupyterLimits ->load (Yii::$ app ->request ->post ()))
151
160
)
152
161
{
153
162
@@ -171,6 +180,10 @@ public function actionConfigure()
171
180
$ isValid = $ coldStorageLimits ->validate () && $ isValid ;
172
181
$ isValid = $ serviceLimits ->validate () && $ isValid ;
173
182
$ isValid = $ ondemandLimits ->validate () && $ isValid ;
183
+ $ isValid = $ jupyter ->validate () && $ isValid ;
184
+ $ isValid = $ jupyterLimits ->validate () && $ isValid ;
185
+
186
+
174
187
if ($ isValid )
175
188
{
176
189
@@ -227,6 +240,12 @@ public function actionConfigure()
227
240
$ ondemandLimits ->updateDB ($ previousUserType );
228
241
}
229
242
243
+ $ jupyter ->updateDB ($ previousUserType );
244
+ $ jupyterLimits ->updateDB ($ previousUserType );
245
+
246
+
247
+
248
+
230
249
$ max_autoaccepted_volumes =Project::getMaximumActiveAcceptedProjects (2 ,$ previousUserType ,2 );
231
250
$ max_accepted_volumes =Project::getMaximumActiveAcceptedProjects (2 ,$ previousUserType ,[1 ,2 ]);
232
251
@@ -278,7 +297,8 @@ public function actionConfigure()
278
297
$ coldStorageLimits =ColdStorageLimits::find ()->where (['user_type ' =>$ currentUser ])->one ();
279
298
$ machineComputationLimits =MachineComputeLimits::find ()->where (['user_type ' =>$ currentUser ])->one ();
280
299
$ general =Configuration::find ()->one ();
281
-
300
+ $ jupyter =JupyterAutoaccept::find ()->where (['user_type ' =>$ currentUser ])->one ();
301
+ $ jupyterLimits =JupyterLimits::find ()->where (['user_type ' =>$ currentUser ])->one ();
282
302
283
303
284
304
$ activeButton =$ _POST ['hidden-active-button ' ];
@@ -326,6 +346,14 @@ public function actionConfigure()
326
346
$ activeButtons [7 ]='button-active ' ;
327
347
$ activeTabs [7 ]='tab-active ' ;
328
348
$ hiddenActiveButton ='openstack-machines-button ' ;
349
+
350
+
351
+
352
+ } else if ($ activeButton =='jupyter-button ' )
353
+ {
354
+ $ activeButtons [8 ]='button-active ' ;
355
+ $ activeTabs [8 ]='tab-active ' ;
356
+ $ hiddenActiveButton ='jupyter-button ' ;
329
357
}
330
358
else
331
359
{
@@ -342,6 +370,7 @@ public function actionConfigure()
342
370
343
371
return $ this ->render ('configure ' ,['form_params ' =>$ form_params ,'service ' =>$ service ,
344
372
'ondemand ' =>$ ondemand ,'general ' =>$ general ,
373
+ 'jupyter ' =>$ jupyter , 'jupyterLimits ' =>$ jupyterLimits ,
345
374
'coldStorage ' =>$ coldStorage , 'success ' =>$ success ,
346
375
"hiddenUser " => $ currentUser ,'userTypes ' =>$ userTypes , 'serviceLimits ' =>$ serviceLimits ,
347
376
'ondemandLimits ' =>$ ondemandLimits ,'coldStorageLimits ' =>$ coldStorageLimits ,
@@ -354,6 +383,7 @@ public function actionConfigure()
354
383
$ openstackMachines ->decode ();
355
384
return $ this ->render ('configure ' ,['form_params ' =>$ form_params ,'service ' =>$ service ,
356
385
'ondemand ' =>$ ondemand ,'coldStorage ' =>$ coldStorage ,'serviceLimits ' =>$ serviceLimits ,
386
+ 'jupyter ' =>$ jupyter , 'jupyterLimits ' =>$ jupyterLimits ,
357
387
'ondemandLimits ' =>$ ondemandLimits ,'coldStorageLimits ' =>$ coldStorageLimits ,'general ' =>$ general ,
358
388
'userTypes ' =>$ userTypes , 'success ' =>'' ,"hiddenUser " => $ currentUser ,
359
389
'activeTabs ' =>$ activeTabs ,'activeButtons ' => $ activeButtons ,'hiddenActiveButton ' =>$ hiddenActiveButton , 'smtp ' =>$ smtp , 'machineComputationLimits ' =>$ machineComputationLimits ,
@@ -579,7 +609,7 @@ public function actionAllProjects()
579
609
580
610
$ project_types =Project::TYPES ;
581
611
$ button_links =[0 =>'/project/view-ondemand-request-user ' , 1 =>'/project/view-service-request-user ' ,
582
- 2 =>'/project/view-cold-storage-request-user ' , 3 =>'/project/view-machine-compute-user ' ];
612
+ 2 =>'/project/view-cold-storage-request-user ' , 3 =>'/project/view-machine-compute-user ' , 4 => ' /project/view-jupyter-request-user ' ];
583
613
584
614
585
615
$ deleted =Project::getAllDeletedProjects ();
@@ -825,4 +855,18 @@ public function actionUserStatsList()
825
855
return $ this ->render ('user_stats_list ' , ['users ' =>$ users ,'username ' =>$ username , 'activeFilter ' =>$ activeFilter ,
826
856
'activeFilterDrop ' =>$ activeFilterDrop , 'activeUsers ' =>$ activeUsers , 'totalUsers ' =>$ totalUsers ]);
827
857
}
858
+
859
+ public function actionViewActiveJupyters ()
860
+ {
861
+
862
+ if (!Userw::hasRole ("Admin " , $ superAdminAllowed = true ))
863
+ {
864
+ return $ this ->render ('unauthorized ' );
865
+ }
866
+
867
+ $ servers =JupyterServer::find ()->where (['active ' =>true ])->all ();
868
+
869
+ return $ this ->render ('view_active_jupyters ' ,['servers ' =>$ servers ]);
870
+
871
+ }
828
872
}
0 commit comments