diff --git a/src/components/Menu.vue b/src/components/Menu.vue
index 31c96a72..7390808d 100644
--- a/src/components/Menu.vue
+++ b/src/components/Menu.vue
@@ -7,18 +7,17 @@
-
-
- {{ $t("Create Rule") }}
-
-
-
- {{ $t("Rule Pipeline") }}
-
-
-
- {{ $t("Settings") }}
-
+
+
+
+ {{ page.title }}
+
+
@@ -54,14 +53,14 @@
IonLabel,
IonList,
IonMenu,
+ IonMenuToggle,
IonNote,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar,
- menuController
} from "@ionic/vue";
- import { defineComponent } from "vue";
+ import { defineComponent, computed } from "vue";
import { mapGetters } from "vuex";
import { useStore } from "@/store";
import { hasPermission } from "@/authorization";
@@ -80,6 +79,7 @@
IonLabel,
IonList,
IonMenu,
+ IonMenuToggle,
IonNote,
IonSelect,
IonSelectOption,
@@ -95,26 +95,61 @@
})
},
methods: {
- async closeMenu() {
- await menuController.close();
- },
async setEComStore(event: CustomEvent) {
if(this.eComStore.productStoreId !== event.detail.value) {
await this.store.dispatch('user/setEcomStore', { 'productStoreId': event.detail.value })
emitter.emit("productStoreChanged")
}
+ },
+ getValidMenuItems(appPages: any) {
+ return appPages.filter((appPage: any) => (!appPage.meta || !appPage.meta.permissionId) || hasPermission(appPage.meta.permissionId));
}
},
setup() {
const store = useStore();
const router = useRouter();
+ const appPages = [
+ {
+ title: "Create Rule",
+ url: "/select-product",
+ iosIcon: optionsOutline,
+ mdIcon: optionsOutline,
+ meta: {
+ permissionId: "APP_SELECT_PRODUCT_VIEW"
+
+ }
+ },
+ {
+ title: "Rule Pipeline",
+ url: "/threshold-updates",
+ iosIcon: pulseOutline,
+ mdIcon: pulseOutline,
+ meta: {
+ permissionId: "APP_THRESHOLD_UPDATES_VIEW"
+ }
+ },
+ {
+ title: "Settings",
+ url: "/settings",
+ iosIcon: settingsOutline,
+ mdIcon: settingsOutline
+ }
+ ];
+
+ const selectedIndex = computed(() => {
+ const path = router.currentRoute.value.path;
+ return appPages.findIndex((screen) => screen.url === path);
+ });
+
return {
+ appPages,
+ hasPermission,
router,
pulseOutline,
- hasPermission,
optionsOutline,
settingsOutline,
- store
+ selectedIndex,
+ store,
};
},
});