From 7126066d3fc5b51ef7f6c3c14b785b0c5ee1ed22 Mon Sep 17 00:00:00 2001 From: jamespaologarcia Date: Thu, 5 Oct 2023 17:21:10 -0700 Subject: [PATCH] 18023 incorrect name in breadcrumb (#725) * For PR - Breadcrumb fixed for logged in users * Removed unnecessary console log * Removed unnecessary getter * Updated the URL links for the breadcrumbs * Blank lines restored and added for consistency. * Updated comment and variable name --- package-lock.json | 4 ++-- package.json | 2 +- src/App.vue | 10 +++++++--- src/resources/breadcrumb-resources.ts | 8 ++++++++ src/store/getters.ts | 5 +++++ 5 files changed, 23 insertions(+), 6 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..2272c8912 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, + getRegistryHomeBreadcrumb } from '@/resources' import axios from 'axios' @@ -172,6 +173,7 @@ export default class App extends Mixins( @Getter getNrId!: number @Getter isRoleStaff!: boolean @Getter isMobile!: boolean + @Getter isRoleBasic!: boolean // Global actions @Action resetAnalyzeName!: ActionBindingIF @@ -225,11 +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.isRoleStaff) { - // If staff, set StaffDashboard as home crumb 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 9b1c56bce..5a326d802 100644 --- a/src/resources/breadcrumb-resources.ts +++ b/src/resources/breadcrumb-resources.ts @@ -10,6 +10,14 @@ export function getRegistryDashboardBreadcrumb (): BreadcrumbIF { const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') return { text: 'BC Registries and Online Services', + href: `${registryHomeUrl}` + } +} + +export function getRegistryHomeBreadcrumb (): BreadcrumbIF { + const registryHomeUrl = sessionStorage.getItem('REGISTRY_HOME_URL') + return { + text: 'BC Registries Dashboard', href: `${registryHomeUrl}dashboard/${getParams()}` } } 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