@@ -9224,6 +9224,7 @@ scope: {
9224
9224
model : "=" ,
9225
9225
required : "=" ,
9226
9226
disabled : "=ngDisabled" ,
9227
+ readonly : "=ngReadonly" ,
9227
9228
showTextArea : "=" ,
9228
9229
hideClear : "=?" ,
9229
9230
helpText : "@?" ,
@@ -9347,7 +9348,7 @@ tag: "="
9347
9348
} ,
9348
9349
templateUrl : "views/directives/osc-image-summary.html"
9349
9350
} ;
9350
- } ) , angular . module ( "openshiftConsole" ) . directive ( "oscRouting" , [ "Constants" , "DNS1123_SUBDOMAIN_VALIDATION" , function ( e , t ) {
9351
+ } ) , angular . module ( "openshiftConsole" ) . directive ( "oscRouting" , [ "$filter" , " Constants", "DNS1123_SUBDOMAIN_VALIDATION" , function ( e , t , n ) {
9351
9352
return {
9352
9353
require : "^form" ,
9353
9354
restrict : "E" ,
@@ -9356,17 +9357,32 @@ route: "=model",
9356
9357
services : "=" ,
9357
9358
showNameInput : "=" ,
9358
9359
routingDisabled : "=" ,
9359
- hostReadOnly : "="
9360
+ existingRoute : "="
9360
9361
} ,
9361
9362
templateUrl : "views/directives/osc-routing.html" ,
9362
- link : function ( n , a , r , o ) {
9363
- n . form = o , n . controls = { } , n . options = {
9363
+ link : function ( a , r , o , i ) {
9364
+ a . form = i , a . controls = { } , a . options = {
9364
9365
secureRoute : ! 1 ,
9365
9366
alternateServices : ! 1
9366
- } , n . disableWildcards = e . DISABLE_WILDCARD_ROUTES , n . disableCertificateInputs = function ( ) {
9367
- var e = _ . get ( n , "route.tls.termination" ) ;
9367
+ } ;
9368
+ var s = {
9369
+ group : "route.openshift.io" ,
9370
+ resource : "routes/custom-host"
9371
+ } ;
9372
+ a . canICreateCustomHosts = e ( "canI" ) ( s , "create" ) , a . canIUpdateCustomHosts = e ( "canI" ) ( s , "update" ) ;
9373
+ var c = function ( ) {
9374
+ return a . existingRoute ? a . canIUpdateCustomHosts : a . canICreateCustomHosts ;
9375
+ } ;
9376
+ a . isHostnameReadOnly = function ( ) {
9377
+ return ! c ( ) ;
9378
+ } , a . disableWildcards = t . DISABLE_WILDCARD_ROUTES , a . areCertificateInputsReadOnly = function ( ) {
9379
+ return ! c ( ) ;
9380
+ } , a . areCertificateInputsDisabled = function ( ) {
9381
+ var e = _ . get ( a , "route.tls.termination" ) ;
9368
9382
return ! e || "passthrough" === e ;
9369
- } , n . insecureTrafficOptions = [ {
9383
+ } , a . isDestinationCACertInputDisabled = function ( ) {
9384
+ return "reencrypt" !== _ . get ( a , "route.tls.termination" ) ;
9385
+ } , a . insecureTrafficOptions = [ {
9370
9386
value : "" ,
9371
9387
label : "None"
9372
9388
} , {
@@ -9375,73 +9391,73 @@ label: "Allow"
9375
9391
} , {
9376
9392
value : "Redirect" ,
9377
9393
label : "Redirect"
9378
- } ] , _ . has ( n , "route.tls.insecureEdgeTerminationPolicy" ) || _ . set ( n , "route.tls.insecureEdgeTerminationPolicy" , "" ) ;
9379
- n . $watchGroup ( [ "route.tls.termination" , "route.tls.insecureEdgeTerminationPolicy" ] , function ( ) {
9380
- var e = "passthrough" !== _ . get ( n , "route.tls.termination" ) || "Allow" !== _ . get ( n , "route.tls.insecureEdgeTerminationPolicy" ) ;
9381
- n . routeForm . insecureTraffic . $setValidity ( "passthrough" , e ) ;
9382
- } ) , n . nameValidation = t , n . disableWildcards ? n . hostnamePattern = t . pattern : n . hostnamePattern = / ^ ( \* ( \. [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ) + | [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ? ( \. [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ? ) * ) $ / , n . hostnameMaxLength = t . maxlength ;
9383
- var i = function ( e ) {
9394
+ } ] , _ . has ( a , "route.tls.insecureEdgeTerminationPolicy" ) || _ . set ( a , "route.tls.insecureEdgeTerminationPolicy" , "" ) ;
9395
+ a . $watchGroup ( [ "route.tls.termination" , "route.tls.insecureEdgeTerminationPolicy" ] , function ( ) {
9396
+ var e = "passthrough" !== _ . get ( a , "route.tls.termination" ) || "Allow" !== _ . get ( a , "route.tls.insecureEdgeTerminationPolicy" ) ;
9397
+ a . routeForm . insecureTraffic . $setValidity ( "passthrough" , e ) ;
9398
+ } ) , a . nameValidation = n , a . disableWildcards ? a . hostnamePattern = n . pattern : a . hostnamePattern = / ^ ( \* ( \. [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ) + | [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ? ( \. [ a - z 0 - 9 ] ( [ - a - z 0 - 9 ] * [ a - z 0 - 9 ] ) ? ) * ) $ / , a . hostnameMaxLength = n . maxlength ;
9399
+ var l = function ( e ) {
9384
9400
if ( e ) {
9385
9401
var t = _ . get ( e , "spec.ports" , [ ] ) ;
9386
- n . unnamedServicePort = 1 === t . length && ! t [ 0 ] . name , t . length && ! n . unnamedServicePort ? n . route . portOptions = _ . map ( t , function ( e ) {
9402
+ a . unnamedServicePort = 1 === t . length && ! t [ 0 ] . name , t . length && ! a . unnamedServicePort ? a . route . portOptions = _ . map ( t , function ( e ) {
9387
9403
return {
9388
9404
port : e . name ,
9389
9405
label : e . port + " → " + e . targetPort + " (" + e . protocol + ")"
9390
9406
} ;
9391
- } ) : n . route . portOptions = [ ] ;
9407
+ } ) : a . route . portOptions = [ ] ;
9392
9408
}
9393
9409
} ;
9394
- n . services && ! n . route . service && ( n . route . service = _ . find ( n . services ) ) , n . servicesByName , n . services ? n . servicesByName = _ . keyBy ( n . services , "metadata.name" ) : n . servicesByName = { } , n . $watch ( "route.to.name" , function ( e , t ) {
9395
- i ( n . servicesByName [ e ] ) , e === t && n . route . targetPort || ( n . route . targetPort = _ . get ( n , "route.portOptions[0].port" ) ) , n . services && ( n . alternateServiceOptions = _ . reject ( n . services , function ( t ) {
9410
+ a . services && ! a . route . service && ( a . route . service = _ . find ( a . services ) ) , a . servicesByName , a . services ? a . servicesByName = _ . keyBy ( a . services , "metadata.name" ) : a . servicesByName = { } , a . $watch ( "route.to.name" , function ( e , t ) {
9411
+ l ( a . servicesByName [ e ] ) , e === t && a . route . targetPort || ( a . route . targetPort = _ . get ( a , "route.portOptions[0].port" ) ) , a . services && ( a . alternateServiceOptions = _ . reject ( a . services , function ( t ) {
9396
9412
return e === t . metadata . name ;
9397
9413
} ) ) ;
9398
- } ) , n . $watch ( "route.alternateServices" , function ( e ) {
9399
- n . duplicateServices = _ ( e ) . map ( "name" ) . filter ( function ( e , t , n ) {
9414
+ } ) , a . $watch ( "route.alternateServices" , function ( e ) {
9415
+ a . duplicateServices = _ ( e ) . map ( "name" ) . filter ( function ( e , t , n ) {
9400
9416
return _ . includes ( n , e , t + 1 ) ;
9401
- } ) . value ( ) , o . $setValidity ( "duplicateServices" , ! n . duplicateServices . length ) , n . options . alternateServices = ! _ . isEmpty ( e ) ;
9417
+ } ) . value ( ) , i . $setValidity ( "duplicateServices" , ! a . duplicateServices . length ) , a . options . alternateServices = ! _ . isEmpty ( e ) ;
9402
9418
} , ! 0 ) ;
9403
- var s = function ( ) {
9404
- return ! ! n . route . tls && ( ( ! n . route . tls . termination || "passthrough" === n . route . tls . termination ) && ( n . route . tls . certificate || n . route . tls . key || n . route . tls . caCertificate || n . route . tls . destinationCACertificate ) ) ;
9419
+ var u = function ( ) {
9420
+ return ! ! a . route . tls && ( ( ! a . route . tls . termination || "passthrough" === a . route . tls . termination ) && ( a . route . tls . certificate || a . route . tls . key || a . route . tls . caCertificate || a . route . tls . destinationCACertificate ) ) ;
9405
9421
} ;
9406
- n . $watch ( "route.tls.termination" , function ( ) {
9407
- n . options . secureRoute = ! ! _ . get ( n , "route.tls.termination" ) , n . showCertificatesNotUsedWarning = s ( ) ;
9422
+ a . $watch ( "route.tls.termination" , function ( ) {
9423
+ a . options . secureRoute = ! ! _ . get ( a , "route.tls.termination" ) , a . showCertificatesNotUsedWarning = u ( ) ;
9408
9424
} ) ;
9409
- var c ;
9410
- n . $watch ( "options.secureRoute" , function ( e , t ) {
9425
+ var d ;
9426
+ a . $watch ( "options.secureRoute" , function ( e , t ) {
9411
9427
if ( e !== t ) {
9412
- var a = _ . get ( n , "route.tls.termination" ) ;
9413
- ! n . securetRoute && a && ( c = a , delete n . route . tls . termination ) , n . options . secureRoute && ! a && _ . set ( n , "route.tls.termination" , c || "edge" ) ;
9414
- }
9415
- } ) , n . $watch ( "options.alternateServices" , function ( e , t ) {
9416
- e !== t && ( e || ( n . route . alternateServices = [ ] ) , e && _ . isEmpty ( n . route . alternateServices ) && n . addAlternateService ( ) ) ;
9417
- } ) , n . addAlternateService = function ( ) {
9418
- n . route . alternateServices = n . route . alternateServices || [ ] ;
9419
- var e = _ . find ( n . services , function ( e ) {
9420
- return e . metadata . name !== n . route . to . service && ! _ . some ( n . route . alternateServices , {
9428
+ var n = _ . get ( a , "route.tls.termination" ) ;
9429
+ ! a . securetRoute && n && ( d = n , delete a . route . tls . termination ) , a . options . secureRoute && ! n && _ . set ( a , "route.tls.termination" , d || "edge" ) ;
9430
+ }
9431
+ } ) , a . $watch ( "options.alternateServices" , function ( e , t ) {
9432
+ e !== t && ( e || ( a . route . alternateServices = [ ] ) , e && _ . isEmpty ( a . route . alternateServices ) && a . addAlternateService ( ) ) ;
9433
+ } ) , a . addAlternateService = function ( ) {
9434
+ a . route . alternateServices = a . route . alternateServices || [ ] ;
9435
+ var e = _ . find ( a . services , function ( e ) {
9436
+ return e . metadata . name !== a . route . to . service && ! _ . some ( a . route . alternateServices , {
9421
9437
service : e . metadata . name
9422
9438
} ) ;
9423
9439
} ) ;
9424
- _ . has ( n , "route.to.weight" ) || _ . set ( n , "route.to.weight" , 1 ) , n . route . alternateServices . push ( {
9440
+ _ . has ( a , "route.to.weight" ) || _ . set ( a , "route.to.weight" , 1 ) , a . route . alternateServices . push ( {
9425
9441
service : e . metadata . name ,
9426
9442
weight : 1
9427
9443
} ) ;
9428
- } , n . weightAsPercentage = function ( e , t ) {
9444
+ } , a . weightAsPercentage = function ( e , t ) {
9429
9445
e = e || 0 ;
9430
- var a = _ . get ( n , "route.to.weight" , 0 ) ;
9431
- if ( _ . each ( n . route . alternateServices , function ( e ) {
9432
- a += _ . get ( e , "weight" , 0 ) ;
9433
- } ) , ! a ) return "" ;
9434
- var r = e / a * 100 ;
9446
+ var n = _ . get ( a , "route.to.weight" , 0 ) ;
9447
+ if ( _ . each ( a . route . alternateServices , function ( e ) {
9448
+ n += _ . get ( e , "weight" , 0 ) ;
9449
+ } ) , ! n ) return "" ;
9450
+ var r = e / n * 100 ;
9435
9451
return t ? d3 . round ( r , 1 ) + "%" : r ;
9436
9452
} ;
9437
- var l = ! 1 ;
9438
- n . $watch ( "route.alternateServices.length" , function ( e ) {
9439
- if ( 0 === e && _ . has ( n , "route.to.weight" ) && delete n . route . to . weight , 1 === e ) {
9440
- if ( 0 === n . route . to . weight && 0 === n . route . alternateServices [ 0 ] . weight ) return void ( n . controls . hideSlider = ! 0 ) ;
9441
- l = ! 0 , n . controls . rangeSlider = n . weightAsPercentage ( n . route . to . weight ) ;
9453
+ var m = ! 1 ;
9454
+ a . $watch ( "route.alternateServices.length" , function ( e ) {
9455
+ if ( 0 === e && _ . has ( a , "route.to.weight" ) && delete a . route . to . weight , 1 === e ) {
9456
+ if ( 0 === a . route . to . weight && 0 === a . route . alternateServices [ 0 ] . weight ) return void ( a . controls . hideSlider = ! 0 ) ;
9457
+ m = ! 0 , a . controls . rangeSlider = a . weightAsPercentage ( a . route . to . weight ) ;
9442
9458
}
9443
- } ) , n . $watch ( "controls.rangeSlider" , function ( e , t ) {
9444
- l ? l = ! 1 : e !== t && ( e = parseInt ( e , 10 ) , _ . set ( n , "route.to.weight" , e ) , _ . set ( n , "route.alternateServices[0].weight" , 100 - e ) ) ;
9459
+ } ) , a . $watch ( "controls.rangeSlider" , function ( e , t ) {
9460
+ m ? m = ! 1 : e !== t && ( e = parseInt ( e , 10 ) , _ . set ( a , "route.to.weight" , e ) , _ . set ( a , "route.alternateServices[0].weight" , 100 - e ) ) ;
9445
9461
} ) ;
9446
9462
}
9447
9463
} ;
0 commit comments