@@ -7213,37 +7213,37 @@ A(), f.history.back();
7213
7213
} , a . $on ( "$destroy" , function ( ) {
7214
7214
i . unwatchAll ( s ) ;
7215
7215
} ) ;
7216
- } ] ) , angular . module ( "openshiftConsole" ) . controller ( "EditAutoscalerController" , [ "$scope" , "$filter" , "$routeParams" , "$window" , "APIService" , "AuthorizationService" , "BreadcrumbsService" , "DataService" , "HPAService" , "MetricsService" , "Navigate" , "ProjectsService" , "keyValueEditorUtils" , function ( a , b , c , d , e , f , g , h , i , j , k , l , m ) {
7216
+ } ] ) , angular . module ( "openshiftConsole" ) . controller ( "EditAutoscalerController" , [ "$scope" , "$filter" , "$routeParams" , "$window" , "APIService" , "AuthorizationService" , "BreadcrumbsService" , "DataService" , "HPAService" , "MetricsService" , "Navigate" , "NotificationsService" , " ProjectsService", "keyValueEditorUtils" , function ( a , b , c , d , e , f , g , h , i , j , k , l , m , n ) {
7217
7217
if ( ! c . kind || ! c . name ) return void k . toErrorPage ( "Kind or name parameter missing." ) ;
7218
- var n = [ "Deployment" , "DeploymentConfig" , "HorizontalPodAutoscaler" , "ReplicaSet" , "ReplicationController" ] ;
7219
- if ( ! _ . includes ( n , c . kind ) ) return void k . toErrorPage ( "Autoscaling not supported for kind " + c . kind + "." ) ;
7218
+ var o = [ "Deployment" , "DeploymentConfig" , "HorizontalPodAutoscaler" , "ReplicaSet" , "ReplicationController" ] ;
7219
+ if ( ! _ . includes ( o , c . kind ) ) return void k . toErrorPage ( "Autoscaling not supported for kind " + c . kind + "." ) ;
7220
7220
a . kind = c . kind , a . name = c . name , "HorizontalPodAutoscaler" === c . kind ? a . disableInputs = ! 0 :( a . targetKind = c . kind , a . targetName = c . name ) , a . autoscaling = {
7221
7221
name :a . name
7222
7222
} , a . labels = [ ] , j . isAvailable ( ) . then ( function ( b ) {
7223
7223
a . metricsWarning = ! b ;
7224
- } ) , a . alerts = { } ;
7225
- var o = b ( "getErrorDetails" ) , p = function ( b , c ) {
7226
- a . alerts . autoscaling = {
7227
- type :"error" ,
7228
- message :b ,
7229
- details :o ( c )
7230
- } ;
7224
+ } ) ;
7225
+ var p = b ( "getErrorDetails" ) , q = function ( ) {
7226
+ d . history . back ( ) ;
7227
+ } , r = function ( ) {
7228
+ l . hideNotification ( "edit-hpa-error" ) ;
7231
7229
} ;
7232
- l . get ( c . project ) . then ( _ . spread ( function ( b , j ) {
7230
+ a . cancel = function ( ) {
7231
+ r ( ) , q ( ) ;
7232
+ } , m . get ( c . project ) . then ( _ . spread ( function ( b , d ) {
7233
7233
a . project = b ;
7234
- var l = "HorizontalPodAutoscaler" === c . kind ? "update" :"create" ;
7234
+ var j = "HorizontalPodAutoscaler" === c . kind ? "update" :"create" ;
7235
7235
if ( ! f . canI ( {
7236
7236
resource :"horizontalpodautoscalers" ,
7237
7237
group :"autoscaling"
7238
- } , l , c . project ) ) return void k . toErrorPage ( "You do not have authority to " + l + " horizontal pod autoscalers in project " + c . project + "." , "access_denied" ) ;
7239
- var n = function ( ) {
7240
- a . disableInputs = ! 0 ;
7238
+ } , j , c . project ) ) return void k . toErrorPage ( "You do not have authority to " + j + " horizontal pod autoscalers in project " + c . project + "." , "access_denied" ) ;
7239
+ var m = function ( ) {
7240
+ a . disableInputs = ! 0 , r ( ) ;
7241
7241
var b = {
7242
7242
apiVersion :"autoscaling/v1" ,
7243
7243
kind :"HorizontalPodAutoscaler" ,
7244
7244
metadata :{
7245
7245
name :a . autoscaling . name ,
7246
- labels :m . mapEntries ( m . compactEntries ( a . labels ) )
7246
+ labels :n . mapEntries ( n . compactEntries ( a . labels ) )
7247
7247
} ,
7248
7248
spec :{
7249
7249
scaleTargetRef :{
@@ -7260,40 +7260,56 @@ targetCPUUtilizationPercentage:a.autoscaling.targetCPU || a.autoscaling.defaultT
7260
7260
h . create ( {
7261
7261
resource :"horizontalpodautoscalers" ,
7262
7262
group :"autoscaling"
7263
- } , null , b , j ) . then ( function ( ) {
7264
- d . history . back ( ) ;
7263
+ } , null , b , d ) . then ( function ( a ) {
7264
+ l . addNotification ( {
7265
+ type :"success" ,
7266
+ message :"Horizontal pod autoscaler " + a . metadata . name + " successfully created."
7267
+ } ) , q ( ) ;
7265
7268
} , function ( b ) {
7266
- a . disableInputs = ! 1 , p ( "An error occurred creating the horizontal pod autoscaler." , b ) ;
7269
+ a . disableInputs = ! 1 , l . addNotification ( {
7270
+ id :"edit-hpa-error" ,
7271
+ type :"error" ,
7272
+ message :"An error occurred creating the horizontal pod autoscaler." ,
7273
+ details :p ( b )
7274
+ } ) ;
7267
7275
} ) ;
7268
7276
} , o = function ( b ) {
7269
- a . disableInputs = ! 0 , b = angular . copy ( b ) , b . metadata . labels = m . mapEntries ( m . compactEntries ( a . labels ) ) , b . spec . minReplicas = a . autoscaling . minReplicas , b . spec . maxReplicas = a . autoscaling . maxReplicas , b . spec . targetCPUUtilizationPercentage = a . autoscaling . targetCPU || a . autoscaling . defaultTargetCPU || null , h . update ( {
7277
+ a . disableInputs = ! 0 , b = angular . copy ( b ) , b . metadata . labels = n . mapEntries ( n . compactEntries ( a . labels ) ) , b . spec . minReplicas = a . autoscaling . minReplicas , b . spec . maxReplicas = a . autoscaling . maxReplicas , b . spec . targetCPUUtilizationPercentage = a . autoscaling . targetCPU || a . autoscaling . defaultTargetCPU || null , h . update ( {
7270
7278
resource :"horizontalpodautoscalers" ,
7271
7279
group :"autoscaling"
7272
- } , b . metadata . name , b , j ) . then ( function ( ) {
7273
- d . history . back ( ) ;
7274
- } , function ( c ) {
7275
- a . disableInputs = ! 1 , p ( 'An error occurred updating horizontal pod autoscaler "' + b . metadata . name + '".' , c ) ;
7280
+ } , b . metadata . name , b , d ) . then ( function ( a ) {
7281
+ l . addNotification ( {
7282
+ type :"success" ,
7283
+ message :"Horizontal pod autoscaler " + a . metadata . name + " successfully updated."
7284
+ } ) , q ( ) ;
7285
+ } , function ( b ) {
7286
+ a . disableInputs = ! 1 , l . addNotification ( {
7287
+ id :"edit-hpa-error" ,
7288
+ type :"error" ,
7289
+ message :"An error occurred creating the horizontal pod autoscaler." ,
7290
+ details :p ( b )
7276
7291
} ) ;
7277
- } , q = { } ;
7278
- q = "HorizontalPodAutoscaler" === c . kind ? {
7292
+ } ) ;
7293
+ } , s = { } ;
7294
+ s = "HorizontalPodAutoscaler" === c . kind ? {
7279
7295
resource :"horizontalpodautoscalers" ,
7280
7296
group :"autoscaling" ,
7281
7297
version :"v1"
7282
7298
} :{
7283
7299
resource :e . kindToResource ( c . kind ) ,
7284
7300
group :c . group
7285
- } , h . get ( q , c . name , j ) . then ( function ( d ) {
7286
- if ( a . labels = _ . map ( _ . get ( d , "metadata.labels" , { } ) , function ( a , b ) {
7301
+ } , h . get ( s , c . name , d ) . then ( function ( e ) {
7302
+ if ( a . labels = _ . map ( _ . get ( e , "metadata.labels" , { } ) , function ( a , b ) {
7287
7303
return {
7288
7304
name :b ,
7289
7305
value :a
7290
7306
} ;
7291
- } ) , "HorizontalPodAutoscaler" === c . kind ) a . targetKind = _ . get ( d , "spec.scaleTargetRef.kind" ) , a . targetName = _ . get ( d , "spec.scaleTargetRef.name" ) , _ . assign ( a . autoscaling , {
7292
- minReplicas :_ . get ( d , "spec.minReplicas" ) ,
7293
- maxReplicas :_ . get ( d , "spec.maxReplicas" ) ,
7294
- targetCPU :_ . get ( d , "spec.targetCPUUtilizationPercentage" )
7307
+ } ) , "HorizontalPodAutoscaler" === c . kind ) a . targetKind = _ . get ( e , "spec.scaleTargetRef.kind" ) , a . targetName = _ . get ( e , "spec.scaleTargetRef.name" ) , _ . assign ( a . autoscaling , {
7308
+ minReplicas :_ . get ( e , "spec.minReplicas" ) ,
7309
+ maxReplicas :_ . get ( e , "spec.maxReplicas" ) ,
7310
+ targetCPU :_ . get ( e , "spec.targetCPUUtilizationPercentage" )
7295
7311
} ) , a . disableInputs = ! 1 , a . save = function ( ) {
7296
- o ( d ) ;
7312
+ o ( e ) ;
7297
7313
} , a . breadcrumbs = g . getBreadcrumbs ( {
7298
7314
name :a . targetName ,
7299
7315
kind :a . targetKind ,
@@ -7303,17 +7319,17 @@ subpage:"Autoscale",
7303
7319
includeProject :! 0
7304
7320
} ) ; else {
7305
7321
a . breadcrumbs = g . getBreadcrumbs ( {
7306
- object :d ,
7322
+ object :e ,
7307
7323
project :b ,
7308
7324
subpage :"Autoscale" ,
7309
7325
includeProject :! 0
7310
- } ) , a . save = n ;
7311
- var e = { } , f = function ( ) {
7312
- var c = _ . get ( d , "spec.template.spec.containers" , [ ] ) ;
7313
- a . showCPURequestWarning = ! i . hasCPURequest ( c , e , b ) ;
7326
+ } ) , a . save = m ;
7327
+ var f = { } , j = function ( ) {
7328
+ var c = _ . get ( e , "spec.template.spec.containers" , [ ] ) ;
7329
+ a . showCPURequestWarning = ! i . hasCPURequest ( c , f , b ) ;
7314
7330
} ;
7315
- h . list ( "limitranges" , j ) . then ( function ( a ) {
7316
- e = a . by ( "metadata.name" ) , f ( ) ;
7331
+ h . list ( "limitranges" , d ) . then ( function ( a ) {
7332
+ f = a . by ( "metadata.name" ) , j ( ) ;
7317
7333
} ) ;
7318
7334
}
7319
7335
} ) ;
0 commit comments