summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Kurzynski <zbigniew.kurzynski@intel.com>2019-11-28 11:40:57 +0100
committerGunnar Mills <gmills@us.ibm.com>2019-12-04 18:00:17 +0000
commitca7e093bd789f34c35e714dc5bce1ae4e9ce4205 (patch)
tree7332a69e3b2858bbc84e597bf310d476bdec3931
parent5fcee5ab526d678c9f39763cc90f600c2869df5d (diff)
downloadphosphor-webui-ca7e093bd789f34c35e714dc5bce1ae4e9ce4205.tar.gz
phosphor-webui-ca7e093bd789f34c35e714dc5bce1ae4e9ce4205.zip
Sorting certificate table
So far the certificate table was not sorted and it happen that having multiple certificates they appear on different table position after machine restart. That is because the Redfish was used to get the list of certificates and it does not guarantee any order of elements in returned collections. After merging this commit certificates will be always sorted by: type, issuer name and then by date. Tested: Manual tests were made to cofirm that certificates are properly sorted. Signed-off-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com> Change-Id: Ie8e63d598cd04e2396ed09244a69284e49566f8d
-rw-r--r--app/access-control/controllers/certificate-controller.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/access-control/controllers/certificate-controller.js b/app/access-control/controllers/certificate-controller.js
index ad9a060..8a78c05 100644
--- a/app/access-control/controllers/certificate-controller.js
+++ b/app/access-control/controllers/certificate-controller.js
@@ -50,6 +50,24 @@ window.angular && (function(angular) {
})
.finally(function() {
$scope.loading = false;
+ $scope.certificates.sort(function(a, b) {
+ if (a.Name > b.Name) {
+ return 1;
+ }
+ if (a.Name < b.Name) {
+ return -1;
+ }
+ if (a.Issuer.CommonName > b.Issuer.CommonName) {
+ return 1;
+ }
+ if (a.Issuer.CommonName < b.Issuer.CommonName) {
+ return -1;
+ }
+ return (Date.parse(a.ValidNotBefore) >
+ Date.parse(b.ValidNotBefore)) ?
+ 1 :
+ -1;
+ });
});
},
function(error) {
OpenPOWER on IntegriCloud