This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-booster-ui.git


The following commit(s) were added to refs/heads/main by this push:
     new 169793bd feat: use `title` instead of `i18nKey` for menus. (#303)
169793bd is described below

commit 169793bdff84a18d67316123ce23ff019fe32cd1
Author: Fine0830 <[email protected]>
AuthorDate: Sat Jul 22 14:06:31 2023 +0800

    feat: use `title` instead of `i18nKey` for menus. (#303)
---
 src/layout/components/SideBar.vue | 12 ++++++++----
 src/router/alarm.ts               |  1 +
 src/router/dashboard.ts           |  3 +++
 src/router/marketplace.ts         |  1 +
 src/router/settings.ts            |  1 +
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/layout/components/SideBar.vue 
b/src/layout/components/SideBar.vue
index 2bf51b0c..9eca2fc5 100644
--- a/src/layout/components/SideBar.vue
+++ b/src/layout/components/SideBar.vue
@@ -36,14 +36,16 @@ limitations under the License. -->
                   <Icon size="lg" :iconName="menu.meta.icon" />
                 </el-icon>
                 <span class="title" :class="isCollapse ? 'collapse' : ''">
-                  {{ t(menu.meta.i18nKey) }}
+                  {{ te(menu.meta.i18nKey) ? t(menu.meta.i18nKey) : 
menu.meta.title }}
                 </span>
               </router-link>
             </template>
             <el-menu-item-group>
               <el-menu-item v-for="(m, idx) in filterMenus(menu.children)" 
:index="m.name" :key="idx">
                 <router-link class="items" :to="m.path">
-                  <span class="title">{{ t(m.meta && m.meta.i18nKey) }}</span>
+                  <span class="title">
+                    {{ m.meta && (te(m.meta.i18nKey) ? t(m.meta.i18nKey) : 
m.meta.title) }}
+                  </span>
                 </router-link>
               </el-menu-item>
             </el-menu-item-group>
@@ -56,7 +58,9 @@ limitations under the License. -->
             </el-icon>
             <template #title>
               <router-link class="items menu-title" 
:to="menu.children[0].path">
-                <span class="title">{{ t(menu.meta.i18nKey) }}</span>
+                <span class="title">
+                  {{ te(menu.meta.i18nKey) ? t(menu.meta.i18nKey) : 
menu.meta.title }}
+                </span>
               </router-link>
             </template>
           </el-menu-item>
@@ -75,7 +79,7 @@ limitations under the License. -->
   import { useAppStoreWithOut } from "@/store/modules/app";
 
   /*global Recordable*/
-  const { t } = useI18n();
+  const { t, te } = useI18n();
   const appStore = useAppStoreWithOut();
   const router = useRouter();
   const name = ref<string>(String(router.currentRoute.value.name));
diff --git a/src/router/alarm.ts b/src/router/alarm.ts
index dc5e19e2..f809af6f 100644
--- a/src/router/alarm.ts
+++ b/src/router/alarm.ts
@@ -26,6 +26,7 @@ export const routesAlarm: Array<RouteRecordRaw> = [
       icon: "spam",
       hasGroup: false,
       activate: true,
+      title: "Alerting",
     },
     component: Layout,
     children: [
diff --git a/src/router/dashboard.ts b/src/router/dashboard.ts
index 8ced30cf..8aaa0534 100644
--- a/src/router/dashboard.ts
+++ b/src/router/dashboard.ts
@@ -27,6 +27,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
       icon: "dashboard_customize",
       hasGroup: true,
       activate: true,
+      title: "Dashboards",
     },
     children: [
       {
@@ -36,6 +37,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
         meta: {
           i18nKey: "dashboardList",
           activate: true,
+          title: "Dashboard List",
         },
       },
       {
@@ -45,6 +47,7 @@ export const routesDashboard: Array<RouteRecordRaw> = [
         meta: {
           i18nKey: "dashboardNew",
           activate: true,
+          title: "New Dashboard",
         },
       },
       {
diff --git a/src/router/marketplace.ts b/src/router/marketplace.ts
index 56196d82..f71ab025 100644
--- a/src/router/marketplace.ts
+++ b/src/router/marketplace.ts
@@ -26,6 +26,7 @@ export const routesMarketplace: Array<RouteRecordRaw> = [
       icon: "marketplace",
       hasGroup: false,
       activate: true,
+      title: "Marketplace",
     },
     component: Layout,
     children: [
diff --git a/src/router/settings.ts b/src/router/settings.ts
index 11a78251..aa53c735 100644
--- a/src/router/settings.ts
+++ b/src/router/settings.ts
@@ -26,6 +26,7 @@ export const routesSettings: Array<RouteRecordRaw> = [
       icon: "settings",
       hasGroup: false,
       activate: true,
+      title: "Settings",
     },
     component: Layout,
     children: [

Reply via email to