Skip to content

Commit

Permalink
DRILL-6044: Fixed shutdown button in Web UI when ssl,auth are enabled
Browse files Browse the repository at this point in the history
This closes apache#1153
  • Loading branch information
dvjyothsna authored and parthchandra committed Mar 11, 2018
1 parent 920a12a commit cac2882
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions exec/java-exec/src/main/resources/rest/index.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<tr id="row-${i}">
<td>${i}</td>
<td id="address" >${drillbit.getAddress()}<#if drillbit.isCurrent()>
<span class="label label-info">Current</span>
<span class="label label-info" id="current">Current</span>
</#if>
</td>
<td id="port" >${drillbit.getUserPort()}</td>
Expand All @@ -79,9 +79,9 @@
</span>
</td>
<td id="status" >${drillbit.getState()}</td>
<#if model.shouldShowAdminInfo() || !model.isAuthEnabled() >
<#if (model.shouldShowAdminInfo() || !model.isAuthEnabled()) && drillbit.isCurrent() >
<td>
<button type="button" id="shutdown" onClick="shutdown('${drillbit.getAddress()}',$(this));"> SHUTDOWN </button>
<button type="button" id="shutdown" onClick="shutdown($(this));"> SHUTDOWN </button>
</td>
</#if>
<td id="queriesCount"> </td>
Expand Down Expand Up @@ -143,7 +143,6 @@
</div>
</div>
</#if>

<#assign queueInfo = model.queueInfo() />
<div class="row">
<div class="col-md-12">
Expand Down Expand Up @@ -194,7 +193,6 @@
var timeout;
var size = $("#size").html();
function getPortNum() {
var port = $.ajax({
type: 'GET',
Expand Down Expand Up @@ -247,19 +245,22 @@
$("#row-"+i).find("#queriesCount").text("");
}
else {
if( status_map[key] == "ONLINE") {
if (status_map[key] == "ONLINE") {
$("#row-"+i).find("#status").text(status_map[key]);
}
else {
fillQueryCount(address,i);
if ($("#row-"+i).find("#current").html() == "Current") {
fillQueryCount(i);
}
$("#row-"+i).find("#status").text(status_map[key]);
}
}
}
}
function fillQueryCount(address,row_id) {
url = "http://"+address+":"+portNum+"/queriesCount";
var result = $.ajax({
function fillQueryCount(row_id) {
var requestPath = "/queriesCount";
var url = getRequestUrl(requestPath);
var result = $.ajax({
type: 'GET',
url: url,
complete: function(data) {
Expand All @@ -269,9 +270,10 @@
}
});
}
<#if model.shouldShowAdminInfo() || !model.isAuthEnabled() >
function shutdown(address,button) {
url = "http://"+address+":"+portNum+"/gracefulShutdown";
<#if model.shouldShowAdminInfo() || !model.isAuthEnabled()>
function shutdown(button) {
var requestPath = "/gracefulShutdown";
var url = getRequestUrl(requestPath);
var result = $.ajax({
type: 'POST',
url: url,
Expand All @@ -283,6 +285,12 @@
});
}
</#if>
function getRequestUrl(requestPath) {
var protocol = location.protocol;
var host = location.host;
var url = protocol + "//" + host + requestPath;
return url;
}
</script>
</#macro>

Expand Down

0 comments on commit cac2882

Please sign in to comment.