mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-09-01 23:05:15 +00:00
Added pagination in zone history tab
This commit is contained in:
@@ -432,8 +432,16 @@ class VinylDNS @Inject() (
|
|||||||
}
|
}
|
||||||
|
|
||||||
def getZoneChange(id: String): Action[AnyContent] = userAction.async { implicit request =>
|
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 =
|
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 => {
|
executeRequest(vinyldnsRequest, request.user).map(response => {
|
||||||
Status(response.status)(response.body)
|
Status(response.status)(response.body)
|
||||||
.withHeaders(cacheHeaders: _*)
|
.withHeaders(cacheHeaders: _*)
|
||||||
|
@@ -40,25 +40,26 @@
|
|||||||
data-toggle="modal"> ACL Rules
|
data-toggle="modal"> ACL Rules
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td><a>{{zoneChange.zone.adminGroupName}}</a></td>
|
<td><a ng-bind="zoneChange.zone.adminGroupName" href="/groups/{{zoneChange.zone.adminGroupId}}"></a>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!-- PAGINATION -->
|
<!-- PAGINATION -->
|
||||||
<div class="dataTables_paginate">
|
<div class="dataTables_paginate vinyldns_zones_paginate">
|
||||||
|
<span class="vinyldns_zones_page_number">{{ getZoneHistoryPageNumber() }}</span>
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<li class="paginate_button previous">
|
<li class="paginate_button previous">
|
||||||
<a ng-if="changePrevPageEnabled()" ng-click="changePrevPage()" class="paginate_button">Previous</a>
|
<a ng-if="prevPageEnabled()" ng-click="prevPageZoneHistory()" class="paginate_button">Previous</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="paginate_button next">
|
<li class="paginate_button next">
|
||||||
<a ng-if="changeNextPageEnabled()" ng-click="changeNextPage()" class="paginate_button">Next</a>
|
<a ng-if="nextPageEnabled()" ng-click="nextPageAllZoneHistory()" class="paginate_button">Next</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- END PAGINATION -->
|
<!-- END PAGINATION -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer"></div>
|
<div class="panel-footer"></div>
|
||||||
<!-- END SIMPLE DATATABLE -->
|
<!-- END SIMPLE DATATABLE -->
|
||||||
@@ -76,12 +77,6 @@
|
|||||||
|
|
||||||
<!-- Modal body -->
|
<!-- Modal body -->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="btn-group">
|
|
||||||
<button id="refresh-acl-rules-button" class="btn btn-default" ng-click="refreshAclRule()">
|
|
||||||
<span class="fa fa-refresh"></span> Refresh
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table id="aclRuleTable" class="table table-hover table-striped">
|
<table id="aclRuleTable" class="table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -130,7 +125,7 @@
|
|||||||
|
|
||||||
<!-- Modal footer -->
|
<!-- Modal footer -->
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
angular.module('controller.manageZones', [])
|
angular.module('controller.manageZones', [])
|
||||||
.controller('ManageZonesController', function ($scope, $timeout, $log, recordsService, zonesService, groupsService,
|
.controller('ManageZonesController', function ($scope, $timeout, $log, recordsService, zonesService, groupsService,
|
||||||
profileService, utilityService) {
|
profileService, utilityService, pagingService) {
|
||||||
|
|
||||||
groupsService.getGroupsStored()
|
groupsService.getGroupsStored()
|
||||||
.then(function (results) {
|
.then(function (results) {
|
||||||
@@ -39,7 +39,6 @@ angular.module('controller.manageZones', [])
|
|||||||
$scope.alerts = [];
|
$scope.alerts = [];
|
||||||
$scope.zoneInfo = {};
|
$scope.zoneInfo = {};
|
||||||
$scope.zoneChanges={};
|
$scope.zoneChanges={};
|
||||||
$scope.allAclRules = [];
|
|
||||||
$scope.updateZoneInfo = {};
|
$scope.updateZoneInfo = {};
|
||||||
$scope.manageZoneState = {
|
$scope.manageZoneState = {
|
||||||
UPDATE: 0,
|
UPDATE: 0,
|
||||||
@@ -76,6 +75,9 @@ angular.module('controller.manageZones', [])
|
|||||||
};
|
};
|
||||||
$scope.aclRecordTypes = ['A', 'AAAA', 'CNAME', 'DS', 'MX', 'NS', 'PTR', 'SRV', 'NAPTR', 'SSHFP', 'TXT'];
|
$scope.aclRecordTypes = ['A', 'AAAA', 'CNAME', 'DS', 'MX', 'NS', 'PTR', 'SRV', 'NAPTR', 'SSHFP', 'TXT'];
|
||||||
|
|
||||||
|
var zoneHistoryPaging = pagingService.getNewPagingParams(100);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zone modal control functions
|
* Zone modal control functions
|
||||||
*/
|
*/
|
||||||
@@ -288,12 +290,14 @@ angular.module('controller.manageZones', [])
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.refreshZoneChange = function() {
|
$scope.refreshZoneChange = function() {
|
||||||
|
zoneHistoryPaging = pagingService.resetPaging(zoneHistoryPaging);
|
||||||
function success(response) {
|
function success(response) {
|
||||||
$log.log('zonesService::getZoneChanges-success');
|
$log.log('zonesService::getZoneChanges-success');
|
||||||
|
zoneHistoryPaging.next = response.data.nextId;
|
||||||
updateZoneChangeDisplay(response.data.zoneChanges);
|
updateZoneChangeDisplay(response.data.zoneChanges);
|
||||||
}
|
}
|
||||||
return zonesService
|
return zonesService
|
||||||
.getZoneChanges($scope.zoneId)
|
.getZoneChanges(zoneHistoryPaging.maxItems, undefined, $scope.zoneId)
|
||||||
.then(success)
|
.then(success)
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
handleError(error, 'zonesService::getZoneChanges-failure');
|
handleError(error, 'zonesService::getZoneChanges-failure');
|
||||||
@@ -301,12 +305,14 @@ angular.module('controller.manageZones', [])
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.refreshAclRule = function (index) {
|
$scope.refreshAclRule = function (index) {
|
||||||
|
$scope.allAclRules = [];
|
||||||
for (var length = 0; length < $scope.allZonesChange[index].zone.acl.rules.length; length++) {
|
for (var length = 0; length < $scope.allZonesChange[index].zone.acl.rules.length; length++) {
|
||||||
$scope.allAclRules.push($scope.allZonesChange[index].zone.acl.rules[length]);
|
$scope.allAclRules.push($scope.allZonesChange[index].zone.acl.rules[length]);
|
||||||
getAclUser($scope.allZonesChange[index].zone.acl.rules[length].userId, length, index);
|
if ($scope.allAclRules[length].hasOwnProperty('userId')){
|
||||||
getAclGroup($scope.allZonesChange[index].zone.acl.rules[length].groupId, length, index);
|
getAclUser($scope.allAclRules[length].userId, length); }
|
||||||
|
else{ getAclGroup($scope.allAclRules[length].groupId, length);}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function updateZoneChangeDisplay (zoneChange) {
|
function updateZoneChangeDisplay (zoneChange) {
|
||||||
$scope.allZonesChange = zoneChange;
|
$scope.allZonesChange = zoneChange;
|
||||||
@@ -314,6 +320,7 @@ angular.module('controller.manageZones', [])
|
|||||||
getZoneGroup(zoneChange[length].zone.adminGroupId, length);
|
getZoneGroup(zoneChange[length].zone.adminGroupId, length);
|
||||||
getZoneUser(zoneChange[length].userId, length);
|
getZoneUser(zoneChange[length].userId, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getZoneGroup(groupId, 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) {
|
function success(response) {
|
||||||
$log.log('groupsService::getAclGroup-success',length);
|
$log.log('groupsService::getAclGroup-success');
|
||||||
$scope.allZonesChange[index].zone.acl.rules[length].groupName = response.data.name;
|
$scope.allAclRules[length].groupName = response.data.name;
|
||||||
}
|
}
|
||||||
return groupsService
|
return groupsService
|
||||||
.getGroup(groupId)
|
.getGroup(groupId)
|
||||||
@@ -355,10 +362,10 @@ angular.module('controller.manageZones', [])
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAclUser(userId, length, index) {
|
function getAclUser(userId, length) {
|
||||||
function success(response) {
|
function success(response) {
|
||||||
$log.log('profileService::getAclUserDataById-success',userId, length, index);
|
$log.log('profileService::getAclUserDataById-success');
|
||||||
$scope.allZonesChange[index].zone.acl.rules[length].userName = response.data.userName;
|
$scope.allAclRules[length].userName = response.data.userName;
|
||||||
}
|
}
|
||||||
return profileService
|
return profileService
|
||||||
.getUserDataById(userId)
|
.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.refreshAclRuleDisplay = function() {
|
||||||
$scope.aclRules = [];
|
$scope.aclRules = [];
|
||||||
angular.forEach($scope.zoneInfo.acl.rules, function (rule) {
|
angular.forEach($scope.zoneInfo.acl.rules, function (rule) {
|
||||||
|
@@ -33,8 +33,12 @@ angular.module('service.zones', [])
|
|||||||
return $http.get(url);
|
return $http.get(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getZoneChanges = function (zoneId) {
|
this.getZoneChanges = function (limit, startFrom, zoneId) {
|
||||||
var url = '/api/zones/' + zoneId + '/changes';
|
var params = {
|
||||||
|
"maxItems": limit,
|
||||||
|
"startFrom": startFrom
|
||||||
|
}
|
||||||
|
var url = utilityService.urlBuilder ( "/api/zones/" + zoneId + "/changes", params);
|
||||||
return $http.get(url);
|
return $http.get(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user