Modified the behavior of Permalink to access a newer, faster API
This commit is contained in:
parent
ce9b06e4c6
commit
491d048948
|
@ -17,7 +17,7 @@ angular.module('lemur')
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('CertificatesViewController', function ($q, $scope, $uibModal, $stateParams, CertificateApi, CertificateService, MomentService, ngTableParams, toaster) {
|
.controller('CertificatesViewController', function ($q, $scope, $uibModal, $stateParams, $location, CertificateApi, CertificateService, MomentService, ngTableParams, toaster) {
|
||||||
$scope.filter = $stateParams;
|
$scope.filter = $stateParams;
|
||||||
$scope.certificateTable = new ngTableParams({
|
$scope.certificateTable = new ngTableParams({
|
||||||
page: 1, // show first page
|
page: 1, // show first page
|
||||||
|
@ -29,12 +29,25 @@ angular.module('lemur')
|
||||||
}, {
|
}, {
|
||||||
total: 0, // length of data
|
total: 0, // length of data
|
||||||
getData: function ($defer, params) {
|
getData: function ($defer, params) {
|
||||||
|
$scope.path = $location.path();
|
||||||
|
// Handle Permalink clicks through a separate API
|
||||||
|
// Clicking on Permalink adds the certificate name to the URL after "certificates/", which is used to identify the click
|
||||||
|
if ($scope.path.indexOf("certificates/") > -1 && $scope.path.split("/")[2].length > 0) {
|
||||||
|
$scope.certificateName = $scope.path.split("/")[2];
|
||||||
|
CertificateApi.one('name').one($scope.certificateName).getList()
|
||||||
|
.then(function (data) {
|
||||||
|
params.total(data.total);
|
||||||
|
$defer.resolve(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
CertificateApi.getList(params.url())
|
CertificateApi.getList(params.url())
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
params.total(data.total);
|
params.total(data.total);
|
||||||
$defer.resolve(data);
|
$defer.resolve(data);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.momentService = MomentService;
|
$scope.momentService = MomentService;
|
||||||
|
|
Loading…
Reference in New Issue