mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-29 15:44:14 +00:00
Front end change: display modal dialog for user input on download link click.
This commit is contained in:
parent
18ec7d4a5b
commit
bb6cbfe871
@ -29,8 +29,9 @@ import hirs.data.persist.SupplyChainValidationSummary;
|
||||
import hirs.persist.CriteriaModifier;
|
||||
import hirs.persist.CrudManager;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -109,10 +110,17 @@ public class ValidationReportsPageController extends PageController<NoPageParams
|
||||
return new DataTableResponse<>(records, input);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "download", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "download", method = RequestMethod.POST)
|
||||
public void download(@RequestParam final String id,
|
||||
final HttpServletRequest request,
|
||||
final HttpServletResponse response) {
|
||||
|
||||
LOGGER.info("Downloading validation report for " + id);
|
||||
Enumeration parameters = request.getParameterNames();
|
||||
while (parameters.hasMoreElements()) {
|
||||
String parameter = (String) parameters.nextElement();
|
||||
LOGGER.info(parameter + ": " + request.getParameter(parameter));
|
||||
}
|
||||
UUID uuid = UUID.fromString(id);
|
||||
PlatformCredential pc = PlatformCredential.select(certificateManager).byDeviceId(uuid).getCertificate();
|
||||
LOGGER.info("Verified manufacturer: " + pc.getManufacturer());
|
||||
@ -122,8 +130,10 @@ public class ValidationReportsPageController extends PageController<NoPageParams
|
||||
if (pc.getComponentIdentifiers() != null &&
|
||||
pc.getComponentIdentifiers().size() > 0) {
|
||||
for (ComponentIdentifier ci : pc.getComponentIdentifiers()) {
|
||||
LOGGER.info("Manufacturer ID: " + ci.getComponentManufacturerId().toString() +
|
||||
"\nModel: " + ci.getComponentModel().getString() +
|
||||
if (ci.getComponentManufacturerId() != null) {
|
||||
LOGGER.info("Manufacturer ID: " + ci.getComponentManufacturerId().toString());
|
||||
}
|
||||
LOGGER.info("\nModel: " + ci.getComponentModel().getString() +
|
||||
"\nRevision: " + ci.getComponentRevision().getString());
|
||||
}
|
||||
}
|
||||
|
@ -133,10 +133,35 @@
|
||||
* This method builds a url to download the device validation report.
|
||||
*/
|
||||
function createDownloadLink(full) {
|
||||
return full.device.name + ' ' +
|
||||
'<a href="${portal}/validation-reports/download?id=' + full.device.id +
|
||||
'"><img src="${icons}/ic_file_download_black_24dp.png" title="Download validation report">' +
|
||||
'</a>';
|
||||
var device = full.device;
|
||||
var html = '<form method="POST" action="${portal}/validation-reports/download?id=' + device.id + '">' +
|
||||
device.name +
|
||||
'<a href="#downloadValidationReport" data-toggle="modal" title="Download Validation Report">' +
|
||||
'<img src="${icons}/ic_file_download_black_24dp.png"/>' +
|
||||
'</a>' +
|
||||
'<div id="downloadValidationReport" class="modal fade" role="dialog" style="top:30%">' +
|
||||
'<div class="modal-dialog">' +
|
||||
'<div class="modal-content">' +
|
||||
'<div class="modal-header">' +
|
||||
'<h1 id="modal-title">Download Validation Report</h1>' +
|
||||
'</div>' +
|
||||
'<div class="modal-body">' +
|
||||
'<label>Company<input id="company" type="text" name="company" /></label>' +
|
||||
'<label>Contract #<input id="contract" type="text" name="contract" /></label>' +
|
||||
'<label>Date range end<input id="date" type="text" name="date" /></label>' +
|
||||
'</div>' +
|
||||
'<div class="modal-footer">' +
|
||||
'<div class="modal-custom-buttons">' +
|
||||
|
||||
'</div>' +
|
||||
'<button class="btn btn-secondary" data-dismiss="modal">Cancel</button>' +
|
||||
'<input class="btn btn-primary" type="submit" value="Save">' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</form>';
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,14 @@
|
||||
<%@tag description="download icon that opens modal dialog with form" pageEncoding="UTF-8"%>
|
||||
|
||||
<%@attribute name="id"%>
|
||||
<%@attribute name="label"%>
|
||||
<%@attribute name="customButtons" fragment="true" required="false"%>
|
||||
|
||||
<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %>
|
||||
|
||||
<a href="#${id}" data-toggle="modal" title="${label}">
|
||||
<img src="${icons}/ic_file_download_black_24dp.png"/>
|
||||
</a>
|
||||
<my:modal id="${id}" label="${label}" customButtons="${customButtons}">
|
||||
<jsp:doBody/>
|
||||
</my:modal>
|
Loading…
x
Reference in New Issue
Block a user