diff --git a/server/src/main/java/io/druid/server/coordinator/rules/ForeverLoadRule.java b/server/src/main/java/io/druid/server/coordinator/rules/ForeverLoadRule.java index 70e482764f8..2150150cb03 100644 --- a/server/src/main/java/io/druid/server/coordinator/rules/ForeverLoadRule.java +++ b/server/src/main/java/io/druid/server/coordinator/rules/ForeverLoadRule.java @@ -57,7 +57,8 @@ public class ForeverLoadRule extends LoadRule @Override public int getNumReplicants(String tier) { - return tieredReplicants.get(tier); + Integer retVal = tieredReplicants.get(tier); + return (retVal == null) ? 0 : retVal; } @Override diff --git a/server/src/main/resources/static/css/rules.css b/server/src/main/resources/static/css/rules.css index 384f312181e..dcd52e2706e 100644 --- a/server/src/main/resources/static/css/rules.css +++ b/server/src/main/resources/static/css/rules.css @@ -36,8 +36,9 @@ margin: 0 10px 0 10px; } -.delete_rule { +.delete_rule, .add_tier { border-style : none; color:#555; background-color:#eee; + cursor: pointer; } \ No newline at end of file diff --git a/server/src/main/resources/static/js/rules-0.0.1.js b/server/src/main/resources/static/js/rules-0.0.1.js index 79ae691b2c6..8ffdd085808 100644 --- a/server/src/main/resources/static/js/rules-0.0.1.js +++ b/server/src/main/resources/static/js/rules-0.0.1.js @@ -19,6 +19,7 @@ function makeRuleDiv(rule) { } else { retVal += makeRuleComponents(rule.type) + makeRuleBody(rule); } + retVal += ""; return retVal; } @@ -56,15 +57,15 @@ function makeRuleBody(rule) { case "loadByPeriod": retVal += makeLoadByPeriod(rule); break; + case "loadForever": + retVal += makeLoadForever(rule); + break; case "dropByInterval": retVal += makeDropByInterval(rule); break; case "dropByPeriod": retVal += makeDropByPeriod(rule); break; - case "loadForever": - retVal += makeLoadForever(rule); - break; case "dropForever": retVal += ""; break; @@ -80,42 +81,67 @@ function makeRuleBody(rule) { } function makeLoadByInterval(rule) { - return "interval" + - "replicants" + - makeTiersDropdown(rule) - ; + var retVal = ""; + retVal += "interval"; + retVal += ""; + if (rule.tieredReplicants === undefined) { + retVal += makeTierLoad(null, 0); + } + for (var tier in rule.tieredReplicants) { + retVal += makeTierLoad(tier, rule.tieredReplicants[tier]); + } + return retVal; } function makeLoadByPeriod(rule) { - return "period" + - "replicants" + - makeTiersDropdown(rule) - ; -} - -function makeDropByInterval(rule) { - return "interval"; -} - -function makeDropByPeriod(rule) { - return "period"; + var retVal = ""; + retVal += "period"; + retVal += ""; + if (rule.tieredReplicants === undefined) { + retVal += makeTierLoad(null, 0); + } + for (var tier in rule.tieredReplicants) { + retVal += makeTierLoad(tier, rule.tieredReplicants[tier]); + } + return retVal; } function makeLoadForever(rule) { - return "replicants" + - makeTiersDropdown(rule) - ; + var retVal = ""; + retVal += ""; + if (rule.tieredReplicants === undefined) { + retVal += makeTierLoad(null, 0); + } + for (var tier in rule.tieredReplicants) { + retVal += makeTierLoad(tier, rule.tieredReplicants[tier]); + } + return retVal; +} + +function makeTierLoad(tier, val) { + return "