@@ -7362,8 +7362,8 @@ d.disableInputs = !1, n(o + " could not be updated.", m(a));
7362
7362
n ( o + " could not be loaded." , m ( a ) ) ;
7363
7363
} ) :void j . toErrorPage ( "You do not have authority to update " + o + "." , "access_denied" ) ;
7364
7364
} ) ) ;
7365
- } ] ) , angular . module ( "openshiftConsole" ) . controller ( "EditRouteController" , [ "$filter" , "$location" , "$routeParams" , "$scope" , "AlertMessageService" , "AuthorizationService" , "DataService" , "Navigate" , "ProjectsService" , "RoutesService" , function ( a , b , c , d , e , f , g , h , i , j ) {
7366
- d . alerts = { } , d . renderOptions = {
7365
+ } ] ) , angular . module ( "openshiftConsole" ) . controller ( "EditRouteController" , [ "$filter" , "$location" , "$routeParams" , "$scope" , "AlertMessageService" , "AuthorizationService" , "DataService" , "Navigate" , "NotificationsService" , " ProjectsService", "RoutesService" , function ( a , b , c , d , e , f , g , h , i , j , k ) {
7366
+ d . renderOptions = {
7367
7367
hideFilterWidget :! 0
7368
7368
} , d . projectName = c . project , d . routeName = c . route , d . loading = ! 0 , d . routeURL = h . resourceURL ( d . routeName , "Route" , d . projectName ) , d . breadcrumbs = [ {
7369
7369
title :d . projectName ,
@@ -7376,22 +7376,24 @@ title:d.routeName,
7376
7376
link :d . routeURL
7377
7377
} , {
7378
7378
title :"Edit"
7379
- } ] , i . get ( c . project ) . then ( _ . spread ( function ( i , k ) {
7380
- if ( d . project = i , d . breadcrumbs [ 0 ] . title = a ( "displayName" ) ( i ) , ! f . canI ( "routes" , "update" , c . project ) ) return void h . toErrorPage ( "You do not have authority to update route " + c . routeName + "." , "access_denied" ) ;
7379
+ } ] , d . hideErrorNotifications = function ( ) {
7380
+ i . hideNotification ( "edit-route-error" ) ;
7381
+ } , j . get ( c . project ) . then ( _ . spread ( function ( e , j ) {
7382
+ if ( d . project = e , d . breadcrumbs [ 0 ] . title = a ( "displayName" ) ( e ) , ! f . canI ( "routes" , "update" , c . project ) ) return void h . toErrorPage ( "You do not have authority to update route " + c . routeName + "." , "access_denied" ) ;
7381
7383
var l , m = a ( "orderByDisplayName" ) , n = function ( ) {
7382
7384
h . toErrorPage ( 'Editing routes with non-service targets is unsupported. You can edit the route with the "Edit YAML" action instead.' ) ;
7383
7385
} ;
7384
- g . get ( "routes" , d . routeName , k ) . then ( function ( a ) {
7386
+ g . get ( "routes" , d . routeName , j ) . then ( function ( a ) {
7385
7387
if ( "Service" !== a . spec . to . kind ) return void n ( ) ;
7386
7388
l = angular . copy ( a ) ;
7387
7389
var b = _ . get ( l , "spec.host" ) , c = "Subdomain" === _ . get ( l , "spec.wildcardPolicy" ) ;
7388
- c && ( b = "*." + j . getSubdomain ( l ) ) , d . routing = {
7390
+ c && ( b = "*." + k . getSubdomain ( l ) ) , d . routing = {
7389
7391
host :b ,
7390
7392
wildcardPolicy :_ . get ( l , "spec.wildcardPolicy" ) ,
7391
7393
path :_ . get ( l , "spec.path" ) ,
7392
7394
targetPort :_ . get ( l , "spec.port.targetPort" ) ,
7393
7395
tls :angular . copy ( _ . get ( l , "spec.tls" ) )
7394
- } , g . list ( "services" , k ) . then ( function ( a ) {
7396
+ } , g . list ( "services" , j ) . then ( function ( a ) {
7395
7397
d . loading = ! 1 ;
7396
7398
var b = a . by ( "metadata.name" ) ;
7397
7399
d . routing . to = l . spec . to , d . routing . alternateServices = [ ] , _ . each ( _ . get ( l , "spec.alternateBackends" ) , function ( a ) {
@@ -7419,22 +7421,20 @@ weight:a.weight
7419
7421
} ;
7420
7422
d . updateRoute = function ( ) {
7421
7423
if ( d . form . $valid ) {
7422
- d . disableInputs = ! 0 ;
7424
+ d . hideErrorNotifications ( ) , d . disableInputs = ! 0 ;
7423
7425
var c = o ( ) ;
7424
- g . update ( "routes" , d . routeName , c , k ) . then ( function ( ) {
7425
- e . addAlert ( {
7426
- name :d . routeName ,
7427
- data :{
7426
+ g . update ( "routes" , d . routeName , c , j ) . then ( function ( ) {
7427
+ i . addNotification ( {
7428
7428
type :"success" ,
7429
7429
message :"Route " + d . routeName + " was successfully updated."
7430
- }
7431
7430
} ) , b . path ( d . routeURL ) ;
7432
7431
} , function ( b ) {
7433
- d . disableInputs = ! 1 , d . alerts [ "update-route" ] = {
7432
+ d . disableInputs = ! 1 , i . addNotification ( {
7434
7433
type :"error" ,
7434
+ id :"edit-route-error" ,
7435
7435
message :"An error occurred updating route " + d . routeName + "." ,
7436
7436
details :a ( "getErrorDetails" ) ( b )
7437
- } ;
7437
+ } ) ;
7438
7438
} ) ;
7439
7439
}
7440
7440
} ;
@@ -8185,8 +8185,8 @@ details:c("getErrorDetails")(b)
8185
8185
}
8186
8186
} ) ;
8187
8187
} ) ) ;
8188
- } ] ) , angular . module ( "openshiftConsole" ) . controller ( "CreateRouteController" , [ "$filter" , "$routeParams" , "$scope" , "$window" , "ApplicationGenerator" , "AuthorizationService" , "DataService" , "Navigate" , "ProjectsService" , "keyValueEditorUtils" , function ( a , b , c , d , e , f , g , h , i , j ) {
8189
- c . alerts = { } , c . renderOptions = {
8188
+ } ] ) , angular . module ( "openshiftConsole" ) . controller ( "CreateRouteController" , [ "$filter" , "$routeParams" , "$scope" , "$window" , "ApplicationGenerator" , "AuthorizationService" , "DataService" , "Navigate" , "NotificationsService" , " ProjectsService", "keyValueEditorUtils" , function ( a , b , c , d , e , f , g , h , i , j , k ) {
8189
+ c . renderOptions = {
8190
8190
hideFilterWidget :! 0
8191
8191
} , c . projectName = b . project , c . serviceName = b . service , c . labels = [ ] , c . routing = {
8192
8192
name :c . serviceName || ""
@@ -8198,17 +8198,23 @@ title:"Routes",
8198
8198
link :"project/" + c . projectName + "/browse/routes"
8199
8199
} , {
8200
8200
title :"Create Route"
8201
- } ] , i . get ( b . project ) . then ( _ . spread ( function ( i , k ) {
8202
- if ( c . project = i , c . breadcrumbs [ 0 ] . title = a ( "displayName" ) ( i ) , ! f . canI ( "routes" , "create" , b . project ) ) return void h . toErrorPage ( "You do not have authority to create routes in project " + b . project + "." , "access_denied" ) ;
8203
- var l = a ( "orderByDisplayName" ) ;
8201
+ } ] ;
8202
+ var l = function ( ) {
8203
+ i . hideNotification ( "create-route-error" ) ;
8204
+ } ;
8205
+ c . cancel = function ( ) {
8206
+ l ( ) , d . history . back ( ) ;
8207
+ } , j . get ( b . project ) . then ( _ . spread ( function ( j , m ) {
8208
+ if ( c . project = j , c . breadcrumbs [ 0 ] . title = a ( "displayName" ) ( j ) , ! f . canI ( "routes" , "create" , b . project ) ) return void h . toErrorPage ( "You do not have authority to create routes in project " + b . project + "." , "access_denied" ) ;
8209
+ var n = a ( "orderByDisplayName" ) ;
8204
8210
c . routing . to = {
8205
8211
kind :"Service" ,
8206
8212
name :c . serviceName ,
8207
8213
weight :1
8208
- } , g . list ( "services" , k ) . then ( function ( a ) {
8209
- c . services = l ( a . by ( "metadata.name" ) ) ;
8214
+ } , g . list ( "services" , m ) . then ( function ( a ) {
8215
+ c . services = n ( a . by ( "metadata.name" ) ) ;
8210
8216
} ) , c . copyServiceLabels = function ( ) {
8211
- var a = _ . get ( c , "routing.to.service.metadata.labels" , { } ) , b = j . mapEntries ( j . compactEntries ( c . labels ) ) , d = _ . assign ( b , a ) ;
8217
+ var a = _ . get ( c , "routing.to.service.metadata.labels" , { } ) , b = k . mapEntries ( k . compactEntries ( c . labels ) ) , d = _ . assign ( b , a ) ;
8212
8218
c . labels = _ . map ( d , function ( a , b ) {
8213
8219
return {
8214
8220
name :b ,
@@ -8217,22 +8223,26 @@ value:a
8217
8223
} ) ;
8218
8224
} , c . createRoute = function ( ) {
8219
8225
if ( c . createRouteForm . $valid ) {
8220
- c . disableInputs = ! 0 ;
8221
- var b = c . routing . to . name , f = j . mapEntries ( j . compactEntries ( c . labels ) ) , h = e . createRoute ( c . routing , b , f ) , i = _ . get ( c , "routing.alternateServices" , [ ] ) ;
8222
- _ . isEmpty ( i ) || ( h . spec . to . weight = _ . get ( c , "routing.to.weight" ) , h . spec . alternateBackends = _ . map ( i , function ( a ) {
8226
+ l ( ) , c . disableInputs = ! 0 ;
8227
+ var b = c . routing . to . name , f = k . mapEntries ( k . compactEntries ( c . labels ) ) , h = e . createRoute ( c . routing , b , f ) , j = _ . get ( c , "routing.alternateServices" , [ ] ) ;
8228
+ _ . isEmpty ( j ) || ( h . spec . to . weight = _ . get ( c , "routing.to.weight" ) , h . spec . alternateBackends = _ . map ( j , function ( a ) {
8223
8229
return {
8224
8230
kind :"Service" ,
8225
8231
name :a . name ,
8226
8232
weight :a . weight
8227
8233
} ;
8228
- } ) ) , g . create ( "routes" , null , h , k ) . then ( function ( ) {
8229
- d . history . back ( ) ;
8234
+ } ) ) , g . create ( "routes" , null , h , m ) . then ( function ( ) {
8235
+ i . addNotification ( {
8236
+ type :"success" ,
8237
+ message :"Route " + h . metadata . name + " was successfully created."
8238
+ } ) , d . history . back ( ) ;
8230
8239
} , function ( b ) {
8231
- c . disableInputs = ! 1 , c . alerts [ "create-route" ] = {
8240
+ c . disableInputs = ! 1 , i . addNotification ( {
8232
8241
type :"error" ,
8242
+ id :"create-route-error" ,
8233
8243
message :"An error occurred creating the route." ,
8234
8244
details :a ( "getErrorDetails" ) ( b )
8235
- } ;
8245
+ } ) ;
8236
8246
} ) ;
8237
8247
}
8238
8248
} ;
0 commit comments