Skip to content

Commit

Permalink
Add some JavaScript fixes (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalluck authored Aug 28, 2024
1 parent 6d4832c commit 1ff2dd7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/main/resources/META-INF/resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
});

// XXX
var table = null;
let table = null;
const builds = $('#builds');

const input = $('#url');
Expand All @@ -104,9 +104,9 @@
const urlAlert = $('#urlAlert');
const urlAlertMessage = $('#urlAlertMessage');
const form = $('#analyzeForm');
const progress = $('#progress');
//const progress = $('#progress');

var intervalID;
let intervalID;

form.submit(function(event) {
event.preventDefault();
Expand All @@ -124,7 +124,7 @@

const url = input.val();

if (url == null || url.trim().length == 0) {
if (url == null || url.trim().length === 0) {
urlAlertMessage.html('URL cannot be empty');
urlAlert.show().alert();

Expand All @@ -144,15 +144,15 @@

const protocol = u.protocol;

if (protocol != 'http:' && protocol != 'https:') {
if (protocol !== 'http:' && protocol !== 'https:') {
urlAlertMessage.html('Invalid URL protocol: ' + protocol)
urlAlert.show().alert();

return;
}

const progressbar = $('#progressbar');
var percent = 0;
let percent = 0;

progressbar.css('width', '0%').attr('aria-valuenow', 0);
progressbar.html(percent + '%');
Expand Down Expand Up @@ -182,7 +182,7 @@
const id = location.split('/').pop();
const max = 3600000 - 10000;
const interval = 1000;
var t = 0;
let t = 0;

intervalID = setInterval(function() {
$.getJSON('/api/analyze/statuses/' + id, function(data) {
Expand All @@ -206,7 +206,7 @@

handle(config, data);

if (percent != 100) {
if (percent !== 100) {
percent = 100;
progressbar.css('width', percent + '%').attr('aria-valuenow', percent);
progressbar.html(percent + '%');
Expand Down Expand Up @@ -318,10 +318,12 @@
{
data: 'artifacts',
render: function(data, type) {
let a;

if (type === 'display') {
let text = '<ul>';

for (i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
a = data[i];
text += '<li>';
if (a.brew_id != null) {
Expand Down

0 comments on commit 1ff2dd7

Please sign in to comment.