From d36174cf8d22df30425d9b9573870345f2e7bcca Mon Sep 17 00:00:00 2001 From: idrisGit Date: Sat, 19 Oct 2024 15:07:43 +0530 Subject: [PATCH] fix: breadcrumbs navigation broken for non-english language coreui/vue breadcrumbs takes name as the name the component to redirect to from the router and label to display the name in UI, since only name was provided it would display that name and use that as the component, and as the components are constant values in the Router config, it was causing not found issue Signed-off-by: idrisGit --- src/containers/DefaultContainer.vue | 25 ++++++++--- src/router/index.js | 66 ++++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/src/containers/DefaultContainer.vue b/src/containers/DefaultContainer.vue index 952ea9584..98b9b369b 100644 --- a/src/containers/DefaultContainer.vue +++ b/src/containers/DefaultContainer.vue @@ -172,12 +172,17 @@ export default { subSectionUuid, subSectionLabel, ) { + let sectionName = this.$route.meta.sectionName; let sectionLabel = this.$t(this.$route.meta.i18n); let sectionPath = this.$route.meta.sectionPath; if (crumbName && subSectionName && subSectionUuid && subSectionLabel) { return [ - { path: '', name: this.$t('message.home') }, - { path: sectionPath, name: sectionLabel }, + { path: '', name: 'Home', meta: { label: this.$t('message.home') } }, + { + path: sectionPath, + name: sectionName, + meta: { label: sectionLabel }, + }, { name: subSectionName, params: { uuid: subSectionUuid }, @@ -187,14 +192,22 @@ export default { ]; } else if (crumbName) { return [ - { path: '', name: this.$t('message.home') }, - { path: sectionPath, name: sectionLabel }, + { path: '', name: 'Home', meta: { label: this.$t('message.home') } }, + { + path: sectionPath, + name: sectionName, + meta: { label: sectionLabel }, + }, { name: crumbName, active: true }, ]; } else { return [ - { path: '', name: this.$t('message.home') }, - { path: sectionPath, name: sectionLabel }, + { path: '', name: 'Home', meta: { label: this.$t('message.home') } }, + { + path: sectionPath, + name: sectionName, + meta: { label: sectionLabel }, + }, ]; } }, diff --git a/src/router/index.js b/src/router/index.js index 68b299c55..96c9da708 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -126,6 +126,7 @@ function configRoutes() { title: i18n.t('message.dashboard'), i18n: 'message.dashboard', sectionPath: '/dashboard', + sectionName: 'Dashboard', permission: 'VIEW_PORTFOLIO', }, }, @@ -137,6 +138,7 @@ function configRoutes() { title: i18n.t('message.projects'), i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -157,6 +159,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -171,6 +174,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -185,6 +189,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -200,6 +205,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -211,6 +217,7 @@ function configRoutes() { title: i18n.t('message.component_search'), i18n: 'message.component_search', sectionPath: '/components', + sectionName: 'Component Lookup', permission: 'VIEW_PORTFOLIO', }, }, @@ -226,6 +233,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -237,6 +245,7 @@ function configRoutes() { meta: { i18n: 'message.projects', sectionPath: '/projects', + sectionName: 'Projects', permission: 'VIEW_PORTFOLIO', }, }, @@ -248,6 +257,7 @@ function configRoutes() { title: i18n.t('message.vulnerabilities'), i18n: 'message.vulnerabilities', sectionPath: '/vulnerabilities', + sectionName: 'Vulnerabilities', permission: 'VIEW_PORTFOLIO', }, }, @@ -266,6 +276,7 @@ function configRoutes() { meta: { i18n: 'message.vulnerabilities', sectionPath: '/vulnerabilities', + sectionName: 'Vulnerabilities', permission: 'VIEW_PORTFOLIO', }, }, @@ -277,6 +288,7 @@ function configRoutes() { title: i18n.t('message.tags'), i18n: 'message.tags', sectionPath: '/tags', + sectionName: 'Tags', permission: 'VIEW_PORTFOLIO', }, }, @@ -288,6 +300,7 @@ function configRoutes() { title: i18n.t('message.licenses'), i18n: 'message.licenses', sectionPath: '/licenses', + sectionName: 'Licenses', permission: 'VIEW_PORTFOLIO', }, }, @@ -305,6 +318,7 @@ function configRoutes() { meta: { i18n: 'message.licenses', sectionPath: '/licenses', + sectionName: 'Licenses', permission: 'VIEW_PORTFOLIO', }, }, @@ -317,26 +331,31 @@ function configRoutes() { title: i18n.t('message.policy_management'), i18n: 'message.policy_management', sectionPath: '/policy', + sectionName: 'Policy Management', permission: 'POLICY_MANAGEMENT', }, }, { path: 'policyViolationAudit', + name: 'Policy Violation Audit', component: PolicyViolationAudit, meta: { title: i18n.t('message.policy_violation_audit'), i18n: 'message.policy_violation_audit', - sectionPath: '/audit', + sectionPath: '/policyViolationAudit', + sectionName: 'Policy Violation Audit', permission: 'VIEW_POLICY_VIOLATION', }, }, { path: 'admin', + name: 'Admin', component: Administration, meta: { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, children: [ @@ -349,6 +368,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -359,6 +379,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -369,6 +390,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -379,6 +401,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -389,6 +412,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -399,6 +423,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -409,6 +434,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -419,6 +445,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -429,6 +456,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -440,6 +468,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -450,6 +479,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -460,6 +490,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -470,6 +501,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -480,6 +512,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -491,6 +524,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -501,6 +535,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -511,6 +546,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -522,6 +558,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -532,6 +569,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -542,6 +580,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -552,6 +591,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -562,6 +602,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -572,6 +613,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -582,6 +624,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -592,6 +635,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -602,6 +646,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -612,6 +657,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -622,6 +668,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -632,6 +679,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -642,6 +690,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -653,6 +702,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -663,6 +713,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -674,6 +725,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -684,6 +736,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -694,6 +747,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'SYSTEM_CONFIGURATION', }, }, @@ -705,6 +759,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -715,6 +770,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -725,6 +781,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -735,6 +792,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -745,6 +803,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -755,6 +814,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -765,6 +825,7 @@ function configRoutes() { title: i18n.t('message.administration'), i18n: 'message.administration', sectionPath: '/admin', + sectionName: 'Admin', permission: 'ACCESS_MANAGEMENT', }, }, @@ -781,7 +842,8 @@ function configRoutes() { meta: { title: i18n.t('message.vulnerability_audit'), i18n: 'message.vulnerability_audit', - sectionPath: '/globalAudit', + sectionPath: '/vulnerabilityAudit', + sectionName: 'Vulnerability Audit', permission: 'VIEW_VULNERABILITY', }, },