Skip to content

Commit

Permalink
18023 incorrect name in breadcrumb (#725)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jamespaologarcia authored Oct 6, 2023
1 parent 6659a17 commit 7126066
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 7 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ import { Routes } from '@/enums'
import { BreadcrumbIF } from '@/interfaces'
import {
getRegistryDashboardBreadcrumb,
getStaffDashboardBreadcrumb
getStaffDashboardBreadcrumb,
getRegistryHomeBreadcrumb
} from '@/resources'
import axios from 'axios'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/resources/breadcrumb-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7126066

Please sign in to comment.