Skip to content

Commit

Permalink
Disable download pdf report until campaign not finished #2568
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigo17 committed Jan 4, 2025
1 parent 272068b commit baa9a75
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,22 @@ public String generatePdf(Tag tag, Date today, String folder) throws FileNotFoun
.add(getTextFromString(String.valueOf(tagDur), 12, true))
.add(getTextFromString(" min)", 10, false))
);
if (displayCountryColumn) {
document.add(new Paragraph()
.add(getTextFromString("Executed on Country(ies): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getCountryList()), ","), 12, true))
.add(getTextFromString(", Environment(s): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getEnvironmentList()), ","), 12, true))
.add(getTextFromString(" and Robot(s): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getRobotDecliList()), ","), 12, true)));
} else {
document.add(new Paragraph()
.add(getTextFromString("Executed on Environment(s): ", 10, false))
.add(getTextFromString(tag.getEnvironmentList() == null ? "" : StringUtil.convertToString(new JSONArray(tag.getEnvironmentList()), ","), 12, true))
.add(getTextFromString(" and Robot(s): ", 10, false))
.add(getTextFromString(tag.getRobotDecliList() == null ? "" : StringUtil.convertToString(new JSONArray(tag.getRobotDecliList()), ","), 12, true)));
if (tag.getCountryList() != null) {
if (displayCountryColumn) {
document.add(new Paragraph()
.add(getTextFromString("Executed on Country(ies): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getCountryList()), ","), 12, true))
.add(getTextFromString(", Environment(s): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getEnvironmentList()), ","), 12, true))
.add(getTextFromString(" and Robot(s): ", 10, false))
.add(getTextFromString(StringUtil.convertToString(new JSONArray(tag.getRobotDecliList()), ","), 12, true)));
} else {
document.add(new Paragraph()
.add(getTextFromString("Executed on Environment(s): ", 10, false))
.add(getTextFromString(tag.getEnvironmentList() == null ? "" : StringUtil.convertToString(new JSONArray(tag.getEnvironmentList()), ","), 12, true))
.add(getTextFromString(" and Robot(s): ", 10, false))
.add(getTextFromString(tag.getRobotDecliList() == null ? "" : StringUtil.convertToString(new JSONArray(tag.getRobotDecliList()), ","), 12, true)));
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion source/src/main/webapp/ReportingExecutionByTag.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

<div class="input-group-btn">
<a id="buttonDownloadPdfReport" class="pull-left marginTop10">
<button type="button" class="btn btn-default marginRight10">
<button type="button" id="buttonDownloadPdfReportButton" class="btn btn-default marginRight10">
<span class="glyphicon glyphicon-floppy-save"></span> Download Report
</button>
</a>
Expand Down
19 changes: 14 additions & 5 deletions source/src/main/webapp/js/pages/ReportingExecutionByTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,17 @@ function loadReportingData(selectTag) {
$("#Tagcampaign").val(data.tagObject.campaign);
$("#TagComment").val(data.tagObject.comment);
$("#TagDesc").val(data.tagObject.description);
$("#buttonDownloadPdfReport").attr("href", "./api/public/campaignexecutions/pdf/" + data.tagObject.tag);
$("#buttonOpenQueue").attr("href", "./TestCaseExecutionQueueList.jsp?tag=" + data.tagObject.tag);
if (data.tagObject.ciResult !== "") {
$("#buttonDownloadPdfReportButton").removeAttr("disabled");
$("#buttonDownloadPdfReportButton").removeAttr("title");
$("#buttonDownloadPdfReport").attr("href", "./api/public/campaignexecutions/pdf/" + encodeURIComponent(data.tagObject.tag));
} else {
$("#buttonDownloadPdfReportButton").attr("disabled", true);
$("#buttonDownloadPdfReportButton").attr("title", "Report only available when campaign finished!");
$("#buttonDownloadPdfReport").removeAttr("href");

}
$("#buttonOpenQueue").attr("href", "./TestCaseExecutionQueueList.jsp?tag=" + encodeURIComponent(data.tagObject.tag));

if (isEmpty(data.tagObject.campaign)) {
$("#TagcampaignCel1").addClass("hidden");
Expand All @@ -430,8 +439,8 @@ function loadReportingData(selectTag) {
$("#TagcampaignCel2").removeClass("hidden");
$("#buttonRunCampaign").removeClass("hidden");
$("#buttonSeeStatsCampaign").removeClass("hidden");
$("#buttonRunCampaign").attr("href", "./RunTests.jsp?campaign=" + data.tagObject.campaign);
$("#buttonSeeStatsCampaign").attr("href", "./ReportingCampaignOverTime.jsp?campaigns=" + data.tagObject.campaign);
$("#buttonRunCampaign").attr("href", "./RunTests.jsp?campaign=" + encodeURIComponent(data.tagObject.campaign));
$("#buttonSeeStatsCampaign").attr("href", "./ReportingCampaignOverTime.jsp?campaigns=" + encodeURIComponent(data.tagObject.campaign));
$("#buttonEditCampaign").attr("onclick", "editEntryClick('" + data.tagObject.campaign + "');");

}
Expand Down Expand Up @@ -1080,7 +1089,7 @@ function appendPanelStatus(status, total, selectTag) {
if ((rowClass.panel === "panelQU") || (rowClass.panel === "panelQE")) {
// When we display the QU or QE status, we add a link to all executions in the queue on the queue page.
$("#ReportByStatusTable").append(
$("<a href='./TestCaseExecutionQueueList.jsp?tag=" + selectTag + "'></a>").append(
$("<a href='./TestCaseExecutionQueueList.jsp?tag=" + encodeURIComponent(selectTag) + "'></a>").append(
$("<div class='panel " + rowClass.panel + "'></div>").append(
$('<div class="panel-heading"></div>').append(
$('<div class="row"></div>').append(
Expand Down

0 comments on commit baa9a75

Please sign in to comment.