#247 -- Fix jenkinsfile

This commit is contained in:
Anton Romanov 2024-05-02 14:22:29 +04:00
parent f522ed9b81
commit 234b043d72
2 changed files with 6 additions and 218 deletions

11
Jenkinsfile vendored
View File

@ -8,11 +8,12 @@ pipeline {
}
}
post {
always {
script {
if (currentBuild.currentResult == 'FAILURE') {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "a.romanov@ulstu.ru", sendToIndividuals: true])
always {
script {
if (currentBuild.currentResult == 'FAILURE') {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "a.romanov@ulstu.ru", sendToIndividuals: true])
}
}
}
}
}
}

View File

@ -191,219 +191,6 @@
</div>
</div>
</section>
<script type="text/javascript" src="/js/file-loader.js"></script>
<script>
/*<![CDATA[*/
$(document).ready(function () {
new FileLoader({
div: "loader",
url: urlFileUpload,
maxSize: -1,
extensions: [],
callback: function (response) {
showFeedbackMessage("Файл успешно загружен");
console.debug(response);
addNewFile(response, $("#files-list"), false);
}
});
new FileLoader({
div: "latex-loader",
url: urlFileUpload,
maxSize: -1,
extensions: [],
callback: function (response) {
showFeedbackMessage("Файл успешно загружен");
console.debug(response);
addNewFile(response, $("#latex-files-list"), true);
}
});
$('.selectpicker').selectpicker();
});
/*]]>*/
function addNewFile(fileDto, listElement, isLatexAttach) {
var fileNumber = $('.files-list div.row').length;
var newFileRow = $("<div/>")
.attr("id", 'files' + fileNumber)
.addClass("row");
var idInput = $("<input/>")
.attr("type", "hidden")
.attr("id", "files" + fileNumber + ".id")
.attr("value", '')
.attr("name", "files[" + fileNumber + "].id");
newFileRow.append(idInput);
var flagInput = $("<input/>")
.attr("type", "hidden")
.attr("id", "files" + fileNumber + ".deleted")
.attr("value", "false")
.attr("name", "files[" + fileNumber + "].deleted");
newFileRow.append(flagInput);
var nameInput = $("<input/>")
.attr("type", "hidden")
.attr("id", "files" + fileNumber + ".name")
.attr("value", fileDto.fileName)
.attr("name", "files[" + fileNumber + "].name");
newFileRow.append(nameInput);
var tmpFileNameInput = $("<input/>")
.attr("type", "hidden")
.attr("id", "files" + fileNumber + ".tmpFileName")
.attr("value", fileDto.tmpFileName)
.attr("name", "files[" + fileNumber + "].tmpFileName");
newFileRow.append(tmpFileNameInput);
var isLatexInput = $("<input/>")
.attr("type", "hidden")
.attr("id", "files" + fileNumber + ".isLatexAttach")
.attr("value", isLatexAttach)
.attr("name", "files[" + fileNumber + "].isLatexAttach");
newFileRow.append(isLatexInput);
var nextDiv = $("<div/>")
.addClass("col-2");
var nextA = $("<a/>")
.addClass("btn btn-danger float-right")
.attr("onclick", "$('#files" + fileNumber + "\\\\.deleted').val('true'); $('#files" + fileNumber + "').hide();")
.append(($("<span/>").attr("aria-hidden", "true")).append($("<i/>").addClass("fa fa-times")))
;
nextDiv.append(nextA)
newFileRow.append(nextDiv);
var nameDiv = $("<div/>")
.addClass("col-10")
.append($("<a/>").text(fileDto.fileName)
.attr("href", 'javascript:void(0)')
.attr("onclick", "downloadFile('" + fileDto.tmpFileName + "',null,'" + fileDto.fileName + "')"));
newFileRow.append(nameDiv);
listElement.append(newFileRow);
}
function downloadFile(tmpName, fileId, downloadName) {
let xhr = new XMLHttpRequest();
if (fileId != null) xhr.open('GET', urlFileDownload + fileId);
if (tmpName != null) xhr.open('GET', urlFileDownloadTmp + tmpName);
xhr.responseType = 'blob';
var formData = new FormData();
if (fileId != null) formData.append("file-id", fileId);
if (tmpName != null) formData.append("tmp-file-name", tmpName);
xhr.send(formData);
xhr.onload = function () {
if (this.status == 200) {
console.debug(this.response);
var blob = new Blob([this.response], {type: '*'});
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = downloadName;
a.click();
window.URL.revokeObjectURL(url);
} else {
}
}
}
function generatePDF() {
$('#pdfLoadingIcon').show();
$('#pdfBtn').prop('disabled', true);
var formData = new FormData(document.forms.paperform);
var xhr = new XMLHttpRequest();
xhr.open("POST", urlPdfGenerating);
xhr.send(formData);
xhr.responseType = 'blob';
xhr.onload = function () {
if (this.status == 200) {
console.debug(this.response);
var blob = new Blob([this.response], {type: 'application/pdf'});
let a = document.createElement("a");
a.style = "display: none";
document.body.appendChild(a);
let url = window.URL.createObjectURL(blob);
a.href = url;
a.download = $('#title').val() + '.pdf';
a.click();
window.URL.revokeObjectURL(url);
} else {
showFeedbackMessage("Ошибка при создании PDF", MessageTypesEnum.DANGER);
}
$('#pdfLoadingIcon').hide();
$('#pdfBtn').prop('disabled', false);
}
}
function getFormattedReferences() {
var formData = new FormData(document.forms.paperform);
var xhr = new XMLHttpRequest();
xhr.open("POST", urlReferencesFormatting);
console.log(formData);
xhr.send(formData);
xhr.onload = function () {
if (this.status == 200) {
console.debug(this.response);
$('#formattedReferencesArea').val(this.response);
} else {
showFeedbackMessage("Ошибка при форматировании списка литературы", MessageTypesEnum.DANGER);
}
}
}
</script>
<script th:inline="javascript">
/*<![CDATA[*/
var autoCompleteData = /*[[${autocompleteData}]]*/ 'default';
console.log(autoCompleteData);
$(".autocomplete.author").autocomplete({
source: autoCompleteData.authors,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search");
});
$(".autocomplete.publicationTitle").autocomplete({
source: autoCompleteData.publicationTitles,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search");
});
$(".autocomplete.publisher").autocomplete({
source: autoCompleteData.publishers,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search");
});
$(".autocomplete.journalOrCollectionTitle").autocomplete({
source: autoCompleteData.journalOrCollectionTitles,
minLength: 0,
}).focus(function () {
$(this).autocomplete("search");
});
/*]]>*/
</script>
</div>
</body>