From 34754760b2930eba960a6f3c9a96791e594ceae3 Mon Sep 17 00:00:00 2001 From: Ning Wang Date: Mon, 11 Nov 2019 09:08:27 -0800 Subject: [PATCH] Add parallelism calculator in Heron UI --- heron/tools/ui/resources/static/css/main.css | 8 ++- .../ui/resources/static/js/topologies.js | 51 +++++++++++++--- .../ui/resources/templates/topology.html | 59 +++++++++++++++++++ 3 files changed, 110 insertions(+), 8 deletions(-) diff --git a/heron/tools/ui/resources/static/css/main.css b/heron/tools/ui/resources/static/css/main.css index 0ae4425d60d..f13666de68e 100644 --- a/heron/tools/ui/resources/static/css/main.css +++ b/heron/tools/ui/resources/static/css/main.css @@ -2291,4 +2291,10 @@ div#topologydetails.display-stats div.display-info.display-stats, div#topologydetails.display-counters div.display-info.display-counters, div#topologydetails.display-config div.display-info.display-config { display: block; -} \ No newline at end of file +} + +/* Backdrop in bootstrap 3 seems to have solid color and we would like it to be half transparent */ +div.modal-backdrop.fade.in { + opacity: 0.5; + filter: alpha(opacity=50); +} diff --git a/heron/tools/ui/resources/static/js/topologies.js b/heron/tools/ui/resources/static/js/topologies.js index 764e0aac113..ff8dbbeb49d 100644 --- a/heron/tools/ui/resources/static/js/topologies.js +++ b/heron/tools/ui/resources/static/js/topologies.js @@ -1067,8 +1067,34 @@ var BoltRunningInfo = React.createClass({ }); var setState = this.setState.bind(this); - const headings = ["Bolt", "Parallelism", "Execute Count", "Failure Count", - "Capacity Utilization(min)", "Capacity Utilization(max)"]; + const headings = [ + { name: "Bolt", sortable: true }, + { name: "Parallelism", sortable: true }, + { name: "Execute Count", sortable: true }, + { name: "Failure Count", sortable: true }, + { name: "Capacity Utilization(min)", sortable: true }, + { name: "Capacity Utilization(max)", sortable: true }, + { name: "Parallelism Calculator", sortable: false } + ]; + + var openParallelismCalculator = function (e, index) { + var row = rows[index]; + + var calculator = $("#parallelism-calculator-modal"); + calculator.find('#modal-component').text(row[0]); + calculator.attr('data-execute-count', row[2]); + calculator.find('#modal-execute-count').text(row[2]); + calculator.find('#target-execute-count').val(row[2]); + calculator.attr('data-max-utilization', row[5].replace("%", "")); + calculator.find('#modal-max-utilization').text(row[5]); + calculator.find('#target-max-utilization').val(row[5].replace("%", "")); + calculator.attr('data-parallelism', row[1]); + calculator.find('#modal-parallelism').text(row[1]); + calculator.find('#target-parallelism').val(row[1]); + + calculator.modal({keyboard: true}); + }; + return (
@@ -1100,16 +1126,27 @@ var BoltRunningInfo = React.createClass({ reverse: i === sortKey ? (!reverse) : true }); } - return {heading}; + + if (heading.sortable) { + return {heading.name}; + } else { + return {heading.name}; + } })} - {rows.map(function (row) { + {rows.map(function (row, index) { return { - row.map(function (value, i) { - return {value}; - })}; + row.map(function (value, i) { + return {value}; + })} + + + ; })} diff --git a/heron/tools/ui/resources/templates/topology.html b/heron/tools/ui/resources/templates/topology.html index f743c787a5c..c1096258f23 100644 --- a/heron/tools/ui/resources/templates/topology.html +++ b/heron/tools/ui/resources/templates/topology.html @@ -182,7 +182,49 @@

+ +

+
@@ -204,6 +246,23 @@

+ +