From 837f71b4a35531e0bbdfd4596baf4ce20327a2e6 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Mon, 11 Feb 2019 10:11:12 -0700 Subject: [PATCH 1/2] Fixed issue with count of required actions, also fixes SHIBUI-1213 --- ui/src/app/admin/admin.component.ts | 4 +--- ui/src/app/admin/component/enable-metadata.component.ts | 2 -- ui/src/app/dashboard/container/dashboard.component.ts | 5 +++++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/src/app/admin/admin.component.ts b/ui/src/app/admin/admin.component.ts index f4670889d..409503b6c 100644 --- a/ui/src/app/admin/admin.component.ts +++ b/ui/src/app/admin/admin.component.ts @@ -12,7 +12,5 @@ import { LoadAdminRequest } from './action/admin-collection.action'; export class AdminComponent { constructor( private store: Store - ) { - this.store.dispatch(new LoadAdminRequest()); - } + ) {} } diff --git a/ui/src/app/admin/component/enable-metadata.component.ts b/ui/src/app/admin/component/enable-metadata.component.ts index 3c463eb9d..2f2d56587 100644 --- a/ui/src/app/admin/component/enable-metadata.component.ts +++ b/ui/src/app/admin/component/enable-metadata.component.ts @@ -34,8 +34,6 @@ export class EnableMetadataComponent implements OnInit { private router: Router, private modalService: NgbModal ) { - this.store.dispatch(new LoadMetadataRequest()); - this.resolvers$ = this.store .select(fromMetadata.getMetadataCollection) .pipe( diff --git a/ui/src/app/dashboard/container/dashboard.component.ts b/ui/src/app/dashboard/container/dashboard.component.ts index 0942da7d4..35883eaec 100644 --- a/ui/src/app/dashboard/container/dashboard.component.ts +++ b/ui/src/app/dashboard/container/dashboard.component.ts @@ -7,6 +7,8 @@ import * as fromCore from '../../core/reducer'; import { Observable } from 'rxjs'; import { LoadRoleRequest } from '../../core/action/configuration.action'; import { map } from 'rxjs/operators'; +import { LoadAdminRequest } from '../../admin/action/admin-collection.action'; +import { LoadMetadataRequest } from '../../admin/action/metadata-collection.action'; @Component({ selector: 'dashboard-page', @@ -26,6 +28,9 @@ export class DashboardPageComponent { this.actionsRequired$ = this.store.select(fromAdmin.getTotalActionsRequired); this.hasActions$ = this.actionsRequired$.pipe(map(a => a > 0)); this.isAdmin$ = this.store.select(fromCore.isCurrentUserAdmin); + this.store.dispatch(new LoadRoleRequest()); + this.store.dispatch(new LoadAdminRequest()); + this.store.dispatch(new LoadMetadataRequest()); } } From 93f5e8691fddbf79ea865a267625cb1a4d66e002 Mon Sep 17 00:00:00 2001 From: Ryan Mathis Date: Mon, 11 Feb 2019 10:20:32 -0700 Subject: [PATCH 2/2] Fixed unit test --- ui/src/app/admin/admin.component.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/src/app/admin/admin.component.spec.ts b/ui/src/app/admin/admin.component.spec.ts index 909e20c03..79f45c1bd 100644 --- a/ui/src/app/admin/admin.component.spec.ts +++ b/ui/src/app/admin/admin.component.spec.ts @@ -31,8 +31,6 @@ describe('Admin Root Component', () => { it('should compile', () => { fixture.detectChanges(); - expect(fixture).toBeDefined(); - expect(store.dispatch).toHaveBeenCalled(); }); });