2018-07-27 10:18:29 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2018 Comcast Cable Communications Management, LLC
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
angular.module('controller.manageZones', [])
|
|
|
|
.controller('ManageZonesController', function ($scope, $timeout, $log, recordsService, zonesService, groupsService,
|
2022-07-22 16:58:26 +05:30
|
|
|
profileService, utilityService, pagingService) {
|
2018-07-27 10:18:29 -04:00
|
|
|
|
2019-08-21 14:26:51 -04:00
|
|
|
groupsService.getGroupsStored()
|
2018-07-27 10:18:29 -04:00
|
|
|
.then(function (results) {
|
|
|
|
$scope.myGroups = results.groups;
|
|
|
|
})
|
|
|
|
.catch(function (error){
|
|
|
|
handleError(error, 'getMyGroup:get-groups-failure');
|
|
|
|
});
|
|
|
|
|
2019-05-06 11:51:27 -04:00
|
|
|
zonesService.getBackendIds().then(function (results) {
|
|
|
|
if (results.data) {
|
|
|
|
$scope.backendIds = results.data;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-27 10:18:29 -04:00
|
|
|
/**
|
|
|
|
* Zone scope data initial setup
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.alerts = [];
|
|
|
|
$scope.zoneInfo = {};
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.zoneChanges = {};
|
2018-07-27 10:18:29 -04:00
|
|
|
$scope.updateZoneInfo = {};
|
|
|
|
$scope.manageZoneState = {
|
|
|
|
UPDATE: 0,
|
|
|
|
CONFIRM_UPDATE: 1
|
|
|
|
};
|
2022-05-06 16:19:15 -04:00
|
|
|
$scope.allGroups = [];
|
2018-07-27 10:18:29 -04:00
|
|
|
|
2020-10-23 15:23:01 -04:00
|
|
|
$scope.keyAlgorithms = ['HMAC-MD5', 'HMAC-SHA1', 'HMAC-SHA224', 'HMAC-SHA256', 'HMAC-SHA384', 'HMAC-SHA512'];
|
|
|
|
|
2018-07-27 10:18:29 -04:00
|
|
|
/**
|
|
|
|
* Acl scope data initial setup
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.aclTypes = ['User', 'Group'];
|
|
|
|
$scope.aclAccessLevels = ['Read', 'Write', 'Delete', 'No Access'];
|
|
|
|
$scope.currentAclRule = {};
|
|
|
|
$scope.currentAclRuleIndex = {};
|
|
|
|
$scope.aclRules = [];
|
|
|
|
$scope.aclModalState = {
|
|
|
|
CREATE: 0,
|
|
|
|
UPDATE: 1,
|
|
|
|
CONFIRM_UPDATE: 2,
|
2022-07-25 18:04:12 +05:30
|
|
|
CONFIRM_DELETE: 3,
|
|
|
|
VIEW_DETAILS: 4
|
2018-07-27 10:18:29 -04:00
|
|
|
};
|
|
|
|
$scope.aclModalParams = {
|
|
|
|
readOnly: {
|
|
|
|
class: '',
|
|
|
|
readOnly: true
|
|
|
|
},
|
|
|
|
editable: {
|
|
|
|
class: 'acl-edit',
|
|
|
|
readOnly: false
|
|
|
|
}
|
|
|
|
};
|
2019-06-21 12:14:08 -04:00
|
|
|
$scope.aclRecordTypes = ['A', 'AAAA', 'CNAME', 'DS', 'MX', 'NS', 'PTR', 'SRV', 'NAPTR', 'SSHFP', 'TXT'];
|
2018-07-27 10:18:29 -04:00
|
|
|
|
2022-07-22 16:58:26 +05:30
|
|
|
var zoneHistoryPaging = pagingService.getNewPagingParams(100);
|
|
|
|
|
2018-07-27 10:18:29 -04:00
|
|
|
/**
|
|
|
|
* Zone modal control functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.clickUpdateZone = function() {
|
|
|
|
$scope.currentManageZoneState = $scope.manageZoneState.CONFIRM_UPDATE;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.cancelUpdateZone = function() {
|
|
|
|
$scope.currentManageZoneState = $scope.manageZoneState.UPDATE;
|
|
|
|
};
|
|
|
|
|
2019-05-10 14:49:24 -04:00
|
|
|
$scope.confirmDeleteZone = function() {
|
|
|
|
$("#delete_zone_connection_modal").modal("show");
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.submitDeleteZone = function() {
|
|
|
|
zonesService.delZone($scope.zoneInfo.id)
|
|
|
|
.then(function (response) {
|
|
|
|
$("#delete_zone_connection_modal").modal("hide");
|
|
|
|
var msg = response.statusText + " (HTTP "+response.status+"): " + response.data.changeType + " zone '" + response.data.zone.name + "'";
|
|
|
|
$scope.alerts.push({type: "success", content: msg});
|
|
|
|
$timeout(function(){
|
|
|
|
location.href = "/zones";
|
|
|
|
}, 2000);
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
$("#delete_zone_connection_modal").modal("hide");
|
|
|
|
$scope.zoneError = true;
|
|
|
|
handleError(error, 'zonesService::sendZone-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-07-27 10:18:29 -04:00
|
|
|
/**
|
|
|
|
* Acl modal control functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.clickCreateAclRule = function() {
|
|
|
|
$scope.currentAclRule = {
|
|
|
|
priority: 'User',
|
|
|
|
accessLevel: 'Read'
|
|
|
|
};
|
|
|
|
$scope.aclModal = {
|
|
|
|
action: $scope.aclModalState.CREATE,
|
|
|
|
title: 'Create ACL Rule',
|
|
|
|
details: $scope.aclModalParams.editable
|
|
|
|
};
|
|
|
|
$scope.addAclRuleForm.$setPristine();
|
|
|
|
$('#acl_modal').modal('show');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.clickDeleteAclRule = function(index) {
|
|
|
|
$scope.currentAclRuleIndex = index;
|
|
|
|
$scope.currentAclRule = $scope.aclRules[index];
|
|
|
|
$scope.aclModal = {
|
|
|
|
action: $scope.aclModalState.CONFIRM_DELETE,
|
|
|
|
title: 'Delete ACL Rule',
|
|
|
|
details: $scope.aclModalParams.readOnly
|
|
|
|
};
|
|
|
|
$('#acl_modal').modal('show');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.clickUpdateAclRule = function(index) {
|
|
|
|
$scope.currentAclRuleIndex = index;
|
|
|
|
$scope.currentAclRule = angular.copy($scope.aclRules[index]);
|
|
|
|
$scope.aclModal = {
|
|
|
|
action: $scope.aclModalState.UPDATE,
|
|
|
|
title: 'Update ACL Rule',
|
|
|
|
details: $scope.aclModalParams.editable
|
|
|
|
};
|
|
|
|
$('#acl_modal').modal('show');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.confirmUpdateAclRule = function (bool) {
|
|
|
|
if (bool) {
|
|
|
|
$scope.aclModal.action = $scope.aclModalState.CONFIRM_UPDATE;
|
|
|
|
} else {
|
|
|
|
$scope.aclModal.action = $scope.aclModalState.UPDATE;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.closeAclModal = function() {
|
|
|
|
$scope.addAclRuleForm.$setPristine();
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.clearForm = function() {
|
|
|
|
$scope.currentAclRule = {
|
|
|
|
priority: 'User',
|
|
|
|
accessLevel: 'Read'
|
|
|
|
};
|
|
|
|
$scope.addAclRuleForm.$setPristine();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Zone form submission functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.submitUpdateZone = function () {
|
|
|
|
var zone = angular.copy($scope.updateZoneInfo);
|
|
|
|
zone = zonesService.normalizeZoneDates(zone);
|
|
|
|
zone = zonesService.setConnectionKeys(zone);
|
2019-05-06 11:51:27 -04:00
|
|
|
zone = zonesService.checkBackendId(zone);
|
2019-06-21 11:11:20 -04:00
|
|
|
zone = zonesService.checkSharedStatus(zone);
|
2018-07-27 10:18:29 -04:00
|
|
|
$scope.currentManageZoneState = $scope.manageZoneState.UPDATE;
|
|
|
|
$scope.updateZone(zone, 'Zone Update');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.submitDeleteAclRule = function() {
|
|
|
|
var newZone = angular.copy($scope.zoneInfo);
|
|
|
|
newZone = zonesService.normalizeZoneDates(newZone);
|
|
|
|
newZone.acl.rules.splice($scope.currentAclRuleIndex, 1);
|
|
|
|
$scope.updateZone(newZone, 'ACL Rule Delete');
|
|
|
|
$("#acl_modal").modal('hide');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.submitAclRule = function(type) {
|
|
|
|
if ($scope.addAclRuleForm.$valid) {
|
|
|
|
$("#acl_modal").modal('hide');
|
|
|
|
if ($scope.currentAclRule.priority == 'User') {
|
|
|
|
profileService.getUserDataByUsername($scope.currentAclRule.userName)
|
|
|
|
.then(function (profile) {
|
|
|
|
$log.log('profileService::getUserDataByUsername-success');
|
|
|
|
$scope.currentAclRule.userId = profile.data.id;
|
|
|
|
$scope.postUserLookup(type);
|
|
|
|
})
|
|
|
|
.catch(function (error){
|
|
|
|
handleError(error, 'profileService::getUserDataByUsername-failure');
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
$scope.postUserLookup(type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.postUserLookup = function(type) {
|
|
|
|
var newRule = zonesService.toVinylAclRule($scope.currentAclRule);
|
|
|
|
var newZone = angular.copy($scope.zoneInfo);
|
|
|
|
newZone = zonesService.normalizeZoneDates(newZone);
|
|
|
|
if (type == 'Update') {
|
|
|
|
newZone.acl.rules[$scope.currentAclRuleIndex] = newRule;
|
|
|
|
$scope.updateZone(newZone, 'ACL Rule Update');
|
|
|
|
} else if (type == 'Create') {
|
|
|
|
newZone.acl.rules.push(newRule);
|
|
|
|
$scope.updateZone(newZone, 'ACL Rule Create');
|
|
|
|
}
|
|
|
|
$scope.addAclRuleForm.$setPristine();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Form helpers
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.objectsDiffer = function(left, right) {
|
|
|
|
var l = $scope.normalizeZone(left);
|
|
|
|
var r = $scope.normalizeZone(right);
|
|
|
|
return !angular.equals(l, r);
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.normalizeZone = function(zone) {
|
|
|
|
var vinyldnsZone = angular.copy(zone);
|
|
|
|
delete vinyldnsZone.adminGroupName;
|
|
|
|
delete vinyldnsZone.hiddenKey;
|
|
|
|
delete vinyldnsZone.hiddenTransferKey;
|
|
|
|
return vinyldnsZone;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.clearUpdateConnection = function() {
|
|
|
|
delete $scope.updateZoneInfo.connection;
|
|
|
|
$scope.updateZoneInfo.hiddenKey = '';
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.clearUpdateTransferConnection = function() {
|
|
|
|
delete $scope.updateZoneInfo.transferConnection;
|
|
|
|
$scope.updateZoneInfo.hiddenTransferKey = '';
|
|
|
|
};
|
|
|
|
|
|
|
|
function handleError(error, type) {
|
|
|
|
var alert = utilityService.failure(error, type);
|
|
|
|
$scope.alerts.push(alert);
|
|
|
|
$scope.processing = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function showSuccess(requestType, response) {
|
|
|
|
var msg = requestType + " " + response.statusText + " (HTTP "+response.status+"): ";
|
|
|
|
msg += $scope.zoneInfo.name + ' updated';
|
|
|
|
$scope.alerts.push({type: "success", content: msg});
|
|
|
|
$timeout($scope.refreshZone(), 2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Global data-updating functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.refreshZone = function() {
|
|
|
|
function success(response) {
|
|
|
|
$log.log('recordsService::getZone-success');
|
|
|
|
$scope.zoneInfo = response.data.zone;
|
|
|
|
$scope.updateZoneInfo = angular.copy($scope.zoneInfo);
|
|
|
|
$scope.updateZoneInfo.hiddenKey = '';
|
|
|
|
$scope.updateZoneInfo.hiddenTransferKey = '';
|
|
|
|
$scope.currentManageZoneState = $scope.manageZoneState.UPDATE;
|
|
|
|
$scope.refreshAclRuleDisplay();
|
2022-07-26 15:00:48 +05:30
|
|
|
$scope.refreshZoneChange();
|
2018-07-27 10:18:29 -04:00
|
|
|
}
|
|
|
|
return recordsService
|
|
|
|
.getZone($scope.zoneId)
|
|
|
|
.then(success)
|
|
|
|
.catch(function (error){
|
|
|
|
handleError(error, 'recordsService::getZone-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-07-22 10:14:58 +05:30
|
|
|
$scope.refreshZoneChange = function() {
|
2022-07-22 16:58:26 +05:30
|
|
|
zoneHistoryPaging = pagingService.resetPaging(zoneHistoryPaging);
|
2022-07-22 10:14:58 +05:30
|
|
|
function success(response) {
|
|
|
|
$log.log('zonesService::getZoneChanges-success');
|
2022-07-22 16:58:26 +05:30
|
|
|
zoneHistoryPaging.next = response.data.nextId;
|
2022-07-26 15:00:48 +05:30
|
|
|
$scope.zoneChanges = response.data.zoneChanges;
|
|
|
|
$scope.updateZoneChangeDisplay(response.data.zoneChanges);
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
return zonesService
|
2022-07-22 16:58:26 +05:30
|
|
|
.getZoneChanges(zoneHistoryPaging.maxItems, undefined, $scope.zoneId)
|
2022-07-22 10:14:58 +05:30
|
|
|
.then(success)
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error, 'zonesService::getZoneChanges-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.refreshAclRule = function (index) {
|
2022-07-22 16:58:26 +05:30
|
|
|
$scope.allAclRules = [];
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.aclRulesModal = {
|
|
|
|
action: $scope.aclModalState.VIEW_DETAILS,
|
|
|
|
title: "ACL Rules Info",
|
|
|
|
basics: $scope.aclModalParams.readOnly,
|
|
|
|
details: $scope.aclModalParams.readOnly,
|
|
|
|
};
|
|
|
|
if ($scope.zoneChanges[index].zone.acl.rules.length!=0){
|
|
|
|
for (var length = 0; length < $scope.zoneChanges[index].zone.acl.rules.length; length++) {
|
|
|
|
$scope.allAclRules.push($scope.zoneChanges[index].zone.acl.rules[length]);
|
2022-07-22 16:58:26 +05:30
|
|
|
if ($scope.allAclRules[length].hasOwnProperty('userId')){
|
|
|
|
getAclUser($scope.allAclRules[length].userId, length); }
|
|
|
|
else{ getAclGroup($scope.allAclRules[length].groupId, length);}
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.aclModalViewForm.$setPristine();
|
|
|
|
$("#aclModalView").modal("show");}
|
|
|
|
else{$("#aclModalView").modal("hide");}
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.closeAclModalView = function() {
|
|
|
|
$scope.aclModalViewForm.$setPristine();
|
2022-07-22 16:58:26 +05:30
|
|
|
};
|
2022-07-22 10:14:58 +05:30
|
|
|
|
2022-07-26 15:00:48 +05:30
|
|
|
$scope.updateZoneChangeDisplay = function (zoneChange) {
|
2022-07-22 10:14:58 +05:30
|
|
|
for (var length = 0; length < zoneChange.length; length++) {
|
|
|
|
getZoneGroup(zoneChange[length].zone.adminGroupId, length);
|
2022-07-26 18:02:55 +05:30
|
|
|
getZoneUser(zoneChange[length].userId, length);
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.refreshAclRuleDisplay = function() {
|
|
|
|
$scope.aclRules = [];
|
|
|
|
angular.forEach($scope.zoneInfo.acl.rules, function (rule) {
|
|
|
|
$scope.aclRules.push(zonesService.toDisplayAclRule(rule));
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get User name and Group Name with Ids for Zone history
|
|
|
|
*/
|
|
|
|
|
2022-07-22 10:14:58 +05:30
|
|
|
function getZoneGroup(groupId, length) {
|
|
|
|
function success(response) {
|
|
|
|
$log.log('groupsService::getZoneGroup-success');
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.zoneChanges[length].zone.adminGroupName = response.data.name;
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
return groupsService
|
|
|
|
.getGroup(groupId)
|
|
|
|
.then(success)
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error, 'groupsService::getZoneGroup-failure');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getZoneUser(userId, length) {
|
|
|
|
function success(response) {
|
|
|
|
$log.log('profileService::getZoneUserDataById-success');
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.zoneChanges[length].userName = response.data.userName;
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
return profileService
|
|
|
|
.getUserDataById(userId)
|
|
|
|
.then(success)
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error, 'profileService::getZoneUserDataById-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-07-22 16:58:26 +05:30
|
|
|
function getAclGroup(groupId, length) {
|
2022-07-22 10:14:58 +05:30
|
|
|
function success(response) {
|
2022-07-22 16:58:26 +05:30
|
|
|
$log.log('groupsService::getAclGroup-success');
|
|
|
|
$scope.allAclRules[length].groupName = response.data.name;
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
return groupsService
|
|
|
|
.getGroup(groupId)
|
|
|
|
.then(success)
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error, 'groupsService::getAclGroup-failure');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-07-22 16:58:26 +05:30
|
|
|
function getAclUser(userId, length) {
|
2022-07-22 10:14:58 +05:30
|
|
|
function success(response) {
|
2022-07-22 16:58:26 +05:30
|
|
|
$log.log('profileService::getAclUserDataById-success');
|
|
|
|
$scope.allAclRules[length].userName = response.data.userName;
|
2022-07-22 10:14:58 +05:30
|
|
|
}
|
|
|
|
return profileService
|
|
|
|
.getUserDataById(userId)
|
|
|
|
.then(success)
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error, 'profileService::getAclUserDataById-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2022-07-25 18:04:12 +05:30
|
|
|
/**
|
|
|
|
* Zone history Pagination
|
|
|
|
*/
|
|
|
|
|
2022-07-22 16:58:26 +05:30
|
|
|
$scope.getZoneHistoryPageNumber = function() {
|
|
|
|
return pagingService.getPanelTitle(zoneHistoryPaging);
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.prevPageEnabled = function() {
|
|
|
|
return pagingService.prevPageEnabled(zoneHistoryPaging);
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.nextPageEnabled = function(tab) {
|
|
|
|
return pagingService.nextPageEnabled(zoneHistoryPaging);
|
|
|
|
};
|
|
|
|
|
2022-07-25 18:04:12 +05:30
|
|
|
$scope.nextPageZoneHistory = function () {
|
2022-07-22 16:58:26 +05:30
|
|
|
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) {
|
2022-07-26 18:02:55 +05:30
|
|
|
$scope.zoneChanges = response.data.zoneChanges;
|
2022-07-26 18:11:54 +05:30
|
|
|
$scope.updateZoneChangeDisplay(response.data.zoneChanges)
|
2022-07-22 16:58:26 +05:30
|
|
|
}
|
|
|
|
})
|
|
|
|
.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);
|
2022-07-26 18:02:55 +05:30
|
|
|
$scope.zoneChanges = response.data.zoneChanges;
|
2022-07-26 18:11:54 +05:30
|
|
|
$scope.updateZoneChangeDisplay(response.data.zoneChanges);
|
2022-07-22 16:58:26 +05:30
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
handleError(error,'zonesService::prevPage-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2018-07-27 10:18:29 -04:00
|
|
|
/**
|
|
|
|
* Service interaction functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
$scope.updateZone = function(zone, message) {
|
|
|
|
return zonesService
|
|
|
|
.updateZone($scope.zoneId, zone)
|
|
|
|
.then(function(response){showSuccess(message, response)})
|
|
|
|
.catch(function (error){
|
|
|
|
$timeout($scope.refreshZone(), 1000);
|
|
|
|
handleError(error, 'zonesService::updateZone-failure');
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$timeout($scope.refreshZone, 0);
|
|
|
|
});
|