From b9d2e5f6565e95b7b6e73c457d9a6f857277379e Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Mon, 2 Dec 2019 09:57:03 +0300 Subject: [PATCH] feat(permission-management): add hide badges input --- .../lib/components/roles/roles.component.html | 1 + .../permission-management.component.html | 2 +- .../permission-management.component.ts | 29 +++++++++++++++---- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html index cf238a42499..99569afefce 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html @@ -166,5 +166,6 @@

{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewRole') | abpLocali [(visible)]="visiblePermissions" providerName="R" [providerKey]="providerKey" + [hideBadges]="true" > diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html index 5c72369c837..3e4a1ec3a3f 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html +++ b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html @@ -75,7 +75,7 @@

{{ selectedGroup?.displayName }}

[attr.for]="permission.name" (click)="onClickCheckbox(permission, permissionCheckbox.value)" >{{ permission.displayName }} - + { return this.groups$.pipe( map(groups => - this.selectedGroup ? groups.find(group => group.name === this.selectedGroup.name).permissions : [], + this.selectedGroup + ? groups.find(group => group.name === this.selectedGroup.name).permissions + : [], ), map(permissions => permissions.map( @@ -103,7 +108,11 @@ export class PermissionManagementComponent implements OnInit, OnChanges { } onClickCheckbox(clickedPermission: PermissionManagement.Permission, value) { - if (clickedPermission.isGranted && this.isGrantedByOtherProviderName(clickedPermission.grantedProviders)) return; + if ( + clickedPermission.isGranted && + this.isGrantedByOtherProviderName(clickedPermission.grantedProviders) + ) + return; setTimeout(() => { this.permissions = this.permissions.map(per => { @@ -158,7 +167,8 @@ export class PermissionManagementComponent implements OnInit, OnChanges { onClickSelectThisTab() { this.selectedGroupPermissions$.pipe(take(1)).subscribe(permissions => { permissions.forEach(permission => { - if (permission.isGranted && this.isGrantedByOtherProviderName(permission.grantedProviders)) return; + if (permission.isGranted && this.isGrantedByOtherProviderName(permission.grantedProviders)) + return; const index = this.permissions.findIndex(per => per.name === permission.name); @@ -176,7 +186,8 @@ export class PermissionManagementComponent implements OnInit, OnChanges { onClickSelectAll() { this.permissions = this.permissions.map(permission => ({ ...permission, - isGranted: this.isGrantedByOtherProviderName(permission.grantedProviders) || !this.selectAllTab, + isGranted: + this.isGrantedByOtherProviderName(permission.grantedProviders) || !this.selectAllTab, })); this.selectThisTab = !this.selectAllTab; @@ -195,7 +206,10 @@ export class PermissionManagementComponent implements OnInit, OnChanges { const changedPermissions: PermissionManagement.MinimumPermission[] = this.permissions .filter(per => - unchangedPermissions.find(unchanged => unchanged.name === per.name).isGranted === per.isGranted ? false : true, + unchangedPermissions.find(unchanged => unchanged.name === per.name).isGranted === + per.isGranted + ? false + : true, ) .map(({ name, isGranted }) => ({ name, isGranted })); @@ -255,7 +269,10 @@ export class PermissionManagementComponent implements OnInit, OnChanges { } } -function findMargin(permissions: PermissionManagement.Permission[], permission: PermissionManagement.Permission) { +function findMargin( + permissions: PermissionManagement.Permission[], + permission: PermissionManagement.Permission, +) { const parentPermission = permissions.find(per => per.name === permission.parentName); if (parentPermission && parentPermission.parentName) {