From 1451c9cf14b463e56cbb27f6501b196de18bc9f7 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 20:26:48 -0400 Subject: [PATCH 01/92] poudriere.js: Lint with eslint --- src/share/poudriere/html/assets/poudriere.js | 1058 +++++++++--------- 1 file changed, 529 insertions(+), 529 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index b5df898997..e9d499ddcd 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -24,112 +24,112 @@ * SUCH DAMAGE. */ -var updateInterval = 8; -var first_run = true; -var load_attempts = 0; -var max_load_attempts = 8; -var first_load_interval = 2; -var canvas_width; -var impulseData = []; -var tracker = 0; -var impulse_first_period = 120; -var impulse_target_period = 600; -var impulse_period = impulse_first_period; -var impulse_first_interval = impulse_first_period / updateInterval; -var impulse_interval = impulse_target_period / updateInterval; -var page_type; -var page_buildname; -var page_mastername; -var data_url = ""; +const updateInterval = 8; +let first_run = true; +let load_attempts = 0; +const max_load_attempts = 8; +const first_load_interval = 2; +let canvas_width; +const impulseData = []; +let tracker = 0; +const impulse_first_period = 120; +const impulse_target_period = 600; +const impulse_period = impulse_first_period; +const impulse_first_interval = impulse_first_period / updateInterval; +const impulse_interval = impulse_target_period / updateInterval; +let page_type; +let page_buildname; +let page_mastername; +let data_url = ''; function getParameterByName(name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); + name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); + const regex = new RegExp(`[\\?&]${name}=([^&#]*)`); + const results = regex.exec(location.search); return results == null - ? "" - : decodeURIComponent(results[1].replace(/\+/g, " ")); + ? '' + : decodeURIComponent(results[1].replace(/\+/g, ' ')); } function scrollOffset() { - return -1 * parseFloat($("body").css("padding-top")); + return -1 * parseFloat($('body').css('padding-top')); } function scrollToElement(element) { - var ele = $(element); + const ele = $(element); if (!ele.length) { return; } - $("body,html,document").scrollTop(ele.offset().top + scrollOffset()); + $('body,html,document').scrollTop(ele.offset().top + scrollOffset()); } function update_data() { $.ajax({ - url: data_url + ".data.json", - dataType: "json", + url: `${data_url}.data.json`, + dataType: 'json', headers: { - "Cache-Control": "max-age=0", + 'Cache-Control': 'max-age=0', }, - success: function (data) { + success(data) { load_attempts = 0; process_data(data); }, - error: function (data) { + error(data) { if (++load_attempts < max_load_attempts) { /* May not be there yet, try again shortly */ setTimeout(update_data, first_load_interval * 1000); } else { - $("#loading p") - .text("Invalid request or no data available " + " yet.") - .addClass("error"); + $('#loading p') + .text('Invalid request or no data available ' + ' yet.') + .addClass('error'); } }, }); } function format_origin(origin, flavor) { - var data; + let data; if (!origin) { - return ""; + return ''; } - data = origin.split("/"); + data = origin.split('/'); if (flavor) { - flavor = "@" + flavor; + flavor = `@${flavor}`; } else { - flavor = ""; + flavor = ''; } return ( - '' + - origin + - flavor + - "" + `${ + origin + }${flavor + }` ); } function format_githash(githash) { if (!githash) { - return ""; + return ''; } return ( - '' + - githash + - "" + `${ + githash + }` ); } @@ -138,7 +138,8 @@ function format_pkgname(pkgname) { } function minidraw(x, height, width, context, color, queued, variable) { - var pct, total_pct, newx; + let pct; let total_pct; let + newx; /* Calculate how much percentage this value should display */ pct = Math.floor((variable * 100) / queued); @@ -165,27 +166,29 @@ function minidraw(x, height, width, context, color, queued, variable) { } function determine_canvas_width() { - var width; + let width; /* Determine width by how much space the column has, minus the size of * displaying the percentage at 100% */ - width = $("#progress_col").width(); - $("#progresspct").text("100%"); - width = width - $("#progresspct").width() - 20; - $("#progresspct").text(""); + width = $('#progress_col').width(); + $('#progresspct').text('100%'); + width = width - $('#progresspct').width() - 20; + $('#progresspct').text(''); canvas_width = width; } function update_canvas(stats) { - var queued, built, failed, skipped, ignored, fetched, remaining, pctdone; - var height, width, x, context, canvas, pctdonetxt; + let queued; let built; let failed; let skipped; let ignored; let fetched; let remaining; let + pctdone; + let height; let width; let x; let context; let canvas; let + pctdonetxt; if (stats.queued === undefined) { return; } - canvas = document.getElementById("progressbar"); + canvas = document.getElementById('progressbar'); if (!canvas || canvas.getContext === undefined) { /* Not supported */ return; @@ -205,57 +208,59 @@ function update_canvas(stats) { fetched = stats.fetched; remaining = queued - built - failed - skipped - ignored - fetched; - context = canvas.getContext("2d"); + context = canvas.getContext('2d'); context.beginPath(); context.rect(0, 0, width, height); /* Save 2 pixels for border */ - height = height - 2; + height -= 2; /* Start at 1 and save 1 for border */ - width = width - 1; + width -= 1; x = 1; - context.fillStyle = "#E3E3E3"; + context.fillStyle = '#E3E3E3'; context.fillRect(1, 1, width, height); context.lineWidth = 1; - context.strokeStyle = "black"; + context.strokeStyle = 'black'; context.stroke(); - x += minidraw(x, height, width, context, "#00CC00", queued, built); - x += minidraw(x, height, width, context, "#E00000", queued, failed); - x += minidraw(x, height, width, context, "#FF9900", queued, ignored); - x += minidraw(x, height, width, context, "#228B22", queued, fetched); - x += minidraw(x, height, width, context, "#CC6633", queued, skipped); + x += minidraw(x, height, width, context, '#00CC00', queued, built); + x += minidraw(x, height, width, context, '#E00000', queued, failed); + x += minidraw(x, height, width, context, '#FF9900', queued, ignored); + x += minidraw(x, height, width, context, '#228B22', queued, fetched); + x += minidraw(x, height, width, context, '#CC6633', queued, skipped); pctdone = ((queued - remaining) * 100) / queued; if (isNaN(pctdone)) { pctdone = 0; } if (pctdone < 1.0 && pctdone != 0) { - pctdonetxt = "< 1"; + pctdonetxt = '< 1'; } else { pctdonetxt = Math.floor(pctdone); } - $("#progresspct").text(pctdonetxt + "%"); + $('#progresspct').text(`${pctdonetxt}%`); - $("#stats_remaining").html(remaining); + $('#stats_remaining').html(remaining); } function display_pkghour(stats, snap) { - var attempted, pkghour, hours; + let attempted; let pkghour; let + hours; attempted = parseInt(stats.built) + parseInt(stats.failed); - pkghour = "--"; + pkghour = '--'; if (attempted > 0 && snap.elapsed) { hours = snap.elapsed / 3600; pkghour = Math.ceil(attempted / hours); } - $("#snap_pkghour").html(pkghour); + $('#snap_pkghour').html(pkghour); } function display_impulse(stats, snap) { - var attempted, pkghour, index, tail, d_pkgs, d_secs, title; + let attempted; let pkghour; let index; let tail; let d_pkgs; let d_secs; let + title; attempted = parseInt(stats.built) + parseInt(stats.failed); - pkghour = "--"; + pkghour = '--'; index = tracker % impulse_interval; if (tracker < impulse_interval) { impulseData.push({ pkgs: attempted, time: snap.elapsed }); @@ -266,61 +271,55 @@ function display_impulse(stats, snap) { if (tracker >= impulse_first_interval) { if (tracker < impulse_interval) { tail = 0; - title = - "Package build rate over last " + - Math.floor((tracker * updateInterval) / 60) + - " minutes"; + title = `Package build rate over last ${ + Math.floor((tracker * updateInterval) / 60) + } minutes`; } else { tail = (tracker - (impulse_interval - 1)) % impulse_interval; - title = - "Package build rate over last " + - impulse_target_period / 60 + - " minutes"; + title = `Package build rate over last ${ + impulse_target_period / 60 + } minutes`; } d_pkgs = impulseData[index].pkgs - impulseData[tail].pkgs; d_secs = impulseData[index].time - impulseData[tail].time; pkghour = Math.ceil(d_pkgs / (d_secs / 3600)); } else { - title = "Package build rate. Still calculating..."; + title = 'Package build rate. Still calculating...'; } tracker++; - $("#snap .impulse").attr("title", title); - $("#snap_impulse").html(pkghour); + $('#snap .impulse').attr('title', title); + $('#snap_impulse').html(pkghour); } function jail_url(mastername) { - if (server_style == "hosted") { + if (server_style == 'hosted') { if (mastername) { - return "jail.html?mastername=" + encodeURIComponent(mastername); - } else { - return "#"; + return `jail.html?mastername=${encodeURIComponent(mastername)}`; } - } else { - return "../"; + return '#'; } + return '../'; } function format_mastername(mastername) { - var html; + let html; if (!mastername) { - return ""; + return ''; } - if (page_mastername && mastername == page_mastername && page_type == "jail") { - html = - '' + - mastername + - ""; + if (page_mastername && mastername == page_mastername && page_type == 'jail') { + html = `${ + mastername + }`; } else { - html = - '' + - mastername + - ""; + html = `${ + mastername + }`; } return html; @@ -340,82 +339,79 @@ function format_ptname(ptname) { function build_url(mastername, buildname) { if (!mastername || !buildname) { - return ""; + return ''; } return ( - "build.html?" + - "mastername=" + - encodeURIComponent(mastername) + - "&" + - "build=" + - encodeURIComponent(buildname) + 'build.html?' + + `mastername=${ + encodeURIComponent(mastername) + }&` + + `build=${ + encodeURIComponent(buildname)}` ); } function format_buildname(mastername, buildname) { - var html; + let html; if (!mastername) { return buildname; - } else if (!buildname) { - return ""; + } if (!buildname) { + return ''; } if ( - page_mastername && - mastername == page_mastername && - page_buildname && - buildname == page_buildname && - page_type == "build" + page_mastername + && mastername == page_mastername + && page_buildname + && buildname == page_buildname + && page_type == 'build' ) { - html = - '' + - buildname + - ""; + html = `${ + buildname + }`; } else { - html = - '' + - buildname + - ""; + html = `${ + buildname + }`; } return html; } function format_portset(ptname, setname) { - return ptname + (setname ? "-" : "") + setname; + return ptname + (setname ? '-' : '') + setname; } function format_log(pkgname, errors, text) { - var html; - - html = - '' + - text + - ""; + let html; + + html = `${ + text + }`; return html; } function format_start_to_end(start, end) { - var duration; + let duration; if (!start) { - return ""; + return ''; } start = parseInt(start); if (isNaN(start)) { - return ""; + return ''; } if (end === undefined) { @@ -432,80 +428,80 @@ function format_start_to_end(start, end) { } function format_duration(duration) { - var hours, minutes, seconds; + let hours; let minutes; let + seconds; - if (duration === undefined || duration == "" || isNaN(duration)) { - return ""; + if (duration === undefined || duration == '' || isNaN(duration)) { + return ''; } hours = Math.floor(duration / 3600); - duration = duration - hours * 3600; + duration -= hours * 3600; minutes = Math.floor(duration / 60); seconds = duration - minutes * 60; if (hours < 10) { - hours = "0" + hours; + hours = `0${hours}`; } if (minutes < 10) { - minutes = "0" + minutes; + minutes = `0${minutes}`; } if (seconds < 10) { - seconds = "0" + seconds; + seconds = `0${seconds}`; } - return hours + ":" + minutes + ":" + seconds; + return `${hours}:${minutes}:${seconds}`; } function filter_skipped(pkgname) { - var table, search_filter; + let table; let + search_filter; - scrollToElement("#skipped"); - table = $("#skipped_table").dataTable(); + scrollToElement('#skipped'); + table = $('#skipped_table').dataTable(); table.fnFilter(pkgname, 3); - search_filter = $("#skipped_table_filter input"); + search_filter = $('#skipped_table_filter input'); search_filter.val(pkgname); - search_filter.prop("disabled", true); - search_filter.css("background-color", "#DDD"); + search_filter.prop('disabled', true); + search_filter.css('background-color', '#DDD'); - if (!$("#resetsearch").length) { + if (!$('#resetsearch').length) { search_filter.after( - '' + '', ); - $("#resetsearch").click(function (e) { - table.fnFilter("", 3); - search_filter.val(""); - search_filter.prop("disabled", false); - search_filter.css("background-color", ""); + $('#resetsearch').click(function (e) { + table.fnFilter('', 3); + search_filter.val(''); + search_filter.prop('disabled', false); + search_filter.css('background-color', ''); $(this).remove(); }); } } function translate_status(status) { - var a; + let a; if (status === undefined) { - return ""; + return ''; } - a = status.split(":"); - if (a[0] == "stopped") { + a = status.split(':'); + if (a[0] == 'stopped') { if (a.length >= 3) { - status = a[0] + ":" + a[1] + ":" + a[2]; + status = `${a[0]}:${a[1]}:${a[2]}`; } else if (a.length >= 2) { - status = a[0] + ":" + a[1]; + status = `${a[0]}:${a[1]}`; } else { - status = a[0] + ":"; + status = `${a[0]}:`; } + } else if (a.length >= 2) { + status = `${a[0]}:${a[1]}`; } else { - if (a.length >= 2) { - status = a[0] + ":" + a[1]; - } else { - status = a[0] + ":"; - } + status = `${a[0]}:`; } return status; @@ -516,98 +512,99 @@ function format_skipped(skipped_cnt, pkgname) { return 0; } return ( - '' + - skipped_cnt + - "" + `${ + skipped_cnt + }` ); } function format_status_row(status, row, n) { - var table_row = []; + const table_row = []; table_row.push(n + 1); - if (status == "built") { + if (status == 'built') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); - table_row.push(format_log(row.pkgname, false, "success")); - table_row.push(format_duration(row.elapsed ? row.elapsed : "")); - } else if (status == "failed") { + table_row.push(format_log(row.pkgname, false, 'success')); + table_row.push(format_duration(row.elapsed ? row.elapsed : '')); + } else if (status == 'failed') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(row.phase); table_row.push(row.skipped_cnt); table_row.push(format_log(row.pkgname, true, row.errortype)); - table_row.push(format_duration(row.elapsed ? row.elapsed : "")); - } else if (status == "skipped") { + table_row.push(format_duration(row.elapsed ? row.elapsed : '')); + } else if (status == 'skipped') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(format_pkgname(row.depends)); - } else if (status == "ignored") { + } else if (status == 'ignored') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(row.skipped_cnt); table_row.push(row.reason); - } else if (status == "fetched") { + } else if (status == 'fetched') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); - } else if (status == "remaining") { + } else if (status == 'remaining') { table_row.push(format_pkgname(row.pkgname)); table_row.push(row.status); - } else if (status == "queued") { + } else if (status == 'queued') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); - if (row.reason == "listed") { + if (row.reason == 'listed') { table_row.push(row.reason); } else { table_row.push(format_origin(row.reason)); } } else { - alert('Unknown data type "' + status + '". Try flushing cache.'); - throw 'Unknown data type "' + status + '". Try flushing cache.'; + alert(`Unknown data type "${status}". Try flushing cache.`); + throw `Unknown data type "${status}". Try flushing cache.`; } return table_row; } function DTRow(table_id, div_id) { - this.Table = $("#" + table_id).DataTable(); + this.Table = $(`#${table_id}`).DataTable(); this.new_rows = []; this.first_load = this.Table.row(0).length == 0; this.div_id = div_id; } DTRow.prototype = { - queue: function (row) { - var existing_row; + queue(row) { + let existing_row; /* Is this entry already in the list? If so need to * replace its data. Don't bother with lookups on * first load. */ - row.DT_RowId = "data_row_" + row.id; + row.DT_RowId = `data_row_${row.id}`; if (!this.first_load) { - existing_row = this.Table.row("#" + row.DT_RowId); + existing_row = this.Table.row(`#${row.DT_RowId}`); } else { existing_row = {}; } if (existing_row.length) { /* Only update the row if it doesn't match the existing. */ if (JSON.stringify(row) !== JSON.stringify(existing_row.data())) { - existing_row.data(row).nodes().to$().hide().fadeIn(800); + existing_row.data(row).nodes().to$().hide() + .fadeIn(800); } } else { /* Otherwise add it. */ this.new_rows.push(row); } }, - commit: function () { + commit() { if (this.new_rows.length) { nodes = this.Table.rows.add(this.new_rows).draw().nodes(); if (this.first_load) { - $("#" + this.div_id).show(); + $(`#${this.div_id}`).show(); } else { nodes.to$().hide().fadeIn(1500); } @@ -616,7 +613,8 @@ DTRow.prototype = { }; function process_data_build(data) { - var html, a, n, table_rows, status, builder, now, row, dtrow, is_stopped; + let html; let a; let n; let table_rows; let status; let builder; let now; let row; let dtrow; let + is_stopped; if (data.snap && data.snap.now) { // New data is relative to the 'job.started' time, not epoch. @@ -627,7 +625,7 @@ function process_data_build(data) { } // Redirect from /latest/ to the actual build. - if (page_buildname == "latest") { + if (page_buildname == 'latest') { document.location.href = build_url(page_mastername, data.buildname); return; } @@ -637,14 +635,13 @@ function process_data_build(data) { update_canvas(data.stats); } - document.title = - "Poudriere bulk results for " + data.mastername + " " + data.buildname; + document.title = `Poudriere bulk results for ${data.mastername} ${data.buildname}`; - $("#mastername").html(format_mastername(data.mastername)); - $("#buildname").html(format_buildname(data.mastername, data.buildname)); - $("#jail").html(format_jailname(data.jailname)); - $("#setname").html(format_setname(data.setname)); - $("#ptname").html(format_ptname(data.ptname)); + $('#mastername').html(format_mastername(data.mastername)); + $('#buildname').html(format_buildname(data.mastername, data.buildname)); + $('#jail').html(format_jailname(data.jailname)); + $('#setname').html(format_setname(data.setname)); + $('#ptname').html(format_ptname(data.ptname)); if (data.overlays) { $('#overlays').html(data.overlays); } else { @@ -652,17 +649,17 @@ function process_data_build(data) { $('#overlays_title').hide(); } if (data.git_hash) { - $('#git_hash').html(data.git_hash + (data.git_dirty == "yes" ? " (dirty)" : "")); + $('#git_hash').html(data.git_hash + (data.git_dirty == 'yes' ? ' (dirty)' : '')); } else { $('#git_hash').hide(); $('#git_hash_title').hide(); } - $("#build_info_div").show(); + $('#build_info_div').show(); /* Backwards compatibility */ if (data.status && data.status instanceof Array && !data.jobs) { data.jobs = data.status; - if (data.jobs[0] && data.jobs[0].id == "main") { + if (data.jobs[0] && data.jobs[0].id == 'main') { data.status = data.jobs[0].status; data.jobs.splice(0, 1); } else { @@ -672,34 +669,34 @@ function process_data_build(data) { if (data.status) { status = translate_status(data.status); - $("#status").text(status); + $('#status').text(status); } // Unknown status, assume not stopped. - is_stopped = status ? status.match("^stopped:") : false; + is_stopped = status ? status.match('^stopped:') : false; /* Builder status */ if (data.jobs) { - dtrow = new DTRow("builders_table", "jobs_div"); + dtrow = new DTRow('builders_table', 'jobs_div'); for (n = 0; n < data.jobs.length; n++) { row = {}; builder = data.jobs[n]; row.id = builder.id; row.job_id = builder.id; - row.pkgname = builder.pkgname ? format_pkgname(builder.pkgname) : ""; + row.pkgname = builder.pkgname ? format_pkgname(builder.pkgname) : ''; row.origin = builder.origin ? format_origin(builder.origin, builder.flavor) - : ""; + : ''; row.status = builder.pkgname ? format_log(builder.pkgname, false, builder.status) - : builder.status.split(":")[0]; + : builder.status.split(':')[0]; row.elapsed = builder.started ? format_start_to_end(builder.started, now) - : ""; + : ''; /* Hide idle builders when the build is stopped. */ - if (!is_stopped || row.status != "idle") { + if (!is_stopped || row.status != 'idle') { dtrow.queue(row); } } @@ -708,25 +705,25 @@ function process_data_build(data) { /* Stats */ if (data.stats) { - $.each(data.stats, function (status, count) { - if (status == "elapsed") { + $.each(data.stats, (status, count) => { + if (status == 'elapsed') { count = format_start_to_end(count); } - $("#stats_" + status).html(count); + $(`#stats_${status}`).html(count); }); - $("#stats").data(data.stats); - $("#stats").fadeIn(1400); + $('#stats').data(data.stats); + $('#stats').fadeIn(1400); if (data.snap) { - $.each(data.snap, function (status, count) { - if (status == "elapsed") { + $.each(data.snap, (status, count) => { + if (status == 'elapsed') { count = format_start_to_end(count); } - $("#snap_" + status).html(count); + $(`#snap_${status}`).html(count); }); display_pkghour(data.stats, data.snap); display_impulse(data.stats, data.snap); - $("#snap").fadeIn(1400); + $('#snap').fadeIn(1400); } } @@ -736,23 +733,23 @@ function process_data_build(data) { * may involve looping 24000 times. */ if (data.ports) { - if (data.ports["remaining"] === undefined) { - data.ports["remaining"] = []; + if (data.ports.remaining === undefined) { + data.ports.remaining = []; } - $.each(data.ports, function (status, ports) { - if (status == "tobuild") { + $.each(data.ports, (status, ports) => { + if (status == 'tobuild') { return; } if ( - data.ports[status] && - (data.ports[status].length > 0 || status == "remaining") + data.ports[status] + && (data.ports[status].length > 0 || status == 'remaining') ) { table_rows = []; - if (status != "remaining") { - if ((n = $("#" + status + "_body").data("index")) === undefined) { + if (status != 'remaining') { + if ((n = $(`#${status}_body`).data('index')) === undefined) { n = 0; - $("#" + status + "_div").show(); - $("#nav_" + status).removeClass("disabled"); + $(`#${status}_div`).show(); + $(`#nav_${status}`).removeClass('disabled'); } if (n == data.ports[status].length) { return; @@ -761,37 +758,37 @@ function process_data_build(data) { n = 0; } for (; n < data.ports[status].length; n++) { - var row = data.ports[status][n]; + const row = data.ports[status][n]; // Add in skipped counts for failures and ignores - if (status == "failed" || status == "ignored") - row.skipped_cnt = - data.skipped && data.skipped[row.pkgname] - ? data.skipped[row.pkgname] - : 0; + if (status == 'failed' || status == 'ignored') { + row.skipped_cnt = data.skipped && data.skipped[row.pkgname] + ? data.skipped[row.pkgname] + : 0; + } table_rows.push(format_status_row(status, row, n)); } - if (status != "remaining") { - $("#" + status + "_body").data("index", n); - $("#" + status + "_table") + if (status != 'remaining') { + $(`#${status}_body`).data('index', n); + $(`#${status}_table`) .DataTable() .rows.add(table_rows) .draw(false); } else { - $("#" + status + "_table") + $(`#${status}_table`) .DataTable() .clear() .draw(); - $("#" + status + "_table") + $(`#${status}_table`) .DataTable() .rows.add(table_rows) .draw(false); if (table_rows.length > 0) { - $("#" + status + "_div").show(); - $("#nav_" + status).removeClass("disabled"); + $(`#${status}_div`).show(); + $(`#nav_${status}`).removeClass('disabled'); } else { - $("#" + status + "_div").hide(); - $("#nav_" + status).addClass("disabled"); + $(`#${status}_div`).hide(); + $(`#nav_${status}`).addClass('disabled'); } } } @@ -802,16 +799,17 @@ function process_data_build(data) { } function process_data_jail(data) { - var row, build, buildname, stat, types, latest, remaining, count, dtrow; + let row; let build; let buildname; let stat; let types; let latest; let remaining; let count; let + dtrow; if (data.builds) { - types = ["queued", "built", "failed", "skipped", "ignored", "fetched"]; - dtrow = new DTRow("builds_table", "builds_div"); + types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; + dtrow = new DTRow('builds_table', 'builds_div'); for (buildname in data.builds) { row = {}; build = data.builds[buildname]; - if (buildname == "latest") { + if (buildname == 'latest') { latest = data.builds[build]; continue; } @@ -819,44 +817,43 @@ function process_data_jail(data) { row.id = buildname; row.buildname = buildname; for (stat in types) { - count = - build.stats && build.stats[types[stat]] !== undefined - ? parseInt(build.stats[types[stat]]) - : 0; - row["stat_" + types[stat]] = isNaN(count) ? 0 : count; + count = build.stats && build.stats[types[stat]] !== undefined + ? parseInt(build.stats[types[stat]]) + : 0; + row[`stat_${types[stat]}`] = isNaN(count) ? 0 : count; } remaining = build.stats - ? parseInt(build.stats["queued"]) - - (parseInt(build.stats["built"]) + - parseInt(build.stats["failed"]) + - parseInt(build.stats["skipped"]) + - parseInt(build.stats["ignored"]) + - parseInt(build.stats["fetched"])) + ? parseInt(build.stats.queued) + - (parseInt(build.stats.built) + + parseInt(build.stats.failed) + + parseInt(build.stats.skipped) + + parseInt(build.stats.ignored) + + parseInt(build.stats.fetched)) : 0; if (isNaN(remaining)) { remaining = 0; } row.stat_remaining = remaining; row.status = translate_status(build.status); - row.elapsed = build.elapsed ? build.elapsed : ""; + row.elapsed = build.elapsed ? build.elapsed : ''; dtrow.queue(row); } if (latest) { - $("#mastername").html(format_mastername(latest.mastername)); - $("#status").text(translate_status(latest.status)); - $("#jail").html(format_jailname(latest.jailname)); - $("#setname").html(format_setname(latest.setname)); - $("#ptname").html(format_ptname(latest.ptname)); - $("#latest_url").attr( - "href", - build_url(latest.mastername, latest.buildname) + $('#mastername').html(format_mastername(latest.mastername)); + $('#status').text(translate_status(latest.status)); + $('#jail').html(format_jailname(latest.jailname)); + $('#setname').html(format_setname(latest.setname)); + $('#ptname').html(format_ptname(latest.ptname)); + $('#latest_url').attr( + 'href', + build_url(latest.mastername, latest.buildname), ); - $("#latest_build").html( - format_buildname(latest.mastername, latest.buildname) + $('#latest_build').html( + format_buildname(latest.mastername, latest.buildname), ); - $("#masterinfo_div").show(); + $('#masterinfo_div').show(); } dtrow.commit(); @@ -867,11 +864,12 @@ function process_data_jail(data) { } function process_data_index(data) { - var master, mastername, stat, types, latest, remaining, row, count, dtrow; + let master; let mastername; let stat; let types; let latest; let remaining; let row; let count; let + dtrow; if (data.masternames) { - types = ["queued", "built", "failed", "skipped", "ignored", "fetched"]; - dtrow = new DTRow("latest_builds_table", "latest_builds_div"); + types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; + dtrow = new DTRow('latest_builds_table', 'latest_builds_div'); for (mastername in data.masternames) { row = {}; master = data.masternames[mastername].latest; @@ -884,23 +882,22 @@ function process_data_index(data) { row.setname = master.setname; row.ptname = master.ptname; for (stat in types) { - count = - master.stats && master.stats[types[stat]] !== undefined - ? parseInt(master.stats[types[stat]]) - : 0; - row["stat_" + types[stat]] = isNaN(count) ? 0 : count; + count = master.stats && master.stats[types[stat]] !== undefined + ? parseInt(master.stats[types[stat]]) + : 0; + row[`stat_${types[stat]}`] = isNaN(count) ? 0 : count; } remaining = master.stats - ? parseInt(master.stats["queued"]) - - (parseInt(master.stats["built"]) + - parseInt(master.stats["failed"]) + - parseInt(master.stats["skipped"]) + - parseInt(master.stats["ignored"]) + - parseInt(master.stats["fetched"])) + ? parseInt(master.stats.queued) + - (parseInt(master.stats.built) + + parseInt(master.stats.failed) + + parseInt(master.stats.skipped) + + parseInt(master.stats.ignored) + + parseInt(master.stats.fetched)) : 0; row.stat_remaining = isNaN(remaining) ? 0 : remaining; row.status = translate_status(master.status); - row.elapsed = master.elapsed ? master.elapsed : ""; + row.elapsed = master.elapsed ? master.elapsed : ''; dtrow.queue(row); } @@ -912,29 +909,29 @@ function process_data_index(data) { } function process_data(data) { - var should_reload; + let should_reload; // Determine what kind of data this file actually is. Due to handling // file:// and inline-style setups, it may be unknown what was fetched. if (data.buildname) { // If the current page is not build.html, then redirect for the // sake of file:// loading. - if (page_type != "build") { - location.href = "build.html"; + if (page_type != 'build') { + location.href = 'build.html'; return; } - page_type = "build"; + page_type = 'build'; if (data.buildname) { page_buildname = data.buildname; } } else if (data.builds) { - page_type = "jail"; + page_type = 'jail'; } else if (data.masternames) { - page_type = "index"; + page_type = 'index'; } else { - $("#loading p") - .text("Invalid request. Unknown data type.") - .addClass("error"); + $('#loading p') + .text('Invalid request. Unknown data type.') + .addClass('error'); return; } @@ -942,11 +939,11 @@ function process_data(data) { page_mastername = data.mastername; } - if (page_type == "build") { + if (page_type == 'build') { should_reload = process_data_build(data); - } else if (page_type == "jail") { + } else if (page_type == 'jail') { should_reload = process_data_jail(data); - } else if (page_type == "index") { + } else if (page_type == 'index') { should_reload = process_data_index(data); } else { should_reload = false; @@ -956,7 +953,7 @@ function process_data(data) { /* Resize due to full content. */ do_resize($(window)); // Hide loading overlay - $("#loading_overlay").fadeOut(900); + $('#loading_overlay').fadeOut(900); /* Now that page is loaded, scroll to anchor. */ if (location.hash) { scrollToElement(location.hash); @@ -972,60 +969,61 @@ function process_data(data) { /* Disable static navbar at the breakpoint */ function do_resize(win) { /* Redraw canvas to new width */ - if ($("#stats").data()) { + if ($('#stats').data()) { determine_canvas_width(); - update_canvas($("#stats").data()); + update_canvas($('#stats').data()); } /* Resize padding for navbar/footer heights */ - $("body") - .css("padding-top", $("#header").outerHeight(true)) - .css("padding-bottom", $("footer").outerHeight(true)); + $('body') + .css('padding-top', $('#header').outerHeight(true)) + .css('padding-bottom', $('footer').outerHeight(true)); } /* Force minimum width on mobile, will zoom to fit. */ function fix_viewport() { - var minimum_width; + let minimum_width; - minimum_width = parseInt($("body").css("min-width")); + minimum_width = parseInt($('body').css('min-width')); if (minimum_width != 0 && window.innerWidth < minimum_width) { - $("meta[name=viewport]").attr("content", "width=" + minimum_width); + $('meta[name=viewport]').attr('content', `width=${minimum_width}`); } else { - $("meta[name=viewport]").attr( - "content", - "width=device-width, initial-scale=1.0" + $('meta[name=viewport]').attr( + 'content', + 'width=device-width, initial-scale=1.0', ); } } function applyHovering(table_id) { - var lastIdx, Table; + let lastIdx; let + Table; lastIdx = null; - Table = $("#" + table_id).DataTable(); - $("#" + table_id + " tbody") - .on("mouseover", "td", function () { - var colIdx = Table.cell(this).index().column; + Table = $(`#${table_id}`).DataTable(); + $(`#${table_id} tbody`) + .on('mouseover', 'td', function () { + const colIdx = Table.cell(this).index().column; if (colIdx !== lastIdx) { - $(Table.cells().nodes()).removeClass("highlight"); - $(Table.column(colIdx).nodes()).addClass("highlight"); + $(Table.cells().nodes()).removeClass('highlight'); + $(Table.column(colIdx).nodes()).addClass('highlight'); } }) - .on("mouseleave", function () { - $(Table.cells().nodes()).removeClass("highlight"); + .on('mouseleave', () => { + $(Table.cells().nodes()).removeClass('highlight'); }); } function setup_build() { - var columns, - status, - types, - i, - build_order_column, - pkgname_column, - origin_column; - - $("#builders_table").dataTable({ + let columns; + let status; + let types; + let i; + let build_order_column; + let pkgname_column; + let origin_column; + + $('#builders_table').dataTable({ bFilter: false, bInfo: false, bPaginate: false, @@ -1033,48 +1031,48 @@ function setup_build() { aoColumns: [ // Smaller ID/Status { - data: "job_id", - sWidth: "1em", + data: 'job_id', + sWidth: '1em', }, { - data: "pkgname", - sWidth: "15em", + data: 'pkgname', + sWidth: '15em', }, { - data: "origin", - sWidth: "17em", + data: 'origin', + sWidth: '17em', }, { - data: "status", - sWidth: "10em", + data: 'status', + sWidth: '10em', }, { - data: "elapsed", - sWidth: "4em", + data: 'elapsed', + sWidth: '4em', }, ], columnDefs: [ { data: null, - defaultContent: "", - targets: "_all", + defaultContent: '', + targets: '_all', }, ], stateSave: true, // Enable cookie for keeping state - order: [[0, "asc"]], // Sort by Job ID + order: [[0, 'asc']], // Sort by Job ID }); build_order_column = { - sWidth: "1em", - sType: "numeric", + sWidth: '1em', + sType: 'numeric', bSearchable: false, }; pkgname_column = { - sWidth: "15em", + sWidth: '15em', }; origin_column = { - sWidth: "17em", + sWidth: '17em', }; columns = { @@ -1083,13 +1081,13 @@ function setup_build() { pkgname_column, origin_column, { - sWidth: "4.25em", + sWidth: '4.25em', bSortable: false, bSearchable: false, }, { bSearchable: false, - sWidth: "3em", + sWidth: '3em', }, ], failed: [ @@ -1097,21 +1095,21 @@ function setup_build() { pkgname_column, origin_column, { - sWidth: "6em", + sWidth: '6em', }, { - sType: "numeric", - sWidth: "2em", - render: function (data, type, row) { - return type == "display" ? format_skipped(data, row[1]) : data; + sType: 'numeric', + sWidth: '2em', + render(data, type, row) { + return type == 'display' ? format_skipped(data, row[1]) : data; }, }, { - sWidth: "7em", + sWidth: '7em', }, { bSearchable: false, - sWidth: "3em", + sWidth: '3em', }, ], skipped: [ @@ -1125,14 +1123,14 @@ function setup_build() { pkgname_column, origin_column, { - sWidth: "2em", - sType: "numeric", - render: function (data, type, row) { - return type == "display" ? format_skipped(data, row[1]) : data; + sWidth: '2em', + sType: 'numeric', + render(data, type, row) { + return type == 'display' ? format_skipped(data, row[1]) : data; }, }, { - sWidth: "25em", + sWidth: '25em', }, ], fetched: [build_order_column, pkgname_column, origin_column], @@ -1140,24 +1138,24 @@ function setup_build() { build_order_column, pkgname_column, { - sWidth: "7em", + sWidth: '7em', }, ], queued: [build_order_column, pkgname_column, origin_column, origin_column], }; types = [ - "built", - "failed", - "skipped", - "ignored", - "fetched", - "remaining", - "queued", + 'built', + 'failed', + 'skipped', + 'ignored', + 'fetched', + 'remaining', + 'queued', ]; for (i in types) { status = types[i]; - $("#" + status + "_table").dataTable({ + $(`#${status}_table`).dataTable({ bAutoWidth: false, processing: true, // Show processing icon deferRender: true, // Defer creating TR/TD until needed @@ -1165,168 +1163,170 @@ function setup_build() { stateSave: true, // Enable cookie for keeping state lengthMenu: [ [5, 10, 25, 50, 100, 200, -1], - [5, 10, 25, 50, 100, 200, "All"], + [5, 10, 25, 50, 100, 200, 'All'], ], pageLength: 10, - order: [[0, "asc"]], // Sort by build order + order: [[0, 'asc']], // Sort by build order }); } } function setup_jail() { - var columns, status, types, i, stat_column; + let columns; let status; let types; let i; let + stat_column; stat_column = { - sWidth: "1em", - sType: "numeric", + sWidth: '1em', + sType: 'numeric', bSearchable: false, }; columns = [ { - data: "buildname", - render: function (data, type, row) { - return type == "display" + data: 'buildname', + render(data, type, row) { + return type == 'display' ? format_buildname(page_mastername, data) : data; }, - sWidth: "12em", + sWidth: '12em', }, - $.extend({}, stat_column, { data: "stat_queued" }), - $.extend({}, stat_column, { data: "stat_built" }), - $.extend({}, stat_column, { data: "stat_failed" }), - $.extend({}, stat_column, { data: "stat_skipped" }), - $.extend({}, stat_column, { data: "stat_ignored" }), - $.extend({}, stat_column, { data: "stat_fetched" }), - $.extend({}, stat_column, { data: "stat_remaining" }), + $.extend({}, stat_column, { data: 'stat_queued' }), + $.extend({}, stat_column, { data: 'stat_built' }), + $.extend({}, stat_column, { data: 'stat_failed' }), + $.extend({}, stat_column, { data: 'stat_skipped' }), + $.extend({}, stat_column, { data: 'stat_ignored' }), + $.extend({}, stat_column, { data: 'stat_fetched' }), + $.extend({}, stat_column, { data: 'stat_remaining' }), { - data: "status", - sWidth: "8em", + data: 'status', + sWidth: '8em', }, { - data: "elapsed", + data: 'elapsed', bSearchable: false, - sWidth: "4em", + sWidth: '4em', }, ]; - $("#builds_table").dataTable({ + $('#builds_table').dataTable({ bAutoWidth: false, processing: true, // Show processing icon aoColumns: columns, stateSave: true, // Enable cookie for keeping state lengthMenu: [ [5, 10, 25, 50, 100, 200, -1], - [5, 10, 25, 50, 100, 200, "All"], + [5, 10, 25, 50, 100, 200, 'All'], ], pageLength: 50, columnDefs: [ { data: null, - defaultContent: "", - targets: "_all", + defaultContent: '', + targets: '_all', }, ], - createdRow: function (row, data, index) { - if (data.buildname == $("#latest_build").text()) { - $("td.latest").removeClass("latest"); - $("td", row).addClass("latest"); + createdRow(row, data, index) { + if (data.buildname == $('#latest_build').text()) { + $('td.latest').removeClass('latest'); + $('td', row).addClass('latest'); } }, - order: [[0, "asc"]], // Sort by buildname + order: [[0, 'asc']], // Sort by buildname }); - //applyHovering('builds_table'); + // applyHovering('builds_table'); } function setup_index() { - var columns, status, types, i, stat_column, table; + let columns; let status; let types; let i; let stat_column; let + table; stat_column = { - sWidth: "1em", - sType: "numeric", + sWidth: '1em', + sType: 'numeric', bSearchable: false, }; columns = [ { - data: "portset", + data: 'portset', visible: false, }, { - data: "mastername", - render: function (data, type, row) { - return type == "display" ? format_mastername(data) : data; + data: 'mastername', + render(data, type, row) { + return type == 'display' ? format_mastername(data) : data; }, - sWidth: "22em", + sWidth: '22em', }, { - data: "buildname", - render: function (data, type, row) { - return type == "display" + data: 'buildname', + render(data, type, row) { + return type == 'display' ? format_buildname(row.mastername, data) : data; }, - sWidth: "12em", + sWidth: '12em', }, { - data: "jailname", - render: function (data, type, row) { - return type == "display" ? format_jailname(data) : data; + data: 'jailname', + render(data, type, row) { + return type == 'display' ? format_jailname(data) : data; }, - sWidth: "10em", + sWidth: '10em', visible: false, }, { - data: "setname", - render: function (data, type, row) { - return type == "display" ? format_setname(data) : data; + data: 'setname', + render(data, type, row) { + return type == 'display' ? format_setname(data) : data; }, - sWidth: "10em", + sWidth: '10em', visible: false, }, { - data: "ptname", - render: function (data, type, row) { - return type == "display" ? format_ptname(data) : data; + data: 'ptname', + render(data, type, row) { + return type == 'display' ? format_ptname(data) : data; }, - sWidth: "10em", + sWidth: '10em', visible: false, }, - $.extend({}, stat_column, { data: "stat_queued" }), - $.extend({}, stat_column, { data: "stat_built" }), - $.extend({}, stat_column, { data: "stat_failed" }), - $.extend({}, stat_column, { data: "stat_skipped" }), - $.extend({}, stat_column, { data: "stat_ignored" }), - $.extend({}, stat_column, { data: "stat_fetched" }), - $.extend({}, stat_column, { data: "stat_remaining" }), + $.extend({}, stat_column, { data: 'stat_queued' }), + $.extend({}, stat_column, { data: 'stat_built' }), + $.extend({}, stat_column, { data: 'stat_failed' }), + $.extend({}, stat_column, { data: 'stat_skipped' }), + $.extend({}, stat_column, { data: 'stat_ignored' }), + $.extend({}, stat_column, { data: 'stat_fetched' }), + $.extend({}, stat_column, { data: 'stat_remaining' }), { - data: "status", - sWidth: "8em", + data: 'status', + sWidth: '8em', }, { - data: "elapsed", + data: 'elapsed', bSearchable: false, - sWidth: "4em", + sWidth: '4em', }, ]; - table = $("#latest_builds_table").dataTable({ + table = $('#latest_builds_table').dataTable({ bAutoWidth: false, processing: true, // Show processing icon aoColumns: columns, stateSave: true, // Enable cookie for keeping state lengthMenu: [ [5, 10, 25, 50, 100, 200, -1], - [5, 10, 25, 50, 100, 200, "All"], + [5, 10, 25, 50, 100, 200, 'All'], ], pageLength: 50, - order: [[2, "asc"]], // Sort by buildname + order: [[2, 'asc']], // Sort by buildname columnDefs: [ { data: null, - defaultContent: "", - targets: "_all", + defaultContent: '', + targets: '_all', }, ], }); @@ -1334,91 +1334,91 @@ function setup_index() { table.rowGrouping({ iGroupingColumnIndex2: 4, iGroupingColumnIndex: 5, - sGroupLabelPrefix2: "  Set - ", - sGroupLabelPrefix: "Ports - ", - sEmptyGroupLabel: "", - fnGroupLabelFormat: function (label) { - return "" + label + ""; + sGroupLabelPrefix2: '  Set - ', + sGroupLabelPrefix: 'Ports - ', + sEmptyGroupLabel: '', + fnGroupLabelFormat(label) { + return `${label}`; }, - fnGroupLabelFormat2: function (label) { - return "" + label + ""; + fnGroupLabelFormat2(label) { + return `${label}`; }, - fnOnGrouped: function () { + fnOnGrouped() { // Hide default set group rows $( - "#latest_builds_table tbody tr[id^=group-id-latest_builds_table_][id$=--]" + '#latest_builds_table tbody tr[id^=group-id-latest_builds_table_][id$=--]', ).hide(); }, }); - //applyHovering('latest_builds_table'); + // applyHovering('latest_builds_table'); } -$(document).ready(function () { - var pathname; +$(document).ready(() => { + let pathname; pathname = location.pathname.substring( - location.pathname.lastIndexOf("/") + 1 + location.pathname.lastIndexOf('/') + 1, ); - if (pathname == "") { - page_type = "index"; + if (pathname == '') { + page_type = 'index'; } else { page_type = pathname.substr(0, pathname.length - 5); } - if (page_type == "build") { - if (server_style == "hosted") { - page_mastername = getParameterByName("mastername"); - page_buildname = getParameterByName("build"); + if (page_type == 'build') { + if (server_style == 'hosted') { + page_mastername = getParameterByName('mastername'); + page_buildname = getParameterByName('build'); if (!page_mastername || !page_buildname) { - $("#loading p") - .text("Invalid request. Mastername and Build required.") - .addClass("error"); + $('#loading p') + .text('Invalid request. Mastername and Build required.') + .addClass('error'); return; } - data_url = "data/" + page_mastername + "/" + page_buildname + "/"; - $("a.data_url").each(function () { - var href = $(this).attr("href"); - $(this).attr("href", data_url + href); + data_url = `data/${page_mastername}/${page_buildname}/`; + $('a.data_url').each(function () { + const href = $(this).attr('href'); + $(this).attr('href', data_url + href); }); - $("#master_link").attr("href", jail_url(page_mastername)); - } else if (server_style == "inline") { - $("#master_link").attr("href", "../"); - $("#index_link").attr("href", "../../"); + $('#master_link').attr('href', jail_url(page_mastername)); + } else if (server_style == 'inline') { + $('#master_link').attr('href', '../'); + $('#index_link').attr('href', '../../'); } setup_build(); - } else if (page_type == "jail") { - if (server_style == "hosted") { - page_mastername = getParameterByName("mastername"); + } else if (page_type == 'jail') { + if (server_style == 'hosted') { + page_mastername = getParameterByName('mastername'); if (!page_mastername) { - $("#loading p") - .text("Invalid request. Mastername required.") - .addClass("error"); + $('#loading p') + .text('Invalid request. Mastername required.') + .addClass('error'); return; } - data_url = "data/" + page_mastername + "/"; - $("a.data_url").each(function () { - var href = $(this).attr("href"); - $(this).attr("href", data_url + href); + data_url = `data/${page_mastername}/`; + $('a.data_url').each(function () { + const href = $(this).attr('href'); + $(this).attr('href', data_url + href); }); - $("#latest_url").attr("href", build_url(page_mastername, "latest")); - } else if (server_style == "inline") { - $("#index_link").attr("href", "../"); + $('#latest_url').attr('href', build_url(page_mastername, 'latest')); + } else if (server_style == 'inline') { + $('#index_link').attr('href', '../'); } setup_jail(); - } else if (page_type == "index") { - if (server_style == "hosted") { - data_url = "data/"; - $("a.data_url").each(function () { - var href = $(this).attr("href"); - $(this).attr("href", data_url + href); + } else if (page_type == 'index') { + if (server_style == 'hosted') { + data_url = 'data/'; + $('a.data_url').each(function () { + const href = $(this).attr('href'); + $(this).attr('href', data_url + href); }); } setup_index(); } else { - $("#loading p") - .text("Invalid request. Unhandled page type '" + page_type + "'") - .addClass("error"); + $('#loading p') + .text(`Invalid request. Unhandled page type '${page_type}'`) + .addClass('error'); return; } @@ -1428,9 +1428,9 @@ $(document).ready(function () { /* Fix nav links to not skip hashchange event when clicking multiple * times. */ $('#header .nav a[href^="#"]').each(function () { - var href = $(this).attr("href"); - if (href != "#") { - $(this).on("click", function (e) { + const href = $(this).attr('href'); + if (href != '#') { + $(this).on('click', (e) => { e.preventDefault(); if (location.hash != href) { location.hash = href; @@ -1440,12 +1440,12 @@ $(document).ready(function () { } }); /* Force minimum width on mobile, will zoom to fit. */ - $(window).on("orientationchange", function (e) { + $(window).on('orientationchange', (e) => { fix_viewport(); }); fix_viewport(); /* Handle resize needs */ - $(window).on("resize", function () { + $(window).on('resize', function () { do_resize($(this)); }); do_resize($(window)); @@ -1453,7 +1453,7 @@ $(document).ready(function () { update_data(); }); -$(document).on("keydown", function (e) { +$(document).on('keydown', (e) => { /* Disable F5 refreshing since this is AJAX driven. */ if (e.which == 116) { e.preventDefault(); From 836d60a19a947485562221b0931d43e7f7a7ce00 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 20:30:43 -0400 Subject: [PATCH 02/92] poudriere.js: Use anonymous functions --- src/share/poudriere/html/assets/poudriere.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index e9d499ddcd..4654af0afe 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -472,7 +472,7 @@ function filter_skipped(pkgname) { + 'pull-right" id="resetsearch">', ); - $('#resetsearch').click(function (e) { + $('#resetsearch').click((e) => { table.fnFilter('', 3); search_filter.val(''); search_filter.prop('disabled', false); @@ -1001,7 +1001,7 @@ function applyHovering(table_id) { lastIdx = null; Table = $(`#${table_id}`).DataTable(); $(`#${table_id} tbody`) - .on('mouseover', 'td', function () { + .on('mouseover', 'td', () => { const colIdx = Table.cell(this).index().column; if (colIdx !== lastIdx) { @@ -1377,7 +1377,7 @@ $(document).ready(() => { return; } data_url = `data/${page_mastername}/${page_buildname}/`; - $('a.data_url').each(function () { + $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); }); @@ -1397,7 +1397,7 @@ $(document).ready(() => { return; } data_url = `data/${page_mastername}/`; - $('a.data_url').each(function () { + $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); }); @@ -1409,7 +1409,7 @@ $(document).ready(() => { } else if (page_type == 'index') { if (server_style == 'hosted') { data_url = 'data/'; - $('a.data_url').each(function () { + $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); }); @@ -1427,7 +1427,7 @@ $(document).ready(() => { /* Fix nav links to not skip hashchange event when clicking multiple * times. */ - $('#header .nav a[href^="#"]').each(function () { + $('#header .nav a[href^="#"]').each(() => { const href = $(this).attr('href'); if (href != '#') { $(this).on('click', (e) => { @@ -1445,7 +1445,7 @@ $(document).ready(() => { }); fix_viewport(); /* Handle resize needs */ - $(window).on('resize', function () { + $(window).on('resize', () => { do_resize($(this)); }); do_resize($(window)); From ffa207dba0794547861e12fa007710c66aa253c1 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 20:34:13 -0400 Subject: [PATCH 03/92] poudriere.js: Prefer === and !== of == and != --- src/share/poudriere/html/assets/poudriere.js | 118 +++++++++---------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 4654af0afe..3147aea787 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -143,7 +143,7 @@ function minidraw(x, height, width, context, color, queued, variable) { /* Calculate how much percentage this value should display */ pct = Math.floor((variable * 100) / queued); - if (pct == 0) { + if (pct === 0) { return 0; } newx = width * (pct / 100); @@ -156,7 +156,7 @@ function minidraw(x, height, width, context, color, queued, variable) { newx = Math.ceil(width * (99 / 100)); } /* Always start at 1 */ - if (newx == 0) { + if (newx === 0) { newx = 1; } context.fillStyle = color; @@ -232,7 +232,7 @@ function update_canvas(stats) { if (isNaN(pctdone)) { pctdone = 0; } - if (pctdone < 1.0 && pctdone != 0) { + if (pctdone < 1.0 && pctdone !== 0) { pctdonetxt = '< 1'; } else { pctdonetxt = Math.floor(pctdone); @@ -292,7 +292,7 @@ function display_impulse(stats, snap) { } function jail_url(mastername) { - if (server_style == 'hosted') { + if (server_style === 'hosted') { if (mastername) { return `jail.html?mastername=${encodeURIComponent(mastername)}`; } @@ -308,7 +308,7 @@ function format_mastername(mastername) { return ''; } - if (page_mastername && mastername == page_mastername && page_type == 'jail') { + if (page_mastername && mastername === page_mastername && page_type === 'jail') { html = `${ mastername }`; @@ -362,10 +362,10 @@ function format_buildname(mastername, buildname) { if ( page_mastername - && mastername == page_mastername + && mastername === page_mastername && page_buildname - && buildname == page_buildname - && page_type == 'build' + && buildname === page_buildname + && page_type === 'build' ) { html = `${ buildname @@ -431,7 +431,7 @@ function format_duration(duration) { let hours; let minutes; let seconds; - if (duration === undefined || duration == '' || isNaN(duration)) { + if (duration === undefined || duration === '' || isNaN(duration)) { return ''; } @@ -490,7 +490,7 @@ function translate_status(status) { } a = status.split(':'); - if (a[0] == 'stopped') { + if (a[0] === 'stopped') { if (a.length >= 3) { status = `${a[0]}:${a[1]}:${a[2]}`; } else if (a.length >= 2) { @@ -508,7 +508,7 @@ function translate_status(status) { } function format_skipped(skipped_cnt, pkgname) { - if (skipped_cnt === undefined || skipped_cnt == 0) { + if (skipped_cnt === undefined || skipped_cnt === 0) { return 0; } return ( @@ -525,37 +525,37 @@ function format_status_row(status, row, n) { const table_row = []; table_row.push(n + 1); - if (status == 'built') { + if (status === 'built') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(format_log(row.pkgname, false, 'success')); table_row.push(format_duration(row.elapsed ? row.elapsed : '')); - } else if (status == 'failed') { + } else if (status === 'failed') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(row.phase); table_row.push(row.skipped_cnt); table_row.push(format_log(row.pkgname, true, row.errortype)); table_row.push(format_duration(row.elapsed ? row.elapsed : '')); - } else if (status == 'skipped') { + } else if (status === 'skipped') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(format_pkgname(row.depends)); - } else if (status == 'ignored') { + } else if (status === 'ignored') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); table_row.push(row.skipped_cnt); table_row.push(row.reason); - } else if (status == 'fetched') { + } else if (status === 'fetched') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); - } else if (status == 'remaining') { + } else if (status === 'remaining') { table_row.push(format_pkgname(row.pkgname)); table_row.push(row.status); - } else if (status == 'queued') { + } else if (status === 'queued') { table_row.push(format_pkgname(row.pkgname)); table_row.push(format_origin(row.origin, row.flavor)); - if (row.reason == 'listed') { + if (row.reason === 'listed') { table_row.push(row.reason); } else { table_row.push(format_origin(row.reason)); @@ -571,7 +571,7 @@ function format_status_row(status, row, n) { function DTRow(table_id, div_id) { this.Table = $(`#${table_id}`).DataTable(); this.new_rows = []; - this.first_load = this.Table.row(0).length == 0; + this.first_load = this.Table.row(0).length === 0; this.div_id = div_id; } @@ -625,7 +625,7 @@ function process_data_build(data) { } // Redirect from /latest/ to the actual build. - if (page_buildname == 'latest') { + if (page_buildname === 'latest') { document.location.href = build_url(page_mastername, data.buildname); return; } @@ -649,7 +649,7 @@ function process_data_build(data) { $('#overlays_title').hide(); } if (data.git_hash) { - $('#git_hash').html(data.git_hash + (data.git_dirty == 'yes' ? ' (dirty)' : '')); + $('#git_hash').html(data.git_hash + (data.git_dirty === 'yes' ? ' (dirty)' : '')); } else { $('#git_hash').hide(); $('#git_hash_title').hide(); @@ -659,7 +659,7 @@ function process_data_build(data) { /* Backwards compatibility */ if (data.status && data.status instanceof Array && !data.jobs) { data.jobs = data.status; - if (data.jobs[0] && data.jobs[0].id == 'main') { + if (data.jobs[0] && data.jobs[0].id === 'main') { data.status = data.jobs[0].status; data.jobs.splice(0, 1); } else { @@ -696,7 +696,7 @@ function process_data_build(data) { : ''; /* Hide idle builders when the build is stopped. */ - if (!is_stopped || row.status != 'idle') { + if (!is_stopped || row.status !== 'idle') { dtrow.queue(row); } } @@ -706,7 +706,7 @@ function process_data_build(data) { /* Stats */ if (data.stats) { $.each(data.stats, (status, count) => { - if (status == 'elapsed') { + if (status === 'elapsed') { count = format_start_to_end(count); } $(`#stats_${status}`).html(count); @@ -716,7 +716,7 @@ function process_data_build(data) { if (data.snap) { $.each(data.snap, (status, count) => { - if (status == 'elapsed') { + if (status === 'elapsed') { count = format_start_to_end(count); } $(`#snap_${status}`).html(count); @@ -737,21 +737,21 @@ function process_data_build(data) { data.ports.remaining = []; } $.each(data.ports, (status, ports) => { - if (status == 'tobuild') { + if (status === 'tobuild') { return; } if ( data.ports[status] - && (data.ports[status].length > 0 || status == 'remaining') + && (data.ports[status].length > 0 || status === 'remaining') ) { table_rows = []; - if (status != 'remaining') { + if (status !== 'remaining') { if ((n = $(`#${status}_body`).data('index')) === undefined) { n = 0; $(`#${status}_div`).show(); $(`#nav_${status}`).removeClass('disabled'); } - if (n == data.ports[status].length) { + if (n === data.ports[status].length) { return; } } else { @@ -760,7 +760,7 @@ function process_data_build(data) { for (; n < data.ports[status].length; n++) { const row = data.ports[status][n]; // Add in skipped counts for failures and ignores - if (status == 'failed' || status == 'ignored') { + if (status === 'failed' || status === 'ignored') { row.skipped_cnt = data.skipped && data.skipped[row.pkgname] ? data.skipped[row.pkgname] : 0; @@ -768,7 +768,7 @@ function process_data_build(data) { table_rows.push(format_status_row(status, row, n)); } - if (status != 'remaining') { + if (status !== 'remaining') { $(`#${status}_body`).data('index', n); $(`#${status}_table`) .DataTable() @@ -809,7 +809,7 @@ function process_data_jail(data) { row = {}; build = data.builds[buildname]; - if (buildname == 'latest') { + if (buildname === 'latest') { latest = data.builds[build]; continue; } @@ -916,7 +916,7 @@ function process_data(data) { if (data.buildname) { // If the current page is not build.html, then redirect for the // sake of file:// loading. - if (page_type != 'build') { + if (page_type !== 'build') { location.href = 'build.html'; return; } @@ -939,11 +939,11 @@ function process_data(data) { page_mastername = data.mastername; } - if (page_type == 'build') { + if (page_type === 'build') { should_reload = process_data_build(data); - } else if (page_type == 'jail') { + } else if (page_type === 'jail') { should_reload = process_data_jail(data); - } else if (page_type == 'index') { + } else if (page_type === 'index') { should_reload = process_data_index(data); } else { should_reload = false; @@ -984,7 +984,7 @@ function fix_viewport() { let minimum_width; minimum_width = parseInt($('body').css('min-width')); - if (minimum_width != 0 && window.innerWidth < minimum_width) { + if (minimum_width !== 0 && window.innerWidth < minimum_width) { $('meta[name=viewport]').attr('content', `width=${minimum_width}`); } else { $('meta[name=viewport]').attr( @@ -1101,7 +1101,7 @@ function setup_build() { sType: 'numeric', sWidth: '2em', render(data, type, row) { - return type == 'display' ? format_skipped(data, row[1]) : data; + return type === 'display' ? format_skipped(data, row[1]) : data; }, }, { @@ -1126,7 +1126,7 @@ function setup_build() { sWidth: '2em', sType: 'numeric', render(data, type, row) { - return type == 'display' ? format_skipped(data, row[1]) : data; + return type === 'display' ? format_skipped(data, row[1]) : data; }, }, { @@ -1185,7 +1185,7 @@ function setup_jail() { { data: 'buildname', render(data, type, row) { - return type == 'display' + return type === 'display' ? format_buildname(page_mastername, data) : data; }, @@ -1227,7 +1227,7 @@ function setup_jail() { }, ], createdRow(row, data, index) { - if (data.buildname == $('#latest_build').text()) { + if (data.buildname === $('#latest_build').text()) { $('td.latest').removeClass('latest'); $('td', row).addClass('latest'); } @@ -1256,14 +1256,14 @@ function setup_index() { { data: 'mastername', render(data, type, row) { - return type == 'display' ? format_mastername(data) : data; + return type === 'display' ? format_mastername(data) : data; }, sWidth: '22em', }, { data: 'buildname', render(data, type, row) { - return type == 'display' + return type === 'display' ? format_buildname(row.mastername, data) : data; }, @@ -1272,7 +1272,7 @@ function setup_index() { { data: 'jailname', render(data, type, row) { - return type == 'display' ? format_jailname(data) : data; + return type === 'display' ? format_jailname(data) : data; }, sWidth: '10em', visible: false, @@ -1280,7 +1280,7 @@ function setup_index() { { data: 'setname', render(data, type, row) { - return type == 'display' ? format_setname(data) : data; + return type === 'display' ? format_setname(data) : data; }, sWidth: '10em', visible: false, @@ -1288,7 +1288,7 @@ function setup_index() { { data: 'ptname', render(data, type, row) { - return type == 'display' ? format_ptname(data) : data; + return type === 'display' ? format_ptname(data) : data; }, sWidth: '10em', visible: false, @@ -1360,14 +1360,14 @@ $(document).ready(() => { pathname = location.pathname.substring( location.pathname.lastIndexOf('/') + 1, ); - if (pathname == '') { + if (pathname === '') { page_type = 'index'; } else { page_type = pathname.substr(0, pathname.length - 5); } - if (page_type == 'build') { - if (server_style == 'hosted') { + if (page_type === 'build') { + if (server_style === 'hosted') { page_mastername = getParameterByName('mastername'); page_buildname = getParameterByName('build'); if (!page_mastername || !page_buildname) { @@ -1382,13 +1382,13 @@ $(document).ready(() => { $(this).attr('href', data_url + href); }); $('#master_link').attr('href', jail_url(page_mastername)); - } else if (server_style == 'inline') { + } else if (server_style === 'inline') { $('#master_link').attr('href', '../'); $('#index_link').attr('href', '../../'); } setup_build(); - } else if (page_type == 'jail') { - if (server_style == 'hosted') { + } else if (page_type === 'jail') { + if (server_style === 'hosted') { page_mastername = getParameterByName('mastername'); if (!page_mastername) { $('#loading p') @@ -1402,12 +1402,12 @@ $(document).ready(() => { $(this).attr('href', data_url + href); }); $('#latest_url').attr('href', build_url(page_mastername, 'latest')); - } else if (server_style == 'inline') { + } else if (server_style === 'inline') { $('#index_link').attr('href', '../'); } setup_jail(); - } else if (page_type == 'index') { - if (server_style == 'hosted') { + } else if (page_type === 'index') { + if (server_style === 'hosted') { data_url = 'data/'; $('a.data_url').each(() => { const href = $(this).attr('href'); @@ -1429,10 +1429,10 @@ $(document).ready(() => { * times. */ $('#header .nav a[href^="#"]').each(() => { const href = $(this).attr('href'); - if (href != '#') { + if (href !== '#') { $(this).on('click', (e) => { e.preventDefault(); - if (location.hash != href) { + if (location.hash !== href) { location.hash = href; } scrollToElement(href); @@ -1455,7 +1455,7 @@ $(document).ready(() => { $(document).on('keydown', (e) => { /* Disable F5 refreshing since this is AJAX driven. */ - if (e.which == 116) { + if (e.which === 116) { e.preventDefault(); } }); From 0fa5d20a4e80751682c8d30f4f66232a875275fe Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 20:36:52 -0400 Subject: [PATCH 04/92] poudriere.js: Use window.location --- src/share/poudriere/html/assets/poudriere.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 3147aea787..9af61a07b6 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -45,7 +45,7 @@ let data_url = ''; function getParameterByName(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); const regex = new RegExp(`[\\?&]${name}=([^&#]*)`); - const results = regex.exec(location.search); + const results = regex.exec(window.location.search); return results == null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); @@ -626,7 +626,7 @@ function process_data_build(data) { // Redirect from /latest/ to the actual build. if (page_buildname === 'latest') { - document.location.href = build_url(page_mastername, data.buildname); + window.location.href = build_url(page_mastername, data.buildname); return; } @@ -917,7 +917,7 @@ function process_data(data) { // If the current page is not build.html, then redirect for the // sake of file:// loading. if (page_type !== 'build') { - location.href = 'build.html'; + window.location.href = 'build.html'; return; } page_type = 'build'; @@ -955,8 +955,8 @@ function process_data(data) { // Hide loading overlay $('#loading_overlay').fadeOut(900); /* Now that page is loaded, scroll to anchor. */ - if (location.hash) { - scrollToElement(location.hash); + if (window.location.hash) { + scrollToElement(window.location.hash); } first_run = false; } @@ -1357,8 +1357,8 @@ function setup_index() { $(document).ready(() => { let pathname; - pathname = location.pathname.substring( - location.pathname.lastIndexOf('/') + 1, + pathname = window.location.pathname.substring( + window.location.pathname.lastIndexOf('/') + 1, ); if (pathname === '') { page_type = 'index'; @@ -1432,8 +1432,8 @@ $(document).ready(() => { if (href !== '#') { $(this).on('click', (e) => { e.preventDefault(); - if (location.hash !== href) { - location.hash = href; + if (window.location.hash !== href) { + window.location.hash = href; } scrollToElement(href); }); From 8694af228fcf2f829c9b4a04b677c6c493731205 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 20:45:41 -0400 Subject: [PATCH 05/92] poudriere.js: Use const --- src/share/poudriere/html/assets/poudriere.js | 105 +++++++------------ 1 file changed, 39 insertions(+), 66 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 9af61a07b6..aefa13713c 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -88,13 +88,11 @@ function update_data() { } function format_origin(origin, flavor) { - let data; - if (!origin) { return ''; } - data = origin.split('/'); + const data = origin.split('/'); if (flavor) { flavor = `@${flavor}`; @@ -138,11 +136,10 @@ function format_pkgname(pkgname) { } function minidraw(x, height, width, context, color, queued, variable) { - let pct; let total_pct; let - newx; + let newx; /* Calculate how much percentage this value should display */ - pct = Math.floor((variable * 100) / queued); + const pct = Math.floor((variable * 100) / queued); if (pct === 0) { return 0; } @@ -151,7 +148,7 @@ function minidraw(x, height, width, context, color, queued, variable) { newx = width - x; } /* Cap total bar to 99%, so it's clear something is remaining */ - total_pct = ((x + newx) / width) * 100; + const total_pct = ((x + newx) / width) * 100; if (total_pct >= 99.0 && total_pct < 100.0) { newx = Math.ceil(width * (99 / 100)); } @@ -179,16 +176,15 @@ function determine_canvas_width() { } function update_canvas(stats) { - let queued; let built; let failed; let skipped; let ignored; let fetched; let remaining; let - pctdone; - let height; let width; let x; let context; let canvas; let + let pctdone; + let height; let width; let x; let pctdonetxt; if (stats.queued === undefined) { return; } - canvas = document.getElementById('progressbar'); + const canvas = document.getElementById('progressbar'); if (!canvas || canvas.getContext === undefined) { /* Not supported */ return; @@ -200,15 +196,15 @@ function update_canvas(stats) { canvas.height = height; canvas.width = width; - queued = stats.queued; - built = stats.built; - failed = stats.failed; - skipped = stats.skipped; - ignored = stats.ignored; - fetched = stats.fetched; - remaining = queued - built - failed - skipped - ignored - fetched; + const { queued } = stats; + const { built } = stats; + const { failed } = stats; + const { skipped } = stats; + const { ignored } = stats; + const { fetched } = stats; + const remaining = queued - built - failed - skipped - ignored - fetched; - context = canvas.getContext('2d'); + const context = canvas.getContext('2d'); context.beginPath(); context.rect(0, 0, width, height); @@ -243,10 +239,9 @@ function update_canvas(stats) { } function display_pkghour(stats, snap) { - let attempted; let pkghour; let - hours; + let pkghour; let hours; - attempted = parseInt(stats.built) + parseInt(stats.failed); + const attempted = parseInt(stats.built) + parseInt(stats.failed); pkghour = '--'; if (attempted > 0 && snap.elapsed) { hours = snap.elapsed / 3600; @@ -256,12 +251,11 @@ function display_pkghour(stats, snap) { } function display_impulse(stats, snap) { - let attempted; let pkghour; let index; let tail; let d_pkgs; let d_secs; let - title; + let pkghour; let tail; let d_pkgs; let d_secs; let title; - attempted = parseInt(stats.built) + parseInt(stats.failed); + const attempted = parseInt(stats.built) + parseInt(stats.failed); pkghour = '--'; - index = tracker % impulse_interval; + const index = tracker % impulse_interval; if (tracker < impulse_interval) { impulseData.push({ pkgs: attempted, time: snap.elapsed }); } else { @@ -388,9 +382,7 @@ function format_portset(ptname, setname) { } function format_log(pkgname, errors, text) { - let html; - - html = ` - diff --git a/src/share/poudriere/html/index.html b/src/share/poudriere/html/index.html index e7b2d9db14..6fdd500f88 100644 --- a/src/share/poudriere/html/index.html +++ b/src/share/poudriere/html/index.html @@ -358,9 +358,6 @@
Poudriere
src="assets/jquery.dataTables.rowGrouping-1.2.9.js" type="text/javascript" > - diff --git a/src/share/poudriere/html/jail.html b/src/share/poudriere/html/jail.html index 79544f4b40..f4f4c0adb0 100644 --- a/src/share/poudriere/html/jail.html +++ b/src/share/poudriere/html/jail.html @@ -386,9 +386,6 @@
Poudriere
src="assets/jquery.dataTables.rowGrouping-1.2.9.js" type="text/javascript" > - From e87e4163701187a5dfbb7f7c73c9a141ce26ccd0 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:06:23 -0400 Subject: [PATCH 11/92] poudriere.js: Remove unnecessary escape character --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 07029d4613..bf1a15a4f7 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -46,7 +46,7 @@ let page_mastername; let data_url = ''; function getParameterByName(name) { - name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); + name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); const regex = new RegExp(`[\\?&]${name}=([^&#]*)`); const results = regex.exec(window.location.search); return results == null From cc78a41223e0a0a7d5885781c2483528e6e2b8f7 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:07:08 -0400 Subject: [PATCH 12/92] poudriere.js: Use const --- src/share/poudriere/html/assets/poudriere.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index bf1a15a4f7..5268d66ca5 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -1152,16 +1152,15 @@ function setup_build() { } function setup_jail() { - let columns; let status; let types; let i; let - stat_column; + let status; let types; let i; - stat_column = { + const stat_column = { sWidth: '1em', sType: 'numeric', bSearchable: false, }; - columns = [ + const columns = [ { data: 'buildname', render(data, type, row) { From 3154523fff04517467c6adfc2401f2e3710c0c35 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:09:13 -0400 Subject: [PATCH 13/92] poudriere.js: Avoid unnecessary string concatenation of literals --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 5268d66ca5..c8c2e6fd71 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -84,7 +84,7 @@ function update_data() { setTimeout(update_data, first_load_interval * 1000); } else { $('#loading p') - .text('Invalid request or no data available ' + ' yet.') + .text('Invalid request or no data available yet.') .addClass('error'); } }, From fa758142ed72b576d7f4d98689d8614cf3a43e48 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:16:31 -0400 Subject: [PATCH 14/92] poudriere.js: Define nodes --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index c8c2e6fd71..362614b242 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -593,7 +593,7 @@ DTRow.prototype = { }, commit() { if (this.new_rows.length) { - nodes = this.Table.rows.add(this.new_rows).draw().nodes(); + const nodes = this.Table.rows.add(this.new_rows).draw().nodes(); if (this.first_load) { $(`#${this.div_id}`).show(); } else { From a1f97cf87cf5d1a10b81b721e8e5f2d9c01a01d0 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:18:28 -0400 Subject: [PATCH 15/92] poudriere.js: Throw Error() not string literals --- src/share/poudriere/html/assets/poudriere.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 362614b242..d5bffcf361 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -552,8 +552,7 @@ function format_status_row(status, row, n) { table_row.push(format_origin(row.reason)); } } else { - alert(`Unknown data type "${status}". Try flushing cache.`); - throw `Unknown data type "${status}". Try flushing cache.`; + throw new Error(`Unknown data type "${status}". Try flushing cache.`); } return table_row; From f2255d3cec8a4bc39cf8b64d05c02c2ad964cf23 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:23:32 -0400 Subject: [PATCH 16/92] poudriere.js: Avoid double declaration --- src/share/poudriere/html/assets/poudriere.js | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index d5bffcf361..fec7d3e5ff 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -694,21 +694,21 @@ function process_data_build(data) { /* Stats */ if (data.stats) { - $.each(data.stats, (status, count) => { - if (status === 'elapsed') { + $.each(data.stats, (stat, count) => { + if (stat === 'elapsed') { count = format_start_to_end(count); } - $(`#stats_${status}`).html(count); + $(`#stats_${stat}`).html(count); }); $('#stats').data(data.stats); $('#stats').fadeIn(1400); if (data.snap) { - $.each(data.snap, (status, count) => { - if (status === 'elapsed') { + $.each(data.snap, (stat, count) => { + if (stat === 'elapsed') { count = format_start_to_end(count); } - $(`#snap_${status}`).html(count); + $(`#snap_${stat}`).html(count); }); display_pkghour(data.stats, data.snap); display_impulse(data.stats, data.snap); @@ -725,59 +725,59 @@ function process_data_build(data) { if (data.ports.remaining === undefined) { data.ports.remaining = []; } - $.each(data.ports, (status, ports) => { - if (status === 'tobuild') { + $.each(data.ports, (stat, ports) => { + if (stat === 'tobuild') { return; } if ( - data.ports[status] - && (data.ports[status].length > 0 || status === 'remaining') + data.ports[stat] + && (data.ports[stat].length > 0 || stat === 'remaining') ) { table_rows = []; - if (status !== 'remaining') { - if ((n = $(`#${status}_body`).data('index')) === undefined) { + if (stat !== 'remaining') { + if ((n = $(`#${stat}_body`).data('index')) === undefined) { n = 0; - $(`#${status}_div`).show(); - $(`#nav_${status}`).removeClass('disabled'); + $(`#${stat}_div`).show(); + $(`#nav_${stat}`).removeClass('disabled'); } - if (n === data.ports[status].length) { + if (n === data.ports[stat].length) { return; } } else { n = 0; } - for (; n < data.ports[status].length; n += 1) { - const row = data.ports[status][n]; + for (; n < data.ports[stat].length; n += 1) { + const fetchedRow = data.ports[stat][n]; // Add in skipped counts for failures and ignores - if (status === 'failed' || status === 'ignored') { - row.skipped_cnt = data.skipped && data.skipped[row.pkgname] - ? data.skipped[row.pkgname] + if (stat === 'failed' || stat === 'ignored') { + fetchedRow.skipped_cnt = data.skipped && data.skipped[fetchedRow.pkgname] + ? data.skipped[fetchedRow.pkgname] : 0; } - table_rows.push(format_status_row(status, row, n)); + table_rows.push(format_status_row(stat, fetchedRow, n)); } - if (status !== 'remaining') { - $(`#${status}_body`).data('index', n); - $(`#${status}_table`) + if (stat !== 'remaining') { + $(`#${stat}_body`).data('index', n); + $(`#${stat}_table`) .DataTable() .rows.add(table_rows) .draw(false); } else { - $(`#${status}_table`) + $(`#${stat}_table`) .DataTable() .clear() .draw(); - $(`#${status}_table`) + $(`#${stat}_table`) .DataTable() .rows.add(table_rows) .draw(false); if (table_rows.length > 0) { - $(`#${status}_div`).show(); - $(`#nav_${status}`).removeClass('disabled'); + $(`#${stat}_div`).show(); + $(`#nav_${stat}`).removeClass('disabled'); } else { - $(`#${status}_div`).hide(); - $(`#nav_${status}`).addClass('disabled'); + $(`#${stat}_div`).hide(); + $(`#nav_${stat}`).addClass('disabled'); } } } From 696ba2a7758edb50db995599f39e2eabf23b5d0c Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:24:55 -0400 Subject: [PATCH 17/92] poudriere.js: Avoid assignment in if statement --- src/share/poudriere/html/assets/poudriere.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index fec7d3e5ff..8ddf7368f2 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -735,7 +735,8 @@ function process_data_build(data) { ) { table_rows = []; if (stat !== 'remaining') { - if ((n = $(`#${stat}_body`).data('index')) === undefined) { + n = $(`#${stat}_body`).data('index'); + if (n === undefined) { n = 0; $(`#${stat}_div`).show(); $(`#nav_${stat}`).removeClass('disabled'); From 1dfb1316b0e7d6f88f6e4ea0e13b740eed086082 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:29:01 -0400 Subject: [PATCH 18/92] poudriere.js: Explicitly return undefined --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 8ddf7368f2..ef17c129c8 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -616,7 +616,7 @@ function process_data_build(data) { // Redirect from /latest/ to the actual build. if (page_buildname === 'latest') { window.location.href = build_url(page_mastername, data.buildname); - return; + return undefined; } if (data.stats) { From da8c780bd3e733d641ad32eeaa4bb299525e2ad8 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:35:22 -0400 Subject: [PATCH 19/92] poudriere.js: Use guard in for in loops --- src/share/poudriere/html/assets/poudriere.js | 132 ++++++++++--------- 1 file changed, 71 insertions(+), 61 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index ef17c129c8..d12658a9f4 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -796,38 +796,42 @@ function process_data_jail(data) { types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; dtrow = new DTRow('builds_table', 'builds_div'); for (buildname in data.builds) { - row = {}; + if (buildname !== undefined) { + row = {}; - build = data.builds[buildname]; - if (buildname === 'latest') { - latest = data.builds[build]; - continue; - } + build = data.builds[buildname]; + if (buildname === 'latest') { + latest = data.builds[build]; + continue; + } - row.id = buildname; - row.buildname = buildname; - for (stat in types) { - count = build.stats && build.stats[types[stat]] !== undefined - ? parseInt(build.stats[types[stat]], 10) - : 0; - row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; - } - remaining = build.stats - ? parseInt(build.stats.queued, 10) + row.id = buildname; + row.buildname = buildname; + for (stat in types) { + if (stat !== undefined) { + count = build.stats && build.stats[types[stat]] !== undefined + ? parseInt(build.stats[types[stat]], 10) + : 0; + row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; + } + } + remaining = build.stats + ? parseInt(build.stats.queued, 10) - (parseInt(build.stats.built, 10) + parseInt(build.stats.failed, 10) + parseInt(build.stats.skipped, 10) + parseInt(build.stats.ignored, 10) + parseInt(build.stats.fetched, 10)) - : 0; - if (Number.isNaN(remaining)) { - remaining = 0; - } - row.stat_remaining = remaining; - row.status = translate_status(build.status); - row.elapsed = build.elapsed ? build.elapsed : ''; + : 0; + if (Number.isNaN(remaining)) { + remaining = 0; + } + row.stat_remaining = remaining; + row.status = translate_status(build.status); + row.elapsed = build.elapsed ? build.elapsed : ''; - dtrow.queue(row); + dtrow.queue(row); + } } if (latest) { @@ -861,35 +865,39 @@ function process_data_index(data) { types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; dtrow = new DTRow('latest_builds_table', 'latest_builds_div'); for (mastername in data.masternames) { - row = {}; - master = data.masternames[mastername].latest; - - row.id = master.mastername; - row.portset = format_portset(master.ptname, master.setname); - row.mastername = master.mastername; - row.buildname = master.buildname; - row.jailname = master.jailname; - row.setname = master.setname; - row.ptname = master.ptname; - for (stat in types) { - count = master.stats && master.stats[types[stat]] !== undefined - ? parseInt(master.stats[types[stat]], 10) - : 0; - row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; - } - remaining = master.stats - ? parseInt(master.stats.queued, 10) + if (mastername !== undefined) { + row = {}; + master = data.masternames[mastername].latest; + + row.id = master.mastername; + row.portset = format_portset(master.ptname, master.setname); + row.mastername = master.mastername; + row.buildname = master.buildname; + row.jailname = master.jailname; + row.setname = master.setname; + row.ptname = master.ptname; + for (stat in types) { + if (stat !== undefined) { + count = master.stats && master.stats[types[stat]] !== undefined + ? parseInt(master.stats[types[stat]], 10) + : 0; + row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; + } + } + remaining = master.stats + ? parseInt(master.stats.queued, 10) - (parseInt(master.stats.built, 10) + parseInt(master.stats.failed, 10) + parseInt(master.stats.skipped, 10) + parseInt(master.stats.ignored, 10) + parseInt(master.stats.fetched, 10)) - : 0; - row.stat_remaining = Number.isNaN(remaining) ? 0 : remaining; - row.status = translate_status(master.status); - row.elapsed = master.elapsed ? master.elapsed : ''; + : 0; + row.stat_remaining = Number.isNaN(remaining) ? 0 : remaining; + row.status = translate_status(master.status); + row.elapsed = master.elapsed ? master.elapsed : ''; - dtrow.queue(row); + dtrow.queue(row); + } } dtrow.commit(); } @@ -1134,20 +1142,22 @@ function setup_build() { 'queued', ]; for (i in types) { - status = types[i]; - $(`#${status}_table`).dataTable({ - bAutoWidth: false, - processing: true, // Show processing icon - deferRender: true, // Defer creating TR/TD until needed - aoColumns: columns[status], - stateSave: true, // Enable cookie for keeping state - lengthMenu: [ - [5, 10, 25, 50, 100, 200, -1], - [5, 10, 25, 50, 100, 200, 'All'], - ], - pageLength: 10, - order: [[0, 'asc']], // Sort by build order - }); + if (i !== undefined) { + status = types[i]; + $(`#${status}_table`).dataTable({ + bAutoWidth: false, + processing: true, // Show processing icon + deferRender: true, // Defer creating TR/TD until needed + aoColumns: columns[status], + stateSave: true, // Enable cookie for keeping state + lengthMenu: [ + [5, 10, 25, 50, 100, 200, -1], + [5, 10, 25, 50, 100, 200, 'All'], + ], + pageLength: 10, + order: [[0, 'asc']], // Sort by build order + }); + } } } From fd4a9cb0ef14711b54556593000d7c23370520bb Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 21:58:57 -0400 Subject: [PATCH 20/92] poudriere.js: Don't use function before definition --- src/share/poudriere/html/assets/poudriere.js | 120 +++++++++---------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index d12658a9f4..1fc713ed93 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -66,31 +66,6 @@ function scrollToElement(element) { $('body,html,document').scrollTop(ele.offset().top + scrollOffset()); } -function update_data() { - $.ajax({ - url: `${data_url}.data.json`, - dataType: 'json', - headers: { - 'Cache-Control': 'max-age=0', - }, - success(data) { - load_attempts = 0; - process_data(data); - }, - error(data) { - load_attempts += 1; - if (load_attempts < max_load_attempts) { - /* May not be there yet, try again shortly */ - setTimeout(update_data, first_load_interval * 1000); - } else { - $('#loading p') - .text('Invalid request or no data available yet.') - .addClass('error'); - } - }, - }); -} - function format_origin(origin, flavor) { if (!origin) { return ''; @@ -399,30 +374,6 @@ function format_log(pkgname, errors, text) { return html; } -function format_start_to_end(start, end) { - let duration; - - if (!start) { - return ''; - } - start = parseInt(start, 10); - if (Number.isNaN(start)) { - return ''; - } - - if (end === undefined) { - duration = start; - } else { - duration = end - start; - } - - if (duration < 0) { - duration = 0; - } - - return format_duration(duration); -} - function format_duration(duration) { let hours; let minutes; let seconds; @@ -449,6 +400,30 @@ function format_duration(duration) { return `${hours}:${minutes}:${seconds}`; } +function format_start_to_end(start, end) { + let duration; + + if (!start) { + return ''; + } + start = parseInt(start, 10); + if (Number.isNaN(start)) { + return ''; + } + + if (end === undefined) { + duration = start; + } else { + duration = end - start; + } + + if (duration < 0) { + duration = 0; + } + + return format_duration(duration); +} + function filter_skipped(pkgname) { scrollToElement('#skipped'); const table = $('#skipped_table').dataTable(); @@ -906,6 +881,19 @@ function process_data_index(data) { return true; } +/* Disable static navbar at the breakpoint */ +function do_resize(win) { + /* Redraw canvas to new width */ + if ($('#stats').data()) { + determine_canvas_width(); + update_canvas($('#stats').data()); + } + /* Resize padding for navbar/footer heights */ + $('body') + .css('padding-top', $('#header').outerHeight(true)) + .css('padding-bottom', $('footer').outerHeight(true)); +} + function process_data(data) { let should_reload; @@ -964,17 +952,29 @@ function process_data(data) { } } -/* Disable static navbar at the breakpoint */ -function do_resize(win) { - /* Redraw canvas to new width */ - if ($('#stats').data()) { - determine_canvas_width(); - update_canvas($('#stats').data()); - } - /* Resize padding for navbar/footer heights */ - $('body') - .css('padding-top', $('#header').outerHeight(true)) - .css('padding-bottom', $('footer').outerHeight(true)); +function update_data() { + $.ajax({ + url: `${data_url}.data.json`, + dataType: 'json', + headers: { + 'Cache-Control': 'max-age=0', + }, + success(data) { + load_attempts = 0; + process_data(data); + }, + error(data) { + load_attempts += 1; + if (load_attempts < max_load_attempts) { + /* May not be there yet, try again shortly */ + setTimeout(update_data, first_load_interval * 1000); + } else { + $('#loading p') + .text('Invalid request or no data available yet.') + .addClass('error'); + } + }, + }); } /* Force minimum width on mobile, will zoom to fit. */ From a584ce0b4825b9b36b0ac5ef85dc60467bd38402 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 22:08:53 -0400 Subject: [PATCH 21/92] poudriere.js: Remove unused varaibles and functions --- src/share/poudriere/html/assets/poudriere.js | 106 +++---------------- 1 file changed, 17 insertions(+), 89 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 1fc713ed93..d84be13145 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -37,7 +37,6 @@ const impulseData = []; let tracker = 0; const impulse_first_period = 120; const impulse_target_period = 600; -const impulse_period = impulse_first_period; const impulse_first_interval = impulse_first_period / updateInterval; const impulse_interval = impulse_target_period / updateInterval; let page_type; @@ -94,53 +93,10 @@ function format_origin(origin, flavor) { ); } -function format_githash(githash) { - if (!githash) { - return ''; - } - return ( - `
${ - githash - }` - ); -} - function format_pkgname(pkgname) { return pkgname; } -function minidraw(x, height, width, context, color, queued, variable) { - let newx; - - /* Calculate how much percentage this value should display */ - const pct = Math.floor((variable * 100) / queued); - if (pct === 0) { - return 0; - } - newx = width * (pct / 100); - if (x + newx >= width) { - newx = width - x; - } - /* Cap total bar to 99%, so it's clear something is remaining */ - const total_pct = ((x + newx) / width) * 100; - if (total_pct >= 99.0 && total_pct < 100.0) { - newx = Math.ceil(width * (99 / 100)); - } - /* Always start at 1 */ - if (newx === 0) { - newx = 1; - } - context.fillStyle = color; - context.fillRect(x, 1, newx, height); - - return newx; -} - function determine_canvas_width() { let width; @@ -156,8 +112,8 @@ function determine_canvas_width() { function update_canvas(stats) { let pctdone; - let height; let width; let x; let - pctdonetxt; + let height; let width; + let pctdonetxt; if (stats.queued === undefined) { return; @@ -191,17 +147,11 @@ function update_canvas(stats) { height -= 2; /* Start at 1 and save 1 for border */ width -= 1; - x = 1; context.fillStyle = '#E3E3E3'; context.fillRect(1, 1, width, height); context.lineWidth = 1; context.strokeStyle = 'black'; context.stroke(); - x += minidraw(x, height, width, context, '#00CC00', queued, built); - x += minidraw(x, height, width, context, '#E00000', queued, failed); - x += minidraw(x, height, width, context, '#FF9900', queued, ignored); - x += minidraw(x, height, width, context, '#228B22', queued, fetched); - x += minidraw(x, height, width, context, '#CC6633', queued, skipped); pctdone = ((queued - remaining) * 100) / queued; if (Number.isNaN(pctdone)) { @@ -218,7 +168,8 @@ function update_canvas(stats) { } function display_pkghour(stats, snap) { - let pkghour; let hours; + let pkghour; + let hours; const attempted = parseInt(stats.built, 10) + parseInt(stats.failed, 10); pkghour = '--'; @@ -440,7 +391,7 @@ function filter_skipped(pkgname) { + 'pull-right" id="resetsearch">', ); - $('#resetsearch').click((e) => { + $('#resetsearch').click(() => { table.fnFilter('', 3); search_filter.val(''); search_filter.prop('disabled', false); @@ -578,7 +529,7 @@ DTRow.prototype = { }; function process_data_build(data) { - let html; let a; let n; let table_rows; let status; let builder; let now; let row; let dtrow; + let n; let table_rows; let status; let builder; let now; let row; let dtrow; if (data.snap && data.snap.now) { // New data is relative to the 'job.started' time, not epoch. @@ -700,7 +651,7 @@ function process_data_build(data) { if (data.ports.remaining === undefined) { data.ports.remaining = []; } - $.each(data.ports, (stat, ports) => { + $.each(data.ports, (stat) => { if (stat === 'tobuild') { return; } @@ -833,7 +784,7 @@ function process_data_jail(data) { } function process_data_index(data) { - let master; let mastername; let stat; let types; let latest; let remaining; + let master; let mastername; let stat; let types; let remaining; let row; let count; let dtrow; if (data.masternames) { @@ -882,7 +833,7 @@ function process_data_index(data) { } /* Disable static navbar at the breakpoint */ -function do_resize(win) { +function do_resize() { /* Redraw canvas to new width */ if ($('#stats').data()) { determine_canvas_width(); @@ -963,7 +914,7 @@ function update_data() { load_attempts = 0; process_data(data); }, - error(data) { + error() { load_attempts += 1; if (load_attempts < max_load_attempts) { /* May not be there yet, try again shortly */ @@ -990,23 +941,6 @@ function fix_viewport() { } } -function applyHovering(table_id) { - const lastIdx = null; - const Table = $(`#${table_id}`).DataTable(); - $(`#${table_id} tbody`) - .on('mouseover', 'td', () => { - const colIdx = Table.cell(this).index().column; - - if (colIdx !== lastIdx) { - $(Table.cells().nodes()).removeClass('highlight'); - $(Table.column(colIdx).nodes()).addClass('highlight'); - } - }) - .on('mouseleave', () => { - $(Table.cells().nodes()).removeClass('highlight'); - }); -} - function setup_build() { let status; let i; @@ -1162,8 +1096,6 @@ function setup_build() { } function setup_jail() { - let status; let types; let i; - const stat_column = { sWidth: '1em', sType: 'numeric', @@ -1173,7 +1105,7 @@ function setup_jail() { const columns = [ { data: 'buildname', - render(data, type, row) { + render(data, type) { return type === 'display' ? format_buildname(page_mastername, data) : data; @@ -1215,7 +1147,7 @@ function setup_jail() { targets: '_all', }, ], - createdRow(row, data, index) { + createdRow(row, data) { if (data.buildname === $('#latest_build').text()) { $('td.latest').removeClass('latest'); $('td', row).addClass('latest'); @@ -1223,13 +1155,9 @@ function setup_jail() { }, order: [[0, 'asc']], // Sort by buildname }); - - // applyHovering('builds_table'); } function setup_index() { - let status; let types; let i; - const stat_column = { sWidth: '1em', sType: 'numeric', @@ -1243,7 +1171,7 @@ function setup_index() { }, { data: 'mastername', - render(data, type, row) { + render(data, type) { return type === 'display' ? format_mastername(data) : data; }, sWidth: '22em', @@ -1259,7 +1187,7 @@ function setup_index() { }, { data: 'jailname', - render(data, type, row) { + render(data, type) { return type === 'display' ? format_jailname(data) : data; }, sWidth: '10em', @@ -1267,7 +1195,7 @@ function setup_index() { }, { data: 'setname', - render(data, type, row) { + render(data, type) { return type === 'display' ? format_setname(data) : data; }, sWidth: '10em', @@ -1275,7 +1203,7 @@ function setup_index() { }, { data: 'ptname', - render(data, type, row) { + render(data, type) { return type === 'display' ? format_ptname(data) : data; }, sWidth: '10em', @@ -1426,7 +1354,7 @@ $(document).ready(() => { } }); /* Force minimum width on mobile, will zoom to fit. */ - $(window).on('orientationchange', (e) => { + $(window).on('orientationchange', () => { fix_viewport(); }); fix_viewport(); From 05d20214f515454828e91c3d4cb1b5579c048d43 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:25:10 -0400 Subject: [PATCH 22/92] poudriere.js: Make server_style camelCase --- src/share/poudriere/html/assets/poudriere.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index d84be13145..ccf8547a53 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -25,7 +25,7 @@ */ // server_style = ['hosted', 'inline']; -const server_style = 'hosted'; +const serverStyle = 'hosted'; const updateInterval = 8; let first_run = true; @@ -216,7 +216,7 @@ function display_impulse(stats, snap) { } function jail_url(mastername) { - if (server_style === 'hosted') { + if (serverStyle === 'hosted') { if (mastername) { return `jail.html?mastername=${encodeURIComponent(mastername)}`; } @@ -1281,7 +1281,7 @@ $(document).ready(() => { } if (page_type === 'build') { - if (server_style === 'hosted') { + if (serverStyle === 'hosted') { page_mastername = getParameterByName('mastername'); page_buildname = getParameterByName('build'); if (!page_mastername || !page_buildname) { @@ -1296,13 +1296,13 @@ $(document).ready(() => { $(this).attr('href', data_url + href); }); $('#master_link').attr('href', jail_url(page_mastername)); - } else if (server_style === 'inline') { + } else if (serverStyle === 'inline') { $('#master_link').attr('href', '../'); $('#index_link').attr('href', '../../'); } setup_build(); } else if (page_type === 'jail') { - if (server_style === 'hosted') { + if (serverStyle === 'hosted') { page_mastername = getParameterByName('mastername'); if (!page_mastername) { $('#loading p') @@ -1316,12 +1316,12 @@ $(document).ready(() => { $(this).attr('href', data_url + href); }); $('#latest_url').attr('href', build_url(page_mastername, 'latest')); - } else if (server_style === 'inline') { + } else if (serverStyle === 'inline') { $('#index_link').attr('href', '../'); } setup_jail(); } else if (page_type === 'index') { - if (server_style === 'hosted') { + if (serverStyle === 'hosted') { data_url = 'data/'; $('a.data_url').each(() => { const href = $(this).attr('href'); From 0b96e45d2cfed287678df034f7ca984ca67d0b6c Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:25:48 -0400 Subject: [PATCH 23/92] poudriere.js: Make first_run camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index ccf8547a53..200b7f802f 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -28,7 +28,7 @@ const serverStyle = 'hosted'; const updateInterval = 8; -let first_run = true; +let firstRun = true; let load_attempts = 0; const max_load_attempts = 8; const first_load_interval = 2; @@ -886,7 +886,7 @@ function process_data(data) { should_reload = false; } - if (first_run) { + if (firstRun) { /* Resize due to full content. */ do_resize($(window)); // Hide loading overlay @@ -895,7 +895,7 @@ function process_data(data) { if (window.location.hash) { scrollToElement(window.location.hash); } - first_run = false; + firstRun = false; } if (should_reload) { From 1bb131da992a2ea28e6e6efb1561f581f4293c22 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:26:37 -0400 Subject: [PATCH 24/92] poudriere.js: Make load_attempts camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 200b7f802f..e92d261499 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -29,7 +29,7 @@ const serverStyle = 'hosted'; const updateInterval = 8; let firstRun = true; -let load_attempts = 0; +let loadAttempts = 0; const max_load_attempts = 8; const first_load_interval = 2; let canvas_width; @@ -911,12 +911,12 @@ function update_data() { 'Cache-Control': 'max-age=0', }, success(data) { - load_attempts = 0; + loadAttempts = 0; process_data(data); }, error() { - load_attempts += 1; - if (load_attempts < max_load_attempts) { + loadAttempts += 1; + if (loadAttempts < max_load_attempts) { /* May not be there yet, try again shortly */ setTimeout(update_data, first_load_interval * 1000); } else { From f71866316f02c675020a3759e247dbb82a547ef6 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:27:01 -0400 Subject: [PATCH 25/92] poudriere.js: Make max_load_attempts camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index e92d261499..5d4d7f26ee 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -30,7 +30,7 @@ const serverStyle = 'hosted'; const updateInterval = 8; let firstRun = true; let loadAttempts = 0; -const max_load_attempts = 8; +const maxLoadAttempts = 8; const first_load_interval = 2; let canvas_width; const impulseData = []; @@ -916,7 +916,7 @@ function update_data() { }, error() { loadAttempts += 1; - if (loadAttempts < max_load_attempts) { + if (loadAttempts < maxLoadAttempts) { /* May not be there yet, try again shortly */ setTimeout(update_data, first_load_interval * 1000); } else { From 4265f6f479f24781b7ca3a29b4909ea28c077df3 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:29:04 -0400 Subject: [PATCH 26/92] poudriere.js: Make first_load_interval camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 5d4d7f26ee..d57df61790 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -31,7 +31,7 @@ const updateInterval = 8; let firstRun = true; let loadAttempts = 0; const maxLoadAttempts = 8; -const first_load_interval = 2; +const firstLoadInterval = 2; let canvas_width; const impulseData = []; let tracker = 0; @@ -918,7 +918,7 @@ function update_data() { loadAttempts += 1; if (loadAttempts < maxLoadAttempts) { /* May not be there yet, try again shortly */ - setTimeout(update_data, first_load_interval * 1000); + setTimeout(update_data, firstLoadInterval * 1000); } else { $('#loading p') .text('Invalid request or no data available yet.') From e306e1c654a18ed6bdcc8e0999fc836fb1484076 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:29:58 -0400 Subject: [PATCH 27/92] poudriere.js: Make canvas_width camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index d57df61790..a8c1ee9b33 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -32,7 +32,7 @@ let firstRun = true; let loadAttempts = 0; const maxLoadAttempts = 8; const firstLoadInterval = 2; -let canvas_width; +let canvasWidth; const impulseData = []; let tracker = 0; const impulse_first_period = 120; @@ -107,7 +107,7 @@ function determine_canvas_width() { $('#progresspct').text('100%'); width = width - $('#progresspct').width() - 20; $('#progresspct').text(''); - canvas_width = width; + canvasWidth = width; } function update_canvas(stats) { @@ -126,7 +126,7 @@ function update_canvas(stats) { } height = 10; - width = canvas_width; + width = canvasWidth; canvas.height = height; canvas.width = width; From 6141080112b88d22341215e110dbf71e7c0f564b Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:36:24 -0400 Subject: [PATCH 28/92] poudriere.js: Make impulse_first_period camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index a8c1ee9b33..ab45b7fe76 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -35,9 +35,9 @@ const firstLoadInterval = 2; let canvasWidth; const impulseData = []; let tracker = 0; -const impulse_first_period = 120; +const impulseFirstPeriod = 120; const impulse_target_period = 600; -const impulse_first_interval = impulse_first_period / updateInterval; +const impulse_first_interval = impulseFirstPeriod / updateInterval; const impulse_interval = impulse_target_period / updateInterval; let page_type; let page_buildname; From efa4107a1c228a012bf3e3d9c799a850e0191024 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:36:48 -0400 Subject: [PATCH 29/92] poudriere.js: Make impulse_target_period camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index ab45b7fe76..c39d52ceee 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -36,9 +36,9 @@ let canvasWidth; const impulseData = []; let tracker = 0; const impulseFirstPeriod = 120; -const impulse_target_period = 600; +const impulseTargetPeriod = 600; const impulse_first_interval = impulseFirstPeriod / updateInterval; -const impulse_interval = impulse_target_period / updateInterval; +const impulse_interval = impulseTargetPeriod / updateInterval; let page_type; let page_buildname; let page_mastername; @@ -201,7 +201,7 @@ function display_impulse(stats, snap) { } else { tail = (tracker - (impulse_interval - 1)) % impulse_interval; title = `Package build rate over last ${ - impulse_target_period / 60 + impulseTargetPeriod / 60 } minutes`; } d_pkgs = impulseData[index].pkgs - impulseData[tail].pkgs; From 560805b064679728130923166df6de6de6a43635 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:37:09 -0400 Subject: [PATCH 30/92] poudriere.js: Make impulse_first_interval camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index c39d52ceee..1e533c5ec6 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -37,7 +37,7 @@ const impulseData = []; let tracker = 0; const impulseFirstPeriod = 120; const impulseTargetPeriod = 600; -const impulse_first_interval = impulseFirstPeriod / updateInterval; +const impulseFirstInterval = impulseFirstPeriod / updateInterval; const impulse_interval = impulseTargetPeriod / updateInterval; let page_type; let page_buildname; @@ -192,7 +192,7 @@ function display_impulse(stats, snap) { impulseData[index].pkgs = attempted; impulseData[index].time = snap.elapsed; } - if (tracker >= impulse_first_interval) { + if (tracker >= impulseFirstInterval) { if (tracker < impulse_interval) { tail = 0; title = `Package build rate over last ${ From 213d5456f267c12e9f38c1df9a5b3cc9668c4e42 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:37:24 -0400 Subject: [PATCH 31/92] poudriere.js: Make impulse_interval camelCase --- src/share/poudriere/html/assets/poudriere.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 1e533c5ec6..1cbd8b79b2 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -38,7 +38,7 @@ let tracker = 0; const impulseFirstPeriod = 120; const impulseTargetPeriod = 600; const impulseFirstInterval = impulseFirstPeriod / updateInterval; -const impulse_interval = impulseTargetPeriod / updateInterval; +const impulseInterval = impulseTargetPeriod / updateInterval; let page_type; let page_buildname; let page_mastername; @@ -185,21 +185,21 @@ function display_impulse(stats, snap) { const attempted = parseInt(stats.built, 10) + parseInt(stats.failed, 10); pkghour = '--'; - const index = tracker % impulse_interval; - if (tracker < impulse_interval) { + const index = tracker % impulseInterval; + if (tracker < impulseInterval) { impulseData.push({ pkgs: attempted, time: snap.elapsed }); } else { impulseData[index].pkgs = attempted; impulseData[index].time = snap.elapsed; } if (tracker >= impulseFirstInterval) { - if (tracker < impulse_interval) { + if (tracker < impulseInterval) { tail = 0; title = `Package build rate over last ${ Math.floor((tracker * updateInterval) / 60) } minutes`; } else { - tail = (tracker - (impulse_interval - 1)) % impulse_interval; + tail = (tracker - (impulseInterval - 1)) % impulseInterval; title = `Package build rate over last ${ impulseTargetPeriod / 60 } minutes`; From 871137a391ed55f2dcae806a24cadf25a7ef310d Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:37:36 -0400 Subject: [PATCH 32/92] poudriere.js: Make page_type camelCase --- src/share/poudriere/html/assets/poudriere.js | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 1cbd8b79b2..8d032e3ff5 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -39,7 +39,7 @@ const impulseFirstPeriod = 120; const impulseTargetPeriod = 600; const impulseFirstInterval = impulseFirstPeriod / updateInterval; const impulseInterval = impulseTargetPeriod / updateInterval; -let page_type; +let pageType; let page_buildname; let page_mastername; let data_url = ''; @@ -232,7 +232,7 @@ function format_mastername(mastername) { return ''; } - if (page_mastername && mastername === page_mastername && page_type === 'jail') { + if (page_mastername && mastername === page_mastername && pageType === 'jail') { html = `${ mastername }`; @@ -289,7 +289,7 @@ function format_buildname(mastername, buildname) { && mastername === page_mastername && page_buildname && buildname === page_buildname - && page_type === 'build' + && pageType === 'build' ) { html = `${ buildname @@ -853,18 +853,18 @@ function process_data(data) { if (data.buildname) { // If the current page is not build.html, then redirect for the // sake of file:// loading. - if (page_type !== 'build') { + if (pageType !== 'build') { window.location.href = 'build.html'; return; } - page_type = 'build'; + pageType = 'build'; if (data.buildname) { page_buildname = data.buildname; } } else if (data.builds) { - page_type = 'jail'; + pageType = 'jail'; } else if (data.masternames) { - page_type = 'index'; + pageType = 'index'; } else { $('#loading p') .text('Invalid request. Unknown data type.') @@ -876,11 +876,11 @@ function process_data(data) { page_mastername = data.mastername; } - if (page_type === 'build') { + if (pageType === 'build') { should_reload = process_data_build(data); - } else if (page_type === 'jail') { + } else if (pageType === 'jail') { should_reload = process_data_jail(data); - } else if (page_type === 'index') { + } else if (pageType === 'index') { should_reload = process_data_index(data); } else { should_reload = false; @@ -1275,12 +1275,12 @@ $(document).ready(() => { window.location.pathname.lastIndexOf('/') + 1, ); if (pathname === '') { - page_type = 'index'; + pageType = 'index'; } else { - page_type = pathname.substr(0, pathname.length - 5); + pageType = pathname.substr(0, pathname.length - 5); } - if (page_type === 'build') { + if (pageType === 'build') { if (serverStyle === 'hosted') { page_mastername = getParameterByName('mastername'); page_buildname = getParameterByName('build'); @@ -1301,7 +1301,7 @@ $(document).ready(() => { $('#index_link').attr('href', '../../'); } setup_build(); - } else if (page_type === 'jail') { + } else if (pageType === 'jail') { if (serverStyle === 'hosted') { page_mastername = getParameterByName('mastername'); if (!page_mastername) { @@ -1320,7 +1320,7 @@ $(document).ready(() => { $('#index_link').attr('href', '../'); } setup_jail(); - } else if (page_type === 'index') { + } else if (pageType === 'index') { if (serverStyle === 'hosted') { data_url = 'data/'; $('a.data_url').each(() => { @@ -1331,7 +1331,7 @@ $(document).ready(() => { setup_index(); } else { $('#loading p') - .text(`Invalid request. Unhandled page type '${page_type}'`) + .text(`Invalid request. Unhandled page type '${pageType}'`) .addClass('error'); return; } From 93f3ae12050878eeb0818e63d0a90b1cf2d573f5 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:37:52 -0400 Subject: [PATCH 33/92] poudriere.js: Make page_buildname camelCase --- src/share/poudriere/html/assets/poudriere.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 8d032e3ff5..490e5abda2 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -40,7 +40,7 @@ const impulseTargetPeriod = 600; const impulseFirstInterval = impulseFirstPeriod / updateInterval; const impulseInterval = impulseTargetPeriod / updateInterval; let pageType; -let page_buildname; +let pageBuildName; let page_mastername; let data_url = ''; @@ -287,8 +287,8 @@ function format_buildname(mastername, buildname) { if ( page_mastername && mastername === page_mastername - && page_buildname - && buildname === page_buildname + && pageBuildName + && buildname === pageBuildName && pageType === 'build' ) { html = `${ @@ -540,7 +540,7 @@ function process_data_build(data) { } // Redirect from /latest/ to the actual build. - if (page_buildname === 'latest') { + if (pageBuildName === 'latest') { window.location.href = build_url(page_mastername, data.buildname); return undefined; } @@ -859,7 +859,7 @@ function process_data(data) { } pageType = 'build'; if (data.buildname) { - page_buildname = data.buildname; + pageBuildName = data.buildname; } } else if (data.builds) { pageType = 'jail'; @@ -1283,14 +1283,14 @@ $(document).ready(() => { if (pageType === 'build') { if (serverStyle === 'hosted') { page_mastername = getParameterByName('mastername'); - page_buildname = getParameterByName('build'); - if (!page_mastername || !page_buildname) { + pageBuildName = getParameterByName('build'); + if (!page_mastername || !pageBuildName) { $('#loading p') .text('Invalid request. Mastername and Build required.') .addClass('error'); return; } - data_url = `data/${page_mastername}/${page_buildname}/`; + data_url = `data/${page_mastername}/${pageBuildName}/`; $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); From dcef7bb602c0285e76c6c1bd0057678719596231 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:38:13 -0400 Subject: [PATCH 34/92] poudriere.js: Make page_mastername camelCase --- src/share/poudriere/html/assets/poudriere.js | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 490e5abda2..5acc0c22cd 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -41,7 +41,7 @@ const impulseFirstInterval = impulseFirstPeriod / updateInterval; const impulseInterval = impulseTargetPeriod / updateInterval; let pageType; let pageBuildName; -let page_mastername; +let pageMasterName; let data_url = ''; function getParameterByName(name) { @@ -232,7 +232,7 @@ function format_mastername(mastername) { return ''; } - if (page_mastername && mastername === page_mastername && pageType === 'jail') { + if (pageMasterName && mastername === pageMasterName && pageType === 'jail') { html = `${ mastername }`; @@ -285,8 +285,8 @@ function format_buildname(mastername, buildname) { } if ( - page_mastername - && mastername === page_mastername + pageMasterName + && mastername === pageMasterName && pageBuildName && buildname === pageBuildName && pageType === 'build' @@ -541,7 +541,7 @@ function process_data_build(data) { // Redirect from /latest/ to the actual build. if (pageBuildName === 'latest') { - window.location.href = build_url(page_mastername, data.buildname); + window.location.href = build_url(pageMasterName, data.buildname); return undefined; } @@ -873,7 +873,7 @@ function process_data(data) { } if (data.mastername) { - page_mastername = data.mastername; + pageMasterName = data.mastername; } if (pageType === 'build') { @@ -1107,7 +1107,7 @@ function setup_jail() { data: 'buildname', render(data, type) { return type === 'display' - ? format_buildname(page_mastername, data) + ? format_buildname(pageMasterName, data) : data; }, sWidth: '12em', @@ -1282,20 +1282,20 @@ $(document).ready(() => { if (pageType === 'build') { if (serverStyle === 'hosted') { - page_mastername = getParameterByName('mastername'); + pageMasterName = getParameterByName('mastername'); pageBuildName = getParameterByName('build'); - if (!page_mastername || !pageBuildName) { + if (!pageMasterName || !pageBuildName) { $('#loading p') .text('Invalid request. Mastername and Build required.') .addClass('error'); return; } - data_url = `data/${page_mastername}/${pageBuildName}/`; + data_url = `data/${pageMasterName}/${pageBuildName}/`; $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); }); - $('#master_link').attr('href', jail_url(page_mastername)); + $('#master_link').attr('href', jail_url(pageMasterName)); } else if (serverStyle === 'inline') { $('#master_link').attr('href', '../'); $('#index_link').attr('href', '../../'); @@ -1303,19 +1303,19 @@ $(document).ready(() => { setup_build(); } else if (pageType === 'jail') { if (serverStyle === 'hosted') { - page_mastername = getParameterByName('mastername'); - if (!page_mastername) { + pageMasterName = getParameterByName('mastername'); + if (!pageMasterName) { $('#loading p') .text('Invalid request. Mastername required.') .addClass('error'); return; } - data_url = `data/${page_mastername}/`; + data_url = `data/${pageMasterName}/`; $('a.data_url').each(() => { const href = $(this).attr('href'); $(this).attr('href', data_url + href); }); - $('#latest_url').attr('href', build_url(page_mastername, 'latest')); + $('#latest_url').attr('href', build_url(pageMasterName, 'latest')); } else if (serverStyle === 'inline') { $('#index_link').attr('href', '../'); } From b00ed7be74ab449e40a187d5bea947e3e7c06c4a Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:38:39 -0400 Subject: [PATCH 35/92] poudriere.js: Make data_url camelCase --- src/share/poudriere/html/assets/poudriere.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 5acc0c22cd..4ca11335de 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -42,7 +42,7 @@ const impulseInterval = impulseTargetPeriod / updateInterval; let pageType; let pageBuildName; let pageMasterName; -let data_url = ''; +let dataURL = ''; function getParameterByName(name) { name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); @@ -315,7 +315,7 @@ function format_log(pkgname, errors, text) { const html = ` Date: Mon, 11 Mar 2024 23:39:49 -0400 Subject: [PATCH 37/92] poudriere.js: Make format_pkgname camelCase --- src/share/poudriere/html/assets/poudriere.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 8f681b8dea..02397a24e6 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -93,7 +93,7 @@ function formatOrigin(origin, flavor) { ); } -function format_pkgname(pkgname) { +function formatPkgName(pkgname) { return pkgname; } @@ -443,34 +443,34 @@ function format_status_row(status, row, n) { table_row.push(n + 1); if (status === 'built') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); table_row.push(format_log(row.pkgname, false, 'success')); table_row.push(format_duration(row.elapsed ? row.elapsed : '')); } else if (status === 'failed') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); table_row.push(row.phase); table_row.push(row.skipped_cnt); table_row.push(format_log(row.pkgname, true, row.errortype)); table_row.push(format_duration(row.elapsed ? row.elapsed : '')); } else if (status === 'skipped') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); - table_row.push(format_pkgname(row.depends)); + table_row.push(formatPkgName(row.depends)); } else if (status === 'ignored') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); table_row.push(row.skipped_cnt); table_row.push(row.reason); } else if (status === 'fetched') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); } else if (status === 'remaining') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(row.status); } else if (status === 'queued') { - table_row.push(format_pkgname(row.pkgname)); + table_row.push(formatPkgName(row.pkgname)); table_row.push(formatOrigin(row.origin, row.flavor)); if (row.reason === 'listed') { table_row.push(row.reason); @@ -599,7 +599,7 @@ function process_data_build(data) { row.id = builder.id; row.job_id = builder.id; - row.pkgname = builder.pkgname ? format_pkgname(builder.pkgname) : ''; + row.pkgname = builder.pkgname ? formatPkgName(builder.pkgname) : ''; row.origin = builder.origin ? formatOrigin(builder.origin, builder.flavor) : ''; From 07e9efe451602442e2fb23a35e5913a74057ffbb Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:40:03 -0400 Subject: [PATCH 38/92] poudriere.js: Make determine_canvas_width camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 02397a24e6..49e6002ffb 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -97,7 +97,7 @@ function formatPkgName(pkgname) { return pkgname; } -function determine_canvas_width() { +function determineCanvasWidth() { let width; /* Determine width by how much space the column has, minus the size of @@ -546,7 +546,7 @@ function process_data_build(data) { } if (data.stats) { - determine_canvas_width(); + determineCanvasWidth(); update_canvas(data.stats); } @@ -836,7 +836,7 @@ function process_data_index(data) { function do_resize() { /* Redraw canvas to new width */ if ($('#stats').data()) { - determine_canvas_width(); + determineCanvasWidth(); update_canvas($('#stats').data()); } /* Resize padding for navbar/footer heights */ From 7aeddae7d2e14f0440ac30d3046880a31f489b48 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:40:22 -0400 Subject: [PATCH 39/92] poudriere.js: Make update_canvas camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 49e6002ffb..0302af42ff 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -110,7 +110,7 @@ function determineCanvasWidth() { canvasWidth = width; } -function update_canvas(stats) { +function updateCanvas(stats) { let pctdone; let height; let width; let pctdonetxt; @@ -547,7 +547,7 @@ function process_data_build(data) { if (data.stats) { determineCanvasWidth(); - update_canvas(data.stats); + updateCanvas(data.stats); } document.title = `Poudriere bulk results for ${data.mastername} ${data.buildname}`; @@ -837,7 +837,7 @@ function do_resize() { /* Redraw canvas to new width */ if ($('#stats').data()) { determineCanvasWidth(); - update_canvas($('#stats').data()); + updateCanvas($('#stats').data()); } /* Resize padding for navbar/footer heights */ $('body') From 2fc7d718e06a37987d08880069b2b17df01fa24d Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:40:36 -0400 Subject: [PATCH 40/92] poudriere.js: Make display_pkghour camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 0302af42ff..15943032dc 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -167,7 +167,7 @@ function updateCanvas(stats) { $('#stats_remaining').html(remaining); } -function display_pkghour(stats, snap) { +function displayPkgHour(stats, snap) { let pkghour; let hours; @@ -636,7 +636,7 @@ function process_data_build(data) { } $(`#snap_${stat}`).html(count); }); - display_pkghour(data.stats, data.snap); + displayPkgHour(data.stats, data.snap); display_impulse(data.stats, data.snap); $('#snap').fadeIn(1400); } From df495525abca8d85ad8418e70d9ef96848aa4ee6 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:40:49 -0400 Subject: [PATCH 41/92] poudriere.js: Make display_impulse camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 15943032dc..64693b520a 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -180,7 +180,7 @@ function displayPkgHour(stats, snap) { $('#snap_pkghour').html(pkghour); } -function display_impulse(stats, snap) { +function displayImpulse(stats, snap) { let pkghour; let tail; let d_pkgs; let d_secs; let title; const attempted = parseInt(stats.built, 10) + parseInt(stats.failed, 10); @@ -637,7 +637,7 @@ function process_data_build(data) { $(`#snap_${stat}`).html(count); }); displayPkgHour(data.stats, data.snap); - display_impulse(data.stats, data.snap); + displayImpulse(data.stats, data.snap); $('#snap').fadeIn(1400); } } From d455f30245fdf892f4f4a184f66111d9a384def9 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:41:07 -0400 Subject: [PATCH 42/92] poudriere.js: Make d_pkgs camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 64693b520a..4c60fbf809 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -181,7 +181,7 @@ function displayPkgHour(stats, snap) { } function displayImpulse(stats, snap) { - let pkghour; let tail; let d_pkgs; let d_secs; let title; + let pkghour; let tail; let dPkgs; let d_secs; let title; const attempted = parseInt(stats.built, 10) + parseInt(stats.failed, 10); pkghour = '--'; @@ -204,9 +204,9 @@ function displayImpulse(stats, snap) { impulseTargetPeriod / 60 } minutes`; } - d_pkgs = impulseData[index].pkgs - impulseData[tail].pkgs; + dPkgs = impulseData[index].pkgs - impulseData[tail].pkgs; d_secs = impulseData[index].time - impulseData[tail].time; - pkghour = Math.ceil(d_pkgs / (d_secs / 3600)); + pkghour = Math.ceil(dPkgs / (d_secs / 3600)); } else { title = 'Package build rate. Still calculating...'; } From 999187379930ca90fe45dc78f9f5d5762374ab28 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:41:16 -0400 Subject: [PATCH 43/92] poudriere.js: Make d_secs camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 4c60fbf809..04b22eb016 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -181,7 +181,7 @@ function displayPkgHour(stats, snap) { } function displayImpulse(stats, snap) { - let pkghour; let tail; let dPkgs; let d_secs; let title; + let pkghour; let tail; let dPkgs; let dSecs; let title; const attempted = parseInt(stats.built, 10) + parseInt(stats.failed, 10); pkghour = '--'; @@ -205,8 +205,8 @@ function displayImpulse(stats, snap) { } minutes`; } dPkgs = impulseData[index].pkgs - impulseData[tail].pkgs; - d_secs = impulseData[index].time - impulseData[tail].time; - pkghour = Math.ceil(dPkgs / (d_secs / 3600)); + dSecs = impulseData[index].time - impulseData[tail].time; + pkghour = Math.ceil(dPkgs / (dSecs / 3600)); } else { title = 'Package build rate. Still calculating...'; } From 52f46cfd19a2540c0c19e4d939904b33290270f0 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:41:33 -0400 Subject: [PATCH 44/92] poudriere.js: Make jail_url camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 04b22eb016..3febd78c86 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -215,7 +215,7 @@ function displayImpulse(stats, snap) { $('#snap_impulse').html(pkghour); } -function jail_url(mastername) { +function jailURL(mastername) { if (serverStyle === 'hosted') { if (mastername) { return `jail.html?mastername=${encodeURIComponent(mastername)}`; @@ -240,7 +240,7 @@ function format_mastername(mastername) { html = `${ mastername }`; @@ -1295,7 +1295,7 @@ $(document).ready(() => { const href = $(this).attr('href'); $(this).attr('href', dataURL + href); }); - $('#master_link').attr('href', jail_url(pageMasterName)); + $('#master_link').attr('href', jailURL(pageMasterName)); } else if (serverStyle === 'inline') { $('#master_link').attr('href', '../'); $('#index_link').attr('href', '../../'); From 120913e503c2b8acd3dc734482285874ba64a4f4 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:41:43 -0400 Subject: [PATCH 45/92] poudriere.js: Make format_mastername camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 3febd78c86..4898e272cb 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -225,7 +225,7 @@ function jailURL(mastername) { return '../'; } -function format_mastername(mastername) { +function formatMasterName(mastername) { let html; if (!mastername) { @@ -552,7 +552,7 @@ function process_data_build(data) { document.title = `Poudriere bulk results for ${data.mastername} ${data.buildname}`; - $('#mastername').html(format_mastername(data.mastername)); + $('#mastername').html(formatMasterName(data.mastername)); $('#buildname').html(format_buildname(data.mastername, data.buildname)); $('#jail').html(format_jailname(data.jailname)); $('#setname').html(format_setname(data.setname)); @@ -761,7 +761,7 @@ function process_data_jail(data) { } if (latest) { - $('#mastername').html(format_mastername(latest.mastername)); + $('#mastername').html(formatMasterName(latest.mastername)); $('#status').text(translate_status(latest.status)); $('#jail').html(format_jailname(latest.jailname)); $('#setname').html(format_setname(latest.setname)); @@ -1172,7 +1172,7 @@ function setup_index() { { data: 'mastername', render(data, type) { - return type === 'display' ? format_mastername(data) : data; + return type === 'display' ? formatMasterName(data) : data; }, sWidth: '22em', }, From 2bc35481c99d0c185dc43b598dd03ca2e4e89c69 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:41:55 -0400 Subject: [PATCH 46/92] poudriere.js: Make format_jailname camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 4898e272cb..f5c9e90826 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -249,7 +249,7 @@ function formatMasterName(mastername) { return html; } -function format_jailname(jailname) { +function formatJailName(jailname) { return jailname; } @@ -554,7 +554,7 @@ function process_data_build(data) { $('#mastername').html(formatMasterName(data.mastername)); $('#buildname').html(format_buildname(data.mastername, data.buildname)); - $('#jail').html(format_jailname(data.jailname)); + $('#jail').html(formatJailName(data.jailname)); $('#setname').html(format_setname(data.setname)); $('#ptname').html(format_ptname(data.ptname)); if (data.overlays) { @@ -763,7 +763,7 @@ function process_data_jail(data) { if (latest) { $('#mastername').html(formatMasterName(latest.mastername)); $('#status').text(translate_status(latest.status)); - $('#jail').html(format_jailname(latest.jailname)); + $('#jail').html(formatJailName(latest.jailname)); $('#setname').html(format_setname(latest.setname)); $('#ptname').html(format_ptname(latest.ptname)); $('#latest_url').attr( @@ -1188,7 +1188,7 @@ function setup_index() { { data: 'jailname', render(data, type) { - return type === 'display' ? format_jailname(data) : data; + return type === 'display' ? formatJailName(data) : data; }, sWidth: '10em', visible: false, From 411d42b44b4b353840829e3a89e58d3a2d5251c2 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:42:06 -0400 Subject: [PATCH 47/92] poudriere.js: Make format_setname camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index f5c9e90826..21e1b69174 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -253,7 +253,7 @@ function formatJailName(jailname) { return jailname; } -function format_setname(setname) { +function formatSetName(setname) { return setname; } @@ -555,7 +555,7 @@ function process_data_build(data) { $('#mastername').html(formatMasterName(data.mastername)); $('#buildname').html(format_buildname(data.mastername, data.buildname)); $('#jail').html(formatJailName(data.jailname)); - $('#setname').html(format_setname(data.setname)); + $('#setname').html(formatSetName(data.setname)); $('#ptname').html(format_ptname(data.ptname)); if (data.overlays) { $('#overlays').html(data.overlays); @@ -764,7 +764,7 @@ function process_data_jail(data) { $('#mastername').html(formatMasterName(latest.mastername)); $('#status').text(translate_status(latest.status)); $('#jail').html(formatJailName(latest.jailname)); - $('#setname').html(format_setname(latest.setname)); + $('#setname').html(formatSetName(latest.setname)); $('#ptname').html(format_ptname(latest.ptname)); $('#latest_url').attr( 'href', @@ -1196,7 +1196,7 @@ function setup_index() { { data: 'setname', render(data, type) { - return type === 'display' ? format_setname(data) : data; + return type === 'display' ? formatSetName(data) : data; }, sWidth: '10em', visible: false, From 835634069bd384776505048fbb932cc6aed3a9b6 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:42:19 -0400 Subject: [PATCH 48/92] poudriere.js: Make format_ptname camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 21e1b69174..18348be8ec 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -257,7 +257,7 @@ function formatSetName(setname) { return setname; } -function format_ptname(ptname) { +function formatPtName(ptname) { return ptname; } @@ -556,7 +556,7 @@ function process_data_build(data) { $('#buildname').html(format_buildname(data.mastername, data.buildname)); $('#jail').html(formatJailName(data.jailname)); $('#setname').html(formatSetName(data.setname)); - $('#ptname').html(format_ptname(data.ptname)); + $('#ptname').html(formatPtName(data.ptname)); if (data.overlays) { $('#overlays').html(data.overlays); } else { @@ -765,7 +765,7 @@ function process_data_jail(data) { $('#status').text(translate_status(latest.status)); $('#jail').html(formatJailName(latest.jailname)); $('#setname').html(formatSetName(latest.setname)); - $('#ptname').html(format_ptname(latest.ptname)); + $('#ptname').html(formatPtName(latest.ptname)); $('#latest_url').attr( 'href', build_url(latest.mastername, latest.buildname), @@ -1204,7 +1204,7 @@ function setup_index() { { data: 'ptname', render(data, type) { - return type === 'display' ? format_ptname(data) : data; + return type === 'display' ? formatPtName(data) : data; }, sWidth: '10em', visible: false, From 8067a3177ca1185ec57b116232fc13b06c64e1bd Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:42:27 -0400 Subject: [PATCH 49/92] poudriere.js: Make build_url camelCase --- src/share/poudriere/html/assets/poudriere.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 18348be8ec..da164affcf 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -261,7 +261,7 @@ function formatPtName(ptname) { return ptname; } -function build_url(mastername, buildname) { +function buildURL(mastername, buildname) { if (!mastername || !buildname) { return ''; } @@ -298,7 +298,7 @@ function format_buildname(mastername, buildname) { html = `${ buildname }`; @@ -541,7 +541,7 @@ function process_data_build(data) { // Redirect from /latest/ to the actual build. if (pageBuildName === 'latest') { - window.location.href = build_url(pageMasterName, data.buildname); + window.location.href = buildURL(pageMasterName, data.buildname); return undefined; } @@ -768,7 +768,7 @@ function process_data_jail(data) { $('#ptname').html(formatPtName(latest.ptname)); $('#latest_url').attr( 'href', - build_url(latest.mastername, latest.buildname), + buildURL(latest.mastername, latest.buildname), ); $('#latest_build').html( format_buildname(latest.mastername, latest.buildname), @@ -1315,7 +1315,7 @@ $(document).ready(() => { const href = $(this).attr('href'); $(this).attr('href', dataURL + href); }); - $('#latest_url').attr('href', build_url(pageMasterName, 'latest')); + $('#latest_url').attr('href', buildURL(pageMasterName, 'latest')); } else if (serverStyle === 'inline') { $('#index_link').attr('href', '../'); } From 57f9049a3ec1443a5faa59b9e29752ae98f5bcb8 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:42:41 -0400 Subject: [PATCH 50/92] poudriere.js: Make format_buildname camelCase --- src/share/poudriere/html/assets/poudriere.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index da164affcf..c9ed365791 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -275,7 +275,7 @@ function buildURL(mastername, buildname) { ); } -function format_buildname(mastername, buildname) { +function formatBuildName(mastername, buildname) { let html; if (!mastername) { @@ -553,7 +553,7 @@ function process_data_build(data) { document.title = `Poudriere bulk results for ${data.mastername} ${data.buildname}`; $('#mastername').html(formatMasterName(data.mastername)); - $('#buildname').html(format_buildname(data.mastername, data.buildname)); + $('#buildname').html(formatBuildName(data.mastername, data.buildname)); $('#jail').html(formatJailName(data.jailname)); $('#setname').html(formatSetName(data.setname)); $('#ptname').html(formatPtName(data.ptname)); @@ -771,7 +771,7 @@ function process_data_jail(data) { buildURL(latest.mastername, latest.buildname), ); $('#latest_build').html( - format_buildname(latest.mastername, latest.buildname), + formatBuildName(latest.mastername, latest.buildname), ); $('#masterinfo_div').show(); } @@ -1107,7 +1107,7 @@ function setup_jail() { data: 'buildname', render(data, type) { return type === 'display' - ? format_buildname(pageMasterName, data) + ? formatBuildName(pageMasterName, data) : data; }, sWidth: '12em', @@ -1180,7 +1180,7 @@ function setup_index() { data: 'buildname', render(data, type, row) { return type === 'display' - ? format_buildname(row.mastername, data) + ? formatBuildName(row.mastername, data) : data; }, sWidth: '12em', From 198a1575f465ca550a0242d3325e44e01560cc49 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:42:55 -0400 Subject: [PATCH 51/92] poudriere.js: Make format_portset camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index c9ed365791..38736a4723 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -307,7 +307,7 @@ function formatBuildName(mastername, buildname) { return html; } -function format_portset(ptname, setname) { +function formatPortSet(ptname, setname) { return ptname + (setname ? '-' : '') + setname; } @@ -796,7 +796,7 @@ function process_data_index(data) { master = data.masternames[mastername].latest; row.id = master.mastername; - row.portset = format_portset(master.ptname, master.setname); + row.portset = formatPortSet(master.ptname, master.setname); row.mastername = master.mastername; row.buildname = master.buildname; row.jailname = master.jailname; From c6bbea6bf5ae5f576364b088b607f82c654aa1a5 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:43:09 -0400 Subject: [PATCH 52/92] poudriere.js: Make format_log camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 38736a4723..b71175c14e 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -311,7 +311,7 @@ function formatPortSet(ptname, setname) { return ptname + (setname ? '-' : '') + setname; } -function format_log(pkgname, errors, text) { +function formatLog(pkgname, errors, text) { const html = `', ); $('#resetsearch').click(() => { table.fnFilter('', 3); - search_filter.val(''); - search_filter.prop('disabled', false); - search_filter.css('background-color', ''); + searchFilter.val(''); + searchFilter.prop('disabled', false); + searchFilter.css('background-color', ''); $(this).remove(); }); } From c9d96f1ae62e34323b581561f5b307343cb6d9c9 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:44:17 -0400 Subject: [PATCH 57/92] poudriere.js: Make translate_status camelCase --- src/share/poudriere/html/assets/poudriere.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 0eb7abdd13..74e2464ec1 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -401,7 +401,7 @@ function filterSkipped(pkgname) { } } -function translate_status(status) { +function translateStatus(status) { if (status === undefined) { return ''; } @@ -583,7 +583,7 @@ function process_data_build(data) { } if (data.status) { - status = translate_status(data.status); + status = translateStatus(data.status); $('#status').text(status); } @@ -753,7 +753,7 @@ function process_data_jail(data) { remaining = 0; } row.stat_remaining = remaining; - row.status = translate_status(build.status); + row.status = translateStatus(build.status); row.elapsed = build.elapsed ? build.elapsed : ''; dtrow.queue(row); @@ -762,7 +762,7 @@ function process_data_jail(data) { if (latest) { $('#mastername').html(formatMasterName(latest.mastername)); - $('#status').text(translate_status(latest.status)); + $('#status').text(translateStatus(latest.status)); $('#jail').html(formatJailName(latest.jailname)); $('#setname').html(formatSetName(latest.setname)); $('#ptname').html(formatPtName(latest.ptname)); @@ -819,7 +819,7 @@ function process_data_index(data) { + parseInt(master.stats.fetched, 10)) : 0; row.stat_remaining = Number.isNaN(remaining) ? 0 : remaining; - row.status = translate_status(master.status); + row.status = translateStatus(master.status); row.elapsed = master.elapsed ? master.elapsed : ''; dtrow.queue(row); From 1646f6c33f3e7c58e6f590ab33e9886f90f1c264 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:44:33 -0400 Subject: [PATCH 58/92] poudriere.js: Make format_skipped camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 74e2464ec1..0e37b3d0ca 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -424,7 +424,7 @@ function translateStatus(status) { return status; } -function format_skipped(skipped_cnt, pkgname) { +function formatSkipped(skipped_cnt, pkgname) { if (skipped_cnt === undefined || skipped_cnt === 0) { return 0; } @@ -1023,7 +1023,7 @@ function setup_build() { sType: 'numeric', sWidth: '2em', render(data, type, row) { - return type === 'display' ? format_skipped(data, row[1]) : data; + return type === 'display' ? formatSkipped(data, row[1]) : data; }, }, { @@ -1048,7 +1048,7 @@ function setup_build() { sWidth: '2em', sType: 'numeric', render(data, type, row) { - return type === 'display' ? format_skipped(data, row[1]) : data; + return type === 'display' ? formatSkipped(data, row[1]) : data; }, }, { From 27216a641797fd0f80d3fc3b01c0be7031e93d25 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:44:49 -0400 Subject: [PATCH 59/92] poudriere.js: Make skipped_cnt camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 0e37b3d0ca..99da321ef7 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -424,8 +424,8 @@ function translateStatus(status) { return status; } -function formatSkipped(skipped_cnt, pkgname) { - if (skipped_cnt === undefined || skipped_cnt === 0) { +function formatSkipped(skippedCnt, pkgname) { + if (skippedCnt === undefined || skippedCnt === 0) { return 0; } return ( @@ -433,7 +433,7 @@ function formatSkipped(skipped_cnt, pkgname) { pkgname }'); return false;">${ - skipped_cnt + skippedCnt }` ); } From e9245c06a344148ec18d112f82520f875dffd16f Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:45:00 -0400 Subject: [PATCH 60/92] poudriere.js: Make format_status_row camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 99da321ef7..125cacde41 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -438,7 +438,7 @@ function formatSkipped(skippedCnt, pkgname) { ); } -function format_status_row(status, row, n) { +function formatStatusRow(status, row, n) { const table_row = []; table_row.push(n + 1); @@ -682,7 +682,7 @@ function process_data_build(data) { : 0; } - table_rows.push(format_status_row(stat, fetchedRow, n)); + table_rows.push(formatStatusRow(stat, fetchedRow, n)); } if (stat !== 'remaining') { $(`#${stat}_body`).data('index', n); From ef6fdf7a897f0467dd12093c18a38bb6cecaeb1e Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:45:12 -0400 Subject: [PATCH 61/92] poudriere.js: Make table_row camelCase --- src/share/poudriere/html/assets/poudriere.js | 56 ++++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 125cacde41..59d1f226ce 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -439,49 +439,49 @@ function formatSkipped(skippedCnt, pkgname) { } function formatStatusRow(status, row, n) { - const table_row = []; + const tableRow = []; - table_row.push(n + 1); + tableRow.push(n + 1); if (status === 'built') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); - table_row.push(formatLog(row.pkgname, false, 'success')); - table_row.push(formatDuration(row.elapsed ? row.elapsed : '')); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(formatLog(row.pkgname, false, 'success')); + tableRow.push(formatDuration(row.elapsed ? row.elapsed : '')); } else if (status === 'failed') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); - table_row.push(row.phase); - table_row.push(row.skipped_cnt); - table_row.push(formatLog(row.pkgname, true, row.errortype)); - table_row.push(formatDuration(row.elapsed ? row.elapsed : '')); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(row.phase); + tableRow.push(row.skipped_cnt); + tableRow.push(formatLog(row.pkgname, true, row.errortype)); + tableRow.push(formatDuration(row.elapsed ? row.elapsed : '')); } else if (status === 'skipped') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); - table_row.push(formatPkgName(row.depends)); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(formatPkgName(row.depends)); } else if (status === 'ignored') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); - table_row.push(row.skipped_cnt); - table_row.push(row.reason); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(row.skipped_cnt); + tableRow.push(row.reason); } else if (status === 'fetched') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); } else if (status === 'remaining') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(row.status); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(row.status); } else if (status === 'queued') { - table_row.push(formatPkgName(row.pkgname)); - table_row.push(formatOrigin(row.origin, row.flavor)); + tableRow.push(formatPkgName(row.pkgname)); + tableRow.push(formatOrigin(row.origin, row.flavor)); if (row.reason === 'listed') { - table_row.push(row.reason); + tableRow.push(row.reason); } else { - table_row.push(formatOrigin(row.reason)); + tableRow.push(formatOrigin(row.reason)); } } else { throw new Error(`Unknown data type "${status}". Try flushing cache.`); } - return table_row; + return tableRow; } function DTRow(table_id, div_id) { From 78c373f56a401693bac11f323866c1e954f24ee0 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:45:35 -0400 Subject: [PATCH 62/92] poudriere.js: Make table_id camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 59d1f226ce..589eb0b49b 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -484,8 +484,8 @@ function formatStatusRow(status, row, n) { return tableRow; } -function DTRow(table_id, div_id) { - this.Table = $(`#${table_id}`).DataTable(); +function DTRow(tableID, div_id) { + this.Table = $(`#${tableID}`).DataTable(); this.new_rows = []; this.first_load = this.Table.row(0).length === 0; this.div_id = div_id; From 0f1fd700803f68d3b2473f84a59d1dfba1c11e26 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:46:09 -0400 Subject: [PATCH 63/92] poudriere.js: Make div_id camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 589eb0b49b..f32b911bcd 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -484,11 +484,11 @@ function formatStatusRow(status, row, n) { return tableRow; } -function DTRow(tableID, div_id) { +function DTRow(tableID, divID) { this.Table = $(`#${tableID}`).DataTable(); this.new_rows = []; this.first_load = this.Table.row(0).length === 0; - this.div_id = div_id; + this.div_id = divID; } DTRow.prototype = { From 2c0102d803f1e656c28c42cd3097f45abb90ffbb Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:46:20 -0400 Subject: [PATCH 64/92] poudriere.js: Make existing_row camelCase --- src/share/poudriere/html/assets/poudriere.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index f32b911bcd..5c1a4114b6 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -493,7 +493,7 @@ function DTRow(tableID, divID) { DTRow.prototype = { queue(row) { - let existing_row; + let existingRow; /* Is this entry already in the list? If so need to * replace its data. Don't bother with lookups on @@ -501,14 +501,14 @@ DTRow.prototype = { */ row.DT_RowId = `data_row_${row.id}`; if (!this.first_load) { - existing_row = this.Table.row(`#${row.DT_RowId}`); + existingRow = this.Table.row(`#${row.DT_RowId}`); } else { - existing_row = {}; + existingRow = {}; } - if (existing_row.length) { + if (existingRow.length) { /* Only update the row if it doesn't match the existing. */ - if (JSON.stringify(row) !== JSON.stringify(existing_row.data())) { - existing_row.data(row).nodes().to$().hide() + if (JSON.stringify(row) !== JSON.stringify(existingRow.data())) { + existingRow.data(row).nodes().to$().hide() .fadeIn(800); } } else { From ddff4a42f5789d4e5a6a974c566ea01d3eb1b397 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:46:34 -0400 Subject: [PATCH 65/92] poudriere.js: Make process_data_build camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 5c1a4114b6..3e9c7a5f9b 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -528,7 +528,7 @@ DTRow.prototype = { }, }; -function process_data_build(data) { +function processDataBuild(data) { let n; let table_rows; let status; let builder; let now; let row; let dtrow; if (data.snap && data.snap.now) { @@ -877,7 +877,7 @@ function process_data(data) { } if (pageType === 'build') { - should_reload = process_data_build(data); + should_reload = processDataBuild(data); } else if (pageType === 'jail') { should_reload = process_data_jail(data); } else if (pageType === 'index') { From 5e6371fb466c749a9259122c33f03366c528d99b Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:46:46 -0400 Subject: [PATCH 66/92] poudriere.js: Make table_rows camelCase --- src/share/poudriere/html/assets/poudriere.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 3e9c7a5f9b..9c56e7cebb 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -529,7 +529,7 @@ DTRow.prototype = { }; function processDataBuild(data) { - let n; let table_rows; let status; let builder; let now; let row; let dtrow; + let n; let tableRows; let status; let builder; let now; let row; let dtrow; if (data.snap && data.snap.now) { // New data is relative to the 'job.started' time, not epoch. @@ -659,7 +659,7 @@ function processDataBuild(data) { data.ports[stat] && (data.ports[stat].length > 0 || stat === 'remaining') ) { - table_rows = []; + tableRows = []; if (stat !== 'remaining') { n = $(`#${stat}_body`).data('index'); if (n === undefined) { @@ -682,13 +682,13 @@ function processDataBuild(data) { : 0; } - table_rows.push(formatStatusRow(stat, fetchedRow, n)); + tableRows.push(formatStatusRow(stat, fetchedRow, n)); } if (stat !== 'remaining') { $(`#${stat}_body`).data('index', n); $(`#${stat}_table`) .DataTable() - .rows.add(table_rows) + .rows.add(tableRows) .draw(false); } else { $(`#${stat}_table`) @@ -697,9 +697,9 @@ function processDataBuild(data) { .draw(); $(`#${stat}_table`) .DataTable() - .rows.add(table_rows) + .rows.add(tableRows) .draw(false); - if (table_rows.length > 0) { + if (tableRows.length > 0) { $(`#${stat}_div`).show(); $(`#nav_${stat}`).removeClass('disabled'); } else { From 2a95986bc8babcdb33366bf8cc14e76a2bf6ab04 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:47:01 -0400 Subject: [PATCH 67/92] poudriere.js: Make is_stopped camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 9c56e7cebb..54e3422e49 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -588,7 +588,7 @@ function processDataBuild(data) { } // Unknown status, assume not stopped. - const is_stopped = status ? status.match('^stopped:') : false; + const isStopped = status ? status.match('^stopped:') : false; /* Builder status */ if (data.jobs) { @@ -611,7 +611,7 @@ function processDataBuild(data) { : ''; /* Hide idle builders when the build is stopped. */ - if (!is_stopped || row.status !== 'idle') { + if (!isStopped || row.status !== 'idle') { dtrow.queue(row); } } @@ -711,7 +711,7 @@ function processDataBuild(data) { }); } - return !is_stopped; + return !isStopped; } function process_data_jail(data) { From bbec836725cf0b074f725193f624b79d0a009731 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:47:13 -0400 Subject: [PATCH 68/92] poudriere.js: Make process_data_jail camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 54e3422e49..30097a1e13 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -714,7 +714,7 @@ function processDataBuild(data) { return !isStopped; } -function process_data_jail(data) { +function processDataJail(data) { let row; let build; let buildname; let stat; let types; let latest; let remaining; let count; let dtrow; @@ -879,7 +879,7 @@ function process_data(data) { if (pageType === 'build') { should_reload = processDataBuild(data); } else if (pageType === 'jail') { - should_reload = process_data_jail(data); + should_reload = processDataJail(data); } else if (pageType === 'index') { should_reload = process_data_index(data); } else { From a7c80ba705c64fae994e0918d7fd0df2d8cf291b Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:47:26 -0400 Subject: [PATCH 69/92] poudriere.js: Make process_data_index camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 30097a1e13..b3a975a2ed 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -783,7 +783,7 @@ function processDataJail(data) { return true; } -function process_data_index(data) { +function processDataIndex(data) { let master; let mastername; let stat; let types; let remaining; let row; let count; let dtrow; @@ -881,7 +881,7 @@ function process_data(data) { } else if (pageType === 'jail') { should_reload = processDataJail(data); } else if (pageType === 'index') { - should_reload = process_data_index(data); + should_reload = processDataIndex(data); } else { should_reload = false; } From 0a22f9fc9fd0c49e45ad9fc44e4800cc61a92c05 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:48:31 -0400 Subject: [PATCH 70/92] poudriere.js: Make do_resize camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index b3a975a2ed..682897e006 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -833,7 +833,7 @@ function processDataIndex(data) { } /* Disable static navbar at the breakpoint */ -function do_resize() { +function doResize() { /* Redraw canvas to new width */ if ($('#stats').data()) { determineCanvasWidth(); @@ -888,7 +888,7 @@ function process_data(data) { if (firstRun) { /* Resize due to full content. */ - do_resize($(window)); + doResize($(window)); // Hide loading overlay $('#loading_overlay').fadeOut(900); /* Now that page is loaded, scroll to anchor. */ @@ -1360,9 +1360,9 @@ $(document).ready(() => { fix_viewport(); /* Handle resize needs */ $(window).on('resize', () => { - do_resize($(this)); + doResize($(this)); }); - do_resize($(window)); + doResize($(window)); update_data(); }); From 690fe0914d9085f46dcce2acd224d56d677681ea Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:48:50 -0400 Subject: [PATCH 71/92] poudriere.js: Make process_data camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 682897e006..58712cb3db 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -845,7 +845,7 @@ function doResize() { .css('padding-bottom', $('footer').outerHeight(true)); } -function process_data(data) { +function processData(data) { let should_reload; // Determine what kind of data this file actually is. Due to handling @@ -912,7 +912,7 @@ function update_data() { }, success(data) { loadAttempts = 0; - process_data(data); + processData(data); }, error() { loadAttempts += 1; From 07d94ec24c8cfc847d47dc9ded4b61fb4073086f Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:48:58 -0400 Subject: [PATCH 72/92] poudriere.js: Make should_reload camelCase --- src/share/poudriere/html/assets/poudriere.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 58712cb3db..c5f9de6eea 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -846,7 +846,7 @@ function doResize() { } function processData(data) { - let should_reload; + let shouldReload; // Determine what kind of data this file actually is. Due to handling // file:// and inline-style setups, it may be unknown what was fetched. @@ -877,13 +877,13 @@ function processData(data) { } if (pageType === 'build') { - should_reload = processDataBuild(data); + shouldReload = processDataBuild(data); } else if (pageType === 'jail') { - should_reload = processDataJail(data); + shouldReload = processDataJail(data); } else if (pageType === 'index') { - should_reload = processDataIndex(data); + shouldReload = processDataIndex(data); } else { - should_reload = false; + shouldReload = false; } if (firstRun) { @@ -898,7 +898,7 @@ function processData(data) { firstRun = false; } - if (should_reload) { + if (shouldReload) { setTimeout(update_data, updateInterval * 1000); } } From 16eb0994bbeb3d64b34b557bd948734b2065c0ec Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:49:11 -0400 Subject: [PATCH 73/92] poudriere.js: Make update_data camelCase --- src/share/poudriere/html/assets/poudriere.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index c5f9de6eea..b194f1f7f0 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -899,11 +899,11 @@ function processData(data) { } if (shouldReload) { - setTimeout(update_data, updateInterval * 1000); + setTimeout(updateData, updateInterval * 1000); } } -function update_data() { +function updateData() { $.ajax({ url: `${dataURL}.data.json`, dataType: 'json', @@ -918,7 +918,7 @@ function update_data() { loadAttempts += 1; if (loadAttempts < maxLoadAttempts) { /* May not be there yet, try again shortly */ - setTimeout(update_data, firstLoadInterval * 1000); + setTimeout(updateData, firstLoadInterval * 1000); } else { $('#loading p') .text('Invalid request or no data available yet.') @@ -1364,7 +1364,7 @@ $(document).ready(() => { }); doResize($(window)); - update_data(); + updateData(); }); $(document).on('keydown', (e) => { From ee081264b5032c595eb1d2b155c0e04432d7b8c8 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:49:23 -0400 Subject: [PATCH 74/92] poudriere.js: Make fix_viewport camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index b194f1f7f0..c136016c0a 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -929,7 +929,7 @@ function updateData() { } /* Force minimum width on mobile, will zoom to fit. */ -function fix_viewport() { +function fixViewport() { const minimum_width = parseInt($('body').css('min-width'), 10); if (minimum_width !== 0 && window.innerWidth < minimum_width) { $('meta[name=viewport]').attr('content', `width=${minimum_width}`); @@ -1355,9 +1355,9 @@ $(document).ready(() => { }); /* Force minimum width on mobile, will zoom to fit. */ $(window).on('orientationchange', () => { - fix_viewport(); + fixViewport(); }); - fix_viewport(); + fixViewport(); /* Handle resize needs */ $(window).on('resize', () => { doResize($(this)); From ca7d73929d903f25c5b3ba78d4a8930c44225761 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:49:30 -0400 Subject: [PATCH 75/92] poudriere.js: Make setup_build camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index c136016c0a..8dfd7e8f68 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -941,7 +941,7 @@ function fixViewport() { } } -function setup_build() { +function setupBuild() { let status; let i; @@ -1300,7 +1300,7 @@ $(document).ready(() => { $('#master_link').attr('href', '../'); $('#index_link').attr('href', '../../'); } - setup_build(); + setupBuild(); } else if (pageType === 'jail') { if (serverStyle === 'hosted') { pageMasterName = getParameterByName('mastername'); From c87adb409e16d0d10b386e1519d24d87a6a8891f Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:49:36 -0400 Subject: [PATCH 76/92] poudriere.js: Make setup_jail camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 8dfd7e8f68..fbbb6402ef 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -1095,7 +1095,7 @@ function setupBuild() { } } -function setup_jail() { +function setupJail() { const stat_column = { sWidth: '1em', sType: 'numeric', @@ -1319,7 +1319,7 @@ $(document).ready(() => { } else if (serverStyle === 'inline') { $('#index_link').attr('href', '../'); } - setup_jail(); + setupJail(); } else if (pageType === 'index') { if (serverStyle === 'hosted') { dataURL = 'data/'; From 1df19171599849a530780d530a19e5d2b8f75596 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:49:44 -0400 Subject: [PATCH 77/92] poudriere.js: Make setup_index camelCase --- src/share/poudriere/html/assets/poudriere.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index fbbb6402ef..4f05ffb59f 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -1157,7 +1157,7 @@ function setupJail() { }); } -function setup_index() { +function setupIndex() { const stat_column = { sWidth: '1em', sType: 'numeric', @@ -1328,7 +1328,7 @@ $(document).ready(() => { $(this).attr('href', dataURL + href); }); } - setup_index(); + setupIndex(); } else { $('#loading p') .text(`Invalid request. Unhandled page type '${pageType}'`) From 96c11fb376e52a0a24506b129f83221a8f1925a4 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:50:16 -0400 Subject: [PATCH 78/92] poudriere.js: Make minimum_width camelCase --- src/share/poudriere/html/assets/poudriere.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 4f05ffb59f..2cc0eef95a 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -930,9 +930,9 @@ function updateData() { /* Force minimum width on mobile, will zoom to fit. */ function fixViewport() { - const minimum_width = parseInt($('body').css('min-width'), 10); - if (minimum_width !== 0 && window.innerWidth < minimum_width) { - $('meta[name=viewport]').attr('content', `width=${minimum_width}`); + const minimumWidth = parseInt($('body').css('min-width'), 10); + if (minimumWidth !== 0 && window.innerWidth < minimumWidth) { + $('meta[name=viewport]').attr('content', `width=${minimumWidth}`); } else { $('meta[name=viewport]').attr( 'content', From 63519506f06d79c89a51ac7f104fcf079b5185af Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:50:38 -0400 Subject: [PATCH 79/92] poudriere.js: Make build_order_column camelCase --- src/share/poudriere/html/assets/poudriere.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 2cc0eef95a..241e6ec6e5 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -984,7 +984,7 @@ function setupBuild() { order: [[0, 'asc']], // Sort by Job ID }); - const build_order_column = { + const buildOrderColumn = { sWidth: '1em', sType: 'numeric', bSearchable: false, @@ -999,7 +999,7 @@ function setupBuild() { const columns = { built: [ - build_order_column, + buildOrderColumn, pkgname_column, origin_column, { @@ -1013,7 +1013,7 @@ function setupBuild() { }, ], failed: [ - build_order_column, + buildOrderColumn, pkgname_column, origin_column, { @@ -1035,13 +1035,13 @@ function setupBuild() { }, ], skipped: [ - build_order_column, + buildOrderColumn, pkgname_column, origin_column, pkgname_column, ], ignored: [ - build_order_column, + buildOrderColumn, pkgname_column, origin_column, { @@ -1055,15 +1055,15 @@ function setupBuild() { sWidth: '25em', }, ], - fetched: [build_order_column, pkgname_column, origin_column], + fetched: [buildOrderColumn, pkgname_column, origin_column], remaining: [ - build_order_column, + buildOrderColumn, pkgname_column, { sWidth: '7em', }, ], - queued: [build_order_column, pkgname_column, origin_column, origin_column], + queued: [buildOrderColumn, pkgname_column, origin_column, origin_column], }; const types = [ From 287935754ecf27df8aaf47bc6acb1cec92c98c6b Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:50:49 -0400 Subject: [PATCH 80/92] poudriere.js: Make pkgname_column camelCase --- src/share/poudriere/html/assets/poudriere.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 241e6ec6e5..e965feb7e7 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -990,7 +990,7 @@ function setupBuild() { bSearchable: false, }; - const pkgname_column = { + const PkgNameColumn = { sWidth: '15em', }; const origin_column = { @@ -1000,7 +1000,7 @@ function setupBuild() { const columns = { built: [ buildOrderColumn, - pkgname_column, + PkgNameColumn, origin_column, { sWidth: '4.25em', @@ -1014,7 +1014,7 @@ function setupBuild() { ], failed: [ buildOrderColumn, - pkgname_column, + PkgNameColumn, origin_column, { sWidth: '6em', @@ -1036,13 +1036,13 @@ function setupBuild() { ], skipped: [ buildOrderColumn, - pkgname_column, + PkgNameColumn, origin_column, - pkgname_column, + PkgNameColumn, ], ignored: [ buildOrderColumn, - pkgname_column, + PkgNameColumn, origin_column, { sWidth: '2em', @@ -1055,15 +1055,15 @@ function setupBuild() { sWidth: '25em', }, ], - fetched: [buildOrderColumn, pkgname_column, origin_column], + fetched: [buildOrderColumn, PkgNameColumn, origin_column], remaining: [ buildOrderColumn, - pkgname_column, + PkgNameColumn, { sWidth: '7em', }, ], - queued: [buildOrderColumn, pkgname_column, origin_column, origin_column], + queued: [buildOrderColumn, PkgNameColumn, origin_column, origin_column], }; const types = [ From bc9e3e37cf682f1c2b20871489151798809e017c Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:50:59 -0400 Subject: [PATCH 81/92] poudriere.js: Make origin_column camelCase --- src/share/poudriere/html/assets/poudriere.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index e965feb7e7..40caa1d6bf 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -993,7 +993,7 @@ function setupBuild() { const PkgNameColumn = { sWidth: '15em', }; - const origin_column = { + const originColumn = { sWidth: '17em', }; @@ -1001,7 +1001,7 @@ function setupBuild() { built: [ buildOrderColumn, PkgNameColumn, - origin_column, + originColumn, { sWidth: '4.25em', bSortable: false, @@ -1015,7 +1015,7 @@ function setupBuild() { failed: [ buildOrderColumn, PkgNameColumn, - origin_column, + originColumn, { sWidth: '6em', }, @@ -1037,13 +1037,13 @@ function setupBuild() { skipped: [ buildOrderColumn, PkgNameColumn, - origin_column, + originColumn, PkgNameColumn, ], ignored: [ buildOrderColumn, PkgNameColumn, - origin_column, + originColumn, { sWidth: '2em', sType: 'numeric', @@ -1055,7 +1055,7 @@ function setupBuild() { sWidth: '25em', }, ], - fetched: [buildOrderColumn, PkgNameColumn, origin_column], + fetched: [buildOrderColumn, PkgNameColumn, originColumn], remaining: [ buildOrderColumn, PkgNameColumn, @@ -1063,7 +1063,7 @@ function setupBuild() { sWidth: '7em', }, ], - queued: [buildOrderColumn, PkgNameColumn, origin_column, origin_column], + queued: [buildOrderColumn, PkgNameColumn, originColumn, originColumn], }; const types = [ From 4ab0c2ce7f5028c15724204c2201c922eda3df28 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:51:12 -0400 Subject: [PATCH 82/92] poudriere.js: Make stat_column camelCase --- src/share/poudriere/html/assets/poudriere.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 40caa1d6bf..0b84684661 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -1158,7 +1158,7 @@ function setupJail() { } function setupIndex() { - const stat_column = { + const statColumn = { sWidth: '1em', sType: 'numeric', bSearchable: false, @@ -1209,13 +1209,13 @@ function setupIndex() { sWidth: '10em', visible: false, }, - $.extend({}, stat_column, { data: 'stat_queued' }), - $.extend({}, stat_column, { data: 'stat_built' }), - $.extend({}, stat_column, { data: 'stat_failed' }), - $.extend({}, stat_column, { data: 'stat_skipped' }), - $.extend({}, stat_column, { data: 'stat_ignored' }), - $.extend({}, stat_column, { data: 'stat_fetched' }), - $.extend({}, stat_column, { data: 'stat_remaining' }), + $.extend({}, statColumn, { data: 'stat_queued' }), + $.extend({}, statColumn, { data: 'stat_built' }), + $.extend({}, statColumn, { data: 'stat_failed' }), + $.extend({}, statColumn, { data: 'stat_skipped' }), + $.extend({}, statColumn, { data: 'stat_ignored' }), + $.extend({}, statColumn, { data: 'stat_fetched' }), + $.extend({}, statColumn, { data: 'stat_remaining' }), { data: 'status', sWidth: '8em', From 949033acc7e41fd050372533068e831bd28228a2 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Mon, 11 Mar 2024 23:52:04 -0400 Subject: [PATCH 83/92] poudriere.js: Make stat_column camelCase --- src/share/poudriere/html/assets/poudriere.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 0b84684661..89dbc9bae8 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -1096,7 +1096,7 @@ function setupBuild() { } function setupJail() { - const stat_column = { + const statColumn = { sWidth: '1em', sType: 'numeric', bSearchable: false, @@ -1112,13 +1112,13 @@ function setupJail() { }, sWidth: '12em', }, - $.extend({}, stat_column, { data: 'stat_queued' }), - $.extend({}, stat_column, { data: 'stat_built' }), - $.extend({}, stat_column, { data: 'stat_failed' }), - $.extend({}, stat_column, { data: 'stat_skipped' }), - $.extend({}, stat_column, { data: 'stat_ignored' }), - $.extend({}, stat_column, { data: 'stat_fetched' }), - $.extend({}, stat_column, { data: 'stat_remaining' }), + $.extend({}, statColumn, { data: 'stat_queued' }), + $.extend({}, statColumn, { data: 'stat_built' }), + $.extend({}, statColumn, { data: 'stat_failed' }), + $.extend({}, statColumn, { data: 'stat_skipped' }), + $.extend({}, statColumn, { data: 'stat_ignored' }), + $.extend({}, statColumn, { data: 'stat_fetched' }), + $.extend({}, statColumn, { data: 'stat_remaining' }), { data: 'status', sWidth: '8em', From df6b8a76d3aba8f546349ebe6ab343a53b7a4d41 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 00:02:43 -0400 Subject: [PATCH 84/92] poudriere.js: Remove assignment to function parameters --- src/share/poudriere/html/assets/poudriere.js | 55 +++++++++++--------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 89dbc9bae8..5ed5d75aa4 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -45,8 +45,8 @@ let pageMasterName; let dataURL = ''; function getParameterByName(name) { - name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); - const regex = new RegExp(`[\\?&]${name}=([^&#]*)`); + const tmpName = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); + const regex = new RegExp(`[\\?&]${tmpName}=([^&#]*)`); const results = regex.exec(window.location.search); return results == null ? '' @@ -71,11 +71,12 @@ function formatOrigin(origin, flavor) { } const data = origin.split('/'); + let resultFlavor = ''; if (flavor) { - flavor = `@${flavor}`; + resultFlavor = `@${flavor}`; } else { - flavor = ''; + resultFlavor = ''; } return ( @@ -88,7 +89,7 @@ function formatOrigin(origin, flavor) { }/">${ origin - }${flavor + }${resultFlavor }` ); } @@ -334,9 +335,9 @@ function formatDuration(duration) { } hours = Math.floor(duration / 3600); - duration -= hours * 3600; - minutes = Math.floor(duration / 60); - seconds = duration - minutes * 60; + const tmpDuration = duration - hours * 3600; + minutes = Math.floor(tmpDuration / 60); + seconds = tmpDuration - minutes * 60; if (hours < 10) { hours = `0${hours}`; @@ -357,15 +358,15 @@ function formatStartToEnd(start, end) { if (!start) { return ''; } - start = parseInt(start, 10); - if (Number.isNaN(start)) { + const startStr = parseInt(start, 10); + if (Number.isNaN(startStr)) { return ''; } if (end === undefined) { - duration = start; + duration = startStr; } else { - duration = end - start; + duration = end - startStr; } if (duration < 0) { @@ -407,21 +408,23 @@ function translateStatus(status) { } const a = status.split(':'); + let translatedStatus; + if (a[0] === 'stopped') { if (a.length >= 3) { - status = `${a[0]}:${a[1]}:${a[2]}`; + translatedStatus = `${a[0]}:${a[1]}:${a[2]}`; } else if (a.length >= 2) { - status = `${a[0]}:${a[1]}`; + translatedStatus = `${a[0]}:${a[1]}`; } else { - status = `${a[0]}:`; + translatedStatus = `${a[0]}:`; } } else if (a.length >= 2) { - status = `${a[0]}:${a[1]}`; + translatedStatus = `${a[0]}:${a[1]}`; } else { - status = `${a[0]}:`; + translatedStatus = `${a[0]}:`; } - return status; + return translatedStatus; } function formatSkipped(skippedCnt, pkgname) { @@ -492,7 +495,8 @@ function DTRow(tableID, divID) { } DTRow.prototype = { - queue(row) { + queue(rowInput) { + const row = rowInput; let existingRow; /* Is this entry already in the list? If so need to @@ -528,7 +532,8 @@ DTRow.prototype = { }, }; -function processDataBuild(data) { +function processDataBuild(dataInput) { + const data = dataInput; let n; let tableRows; let status; let builder; let now; let row; let dtrow; if (data.snap && data.snap.now) { @@ -621,20 +626,22 @@ function processDataBuild(data) { /* Stats */ if (data.stats) { $.each(data.stats, (stat, count) => { + let newCount = count; if (stat === 'elapsed') { - count = formatStartToEnd(count); + newCount = formatStartToEnd(count); } - $(`#stats_${stat}`).html(count); + $(`#stats_${stat}`).html(newCount); }); $('#stats').data(data.stats); $('#stats').fadeIn(1400); if (data.snap) { $.each(data.snap, (stat, count) => { + let newCount = count; if (stat === 'elapsed') { - count = formatStartToEnd(count); + newCount = formatStartToEnd(count); } - $(`#snap_${stat}`).html(count); + $(`#snap_${stat}`).html(newCount); }); displayPkgHour(data.stats, data.snap); displayImpulse(data.stats, data.snap); From d227044dadaa5d05ca3eb42f1d16f1ecc864ebc8 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 00:17:23 -0400 Subject: [PATCH 85/92] poudriere.js: Use promise for updateData --- src/share/poudriere/html/assets/poudriere.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 5ed5d75aa4..a0cbd718ae 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -852,6 +852,10 @@ function doResize() { .css('padding-bottom', $('footer').outerHeight(true)); } +function delay(ms) { + return new Promise((resolve) => { setTimeout(resolve, ms); }); +} + function processData(data) { let shouldReload; @@ -906,7 +910,7 @@ function processData(data) { } if (shouldReload) { - setTimeout(updateData, updateInterval * 1000); + delay(updateInterval * 1000).then(updateData); } } @@ -925,7 +929,7 @@ function updateData() { loadAttempts += 1; if (loadAttempts < maxLoadAttempts) { /* May not be there yet, try again shortly */ - setTimeout(updateData, firstLoadInterval * 1000); + delay(firstLoadInterval * 1000).then(updateData); } else { $('#loading p') .text('Invalid request or no data available yet.') From 8042a931acadd926b1c3d4ad9caa4b14b41f81e7 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 00:27:53 -0400 Subject: [PATCH 86/92] poudriere.js: Correct filter_skipped --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index a0cbd718ae..99ef125d9a 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -432,7 +432,7 @@ function formatSkipped(skippedCnt, pkgname) { return 0; } return ( - `${ From b27590a4459359bca7d8d0d435f254edc3dc5470 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 00:39:10 -0400 Subject: [PATCH 87/92] poudriere.js: Use 'use strict'; --- src/share/poudriere/html/assets/poudriere.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 99ef125d9a..b1b1e120f8 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +'use strict'; + // server_style = ['hosted', 'inline']; const serverStyle = 'hosted'; From 35ef3523e4e5c65209c426e8193f5cb7e0993c2e Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 00:59:04 -0400 Subject: [PATCH 88/92] Replace for-in to Object-keys --- src/share/poudriere/html/assets/poudriere.js | 151 +++++++++---------- 1 file changed, 70 insertions(+), 81 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index b1b1e120f8..04f5c75aa0 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -724,50 +724,46 @@ function processDataBuild(dataInput) { } function processDataJail(data) { - let row; let build; let buildname; let stat; let types; let latest; let remaining; let count; let + let row; let build; let types; let latest; let remaining; let count; let dtrow; if (data.builds) { types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; dtrow = new DTRow('builds_table', 'builds_div'); - for (buildname in data.builds) { - if (buildname !== undefined) { - row = {}; - - build = data.builds[buildname]; - if (buildname === 'latest') { - latest = data.builds[build]; - continue; - } + Object.keys(data.builds).forEach((bundleNameID) => { + row = {}; - row.id = buildname; - row.buildname = buildname; - for (stat in types) { - if (stat !== undefined) { - count = build.stats && build.stats[types[stat]] !== undefined - ? parseInt(build.stats[types[stat]], 10) - : 0; - row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; - } - } - remaining = build.stats - ? parseInt(build.stats.queued, 10) + build = data.builds[bundleNameID]; + if (bundleNameID === 'latest') { + latest = data.builds[build]; + return; + } + + row.id = bundleNameID; + row.buildname = bundleNameID; + Object.keys(types).forEach((statID) => { + count = build.stats && build.stats[types[statID]] !== undefined + ? parseInt(build.stats[types[statID]], 10) + : 0; + row[`stat_${types[statID]}`] = Number.isNaN(count) ? 0 : count; + }); + remaining = build.stats + ? parseInt(build.stats.queued, 10) - (parseInt(build.stats.built, 10) + parseInt(build.stats.failed, 10) + parseInt(build.stats.skipped, 10) + parseInt(build.stats.ignored, 10) + parseInt(build.stats.fetched, 10)) - : 0; - if (Number.isNaN(remaining)) { - remaining = 0; - } - row.stat_remaining = remaining; - row.status = translateStatus(build.status); - row.elapsed = build.elapsed ? build.elapsed : ''; - - dtrow.queue(row); + : 0; + if (Number.isNaN(remaining)) { + remaining = 0; } - } + row.stat_remaining = remaining; + row.status = translateStatus(build.status); + row.elapsed = build.elapsed ? build.elapsed : ''; + + dtrow.queue(row); + }); if (latest) { $('#mastername').html(formatMasterName(latest.mastername)); @@ -793,47 +789,43 @@ function processDataJail(data) { } function processDataIndex(data) { - let master; let mastername; let stat; let types; let remaining; + let master; let types; let remaining; let row; let count; let dtrow; if (data.masternames) { types = ['queued', 'built', 'failed', 'skipped', 'ignored', 'fetched']; dtrow = new DTRow('latest_builds_table', 'latest_builds_div'); - for (mastername in data.masternames) { - if (mastername !== undefined) { - row = {}; - master = data.masternames[mastername].latest; - - row.id = master.mastername; - row.portset = formatPortSet(master.ptname, master.setname); - row.mastername = master.mastername; - row.buildname = master.buildname; - row.jailname = master.jailname; - row.setname = master.setname; - row.ptname = master.ptname; - for (stat in types) { - if (stat !== undefined) { - count = master.stats && master.stats[types[stat]] !== undefined - ? parseInt(master.stats[types[stat]], 10) - : 0; - row[`stat_${types[stat]}`] = Number.isNaN(count) ? 0 : count; - } - } - remaining = master.stats - ? parseInt(master.stats.queued, 10) + Object.keys(data.masternames).forEach((masterNameID) => { + row = {}; + master = data.masternames[masterNameID].latest; + + row.id = master.mastername; + row.portset = formatPortSet(master.ptname, master.setname); + row.mastername = master.mastername; + row.buildname = master.buildname; + row.jailname = master.jailname; + row.setname = master.setname; + row.ptname = master.ptname; + Object.keys(types).forEach((statID) => { + count = master.stats && master.stats[types[statID]] !== undefined + ? parseInt(master.stats[types[statID]], 10) + : 0; + row[`stat_${types[statID]}`] = Number.isNaN(count) ? 0 : count; + }); + remaining = master.stats + ? parseInt(master.stats.queued, 10) - (parseInt(master.stats.built, 10) + parseInt(master.stats.failed, 10) + parseInt(master.stats.skipped, 10) + parseInt(master.stats.ignored, 10) + parseInt(master.stats.fetched, 10)) - : 0; - row.stat_remaining = Number.isNaN(remaining) ? 0 : remaining; - row.status = translateStatus(master.status); - row.elapsed = master.elapsed ? master.elapsed : ''; + : 0; + row.stat_remaining = Number.isNaN(remaining) ? 0 : remaining; + row.status = translateStatus(master.status); + row.elapsed = master.elapsed ? master.elapsed : ''; - dtrow.queue(row); - } - } + dtrow.queue(row); + }); dtrow.commit(); } @@ -956,7 +948,6 @@ function fixViewport() { function setupBuild() { let status; - let i; $('#builders_table').dataTable({ bFilter: false, @@ -1088,24 +1079,22 @@ function setupBuild() { 'remaining', 'queued', ]; - for (i in types) { - if (i !== undefined) { - status = types[i]; - $(`#${status}_table`).dataTable({ - bAutoWidth: false, - processing: true, // Show processing icon - deferRender: true, // Defer creating TR/TD until needed - aoColumns: columns[status], - stateSave: true, // Enable cookie for keeping state - lengthMenu: [ - [5, 10, 25, 50, 100, 200, -1], - [5, 10, 25, 50, 100, 200, 'All'], - ], - pageLength: 10, - order: [[0, 'asc']], // Sort by build order - }); - } - } + Object.keys(types).forEach((i) => { + status = types[i]; + $(`#${status}_table`).dataTable({ + bAutoWidth: false, + processing: true, // Show processing icon + deferRender: true, // Defer creating TR/TD until needed + aoColumns: columns[status], + stateSave: true, // Enable cookie for keeping state + lengthMenu: [ + [5, 10, 25, 50, 100, 200, -1], + [5, 10, 25, 50, 100, 200, 'All'], + ], + pageLength: 10, + order: [[0, 'asc']], // Sort by build order + }); + }); } function setupJail() { From c266fce64a7e36c4eccf80fd2037605227ff3b5d Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 09:46:39 -0400 Subject: [PATCH 89/92] poudriere.js: Use class --- src/share/poudriere/html/assets/poudriere.js | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 04f5c75aa0..23612bf203 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -489,14 +489,14 @@ function formatStatusRow(status, row, n) { return tableRow; } -function DTRow(tableID, divID) { - this.Table = $(`#${tableID}`).DataTable(); - this.new_rows = []; - this.first_load = this.Table.row(0).length === 0; - this.div_id = divID; -} +class DTRow { + constructor(tableID, divID) { + this.Table = $(`#${tableID}`).DataTable(); + this.new_rows = []; + this.first_load = this.Table.row(0).length === 0; + this.div_id = divID; + } -DTRow.prototype = { queue(rowInput) { const row = rowInput; let existingRow; @@ -521,7 +521,8 @@ DTRow.prototype = { /* Otherwise add it. */ this.new_rows.push(row); } - }, + } + commit() { if (this.new_rows.length) { const nodes = this.Table.rows.add(this.new_rows).draw().nodes(); @@ -531,8 +532,8 @@ DTRow.prototype = { nodes.to$().hide().fadeIn(1500); } } - }, -}; + } +} function processDataBuild(dataInput) { const data = dataInput; From f0e278010be9de867ba4688d6620520dc5580a37 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 09:48:28 -0400 Subject: [PATCH 90/92] poudriere.js: Switch to DataTable() RowGrouping is now disabled --- src/share/poudriere/html/assets/poudriere.js | 48 ++++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 23612bf203..3df3600759 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -380,7 +380,7 @@ function formatStartToEnd(start, end) { function filterSkipped(pkgname) { scrollToElement('#skipped'); - const table = $('#skipped_table').dataTable(); + const table = $('#skipped_table').DataTable(); table.fnFilter(pkgname, 3); const searchFilter = $('#skipped_table_filter input'); @@ -950,7 +950,7 @@ function fixViewport() { function setupBuild() { let status; - $('#builders_table').dataTable({ + $('#builders_table').DataTable({ bFilter: false, bInfo: false, bPaginate: false, @@ -1082,7 +1082,7 @@ function setupBuild() { ]; Object.keys(types).forEach((i) => { status = types[i]; - $(`#${status}_table`).dataTable({ + $(`#${status}_table`).DataTable({ bAutoWidth: false, processing: true, // Show processing icon deferRender: true, // Defer creating TR/TD until needed @@ -1133,7 +1133,7 @@ function setupJail() { }, ]; - $('#builds_table').dataTable({ + $('#builds_table').DataTable({ bAutoWidth: false, processing: true, // Show processing icon aoColumns: columns, @@ -1230,7 +1230,7 @@ function setupIndex() { }, ]; - const table = $('#latest_builds_table').dataTable({ + const table = $('#latest_builds_table').DataTable({ bAutoWidth: false, processing: true, // Show processing icon aoColumns: columns, @@ -1250,25 +1250,25 @@ function setupIndex() { ], }); - table.rowGrouping({ - iGroupingColumnIndex2: 4, - iGroupingColumnIndex: 5, - sGroupLabelPrefix2: '  Set - ', - sGroupLabelPrefix: 'Ports - ', - sEmptyGroupLabel: '', - fnGroupLabelFormat(label) { - return `${label}`; - }, - fnGroupLabelFormat2(label) { - return `${label}`; - }, - fnOnGrouped() { - // Hide default set group rows - $( - '#latest_builds_table tbody tr[id^=group-id-latest_builds_table_][id$=--]', - ).hide(); - }, - }); + // table.rowGrouping({ + // iGroupingColumnIndex2: 4, + // iGroupingColumnIndex: 5, + // sGroupLabelPrefix2: '  Set - ', + // sGroupLabelPrefix: 'Ports - ', + // sEmptyGroupLabel: '', + // fnGroupLabelFormat(label) { + // return `${label}`; + // }, + // fnGroupLabelFormat2(label) { + // return `${label}`; + // }, + // fnOnGrouped() { + // // Hide default set group rows + // $( + // '#latest_builds_table tbody tr[id^=group-id-latest_builds_table_][id$=--]', + // ).hide(); + // }, + // }); // applyHovering('latest_builds_table'); } From f1a4879625bcc18d4291534f2267adfe1b4ba497 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 12:37:22 -0400 Subject: [PATCH 91/92] poudriere.js: Change updateInterval to 3 --- src/share/poudriere/html/assets/poudriere.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 3df3600759..7cc29ef350 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -29,7 +29,7 @@ // server_style = ['hosted', 'inline']; const serverStyle = 'hosted'; -const updateInterval = 8; +const updateInterval = 3; let firstRun = true; let loadAttempts = 0; const maxLoadAttempts = 8; From 6cca53625888d56759b426ff1152cabdd1092fed Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 12 Mar 2024 12:59:43 -0400 Subject: [PATCH 92/92] poudriere.js: Fix progress bar --- src/share/poudriere/html/assets/poudriere.js | 34 ++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/share/poudriere/html/assets/poudriere.js b/src/share/poudriere/html/assets/poudriere.js index 7cc29ef350..e2f61bf238 100644 --- a/src/share/poudriere/html/assets/poudriere.js +++ b/src/share/poudriere/html/assets/poudriere.js @@ -45,6 +45,7 @@ let pageType; let pageBuildName; let pageMasterName; let dataURL = ''; +let x; function getParameterByName(name) { const tmpName = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]'); @@ -100,6 +101,33 @@ function formatPkgName(pkgname) { return pkgname; } +function minidraw(dx, height, width, context, color, queued, variable) { + let newx; + + /* Calculate how much percentage this value should display */ + const pct = Math.floor((variable * 100) / queued); + if (pct === 0) { + return 0; + } + newx = width * (pct / 100); + if (dx + newx >= width) { + newx = width - dx; + } + /* Cap total bar to 99%, so it's clear something is remaining */ + const totalPct = ((dx + newx) / width) * 100; + if (totalPct >= 99.0 && totalPct < 100.0) { + newx = Math.ceil(width * (99 / 100)); + } + /* Always start at 1 */ + if (newx === 0) { + newx = 1; + } + context.fillStyle = color; + context.fillRect(dx, 1, newx, height); + + return newx; +} + function determineCanvasWidth() { let width; @@ -150,11 +178,17 @@ function updateCanvas(stats) { height -= 2; /* Start at 1 and save 1 for border */ width -= 1; + x = 1; context.fillStyle = '#E3E3E3'; context.fillRect(1, 1, width, height); context.lineWidth = 1; context.strokeStyle = 'black'; context.stroke(); + x += minidraw(x, height, width, context, '#00CC00', queued, built); + x += minidraw(x, height, width, context, '#E00000', queued, failed); + x += minidraw(x, height, width, context, '#FF9900', queued, ignored); + x += minidraw(x, height, width, context, '#228B22', queued, fetched); + x += minidraw(x, height, width, context, '#CC6633', queued, skipped); pctdone = ((queued - remaining) * 100) / queued; if (Number.isNaN(pctdone)) {