From f0fd8ba191b377a4c4beece902d98e7e17987802 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Fri, 5 May 2017 03:13:12 +0900 Subject: [PATCH] Add supervisors to overlord console. (#4248) --- .../resources/indexer_static/console.html | 5 ++ .../indexer_static/js/console-0.0.1.js | 48 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/indexing-service/src/main/resources/indexer_static/console.html b/indexing-service/src/main/resources/indexer_static/console.html index a9a5506b256..d397b1bbbea 100644 --- a/indexing-service/src/main/resources/indexer_static/console.html +++ b/indexing-service/src/main/resources/indexer_static/console.html @@ -37,6 +37,11 @@
Coordinator Console
+ +

Running Tasks

Loading Running Tasks... this may take a few minutes
diff --git a/indexing-service/src/main/resources/indexer_static/js/console-0.0.1.js b/indexing-service/src/main/resources/indexer_static/js/console-0.0.1.js index a8eb8bc7cea..5ec87c588fa 100644 --- a/indexing-service/src/main/resources/indexer_static/js/console-0.0.1.js +++ b/indexing-service/src/main/resources/indexer_static/js/console-0.0.1.js @@ -16,6 +16,34 @@ var killTask = function(taskId) { } } +var resetSupervisor = function(supervisorId) { + if(confirm('Do you really want to reset: '+ supervisorId)) { + $.ajax({ + type:'POST', + url: '/druid/indexer/v1/supervisor/' + supervisorId + '/reset', + data: '' + }).done(function(data) { + setTimeout(function() { location.reload(true) }, 750); + }).fail(function(data) { + alert('Reset request failed, please check overlord logs for details.'); + }) + } +} + +var shutdownSupervisor = function(supervisorId) { + if(confirm('Do you really want to shutdown: '+ supervisorId)) { + $.ajax({ + type:'POST', + url: '/druid/indexer/v1/supervisor/' + supervisorId + '/shutdown', + data: '' + }).done(function(data) { + setTimeout(function() { location.reload(true) }, 750); + }).fail(function(data) { + alert('Shutdown request failed, please check overlord logs for details.'); + }) + } +} + $(document).ready(function() { var augment = function(data, showKill) { for (i = 0 ; i < data.length ; i++) { @@ -31,6 +59,26 @@ $(document).ready(function() { } } + $.get('/druid/indexer/v1/supervisor', function(dataList) { + var data = [] + for (i = 0 ; i < dataList.length ; i++) { + var supervisorId = encodeURIComponent(dataList[i]) + data[i] = { + "dataSource" : supervisorId, + "more" : + 'payload' + + 'status' + + 'history' + + 'reset' + + 'shutdown' + } + } + buildTable((data), $('#supervisorsTable')); + if (dataList.length > 0) { + $('.supervisors_section').show(); + } + }); + $.get('/druid/indexer/v1/runningTasks', function(data) { $('.running_loading').hide(); augment(data, true);