mirror of https://github.com/apache/druid.git
add kill task link on console (#3974)
* add kill task link on console * refresh after kill
This commit is contained in:
parent
c3bf40108d
commit
469ae374a3
|
@ -2,39 +2,56 @@
|
||||||
|
|
||||||
var oTable = [];
|
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() {
|
$(document).ready(function() {
|
||||||
var augment = function(data) {
|
var augment = function(data, showKill) {
|
||||||
for (i = 0 ; i < data.length ; i++) {
|
for (i = 0 ; i < data.length ; i++) {
|
||||||
var taskId = encodeURIComponent(data[i].id)
|
var taskId = encodeURIComponent(data[i].id)
|
||||||
data[i].more =
|
data[i].more =
|
||||||
'<a href="/druid/indexer/v1/task/' + taskId + '">payload</a>' +
|
'<a href="/druid/indexer/v1/task/' + taskId + '">payload</a>' +
|
||||||
'<a href="/druid/indexer/v1/task/' + taskId + '/status">status</a>' +
|
'<a href="/druid/indexer/v1/task/' + taskId + '/status">status</a>' +
|
||||||
'<a href="/druid/indexer/v1/task/' + taskId + '/log">log (all)</a>' +
|
'<a href="/druid/indexer/v1/task/' + taskId + '/log">log (all)</a>' +
|
||||||
'<a href="/druid/indexer/v1/task/' + taskId + '/log?offset=-8192">log (last 8kb)</a>'
|
'<a href="/druid/indexer/v1/task/' + taskId + '/log?offset=-8192">log (last 8kb)</a>';
|
||||||
|
if(showKill) {
|
||||||
|
data[i].more += '<a onclick="killTask(\''+ taskId +'\');">kill</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$.get('/druid/indexer/v1/runningTasks', function(data) {
|
$.get('/druid/indexer/v1/runningTasks', function(data) {
|
||||||
$('.running_loading').hide();
|
$('.running_loading').hide();
|
||||||
augment(data);
|
augment(data, true);
|
||||||
buildTable(data, $('#runningTable'));
|
buildTable(data, $('#runningTable'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/druid/indexer/v1/pendingTasks', function(data) {
|
$.get('/druid/indexer/v1/pendingTasks', function(data) {
|
||||||
$('.pending_loading').hide();
|
$('.pending_loading').hide();
|
||||||
augment(data);
|
augment(data, true);
|
||||||
buildTable(data, $('#pendingTable'));
|
buildTable(data, $('#pendingTable'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/druid/indexer/v1/waitingTasks', function(data) {
|
$.get('/druid/indexer/v1/waitingTasks', function(data) {
|
||||||
$('.waiting_loading').hide();
|
$('.waiting_loading').hide();
|
||||||
augment(data);
|
augment(data, true);
|
||||||
buildTable(data, $('#waitingTable'));
|
buildTable(data, $('#waitingTable'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/druid/indexer/v1/completeTasks', function(data) {
|
$.get('/druid/indexer/v1/completeTasks', function(data) {
|
||||||
$('.complete_loading').hide();
|
$('.complete_loading').hide();
|
||||||
augment(data);
|
augment(data, false);
|
||||||
buildTable(data, $('#completeTable'));
|
buildTable(data, $('#completeTable'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue