mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-31 00:24:00 +00:00
Additional code to correctly display # of elements
This commit is contained in:
parent
0c131e6ee5
commit
b018429b69
@ -84,10 +84,6 @@ public class DevicePageController extends PageController<NoPageParams> {
|
||||
|
||||
// get all the devices
|
||||
FilteredRecordsList<Device> deviceList = new FilteredRecordsList<>();
|
||||
// OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
// Device.class,
|
||||
// deviceRepository,
|
||||
// input, orderColumnName);
|
||||
|
||||
int currentPage = input.getStart() / input.getLength();
|
||||
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
||||
@ -95,8 +91,10 @@ public class DevicePageController extends PageController<NoPageParams> {
|
||||
|
||||
if (pagedResult.hasContent()) {
|
||||
deviceList.addAll(pagedResult.getContent());
|
||||
deviceList.setRecordsTotal(pagedResult.getContent().size());
|
||||
} else {
|
||||
deviceList.setRecordsTotal(input.getLength());
|
||||
}
|
||||
deviceList.setRecordsTotal(input.getLength());
|
||||
deviceList.setRecordsFiltered(deviceRepository.count());
|
||||
|
||||
FilteredRecordsList<HashMap<String, Object>> records
|
||||
|
@ -115,22 +115,26 @@ public class ReferenceManifestPageController extends PageController<NoPageParams
|
||||
|
||||
String orderColumnName = input.getOrderColumnName();
|
||||
log.info("Ordering on column: " + orderColumnName);
|
||||
|
||||
log.info("Querying with the following dataTableInput: " + input.toString());
|
||||
|
||||
FilteredRecordsList<ReferenceManifest> records = new FilteredRecordsList<>();
|
||||
int currentPage = input.getStart() / input.getLength();
|
||||
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
||||
org.springframework.data.domain.Page<ReferenceManifest> pagedResult = referenceManifestRepository.findAll(paging);
|
||||
int rimCount = 0;
|
||||
|
||||
if (pagedResult.hasContent()) {
|
||||
for (ReferenceManifest manifest : pagedResult.getContent()) {
|
||||
if (!manifest.getRimType().equals(ReferenceManifest.MEASUREMENT_RIM)) {
|
||||
records.add(manifest);
|
||||
rimCount++;
|
||||
}
|
||||
}
|
||||
records.setRecordsTotal(rimCount);
|
||||
} else {
|
||||
records.setRecordsTotal(input.getLength());
|
||||
}
|
||||
records.setRecordsTotal(input.getLength());
|
||||
|
||||
records.setRecordsFiltered(referenceManifestRepository.count());
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
|
@ -116,15 +116,12 @@ public class RimDatabasePageController extends PageController<NoPageParams> {
|
||||
|
||||
if (pagedResult.hasContent()) {
|
||||
referenceDigestValues.addAll(pagedResult.getContent());
|
||||
referenceDigestValues.setRecordsTotal(pagedResult.getContent().size());
|
||||
} else {
|
||||
referenceDigestValues.setRecordsTotal(input.getLength());
|
||||
}
|
||||
referenceDigestValues.setRecordsTotal(input.getLength());
|
||||
referenceDigestValues.setRecordsFiltered(referenceDigestValueRepository.count());
|
||||
|
||||
// FilteredRecordsList<ReferenceDigestValue> referenceDigestValues =
|
||||
// OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
// referenceDigestValueRepository,
|
||||
// input, orderColumnName, criteriaModifier, entityManager);
|
||||
|
||||
// might be able to get rid of this, maybe right a query that looks for not updated
|
||||
SupportReferenceManifest support;
|
||||
for (ReferenceDigestValue rdv : referenceDigestValues) {
|
||||
|
@ -126,8 +126,11 @@ public class ValidationReportsPageController extends PageController<NoPageParams
|
||||
|
||||
if (pagedResult.hasContent()) {
|
||||
records.addAll(pagedResult.getContent());
|
||||
records.setRecordsTotal(pagedResult.getContent().size());
|
||||
} else {
|
||||
records.setRecordsTotal(input.getLength());
|
||||
}
|
||||
records.setRecordsTotal(input.getLength());
|
||||
|
||||
records.setRecordsFiltered(supplyChainValidatorSummaryRepository.count());
|
||||
|
||||
return new DataTableResponse<>(records, input);
|
||||
|
Loading…
x
Reference in New Issue
Block a user