Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/1153#discussion_r173371697 --- Diff: exec/java-exec/src/main/resources/rest/index.ftl --- @@ -269,9 +277,12 @@ } }); } - <#if model.shouldShowAdminInfo() || !model.isAuthEnabled() > - function shutdown(address,button) { - url = "http://"+address+":"+portNum+"/gracefulShutdown"; + <#if model.shouldShowAdminInfo() || !model.isAuthEnabled()> + function shutdown(button) { + var protocol = location.protocol; + var host = location.host; + var requestPath = "/gracefulShutdown"; + var url = protocol+host+requestPath; --- End diff -- How about refactoring above lines into separate function `getRequestUrl(requestPath)` and call that from both the methods (`shutdown` & `fillQueryCount`) ``` function getRequestUrl(requestPath) { var protocol = location.protocol; var host = location.host; var url = protocol + host + requestPath; return url; } ```
---