org.n3r.quartz.glass.js.glass.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quartz-glass Show documentation
Show all versions of quartz-glass Show documentation
A web user interface for quartz
/**
* Proposes a job name.
*/
function proposeJobName(clazz) {
if (clazz == '' && clazz.indexOf('.') == -1) {
$('#nameProposal').text("");
return;
}
var name = clazz.substring(clazz.lastIndexOf('.') + 1, clazz.length);
$('#nameProposal').text("maybe " + name + " ?");
}
/**
* Displays description and job arguments for given class
*/
onJobSelected = function () {
var clazz = $("#clazz").val();
proposeJobName(clazz);
if (clazz == null) {
$("#arguments").empty();
return;
}
$.getJSON(SERVICE_URL, {"className": clazz}, function (job) {
$("#description").text(job.description);
$("#disallowConcurrentExecution").text(job.disallowConcurrentExecution);
$("#persistJobDataAfterExecution").text(job.persistJobDataAfterExecution);
var htmlBuilder = "";
$(job.arguments).each(function (index, argument) {
htmlBuilder += "";
if (argument.required) {
htmlBuilder += '' + argument.name + '* ';
}
else {
htmlBuilder += '' + argument.name + " ";
}
htmlBuilder += "" + argument.description + " ";
htmlBuilder += "";
$(argument.sampleValues).each(function (i, sample) {
if (i > 0) {
htmlBuilder += "
";
}
htmlBuilder += sample;
});
htmlBuilder += " "
htmlBuilder += " ";
});
$("#arguments").html(htmlBuilder);
});
}
showLogs = function (executionId) {
$.getJSON(LOGS_SERVICE_URL, {"executionId": executionId}, function (page) {
$("#logs-" + executionId + "-link").hide();
$("#logs-" + executionId).show();
var htmlBuilder = "";
$(page.items).each(function (index, log) {
htmlBuilder += log.formattedDate;
htmlBuilder += " ";
htmlBuilder += "" + log.level + "";
htmlBuilder += " ";
htmlBuilder += log.message;
if (log.stackTrace != null) {
htmlBuilder += " ";
htmlBuilder += "view stacktrace";
htmlBuilder += " ";
}
htmlBuilder += "
";
});
if (page.items.length < page.totalCount) {
htmlBuilder += "...
view all";
}
$("#logs-" + executionId).html(htmlBuilder);
});
}
viewStackTrace = function (executionId, index) {
var stackTrace = $("#logs-" + executionId + "-" + index + "-stacktrace").html();
var popup = window.open('', 'stacktrace-' + executionId + "-" + index, 'width=1200,height=800');
popup.document.documentElement.innerHTML = stackTrace;
}
viewLogs = function (executionId, pageIndex) {
window.open('/glass/traces/' + executionId, 'logs-' + executionId, 'width=1200,height=800');
}