Skip to content

Commit

Permalink
Merge pull request #395 from rmiccoli/issue-391-show-group-labels-in-…
Browse files Browse the repository at this point in the history
…account-home-page

WIP: Issue 391 show group labels in account home page
  • Loading branch information
andreaceccanti authored Aug 10, 2021
2 parents 7515c14 + b2d5805 commit 15f7f9f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,23 @@ <h3 class="box-title"><strong>Groups</strong></h3>
<div class="box-body">
<div ng-if="!$ctrl.user.groups.length">No groups found</div>
<div class="row iam-user-group-row" ng-repeat="group in $ctrl.user.groups | orderBy:'display' ">
<div class="iam-user-group-detail col-xs-8 col-sm-8">
<div class="iam-user-group-detail col-xs-6 col-sm-6">
<a ui-sref="group({id: group.value})" ng-if="$ctrl.isVoAdmin()">{{group.display}}</a>
<span ng-if="!$ctrl.isVoAdmin()">{{group.display}}</span>
</div>
<div class="iam-user-group-actions col-xs-4 col-sm-4 text-right">

<div class="iam-user-group-labels col-xs-4 col-sm-4">
<span class="label-pair" ng-repeat="label in $ctrl.userGroupLabels[group.value]">
<span class="label-key label">
{{$ctrl.labelName(label)}}
</span>
<span class="label-value label" ng-if="label.value">
{{label.value}}
</span>
</span>
</div>

<div class="iam-user-group-actions col-xs-2 col-sm-2 text-right">
<div class="btn-group">
<button class="btn btn-xs btn-danger" ng-click="$ctrl.openRemoveGroupDialog(group)" ng-if="$ctrl.isVoAdmin()">
<i class="fa fa-times"></i> Remove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
self.$onInit = function() {
console.log('UserGroupsController onInit');
self.enabled = true;
};
self.userGroupLabels = {};
self.labelName = labelName;

angular.forEach(self.user.groups, function(g){
self.groupLabels(g.value).then(function(res){
self.userGroupLabels[g.value] = res;
});
});
};

self.isVoAdmin = function() { return self.userCtrl.isVoAdmin(); };

Expand All @@ -35,7 +43,23 @@
});
});
};

self.groupLabels = function(groupId){

return scimFactory.getGroup(groupId).then(function(res){
var r = res.data;
var labels = r['urn:indigo-dc:scim:schemas:IndigoGroup'].labels;
return labels;
});
};

function labelName(label) {
if (label.prefix) {
return label.prefix + "/" + label.name;
}
return label.name;
}

self.openAddGroupDialog = function() {
var modalInstance = $uibModal.open({
templateUrl: '/resources/iam/apps/dashboard-app/templates/user/addusergroup.html',
Expand Down

0 comments on commit 15f7f9f

Please sign in to comment.