From e63e1f37ade6e214a6c539db418e7620d86d21d2 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 11:20:22 -0700 Subject: [PATCH 1/6] For PR - Breadcrumb fixed for logged in users --- package-lock.json | 4 ++-- package.json | 2 +- src/App.vue | 15 +++++++++++---- src/resources/breadcrumb-resources.ts | 8 +++++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index fa11cbce4..7af5e2458 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "name-request", - "version": "5.2.7", + "version": "5.2.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "name-request", - "version": "5.2.7", + "version": "5.2.8", "dependencies": { "@babel/compat-data": "^7.21.5", "@bcrs-shared-components/breadcrumb": "2.1.24", diff --git a/package.json b/package.json index a36d803dc..4a2021514 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "name-request", - "version": "5.2.7", + "version": "5.2.8", "private": true, "appName": "Name Request UI", "sbcName": "SBC Common Components", diff --git a/src/App.vue b/src/App.vue index eb43c6892..5b31637bc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -111,7 +111,8 @@ import { Routes } from '@/enums' import { BreadcrumbIF } from '@/interfaces' import { getRegistryDashboardBreadcrumb, - getStaffDashboardBreadcrumb + getStaffDashboardBreadcrumb, + getUserDashboardBreadcrumb } from '@/resources' import axios from 'axios' @@ -172,6 +173,8 @@ export default class App extends Mixins( @Getter getNrId!: number @Getter isRoleStaff!: boolean @Getter isMobile!: boolean + @Getter getFolioNumber!: string + @Getter isAuthenticated!: boolean // Global actions @Action resetAnalyzeName!: ActionBindingIF @@ -225,9 +228,13 @@ export default class App extends Mixins( // Set base crumbs based on user role // Staff don't want the home landing page and they can't access the Manage Business Dashboard - if (this.isRoleStaff) { - // If staff, set StaffDashboard as home crumb - crumbs.unshift(getStaffDashboardBreadcrumb()) + console.log(this.isAuthenticated) + if (this.isAuthenticated) { + if (this.isRoleStaff) { + crumbs.unshift(getStaffDashboardBreadcrumb()) + } else { + crumbs.unshift(getUserDashboardBreadcrumb()) + } } else { // For non-staff, set Home crumb crumbs.unshift(getRegistryDashboardBreadcrumb()) diff --git a/src/resources/breadcrumb-resources.ts b/src/resources/breadcrumb-resources.ts index 9b1c56bce..55d4d8122 100644 --- a/src/resources/breadcrumb-resources.ts +++ b/src/resources/breadcrumb-resources.ts @@ -13,7 +13,13 @@ export function getRegistryDashboardBreadcrumb (): BreadcrumbIF { href: `${registryHomeUrl}dashboard/${getParams()}` } } - +export function getUserDashboardBreadcrumb (): BreadcrumbIF { + const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') + return { + text: 'BC Registries Dashboard', + href: `${registryHomeUrl}dashboard/${getParams()}` + } +} export function getStaffDashboardBreadcrumb (): BreadcrumbIF { const businessUrl = sessionStorage.getItem('BUSINESSES_URL') return { From 0217e1f6939c1240abc3b637dcc4e809c11e717c Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 11:21:35 -0700 Subject: [PATCH 2/6] Removed unnecessary console log --- src/App.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 5b31637bc..438d081a0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -228,7 +228,6 @@ export default class App extends Mixins( // Set base crumbs based on user role // Staff don't want the home landing page and they can't access the Manage Business Dashboard - console.log(this.isAuthenticated) if (this.isAuthenticated) { if (this.isRoleStaff) { crumbs.unshift(getStaffDashboardBreadcrumb()) From f2c93810aa599724d01c0d277fe020f0125450c3 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 11:22:39 -0700 Subject: [PATCH 3/6] Removed unnecessary getter --- src/App.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 438d081a0..6200d6a83 100644 --- a/src/App.vue +++ b/src/App.vue @@ -173,7 +173,6 @@ export default class App extends Mixins( @Getter getNrId!: number @Getter isRoleStaff!: boolean @Getter isMobile!: boolean - @Getter getFolioNumber!: string @Getter isAuthenticated!: boolean // Global actions From 0c2834dfc7f46ab86950939c86b12c85f4ea7047 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 15:03:36 -0700 Subject: [PATCH 4/6] Updated the URL links for the breadcrumbs --- src/resources/breadcrumb-resources.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/breadcrumb-resources.ts b/src/resources/breadcrumb-resources.ts index 55d4d8122..cf1d661ec 100644 --- a/src/resources/breadcrumb-resources.ts +++ b/src/resources/breadcrumb-resources.ts @@ -10,7 +10,7 @@ export function getRegistryDashboardBreadcrumb (): BreadcrumbIF { const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') return { text: 'BC Registries and Online Services', - href: `${registryHomeUrl}dashboard/${getParams()}` + href: `${registryHomeUrl}` } } export function getUserDashboardBreadcrumb (): BreadcrumbIF { From 8cba41d9a305aefe3d270ae5e8e17fa5ff96ba05 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 15:27:09 -0700 Subject: [PATCH 5/6] Blank lines restored and added for consistency. --- src/resources/breadcrumb-resources.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resources/breadcrumb-resources.ts b/src/resources/breadcrumb-resources.ts index cf1d661ec..7a19b62f9 100644 --- a/src/resources/breadcrumb-resources.ts +++ b/src/resources/breadcrumb-resources.ts @@ -13,6 +13,7 @@ export function getRegistryDashboardBreadcrumb (): BreadcrumbIF { href: `${registryHomeUrl}` } } + export function getUserDashboardBreadcrumb (): BreadcrumbIF { const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') return { @@ -20,6 +21,7 @@ export function getUserDashboardBreadcrumb (): BreadcrumbIF { href: `${registryHomeUrl}dashboard/${getParams()}` } } + export function getStaffDashboardBreadcrumb (): BreadcrumbIF { const businessUrl = sessionStorage.getItem('BUSINESSES_URL') return { From 7b1ba7750c9d7e3ea2b649720c36f06bc244e3aa Mon Sep 17 00:00:00 2001 From: James Date: Thu, 5 Oct 2023 17:04:42 -0700 Subject: [PATCH 6/6] Updated comment and variable name --- src/App.vue | 17 ++++++++--------- src/resources/breadcrumb-resources.ts | 2 +- src/store/getters.ts | 5 +++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index 6200d6a83..2272c8912 100644 --- a/src/App.vue +++ b/src/App.vue @@ -112,7 +112,7 @@ import { BreadcrumbIF } from '@/interfaces' import { getRegistryDashboardBreadcrumb, getStaffDashboardBreadcrumb, - getUserDashboardBreadcrumb + getRegistryHomeBreadcrumb } from '@/resources' import axios from 'axios' @@ -173,7 +173,7 @@ export default class App extends Mixins( @Getter getNrId!: number @Getter isRoleStaff!: boolean @Getter isMobile!: boolean - @Getter isAuthenticated!: boolean + @Getter isRoleBasic!: boolean // Global actions @Action resetAnalyzeName!: ActionBindingIF @@ -227,14 +227,13 @@ export default class App extends Mixins( // Set base crumbs based on user role // Staff don't want the home landing page and they can't access the Manage Business Dashboard - if (this.isAuthenticated) { - if (this.isRoleStaff) { - crumbs.unshift(getStaffDashboardBreadcrumb()) - } else { - crumbs.unshift(getUserDashboardBreadcrumb()) - } + + if (this.isRoleStaff) { + crumbs.unshift(getStaffDashboardBreadcrumb()) + } else if (this.isRoleBasic) { + crumbs.unshift(getRegistryHomeBreadcrumb()) } else { - // For non-staff, set Home crumb + // If not logged in, set Registry Home Breadcrumb crumbs.unshift(getRegistryDashboardBreadcrumb()) } return crumbs diff --git a/src/resources/breadcrumb-resources.ts b/src/resources/breadcrumb-resources.ts index 7a19b62f9..5a326d802 100644 --- a/src/resources/breadcrumb-resources.ts +++ b/src/resources/breadcrumb-resources.ts @@ -14,7 +14,7 @@ export function getRegistryDashboardBreadcrumb (): BreadcrumbIF { } } -export function getUserDashboardBreadcrumb (): BreadcrumbIF { +export function getRegistryHomeBreadcrumb (): BreadcrumbIF { const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') return { text: 'BC Registries Dashboard', diff --git a/src/store/getters.ts b/src/store/getters.ts index 78ad22371..43fa6ff6b 100644 --- a/src/store/getters.ts +++ b/src/store/getters.ts @@ -1134,6 +1134,11 @@ export const isRoleStaff = (state: StateIF): boolean => { return state.stateModel.common.keycloakRoles.includes('staff') } +/** Whether the user has "staff" keycloak role. */ +export const isRoleBasic = (state: StateIF): boolean => { + return state.stateModel.common.keycloakRoles.includes('basic') || state.stateModel.common.keycloakRoles.includes('premium') +} + /** The staff payment. */ export const getStaffPayment = (state: StateIF): StaffPaymentIF => { return state.stateModel.staffPayment