diff --git a/htdocs/js/pages/JobDetails.class.js b/htdocs/js/pages/JobDetails.class.js index abf600d..8caf161 100644 --- a/htdocs/js/pages/JobDetails.class.js +++ b/htdocs/js/pages/JobDetails.class.js @@ -374,6 +374,48 @@ Class.subclass(Page.Base, "Page.JobDetails", { if (job.html.caption) html += '
' + job.html.caption + '
'; } + // log grid + + html += ` + + +
+ + ` + // job log (IFRAME) html += '
'; html += 'Console Output'; @@ -667,6 +709,30 @@ Class.subclass(Page.Base, "Page.JobDetails", { window.location = '/api/app/get_job_log?id=' + job.id + '&download=1' + '&session_id=' + localStorage.session_id; }, + unsetLogIcon(id) { + let el = document.getElementById('view_' + id) + if(el) el.className = 'fa fa-eye' + }, + + get_log_to_grid: function(title, id) { + if(!title) return + if(!id) id = title + let curr = document.getElementById('log_' + id) + if(curr) { curr.remove(); return } + + $.get('/api/app/get_job_log?id=' + id, (resp)=>{ + let size = this.args.tail || 25 + data = new AnsiUp().ansi_to_html(resp.split("\n").slice(-1*size - 4, -4).join("\n")) + const newItem = document.createElement('div'); + newItem.setAttribute('id', 'log_' + id) + newItem.className = 'grid-item'; // Apply any necessary classes + newItem.innerHTML = `
${title}
${data}
`; + const gridContainer = document.getElementById('log_grid'); + gridContainer.appendChild(newItem); + + }) + }, + do_view_inline_log: function () { // swap out job log size warning with IFRAME containing inline log var job = this.job;