main.resources.html.js.spark-jobserver-ui.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spark-jobserver Show documentation
Show all versions of spark-jobserver Show documentation
SnappyData distributed data store and execution engine
The newest version!
function getJobs() {
$.getJSON(
'/jobs',
'',
function(jobs) {
$('#failedJobsTable tbody').empty();
$('#runningJobsTable tbody').empty();
$('#completedJobsTable tbody').empty();
$.each(jobs, function(key, job) {
var items = [];
items.push("");
items.push("" + job.jobId + " ");
items.push("" + job.classPath + " ");
items.push("" + job.context + " ");
items.push("" + job.startTime + " ");
items.push("" + job.duration + " ");
items.push(" ");
if(job.status == 'ERROR') {
$('#failedJobsTable > tbody:last').append(items.join(""));
} else if(job.status == 'RUNNING') {
$('#runningJobsTable > tbody:last').append(items.join(""));
} else {
$('#completedJobsTable > tbody:last').append(items.join(""));
}
});
});
}
function getContexts() {
$.getJSON(
'/contexts',
'',
function(contexts) {
$('#contextsTable tbody').empty();
$.each(contexts, function(key, contextName) {
var items = [];
items.push("" + contextName + " ");
$('#contextsTable > tbody:last').append(items.join(""));
});
});
}
function getJars() {
$.getJSON(
'/jars',
'',
function(jars) {
$('#jarsTable tbody').empty();
$.each(jars, function(jarName, deploymentTime) {
var items = [];
items.push("");
items.push("" + jarName + " ");
items.push("" + deploymentTime + " ");
items.push(" ");
$('#jarsTable > tbody:last').append(items.join(""));
});
});
}
$(document).ready(getJobs());
$(document).ready(getContexts());
$(document).ready(getJars());
$(function () {
$('#navTabs a[data-toggle="tab"]').on('show.bs.tab', function (e) {
var target = $(e.target).attr("href");
if (target == '#jobs') {
getJobs();
} else if (target == "#contexts") {
getContexts();
} else {
getJars();
}
})
});