2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-30 22:05:21 +00:00

Email Domains Dropdown for groups

This commit is contained in:
ssranjani06
2023-03-31 10:54:20 +05:30
parent 6cce7ec10a
commit 5ceab5a66c
5 changed files with 80 additions and 6 deletions

View File

@@ -293,6 +293,15 @@ class VinylDNS @Inject() (
})
}
def getValidEmailDomains(): Action[AnyContent] = userAction.async { implicit request =>
val vinyldnsRequest =
VinylDNSRequest("GET", s"$vinyldnsServiceBackend", s"groups/valid/domains")
executeRequest(vinyldnsRequest, request.user).map(response => {
Status(response.status)(response.body)
.withHeaders(cacheHeaders: _*)
})
}
def getAuthenticatedUserData(): Action[AnyContent] = userAction.async { implicit request =>
Future {
Ok(Json.toJson(VinylDNS.UserInfo.fromUser(request.user)))

View File

@@ -281,6 +281,24 @@
type="text"
required>
</input>
<div>
<h5>
<a data-toggle="collapse" data-target="#collapseNewGroupInstruction" aria-expanded="false" aria-controls="collapseInstruction">
<span class="badge">Valid Domains for Email <span class="fa fa-chevron-down"></span></span>
</a>
</h5>
</div>
<div class="collapse" id="collapseNewGroupInstruction">
<div class="well">
<p>
<strong>List Of Valid Email Domains:</strong>
<li ng-repeat="validDomains in validEmailDomains">
<strong>{{validDomains}} </strong>
</li>
</p>
<hr/>
</div>
</div>
<span class="help-block">The email distribution list for the group.</span>
</modal-element>
<modal-element label="Description">
@@ -297,9 +315,12 @@
</div>
</div>
<div class="modal-footer">
<button id="clear-group-button" type="button" class="btn btn-default pull-left" ng-click="reset()">Clear Form</button>
<button id="create-group-button" class="btn btn-primary pull-right">Create</button>
<button type="button" class="btn btn-default" ng-click="closeModal($evt);">Close</button>
<button id="clear-group-button" type="button" class="btn btn-default pull-left" ng-click="reset()"
data-toggle="collapse" data-target="#collapseNewGroupInstruction">Clear Form</button>
<button id="create-group-button" class="btn btn-primary pull-right"
data-toggle="collapse" data-target="#collapseNewGroupInstruction">Create</button>
<button type="button" class="btn btn-default" ng-click="closeModal($evt);"
data-toggle="collapse" data-target="#collapseNewGroupInstruction">Close</button>
</div>
</div>
</form>
@@ -343,6 +364,24 @@
type="text"
required>
</input>
<div>
<h5>
<a data-toggle="collapse" data-target="#collapseEditGroupInstruction" aria-expanded="false" aria-controls="collapseInstruction">
<span class="badge">Valid Domains for Email <span class="fa fa-chevron-down"></span></span>
</a>
</h5>
</div>
<div class="collapse" id="collapseEditGroupInstruction">
<div class="well">
<p>
<strong>List Of Valid Email Domains:</strong>
<li ng-repeat="validDomains in validEmailDomains">
<strong>{{validDomains}} </strong>
</li>
</p>
<hr/>
</div>
</div>
<span class="help-block">The email distribution list for the group.</span>
</modal-element>
<modal-element label="Description">
@@ -360,8 +399,10 @@
</div>
</div>
<div class="modal-footer">
<button id="edit-group-button" class="btn btn-primary pull-right">Update</button>
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="closeEditModal()">Close</button>
<button id="edit-group-button" class="btn btn-primary pull-right"
data-toggle="collapse" data-target="#collapseEditGroupInstruction">Update</button>
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click="closeEditModal()"
data-toggle="collapse" data-target="#collapseEditGroupInstruction">Close</button>
</div>
</div>
</form>

View File

@@ -45,6 +45,7 @@ GET /api/zones/:id/recordsetchanges @controllers.VinylDNS.listRecor
GET /api/groups @controllers.VinylDNS.getGroups
GET /api/groups/:gid @controllers.VinylDNS.getGroup(gid: String)
GET /api/groups/valid/domains @controllers.VinylDNS.getValidEmailDomains
GET /api/groups/:gid/groupchanges @controllers.VinylDNS.listGroupChanges(gid: String)
GET /api/groups/change/:gcid @controllers.VinylDNS.getGroupChange(gcid: String)
POST /api/groups @controllers.VinylDNS.newGroup

View File

@@ -28,6 +28,7 @@ angular.module('controller.groups', []).controller('GroupsController', function
$scope.ignoreAccess = false;
$scope.hasGroups = false;
$scope.query = "";
$scope.validEmailDomains= [];
// Paging status for group sets
var groupsPaging = pagingService.getNewPagingParams(100);
@@ -44,12 +45,15 @@ angular.module('controller.groups', []).controller('GroupsController', function
var modalDialog;
$scope.openModal = function (evt) {
$log.log('First entry');
$scope.currentGroup = {};
$scope.validDomains();
void (evt && evt.preventDefault());
if (!modalDialog) {
modalDialog = angular.element('#modal_new_group').modal();
}
modalDialog.modal('show');
};
$scope.closeModal = function (evt) {
@@ -69,7 +73,6 @@ angular.module('controller.groups', []).controller('GroupsController', function
$scope.refresh();
return true;
};
// Autocomplete for group search
$("#group-search-text").autocomplete({
source: function( request, response ) {
@@ -207,6 +210,21 @@ angular.module('controller.groups', []).controller('GroupsController', function
handleError(error, 'groupsService::getGroups-failure');
});
}
$scope.validDomains=function getValidEmailDomains() {
$log.log('Function Entry');
function success(response) {
$log.log('groupsService::listEmailDomains-success');
return $scope.validEmailDomains = response.data;
}
return groupsService
.listEmailDomains($scope.ignoreAccess, $scope.query)
.then(success)
.catch(function (error) {
handleError(error, 'groupsService::listEmailDomains-failure');
});
}
// Return true if there are no groups created by the user
$scope.haveNoGroups = function (groupLength) {
@@ -228,6 +246,7 @@ angular.module('controller.groups', []).controller('GroupsController', function
$scope.editGroup = function (groupInfo) {
$scope.currentGroup = groupInfo;
$scope.validDomains();
$("#modal_edit_group").modal("show");
};

View File

@@ -43,6 +43,10 @@ angular.module('service.groups', [])
var url = '/api/groups/' + id;
return $http.get(url);
};
this.listEmailDomains = function () {
var url = '/api/groups/valid/domains'
return $http.get(url);
};
this.deleteGroups = function (id) {
var url = '/api/groups/' + id;