[#1143] Table Data Should Be Sorted Chronologically By Default#1144
Conversation
…e list of certs/rims first and called the count/size method on that list to get the number of items in the db with the more efficient method. All pages will have their certs/rims be sorted in order they were created out-of-the-box. This can be clearly seen in the trust chain cert page and validation summary page (prior to this, these pages were not sorted by create time). PR ready.
| * @return a list of certificate authority credentials | ||
| * @return a count of certificate authority credentials | ||
| */ | ||
| List<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag); |
There was a problem hiding this comment.
This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.
| * @return a list of endorsement credentials | ||
| * @return a count of endorsement credentials | ||
| */ | ||
| List<EndorsementCredential> findByArchiveFlag(boolean archiveFlag); |
There was a problem hiding this comment.
This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.
| * @return a list of IDevId certificates | ||
| * @return a count of idevid certificates | ||
| */ | ||
| List<IDevIDCertificate> findByArchiveFlag(boolean archiveFlag); |
There was a problem hiding this comment.
This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.
| * @return a list of issued attestation certificates | ||
| * @return a count of issued certificates | ||
| */ | ||
| List<IssuedAttestationCertificate> findByArchiveFlag(boolean archiveFlag); |
There was a problem hiding this comment.
This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.
|
|
||
|
|
||
| // /** | ||
| // * Query that retrieves a list of IDevId certificates using the provided subject. |
There was a problem hiding this comment.
Removed unused repository methods.
|
|
||
| if (isBaseRim) { | ||
| final BaseReferenceManifest baseReferenceManifest = | ||
| this.referenceManifestPageService.parseBaseRIM(errorMessages, file); |
There was a problem hiding this comment.
Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.
| } | ||
|
|
||
| rimFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements()); | ||
| rimFilteredRecordsList.setRecordsTotal(this.referenceManifestPageService.findRIMRepositoryCount()); |
There was a problem hiding this comment.
Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.
| for (ReferenceDigestValue rdv : rdvFilteredRecordsList) { | ||
| // We are updating the base rim ID field if necessary and | ||
| if (rdv.getBaseRimId() == null | ||
| && this.referenceDigestValuePageService.doesRIMExist(rdv.getSupportRimId())) { |
There was a problem hiding this comment.
Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.
|
|
||
| // add object that contains the leaf ACA certificate information | ||
| mav.addObject(LEAF_ACA_CERT_DATA, new HashMap<>(CertificateStringMapBuilder.getCertificateAuthorityInfoHelper( | ||
| this.certificateRepository, |
There was a problem hiding this comment.
Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.
| final HttpServletResponse response) | ||
| throws IOException { | ||
| log.info("Received request to download validation summary reports"); | ||
| this.validationSummaryPageService.downloadValidationReports(request, response); |
There was a problem hiding this comment.
Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.
…ils will now be responsible for setting the default sort column name so that all pages will be sorted by create time automatically. Sorting by column with no searches should work now.
|
|
||
| // Create the Pageable object without sorting if no order column is provided | ||
| return PageRequest.of(currentPage, pageSize); | ||
| final String defaultSortColumnName = "createTime"; |
There was a problem hiding this comment.
Here is where the default sorting column is set.
| //Set data tables | ||
| let dataTable = setDataTables(viewName, "#reportTable", url, columns); | ||
|
|
||
| dataTable.order([1, "desc"]).draw(); //order by createTime |
There was a problem hiding this comment.
This line was causing issues with the default sorting set in the backend.
...rc/main/java/hirs/attestationca/portal/page/controllers/IDevIdCertificatePageController.java
Outdated
Show resolved
Hide resolved
…ed by this PR. Addressed one PR comment.
Description
Pages with table data will now have their entries sorted by creation time by default.
Test Instructions:
Summary Of Changes:
this., unless it is being used in the constructor, has been removed for cleaner, more readable code.HelperPageServiceclass, the variablelogFilesPathwill no longer be injected via field but via Constructor. This change was made to make the injected dependency explicit, immutable, and easier to test.@Log4j2annotation below Spring Boot@Serviceand@Controllerannotations to follow standard annotation conventions.ControllerPagesUtilsfile that orders all data entries byCreate Timeby default if the user didn't sort the page by any of the table columns.List<> findByArchiveFlag()methods in the repository classes withlong countByArchiveFlag()since the original method was being used, in most cases, to retrieve the list of entries only to determine the total count. The new method performs a direct count query, improving performance and reducing memory usage.Issues This PR Addresses:
Closes #1143