From 8c784151fc209b33b6155f4b662a790bd9339ff0 Mon Sep 17 00:00:00 2001 From: Daniel Truong Date: Thu, 20 Oct 2022 11:51:37 -0700 Subject: [PATCH] NOBUG: Updating flows to use Node 16. Minor sidebar and breadcrumb fixes (#174) --- .github/workflows/deploy_dev.yml | 10 ++++----- .github/workflows/deploy_prod.yml | 4 ++-- .github/workflows/deploy_test.yml | 4 ++-- .github/workflows/pr-linting.yaml | 2 +- .github/workflows/pr-tests.yaml | 2 +- src/app/services/breadcrumb.service.ts | 21 ++++++++++++------- .../components/sidebar/sidebar.component.ts | 2 ++ 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 5e96232..5c115fd 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -18,7 +18,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -40,7 +40,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -63,7 +63,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -113,7 +113,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -169,7 +169,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - name: Check out the repo uses: actions/checkout@v3 diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index 4d7809e..ebdfed1 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -21,7 +21,7 @@ jobs: environment: prod strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -75,7 +75,7 @@ jobs: environment: prod strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/deploy_test.yml b/.github/workflows/deploy_test.yml index 4b7a517..de913e2 100644 --- a/.github/workflows/deploy_test.yml +++ b/.github/workflows/deploy_test.yml @@ -21,7 +21,7 @@ jobs: environment: test strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 @@ -76,7 +76,7 @@ jobs: environment: test strategy: matrix: - node-version: [14.x] + node-version: [16.x] steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/pr-linting.yaml b/.github/workflows/pr-linting.yaml index e53a8ea..8e749dd 100644 --- a/.github/workflows/pr-linting.yaml +++ b/.github/workflows/pr-linting.yaml @@ -9,7 +9,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index 3b2a2f3..a988a08 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -9,7 +9,7 @@ jobs: environment: dev strategy: matrix: - node: ['14'] + node: ['16'] steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 diff --git a/src/app/services/breadcrumb.service.ts b/src/app/services/breadcrumb.service.ts index a7cbeec..ca151c4 100644 --- a/src/app/services/breadcrumb.service.ts +++ b/src/app/services/breadcrumb.service.ts @@ -20,22 +20,29 @@ export class BreadcrumbService { readonly breadcrumbs = this._breadcrumbs.asObservable(); constructor(private router: Router) { + // Initial seed + this.setBreadcrum(); + this.router.events .pipe( // Filter the NavigationEnd events as the breadcrumb is updated only when the route reaches its end filter((event) => event instanceof NavigationEnd) ) .subscribe(() => { - // Construct the breadcrumb hierarchy - const root = this.router.routerState.snapshot.root; - const breadcrumbs: Breadcrumb[] = []; - this.addBreadcrumb(root, [], breadcrumbs); - - // Emit the new hierarchy - this._breadcrumbs.next(breadcrumbs); + this.setBreadcrum(); }); } + private setBreadcrum() { + // Construct the breadcrumb hierarchy + const root = this.router.routerState.snapshot.root; + const breadcrumbs: Breadcrumb[] = []; + this.addBreadcrumb(root, [], breadcrumbs); + + // Emit the new hierarchy + this._breadcrumbs.next(breadcrumbs); + } + private addBreadcrumb( route: ActivatedRouteSnapshot, parentUrl: string[], diff --git a/src/app/shared/components/sidebar/sidebar.component.ts b/src/app/shared/components/sidebar/sidebar.component.ts index 385000f..57ce115 100644 --- a/src/app/shared/components/sidebar/sidebar.component.ts +++ b/src/app/shared/components/sidebar/sidebar.component.ts @@ -31,6 +31,8 @@ export class SidebarComponent implements OnDestroy { return keyCloakService.isAllowed('export-reports'); } else if (obj.path === 'lock-records') { return keyCloakService.isAllowed('lock-records'); + } else if (obj.path === 'login') { + return keyCloakService.isAuthenticated() ? false : true; } else { return obj.path !== '**' && obj.path !== 'unauthorized'; }