Skip to content

Commit 7805cf7

Browse files
author
OpenShift Bot
authored
Merge pull request #1367 from spadgett/zero-weight-routes
Merged by openshift-bot
2 parents f6b4261 + 25072a3 commit 7805cf7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: app/scripts/directives/oscRouting.js

+6
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ angular.module("openshiftConsole")
241241
}
242242

243243
if (alternateServicesCount === 1) {
244+
// If all weights are 0, don't use the slider.
245+
if (scope.route.to.weight === 0 && scope.route.alternateServices[0].weight === 0) {
246+
scope.controls.hideSlider = true;
247+
return;
248+
}
249+
244250
initializingSlider = true;
245251
scope.controls.rangeSlider = scope.weightAsPercentage(scope.route.to.weight);
246252
}

Diff for: dist/scripts/scripts.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -10389,7 +10389,10 @@ return b ? d3.round(e, 1) + "%" :e;
1038910389
};
1039010390
var k = !1;
1039110391
c.$watch("route.alternateServices.length", function(a) {
10392-
0 === a && _.has(c, "route.to.weight") && delete c.route.to.weight, 1 === a && (k = !0, c.controls.rangeSlider = c.weightAsPercentage(c.route.to.weight));
10392+
if (0 === a && _.has(c, "route.to.weight") && delete c.route.to.weight, 1 === a) {
10393+
if (0 === c.route.to.weight && 0 === c.route.alternateServices[0].weight) return void (c.controls.hideSlider = !0);
10394+
k = !0, c.controls.rangeSlider = c.weightAsPercentage(c.route.to.weight);
10395+
}
1039310396
}), c.$watch("controls.rangeSlider", function(a, b) {
1039410397
return k ? void (k = !1) :void (a !== b && (a = parseInt(a, 10), _.set(c, "route.to.weight", a), _.set(c, "route.alternateServices[0].weight", 100 - a)));
1039510398
});

0 commit comments

Comments
 (0)