Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
!/src/main/
/src/main/*
!/src/main/frontend/
!/src/main/webapp/
/src/main/webapp/js/bundles/

/.mvn/*
/Jenkinsfile
Expand Down
64 changes: 35 additions & 29 deletions src/main/webapp/js/build.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,72 @@
const rerunButton = document.getElementById('pgv-rerun');
const rerunButton = document.getElementById("pgv-rerun");

if (rerunButton) {
rerunButton.addEventListener('click', event => {
rerunButton.addEventListener("click", (event) => {
event.preventDefault();
const rerunAction = window[`${rerunButton.dataset.proxyName}`];
rerunAction.doRerun(function (success) {
const result = success.responseJSON;
if (result) {
notificationBar.show(rerunButton.dataset.successMessage, notificationBar.SUCCESS);
notificationBar.show(
rerunButton.dataset.successMessage,
notificationBar.SUCCESS,
);
}
});
})
});
}

const cancelButton = document.getElementById('pgv-cancel');
const cancelButton = document.getElementById("pgv-cancel");

if (cancelButton) {
cancelButton.addEventListener('click', event => {
cancelButton.addEventListener("click", (event) => {
event.preventDefault();
const question = cancelButton.getAttribute("data-confirm");
const execute = function () {
const cancelAction = window[`${cancelButton.dataset.proxyName}`];
cancelAction.doCancel(function (response) {
const result = response.responseJSON;
if (result.status === "ok") {
notificationBar.show(cancelButton.dataset.successMessage)
notificationBar.show(cancelButton.dataset.successMessage);
} else {
notificationBar.show(result.message, notificationBar.WARNING)
notificationBar.show(result.message, notificationBar.WARNING);
}
});

};

if (question != null) {
dialog.confirm(question).then(() => {
execute();
return null;
}).catch((error) => {
console.error("Error in cancel confirm dialog:", error);
})
dialog
.confirm(question)
.then(() => {
execute();
return null;
})
.catch((error) => {
console.error("Error in cancel confirm dialog:", error);
});
} else {
execute();
}
})
});

function updateCancelButton() {
const buildCaption = document.querySelector(".jenkins-build-caption");
const url = buildCaption.dataset.statusUrl;
fetch(url).then((rsp) => {
if (rsp.ok) {
const isBuilding = rsp.headers.get("X-Building");
if (isBuilding === "true") {
setTimeout(updateCancelButton, 5000);
} else {
cancelButton.style.display = "none";
fetch(url)
.then((rsp) => {
if (rsp.ok) {
const isBuilding = rsp.headers.get("X-Building");
if (isBuilding === "true") {
setTimeout(updateCancelButton, 5000);
} else {
cancelButton.style.display = "none";
}
}
}
return null;
})
.catch((error) => {
console.error("Error fetching build caption statsus:", error);
})
return null;
})
.catch((error) => {
console.error("Error fetching build caption status:", error);
});
}
setTimeout(updateCancelButton, 5000);
}
3 changes: 2 additions & 1 deletion src/main/webapp/js/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ h1 {
color: inherit;
}

svg, img {
svg,
img {
width: 1.125rem;
height: 1.125rem;
}
Expand Down