Skip to content

Commit 7370d74

Browse files
authored
Merge pull request #554 from SUSE/workaround-normalizr-bug
Fix two role bugs related to Non-admins missing roles in Organisation Users page
2 parents 878c66b + 31f923f commit 7370d74

File tree

19 files changed

+687
-20
lines changed

19 files changed

+687
-20
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"ngrx-store-localstorage": "10.1.1",
8686
"ngx-moment": "^3.5.0",
8787
"ngx-monaco-editor": "^9.0.0",
88-
"normalizr": "^3.6.0",
8988
"reselect": "^4.0.0",
9089
"rxjs": "^6.6.3",
9190
"rxjs-spy": "^7.5.2",

src/frontend/packages/cf-autoscaler/src/store/autoscaler-entity-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Schema, schema } from 'normalizr';
1+
import { Schema, schema } from '../../../store/src/normalizr/normalizr';
22

33
import { getAPIResourceGuid } from '../../../cloud-foundry/src/store/selectors/api.selectors';
44
import { EntitySchema } from '../../../store/src/helpers/entity-schema';

src/frontend/packages/cloud-foundry/src/cf-entity-schema-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Schema, schema } from 'normalizr';
1+
import { Schema, schema } from '../../store/src/normalizr/normalizr';
22

33
import { EntitySchema } from '../../store/src/helpers/entity-schema';
44
import {

src/frontend/packages/cloud-foundry/src/entity-relations/entity-relations-validate.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ describe('Entity Relations - validate -', () => {
282282

283283
advancedSetup(store => {
284284
store.requestData[orgEntityKey][orgGuid].entity.spaces = [space];
285+
// Ensure the space exists in the store so when we denormalize it can correctly find it
286+
store.requestData[spaceEntityKey][space.metadata.guid] = space;
285287
return store;
286288
});
287289

src/frontend/packages/cloud-foundry/src/entity-relations/entity-relations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Action, Store } from '@ngrx/store';
2-
import { denormalize } from 'normalizr';
2+
import { denormalize } from '../../../store/src/normalizr/normalizr';
33
import { Observable, of as observableOf } from 'rxjs';
44
import { filter, first, map, mergeMap, pairwise, skipWhile, switchMap, withLatestFrom } from 'rxjs/operators';
55

src/frontend/packages/cloud-foundry/src/features/cf/cf.helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export function hasSpaceRoleWithinOrg(user: CfUser, orgGuid: string): boolean {
191191
const orgSpaces = [];
192192

193193
for (const role of roles) {
194-
const roleSpaces = user[role] as APIResource<ISpace>[];
194+
const roleSpaces = (user[role] || []) as APIResource<ISpace>[];
195195

196196
orgSpaces.push(...roleSpaces.filter((space) => {
197197
return space.entity.organization_guid === orgGuid;

src/frontend/packages/core/src/shared/components/app-action-monitor/app-action-monitor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, Input, OnInit } from '@angular/core';
2-
import { schema } from 'normalizr';
2+
import { schema } from '../../../../../store/src/normalizr/normalizr';
33
import { never as observableNever, Observable, of as observableOf } from 'rxjs';
44
import { map, publishReplay, refCount } from 'rxjs/operators';
55

src/frontend/packages/git/src/store/git-entity-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { schema } from 'normalizr';
1+
import { Schema, schema } from '../../../store/src/normalizr/normalizr';
22

33
import { EntitySchema } from '../../../store/src/helpers/entity-schema';
44
import { GitBranch, GitCommit, GitRepo } from './git.public-types';

src/frontend/packages/kubernetes/src/helm/helm-entity-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Schema, schema } from 'normalizr';
1+
import { Schema, schema } from '../../../store/src/normalizr/normalizr';
22

33
import { EntitySchema } from '../../../store/src/helpers/entity-schema';
44
import { stratosMonocularEndpointGuid } from './monocular/stratos-monocular.helper';

src/frontend/packages/kubernetes/src/kubernetes/kubernetes-entity-factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Schema, schema } from 'normalizr';
1+
import { Schema, schema } from '../../../store/src/normalizr/normalizr';
22

33
import { getAPIResourceGuid } from '../../../cloud-foundry/src/store/selectors/api.selectors';
44
import { EntitySchema } from '../../../store/src/helpers/entity-schema';

0 commit comments

Comments
 (0)