From 469ae374a36a6b9790b47452e0b514c6f35bcf73 Mon Sep 17 00:00:00 2001 From: Parag Jain Date: Sat, 25 Feb 2017 03:28:16 -0600 Subject: [PATCH] add kill task link on console (#3974) * add kill task link on console * refresh after kill --- .../indexer_static/js/console-0.0.1.js | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) 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 adaa1fba83f..2ae5cc6abe0 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 @@ -2,39 +2,56 @@ var oTable = []; +var killTask = function(taskId) { + if(confirm('Do you really want to kill: '+taskId)) { + $.ajax({ + type:'POST', + url: '/druid/indexer/v1/task/'+ taskId +'/shutdown', + data: '' + }).done(function(data) { + setTimeout(function() { location.reload(true) }, 75); + }).fail(function(data) { + alert('Kill request failed with status: '+data.status+' please check overlord logs'); + }) + } +} + $(document).ready(function() { - var augment = function(data) { + var augment = function(data, showKill) { for (i = 0 ; i < data.length ; i++) { var taskId = encodeURIComponent(data[i].id) data[i].more = 'payload' + 'status' + 'log (all)' + - 'log (last 8kb)' + 'log (last 8kb)'; + if(showKill) { + data[i].more += 'kill'; + } } } $.get('/druid/indexer/v1/runningTasks', function(data) { $('.running_loading').hide(); - augment(data); + augment(data, true); buildTable(data, $('#runningTable')); }); $.get('/druid/indexer/v1/pendingTasks', function(data) { $('.pending_loading').hide(); - augment(data); + augment(data, true); buildTable(data, $('#pendingTable')); }); $.get('/druid/indexer/v1/waitingTasks', function(data) { $('.waiting_loading').hide(); - augment(data); + augment(data, true); buildTable(data, $('#waitingTable')); }); $.get('/druid/indexer/v1/completeTasks', function(data) { $('.complete_loading').hide(); - augment(data); + augment(data, false); buildTable(data, $('#completeTable')); });