@@ -11146,7 +11146,7 @@ label:"Redirect"
11146
11146
} ];
11147
11147
} ],
11148
11148
link:function(b, c, d, e) {
11149
- b.form = e, b.disableWildcards = a.DISABLE_WILDCARD_ROUTES, b.disableWildcards ? b.hostnamePattern = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/ :b.hostnamePattern = /^(\*(\.[a-z0-9]([-a-z0-9]*[a-z0-9]))+|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)$/;
11149
+ b.form = e, b.controls = {}, b. disableWildcards = a.DISABLE_WILDCARD_ROUTES, b.disableWildcards ? b.hostnamePattern = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/ :b.hostnamePattern = /^(\*(\.[a-z0-9]([-a-z0-9]*[a-z0-9]))+|[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)$/;
11150
11150
var f = function(a) {
11151
11151
a && (b.unnamedServicePort = 1 === a.spec.ports.length && !a.spec.ports[0].name, a.spec.ports.length && !b.unnamedServicePort ? b.route.portOptions = _.map(a.spec.ports, function(a) {
11152
11152
return {
@@ -11185,9 +11185,20 @@ service:a
11185
11185
});
11186
11186
});
11187
11187
b.route.alternateServices.push({
11188
- service:a
11188
+ service:a,
11189
+ weight:1
11190
+ }), _.has(b, "route.to.weight") || _.set(b, "route.to.weight", 1);
11191
+ }, b.weightAsPercentage = function(a) {
11192
+ a = a || 0;
11193
+ var c = _.get(b, "route.to.weight", 0);
11194
+ if (_.each(b.route.alternateServices, function(a) {
11195
+ c += _.get(a, "weight", 0);
11196
+ }), !c) return "";
11197
+ var d = a / c * 100;
11198
+ return d3.round(d, 1) + "%";
11199
+ }, b.$watch("controls.rangeSlider", function(a, c) {
11200
+ a !== c && (a = parseInt(a, 10), _.set(b, "route.to.weight", a), _.set(b, "route.alternateServices[0].weight", 100 - a));
11189
11201
});
11190
- };
11191
11202
}
11192
11203
};
11193
11204
} ]).directive("oscRoutingService", function() {
@@ -23613,7 +23624,7 @@ var _scriptsTemplatesJs = []byte(`angular.module('openshiftConsoleTemplates', []
23613
23624
"</div>\n" +
23614
23625
"\n" +
23615
23626
"<div ng-if=\"services\">\n" +
23616
- "<osc-routing-service model=\"route.to\" services=\"services\" show-weight=\"route.alternateServices.length\">\n" +
23627
+ "<osc-routing-service model=\"route.to\" services=\"services\" show-weight=\"route.alternateServices.length > 1 || (controls.hideSlider && route.alternateServices.length) \">\n" +
23617
23628
"</osc-routing-service>\n" +
23618
23629
"</div>\n" +
23619
23630
"<div ng-if=\"alternateServiceOptions.length && !route.alternateServices.length\" class=\"form-group\">\n" +
@@ -23638,7 +23649,7 @@ var _scriptsTemplatesJs = []byte(`angular.module('openshiftConsoleTemplates', []
23638
23649
"<div ng-if=\"route.alternateServices.length\">\n" +
23639
23650
"<h3>Alternate Services</h3>\n" +
23640
23651
"<div ng-repeat=\"alternate in route.alternateServices\" class=\"form-group\">\n" +
23641
- "<osc-routing-service model=\"alternate\" services=\"alternateServiceOptions\" is-alternate=\"true\" show-weight=\"true \">\n" +
23652
+ "<osc-routing-service model=\"alternate\" services=\"alternateServiceOptions\" is-alternate=\"true\" show-weight=\"route.alternateServices.length > 1 || controls.hideSlider \">\n" +
23642
23653
"</osc-routing-service>\n" +
23643
23654
"<a href=\"\" ng-click=\"route.alternateServices.splice($index, 1)\">Remove Service</a>\n" +
23644
23655
"<span ng-if=\"$last && route.alternateServices.length < alternateServiceOptions.length\">\n" +
@@ -23652,6 +23663,36 @@ var _scriptsTemplatesJs = []byte(`angular.module('openshiftConsoleTemplates', []
23652
23663
"</span>\n" +
23653
23664
"</div>\n" +
23654
23665
"</div>\n" +
23666
+ "\n" +
23667
+ "<div ng-if=\"route.alternateServices.length === 1 && !controls.hideSlider\">\n" +
23668
+ "<h3>Service Weights</h3>\n" +
23669
+ "<div class=\"form-group\">\n" +
23670
+ "<div class=\"weight-slider-values\">\n" +
23671
+ "<div>\n" +
23672
+ "<span class=\"service-name\">{{route.to.service.metadata.name}}</span>\n" +
23673
+ "<span class=\"weight-percentage\">{{weightAsPercentage(route.to.weight)}}</span>\n" +
23674
+ "</div>\n" +
23675
+ "<div>\n" +
23676
+ "<span class=\"weight-percentage hidden-xs\">{{weightAsPercentage(route.alternateServices[0].weight)}}</span>\n" +
23677
+ "<span class=\"service-name\">{{route.alternateServices[0].service.metadata.name}}</span>\n" +
23678
+ "<span class=\"weight-percentage visible-xs-inline\">{{weightAsPercentage(route.alternateServices[0].weight)}}</span>\n" +
23679
+ "</div>\n" +
23680
+ "</div>\n" +
23681
+ "<label class=\"sr-only\" for=\"weight-slider\">Service {{route.to.service.metadata.name}} Weight</label>\n" +
23682
+ "<input id=\"weight-slider\" type=\"range\" min=\"0\" max=\"100\" step=\"1\" list=\"ticks\" ng-model=\"controls.rangeSlider\" aria-describedby=\"weight-slider-help\" class=\"mar-top-md\">\n" +
23683
+ "<datalist id=\"ticks\">\n" +
23684
+ "<option>0</option>\n" +
23685
+ "<option>25</option>\n" +
23686
+ "<option>50</option>\n" +
23687
+ "<option>75</option>\n" +
23688
+ "<option>100</option>\n" +
23689
+ "</datalist>\n" +
23690
+ "<div class=\"help-block\" id=\"weight-slider-help\">\n" +
23691
+ "Percentage of traffic sent to each service. Drag the slider to adjust the values or\n" +
23692
+ "<a href=\"\" ng-click=\"controls.hideSlider = true\">edit weights as integers</a>.\n" +
23693
+ "</div>\n" +
23694
+ "</div>\n" +
23695
+ "</div>\n" +
23655
23696
"<div class=\"checkbox\">\n" +
23656
23697
"<label>\n" +
23657
23698
"<input type=\"checkbox\" ng-model=\"secureRoute\" aria-describedby=\"secure-route-help\">\n" +
@@ -109241,8 +109282,7 @@ func stylesFontsOpenshiftLogosIconWoff() (*asset, error) {
109241
109282
return a, nil
109242
109283
}
109243
109284
109244
- var _stylesMainCss = []byte(`.ie9.layout-pf-alt-fixed .nav-pf-vertical-alt,.ie9.layout-pf-fixed .nav-pf-secondary-nav,.ie9.layout-pf-fixed .nav-pf-tertiary-nav,.ie9.layout-pf-fixed .nav-pf-vertical,hr{box-sizing:content-box}
109245
- div.code,pre,textarea{overflow:auto}
109285
+ var _stylesMainCss = []byte(`div.code,pre,textarea{overflow:auto}
109246
109286
.text-left,caption,th{text-align:left}
109247
109287
.btn,.datepicker table{-webkit-user-select:none;-moz-user-select:none}
109248
109288
.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.pre-scrollable{max-height:340px}
@@ -109275,7 +109315,7 @@ sup{top:-.5em}
109275
109315
sub{bottom:-.25em}
109276
109316
img{border:0;vertical-align:middle}
109277
109317
svg:not(:root){overflow:hidden}
109278
- hr{height:0}
109318
+ hr{box-sizing:content-box; height:0}
109279
109319
code,div.code,kbd,pre,samp{font-size:1em}
109280
109320
button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}
109281
109321
button{overflow:visible}
@@ -111671,6 +111711,7 @@ select.bs-select-hidden,select.selectpicker{display:none!important}
111671
111711
.c3 text,.log-line-number{-moz-user-select:none;-webkit-user-select:none}
111672
111712
.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;border-radius:1px;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}
111673
111713
.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block!important;height:100%;padding:2px 6px;font-size:13px;line-height:21px}
111714
+ .ie9.layout-pf-alt-fixed .nav-pf-vertical-alt,.ie9.layout-pf-fixed .nav-pf-secondary-nav,.ie9.layout-pf-fixed .nav-pf-tertiary-nav,.ie9.layout-pf-fixed .nav-pf-vertical{box-sizing:content-box}
111674
111715
.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}
111675
111716
.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;background:#0088ce}
111676
111717
.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;background:#00659c}
@@ -112831,6 +112872,12 @@ to{transform:rotate(359deg)}
112831
112872
.compute-resource{margin-bottom:5px}
112832
112873
@media (max-width:767px){.compute-resource .inline-select{margin-top:5px}
112833
112874
}
112875
+ .weight-slider-values{display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:-ms-flex;display:flex;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column}
112876
+ .weight-slider-values .service-name{font-weight:600}
112877
+ .weight-slider-values .weight-percentage{font-size:15px;margin-left:5px}
112878
+ @media (min-width:768px){.weight-slider-values{-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;justify-content:space-between}
112879
+ .weight-slider-values .weight-percentage{margin-right:5px}
112880
+ }
112834
112881
.card-pf{box-shadow:0 3px 1px -2px rgba(0,0,0,.15),0 2px 2px 0 rgba(0,0,0,.1),0 1px 5px 0 rgba(0,0,0,.09)}
112835
112882
.card-pf .image-icon,.card-pf .template-icon{font-size:28px;line-height:1;margin-right:15px;opacity:.38}
112836
112883
.card-pf-badge{color:#999;font-size:11px;text-transform:uppercase}
0 commit comments