@@ -44,8 +44,10 @@ angular.module("CombineModule", ["mainApp", "dashboard"]);
4444
4545app . controller ( 'ContainersCreateController' , [ '$filter' , '$routeParams' , '$scope' , '$http' , function ( $filter , $routeParams , $scope , $http ) {
4646 $scope . supportedPlatforms = [ "Java" , "C" , "C++" , "Python" , "HTML" , "JavaScript" , "CSS" ] ;
47- $scope . referId = $routeParams . id ;
48- $scope . progressBar = 0 ;
47+ $scope . referId = $routeParams . id ;
48+ $scope . progressBar = 0 ;
49+
50+
4951 $http ( {
5052 url : 'http://127.0.0.1/github/user/repos/' + $routeParams . id ,
5153 method : 'GET'
@@ -61,18 +63,19 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
6163 $scope . diskquota = null ;
6264 if ( ! response . data . container_create ) {
6365 if ( $scope . supportedPlatforms . indexOf ( response . data . language ) !== - 1 ) {
64- $scope . progressBar = 40 ;
66+ $scope . progressBar = 40 ;
6567 $http ( {
6668 url : 'http://127.0.0.1/github/local' ,
6769 method : 'GET'
6870 } ) . then (
6971 function ( local ) {
70- $scope . progressBar = 70 ;
72+ $scope . progressBar = 70 ;
7173 $scope . userId = local . data . user_id ;
7274 $scope . subscriptionStatus = local . data . subscription_status ;
7375 $scope . github_id = local . data . github_id ;
7476 $scope . premium = null ;
7577 $scope . dockerImages = null ;
78+
7679 if ( $scope . subscriptionStatus === "" ) {
7780 $scope . premium = 0 ;
7881 console . log ( "Free user" ) ;
@@ -86,7 +89,7 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
8689 $scope . dockerImages = 4 ;
8790 }
8891 $scope . rammemory = $scope . diskquota = 1000000000 ;
89- $scope . premiumtext = "Free" ;
92+ $scope . premiumtext = "Free" ;
9093 } else {
9194 console . log ( "Pro user" ) ;
9295 if ( $scope . supportedPlatforms . indexOf ( response . data . language ) === 0 ) {
@@ -99,23 +102,21 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
99102 $scope . dockerImages = 2 ;
100103 }
101104 $scope . premium = 1 ;
102- $scope . premiumtext = "Premium" ;
105+ $scope . premiumtext = "Premium" ;
103106 $scope . rammemory = $scope . diskquota = 2000000000 ;
104107 }
105108
106109 var str = "" + $scope . id ;
107110 var res = str . substring ( 0 , 3 ) ;
108111 $scope . exposedports = 8080 ;
109- $scope . hostports = "8" + res ;
112+ $scope . hostports = ( 1 + res ) ;
110113 $scope . dockerName = $scope . id ;
114+ $scope . progressBar = 90 ;
111115 console . log ( "Status konta:" + $scope . premium ) ;
112116 console . log ( "Obraz:" + $scope . dockerImages ) ;
113117 console . log ( "Port wewnętrzny:" + $scope . exposedports ) ;
114- console . log ( "Port zewnętrzny:" + $scope . hostports ) ;
115118 console . log ( "Nazwa dokeru:" + $scope . id ) ;
116119 console . log ( "Ilość pamięci ram: " + $scope . rammemory + " i dysku: " + $scope . diskquota ) ;
117- $scope . progressBar = 90 ;
118-
119120 $http ( {
120121 url : 'http://127.0.0.1/srv/container/create' ,
121122 method : 'POST' ,
@@ -132,37 +133,37 @@ app.controller('ContainersCreateController', ['$filter', '$routeParams', '$scope
132133 } ) . then (
133134 function ( create ) {
134135 console . log ( create . data ) ;
135- $scope . progressBar = 100 ;
136- $scope . finish = 1 ;
136+ $scope . progressBar = 100 ;
137+ $scope . finish = 1 ;
137138 } ,
138139 function ( create ) {
139- $scope . errors = "Problem with creating a container" ;
140- $scope . erorType = 0 ;
140+ $scope . errors = "Problem with creating a container" ;
141+ $scope . erorType = 0 ;
141142 console . error ( create . data ) ;
142143 }
143144 ) ;
144145
145146 } ,
146- function ( response ) {
147- $scope . errors = "Problem with loading user data" ;
148- $scope . erorType = 1 ;
147+ function ( ) {
148+ $scope . errors = "Problem with loading user data" ;
149+ $scope . erorType = 1 ;
149150 }
150151 ) ;
151152 } else {
152- $scope . errors = "No support for the specified repository" ;
153- $scope . erorType = 2 ;
153+ $scope . errors = "No support for the specified repository" ;
154+ $scope . erorType = 2 ;
154155
155156 }
156157 } else {
157- $scope . errors = "The repository does exist" ;
158- $scope . erorType = 3 ;
158+ $scope . errors = "The repository does exist" ;
159+ $scope . erorType = 3 ;
159160 console . error ( "The repository does exist" ) ;
160161 }
161162
162163 } ,
163- function ( response ) {
164- $scope . errors = "Fatal Error" ;
165- $scope . erorType = 4 ;
164+ function ( ) {
165+ $scope . errors = "Fatal Error" ;
166+ $scope . erorType = 4 ;
166167 window . location = "/" ;
167168 }
168169 ) ;
@@ -180,7 +181,7 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
180181 $scope . creationTime = response . data . createTime ;
181182 $scope . containersId = response . data . idDocker ;
182183 $scope . hostPorts = response . data . hostPorts ;
183- if ( $scope . status == 1 ) {
184+ if ( $scope . status === 1 ) {
184185 $scope . status = "Premium" ;
185186 $scope . shareStatus = response . data . shareUrl ;
186187 } else {
@@ -195,8 +196,8 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
195196 } ) . then (
196197 function ( response ) {
197198 } ,
198- function ( response ) {
199- $scope . errors = "Problem with restarting a container" ;
199+ function ( ) {
200+ $scope . errors = "Problem with restarting a container" ;
200201 }
201202 ) ;
202203 } ;
@@ -205,11 +206,11 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
205206 url : 'http://127.0.0.1/srv/container/' + $scope . containersId + '/delete' ,
206207 method : 'DELETE'
207208 } ) . then (
208- function ( response ) {
209+ function ( ) {
209210 window . location = "/" ;
210211 } ,
211- function ( response ) {
212- $scope . errors = "Problem with deleteing a container" ;
212+ function ( ) {
213+ $scope . errors = "Problem with deleteing a container" ;
213214 }
214215 ) ;
215216 } ;
@@ -220,8 +221,8 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
220221 function ( logGet ) {
221222 $scope . logMachine = logGet . data . logs ;
222223 } ,
223- function ( logGet ) {
224- $scope . errors = "Problem with downloading logs from containers" ;
224+ function ( ) {
225+ $scope . errors = "Problem with downloading logs from containers" ;
225226 }
226227 ) ;
227228 $http ( {
@@ -231,13 +232,13 @@ app.controller('ContainersController', ['$filter', '$routeParams', '$scope', '$h
231232 function ( response ) {
232233 $scope . tops = response . data . Processes ;
233234 } ,
234- function ( response ) {
235- $scope . errors = "Problem with getting processes from a container" ;
235+ function ( ) {
236+ $scope . errors = "Problem with getting processes from a container" ;
236237 }
237238 ) ;
238239 } ,
239- function ( response ) {
240- $scope . errors = "Fatal error" ;
240+ function ( ) {
241+ $scope . errors = "Fatal error" ;
241242 window . location = "/" ;
242243 }
243244 ) ;
@@ -249,7 +250,6 @@ app.controller('HomeController', function ($scope, $http, $cookies) {
249250 $http ( {
250251 url : 'http://127.0.0.1/github/user' ,
251252 method : 'GET'
252- // params: {token: $scope.lastVal}
253253 } ) . then (
254254 function ( response ) {
255255 $scope . passCheck = response ;
@@ -259,7 +259,7 @@ app.controller('HomeController', function ($scope, $http, $cookies) {
259259 $scope . followers = response . data . followers ;
260260 $scope . following = response . data . following ;
261261 } ,
262- function ( response ) {
262+ function ( ) {
263263 $scope . passCheck = false ;
264264 }
265265 ) ;
@@ -275,10 +275,10 @@ app.controller('ProjectsController', function ($scope, $http) {
275275 function ( response ) {
276276 $scope . jsondata = response . data ;
277277 $scope . repoid = response . data . id ;
278- $scope . progressBar = 100 ;
278+ $scope . progressBar = 100 ;
279279 } ,
280- function ( response ) {
281- $scope . errors = "Fatal error" ;
280+ function ( ) {
281+ $scope . errors = "Fatal error" ;
282282 }
283283 ) ;
284284} ) ;
@@ -299,32 +299,37 @@ app.controller('CheckLoginStatus', function ($scope, $http, $cookies) {
299299 method : 'GET' ,
300300 params : { token : $scope . lastVal }
301301 } ) . then (
302- function ( response ) {
302+ function ( ) {
303303 $scope . passCheck = true ;
304304 } ,
305- function ( response ) {
305+ function ( ) {
306306 $scope . passCheck = false ;
307307 }
308308 ) ;
309309} ) ;
310310
311311
312- app . controller ( 'dashboardGithub' , function ( $scope , $http , $cookies ) {
312+ app . controller ( 'dashboardGithub' , function ( $scope , $http , $cookies , $window ) {
313313 $scope . lastVal = $cookies . get ( 'token' ) ;
314314 $http ( {
315315 url : 'http://127.0.0.1/github/user' ,
316316 method : 'GET'
317- // params: {token: $scope.lastVal}
318317 } ) . then (
319318 function ( response ) {
320319 $scope . passCheck = response ;
321320 $scope . avatar = response . data . avatar_url ;
322321 $scope . name = response . data . name ;
323322 } ,
324- function ( response ) {
323+ function ( ) {
325324 $scope . passCheck = false ;
326325 }
327326 ) ;
327+
328+ $scope . logout = function ( ) {
329+ $cookies . remove ( 'token' ) ;
330+ $cookies . remove ( 'id' ) ;
331+ window . location = "/" ;
332+ }
328333} ) ;
329334
330335$ ( 'ul.nav > li > a.nav-link' ) . click ( function ( e ) {
0 commit comments