Browse Source

fix: fix mistyped config file and selector name

pull/2015/head
thediaval 7 years ago
parent
commit
73fbe7ddf1
  1. 32
      npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts
  2. 1
      npm/ng-packs/packages/theme-shared/jest.config.js

32
npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.ts

@ -7,7 +7,7 @@ import {
Output, Output,
Renderer2, Renderer2,
SimpleChanges, SimpleChanges,
TrackByFunction TrackByFunction,
} from '@angular/core'; } from '@angular/core';
import { Select, Store } from '@ngxs/store'; import { Select, Store } from '@ngxs/store';
import { from, Observable } from 'rxjs'; import { from, Observable } from 'rxjs';
@ -22,7 +22,7 @@ type PermissionWithMargin = PermissionManagement.Permission & {
@Component({ @Component({
selector: 'abp-permission-management', selector: 'abp-permission-management',
templateUrl: './permission-management.component.html' templateUrl: './permission-management.component.html',
}) })
export class PermissionManagementComponent implements OnInit, OnChanges { export class PermissionManagementComponent implements OnInit, OnChanges {
@Input() @Input()
@ -54,7 +54,7 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
@Select(PermissionManagementState.getPermissionGroups) @Select(PermissionManagementState.getPermissionGroups)
groups$: Observable<PermissionManagement.Group[]>; groups$: Observable<PermissionManagement.Group[]>;
@Select(PermissionManagementState.getEntitiyDisplayName) @Select(PermissionManagementState.getEntityDisplayName)
entityName$: Observable<string>; entityName$: Observable<string>;
selectedGroup: PermissionManagement.Group; selectedGroup: PermissionManagement.Group;
@ -72,7 +72,7 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
get selectedGroupPermissions$(): Observable<PermissionWithMargin[]> { get selectedGroupPermissions$(): Observable<PermissionWithMargin[]> {
return this.groups$.pipe( return this.groups$.pipe(
map(groups => 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<PermissionManagement.Permission[], PermissionWithMargin[]>(permissions => map<PermissionManagement.Permission[], PermissionWithMargin[]>(permissions =>
permissions.map( permissions.map(
@ -80,10 +80,10 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
(({ (({
...permission, ...permission,
margin: findMargin(permissions, permission), margin: findMargin(permissions, permission),
isGranted: this.permissions.find(per => per.name === permission.name).isGranted isGranted: this.permissions.find(per => per.name === permission.name).isGranted,
} as any) as PermissionWithMargin) } as any) as PermissionWithMargin),
) ),
) ),
); );
} }
@ -165,7 +165,7 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
this.permissions = [ this.permissions = [
...this.permissions.slice(0, index), ...this.permissions.slice(0, index),
{ ...this.permissions[index], isGranted: !this.selectThisTab }, { ...this.permissions[index], isGranted: !this.selectThisTab },
...this.permissions.slice(index + 1) ...this.permissions.slice(index + 1),
]; ];
}); });
}); });
@ -176,7 +176,7 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
onClickSelectAll() { onClickSelectAll() {
this.permissions = this.permissions.map(permission => ({ this.permissions = this.permissions.map(permission => ({
...permission, ...permission,
isGranted: !this.selectAllTab isGranted: !this.selectAllTab,
})); }));
this.selectThisTab = !this.selectAllTab; this.selectThisTab = !this.selectAllTab;
@ -190,12 +190,12 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
submit() { submit() {
this.modalBusy = true; this.modalBusy = true;
const unchangedPermissions = getPermissions( const unchangedPermissions = getPermissions(
this.store.selectSnapshot(PermissionManagementState.getPermissionGroups) this.store.selectSnapshot(PermissionManagementState.getPermissionGroups),
); );
const changedPermissions: PermissionManagement.MinimumPermission[] = this.permissions const changedPermissions: PermissionManagement.MinimumPermission[] = this.permissions
.filter(per => .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 })); .map(({ name, isGranted }) => ({ name, isGranted }));
@ -205,8 +205,8 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
new UpdatePermissions({ new UpdatePermissions({
providerKey: this.providerKey, providerKey: this.providerKey,
providerName: this.providerName, providerName: this.providerName,
permissions: changedPermissions permissions: changedPermissions,
}) }),
) )
.subscribe(() => { .subscribe(() => {
this.modalBusy = false; this.modalBusy = false;
@ -227,8 +227,8 @@ export class PermissionManagementComponent implements OnInit, OnChanges {
.dispatch( .dispatch(
new GetPermissions({ new GetPermissions({
providerKey: this.providerKey, providerKey: this.providerKey,
providerName: this.providerName providerName: this.providerName,
}) }),
) )
.pipe(pluck('PermissionManagementState', 'permissionRes')) .pipe(pluck('PermissionManagementState', 'permissionRes'))
.subscribe((permissionRes: PermissionManagement.Response) => { .subscribe((permissionRes: PermissionManagement.Response) => {

1
npm/ng-packs/packages/theme-shared/jest.config.js

@ -8,4 +8,3 @@ module.exports = {
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '<rootDir>/' } */), moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '<rootDir>/' } */),
'ts-jest': { allowSyntheticDefaultImports: true }, 'ts-jest': { allowSyntheticDefaultImports: true },
}; };
z;

Loading…
Cancel
Save