Unverified Commit 04e88f85 authored by JR's avatar JR Committed by GitHub
Browse files

fix(frontend): add confirm dialog on modify recursive entries and added change...

fix(frontend): add confirm dialog on modify recursive entries and added change all events API (#1593)

fixes issue #1337
parent 1dfb6b9a
......@@ -21,11 +21,11 @@ function svcEntry($resource) {
svcLDAP.$inject = ["$resource"];
function svcLDAP($resource) {
return $resource('/:qry',{ qry: '@qry' }, {
return $resource('/:action/:qry',{ qry: '@qry' }, {
list_groups: {
method: 'GET',
isArray: true,
params: { qry: 'list_ldap_groups'}
params: { action: 'list_ldap_groups'}
}
});
}
<div>
<select class="form-control"
<input type="text" ng-model="$ctrl.group_selected" placeholder="Escriu el grup"
ng-if="$ctrl.editable"
ng-options="name for name in $ctrl.available_groups"
ng-model="$ctrl.group_selected"
ng-required="!$ctrl.ngModel.$valid"
ng-change="$ctrl.add_ldap_group()">
<option selected value="">Select groups</option>
</select>
<div class="text-danger" role="alert" ng-show="$ctrl.err">
{{ $ctrl.err }}
uib-typeahead="name for name in $ctrl.getGroups($viewValue)"
typeahead-on-select="$ctrl.add_ldap_group()"
typeahead-loading="$ctrl.loadingGroups"
typeahead-no-results="$ctrl.noResults"
class="form-control">
<i ng-show="$ctrl.loadingGroups" class="fas fa-refresh"></i>
<div ng-show="$ctrl.noResults">
<i class="fas fa-times"></i> No Results Found
</div>
<div class="container-fluid">
<div class="d-inline-flex mr-2 mt-2"
ng-repeat="group in $ctrl.selected_groups">
......
......@@ -18,6 +18,7 @@ function grpCtrl(apiLDAP, $scope, $timeout) {
const msgError = msg => { self.err = msg; $timeout(() => self.err=null,2000)};
self.available_groups = [];
self.group_selected = null;
self.$onInit = () => {
self.ngModel.$render = () => {
self.selected_groups = self.ngModel.$viewValue;
......@@ -27,8 +28,10 @@ function grpCtrl(apiLDAP, $scope, $timeout) {
self.required = Object.prototype.hasOwnProperty.call(self.ngModel.$validators,"required");
if (self.required) self.ngModel.$setValidity("required",!!value.length);
});
apiLDAP.list_groups({}, res => self.available_groups = res)
self.getGroups()
};
self.getGroups = async qry => await apiLDAP.list_groups({ qry }).$promise
self.add_ldap_group = () => {
if (!self.group_selected) return;
if (self.selected_groups.indexOf(self.group_selected) >= 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment