diff --git a/modules/portal/app/controllers/VinylDNS.scala b/modules/portal/app/controllers/VinylDNS.scala
index b592e814a..c486698a6 100644
--- a/modules/portal/app/controllers/VinylDNS.scala
+++ b/modules/portal/app/controllers/VinylDNS.scala
@@ -432,8 +432,16 @@ class VinylDNS @Inject() (
}
def getZoneChange(id: String): Action[AnyContent] = userAction.async { implicit request =>
+ val queryParameters = new HashMap[String, java.util.List[String]]()
+ for {
+ (name, values) <- request.queryString
+ } queryParameters.put(name, values.asJava)
val vinyldnsRequest =
- new VinylDNSRequest("GET", s"$vinyldnsServiceBackend", s"zones/$id/changes")
+ new VinylDNSRequest(
+ "GET",
+ s"$vinyldnsServiceBackend",
+ s"zones/$id/changes",
+ parameters = queryParameters)
executeRequest(vinyldnsRequest, request.user).map(response => {
Status(response.status)(response.body)
.withHeaders(cacheHeaders: _*)
diff --git a/modules/portal/app/views/zones/zoneTabs/zoneChangeHistory.scala.html b/modules/portal/app/views/zones/zoneTabs/zoneChangeHistory.scala.html
index 9c87d8b7e..cc47c9d2a 100644
--- a/modules/portal/app/views/zones/zoneTabs/zoneChangeHistory.scala.html
+++ b/modules/portal/app/views/zones/zoneTabs/zoneChangeHistory.scala.html
@@ -40,25 +40,26 @@
data-toggle="modal"> ACL Rules
-
{{zoneChange.zone.adminGroupName}} |
+
+ |
-
-
-
+
+ {{ getZoneHistoryPageNumber() }}
+
@@ -76,12 +77,6 @@
-
-
-
-
@@ -130,7 +125,7 @@
diff --git a/modules/portal/public/lib/controllers/controller.manageZones.js b/modules/portal/public/lib/controllers/controller.manageZones.js
index 5fcda102e..9e249b0e3 100644
--- a/modules/portal/public/lib/controllers/controller.manageZones.js
+++ b/modules/portal/public/lib/controllers/controller.manageZones.js
@@ -16,7 +16,7 @@
angular.module('controller.manageZones', [])
.controller('ManageZonesController', function ($scope, $timeout, $log, recordsService, zonesService, groupsService,
- profileService, utilityService) {
+ profileService, utilityService, pagingService) {
groupsService.getGroupsStored()
.then(function (results) {
@@ -39,7 +39,6 @@ angular.module('controller.manageZones', [])
$scope.alerts = [];
$scope.zoneInfo = {};
$scope.zoneChanges={};
- $scope.allAclRules = [];
$scope.updateZoneInfo = {};
$scope.manageZoneState = {
UPDATE: 0,
@@ -76,6 +75,9 @@ angular.module('controller.manageZones', [])
};
$scope.aclRecordTypes = ['A', 'AAAA', 'CNAME', 'DS', 'MX', 'NS', 'PTR', 'SRV', 'NAPTR', 'SSHFP', 'TXT'];
+ var zoneHistoryPaging = pagingService.getNewPagingParams(100);
+
+
/**
* Zone modal control functions
*/
@@ -288,12 +290,14 @@ angular.module('controller.manageZones', [])
};
$scope.refreshZoneChange = function() {
+ zoneHistoryPaging = pagingService.resetPaging(zoneHistoryPaging);
function success(response) {
$log.log('zonesService::getZoneChanges-success');
+ zoneHistoryPaging.next = response.data.nextId;
updateZoneChangeDisplay(response.data.zoneChanges);
}
return zonesService
- .getZoneChanges($scope.zoneId)
+ .getZoneChanges(zoneHistoryPaging.maxItems, undefined, $scope.zoneId)
.then(success)
.catch(function (error) {
handleError(error, 'zonesService::getZoneChanges-failure');
@@ -301,12 +305,14 @@ angular.module('controller.manageZones', [])
};
$scope.refreshAclRule = function (index) {
+ $scope.allAclRules = [];
for (var length = 0; length < $scope.allZonesChange[index].zone.acl.rules.length; length++) {
$scope.allAclRules.push($scope.allZonesChange[index].zone.acl.rules[length]);
- getAclUser($scope.allZonesChange[index].zone.acl.rules[length].userId, length, index);
- getAclGroup($scope.allZonesChange[index].zone.acl.rules[length].groupId, length, index);
+ if ($scope.allAclRules[length].hasOwnProperty('userId')){
+ getAclUser($scope.allAclRules[length].userId, length); }
+ else{ getAclGroup($scope.allAclRules[length].groupId, length);}
}
- }
+ };
function updateZoneChangeDisplay (zoneChange) {
$scope.allZonesChange = zoneChange;
@@ -314,6 +320,7 @@ angular.module('controller.manageZones', [])
getZoneGroup(zoneChange[length].zone.adminGroupId, length);
getZoneUser(zoneChange[length].userId, length);
}
+
};
function getZoneGroup(groupId, length) {
@@ -342,10 +349,10 @@ angular.module('controller.manageZones', [])
});
};
- function getAclGroup(groupId, length, index) {
+ function getAclGroup(groupId, length) {
function success(response) {
- $log.log('groupsService::getAclGroup-success',length);
- $scope.allZonesChange[index].zone.acl.rules[length].groupName = response.data.name;
+ $log.log('groupsService::getAclGroup-success');
+ $scope.allAclRules[length].groupName = response.data.name;
}
return groupsService
.getGroup(groupId)
@@ -355,10 +362,10 @@ angular.module('controller.manageZones', [])
});
}
- function getAclUser(userId, length, index) {
+ function getAclUser(userId, length) {
function success(response) {
- $log.log('profileService::getAclUserDataById-success',userId, length, index);
- $scope.allZonesChange[index].zone.acl.rules[length].userName = response.data.userName;
+ $log.log('profileService::getAclUserDataById-success');
+ $scope.allAclRules[length].userName = response.data.userName;
}
return profileService
.getUserDataById(userId)
@@ -368,6 +375,47 @@ angular.module('controller.manageZones', [])
});
};
+ $scope.getZoneHistoryPageNumber = function() {
+ return pagingService.getPanelTitle(zoneHistoryPaging);
+ };
+
+ $scope.prevPageEnabled = function() {
+ return pagingService.prevPageEnabled(zoneHistoryPaging);
+ };
+
+ $scope.nextPageEnabled = function(tab) {
+ return pagingService.nextPageEnabled(zoneHistoryPaging);
+ };
+
+ $scope.nextPageAllZoneHistory = function () {
+ return zonesService
+ .getZoneChanges(zoneHistoryPaging.maxItems, zoneHistoryPaging.next, $scope.zoneId )
+ .then(function(response) {
+ var zoneChanges = response.data.zoneChanges;
+ zoneHistoryPaging = pagingService.nextPageUpdate(zoneChanges, response.data.nextId, zoneHistoryPaging);
+
+ if (zoneChanges.length > 0) {
+ updateZoneChangeDisplay(response.data.zoneChanges);
+ }
+ })
+ .catch(function (error) {
+ handleError(error,'zonesService::nextPage-failure')
+ });
+ };
+
+ $scope.prevPageZoneHistory = function() {
+ var startFrom = pagingService.getPrevStartFrom(zoneHistoryPaging);
+ return zonesService
+ .getZoneChanges(zoneHistoryPaging.maxItems, startFrom, $scope.zoneId )
+ .then(function(response) {
+ zoneHistoryPaging = pagingService.prevPageUpdate(response.data.nextId, zoneHistoryPaging);
+ updateZoneChangeDisplay(response.data.zoneChanges);
+ })
+ .catch(function (error) {
+ handleError(error,'zonesService::prevPage-failure');
+ });
+ };
+
$scope.refreshAclRuleDisplay = function() {
$scope.aclRules = [];
angular.forEach($scope.zoneInfo.acl.rules, function (rule) {
diff --git a/modules/portal/public/lib/services/zones/service.zones.js b/modules/portal/public/lib/services/zones/service.zones.js
index 4fa1cd0ab..226542eec 100644
--- a/modules/portal/public/lib/services/zones/service.zones.js
+++ b/modules/portal/public/lib/services/zones/service.zones.js
@@ -33,8 +33,12 @@ angular.module('service.zones', [])
return $http.get(url);
};
- this.getZoneChanges = function (zoneId) {
- var url = '/api/zones/' + zoneId + '/changes';
+ this.getZoneChanges = function (limit, startFrom, zoneId) {
+ var params = {
+ "maxItems": limit,
+ "startFrom": startFrom
+ }
+ var url = utilityService.urlBuilder ( "/api/zones/" + zoneId + "/changes", params);
return $http.get(url);
};