2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-29 13:27:43 +00:00

Resolve group edit details update

This commit is contained in:
Aravindh-Raju 2022-11-09 11:53:41 +05:30
parent 9e0a38d3b3
commit 63050e90bc
No known key found for this signature in database
GPG Key ID: 6B4D566AC36626F6

View File

@ -231,18 +231,10 @@ angular.module('controller.groups', []).controller('GroupsController', function
$("#modal_edit_group").modal("show"); $("#modal_edit_group").modal("show");
}; };
$scope.submitEditGroup = function (name, email, description) { $scope.getGroupAndUpdate = function(groupId, name, email, description) {
//prevent user executing service call multiple times function success(response) {
//if true prevent, if false allow for execution of rest of code $log.debug('groupsService::getGroup-success');
//ng-href='/groups' $scope.currentGroup = response.data;
$log.log('updateGroup::called', $scope.data);
if ($scope.processing) {
$log.log('updateGroup::processing is true; exiting');
return;
}
//flag to prevent multiple clicks until previous promise has resolved.
$scope.processing = true;
//data from user form values //data from user form values
var payload = var payload =
@ -253,7 +245,6 @@ angular.module('controller.groups', []).controller('GroupsController', function
'members': $scope.currentGroup.members, 'members': $scope.currentGroup.members,
'admins': $scope.currentGroup.admins 'admins': $scope.currentGroup.admins
}; };
if (description) { if (description) {
payload['description'] = description; payload['description'] = description;
} }
@ -267,12 +258,33 @@ angular.module('controller.groups', []).controller('GroupsController', function
$scope.refresh(); $scope.refresh();
return response.data; return response.data;
} }
return groupsService.updateGroup(groupId, payload)
return groupsService.updateGroup($scope.currentGroup.id, payload)
.then(success) .then(success)
.catch(function (error) { .catch(function (error) {
handleError(error, 'groupsService::updateGroup-failure'); handleError(error, 'groupsService::updateGroup-failure');
}); });
}
return groupsService
.getGroup(groupId)
.then(success)
.catch(function (error) {
handleError(error, 'groupsService::getGroup-failure');
});
};
$scope.submitEditGroup = function (name, email, description) {
//prevent user executing service call multiple times
//if true prevent, if false allow for execution of rest of code
//ng-href='/groups'
if ($scope.processing) {
$log.debug('updateGroup::processing is true; exiting');
return;
}
//flag to prevent multiple clicks until previous promise has resolved.
$scope.processing = true;
$scope.getGroupAndUpdate($scope.currentGroup.id, name, email, description);
}; };
$scope.confirmDeleteGroup = function (groupInfo) { $scope.confirmDeleteGroup = function (groupInfo) {