Skip to content

Commit 9d97e81

Browse files
Updated env based configuration (#436)
* Updated env based configuration - Updated env based config in Vue3 Signed-off-by: Nikhil Ashoka <[email protected]> * Updated routes.js - Updated routes.js to match 1060’s routes.js * Implemented AppNavigation - Implemented AppNavigation -> AppNavigationData and ibm.js * Updated AppnavigationData - Updated AppNavigationData in Vue3 * Fixed ibm.js for AppNav - Fixed ibm.js file for AppNav in Vue3 * Fixed icons for AppNavigation - Fixed icons for the Left menu for vue3 * Fixed env stores - Fixed env stores in Vue3 --------- Signed-off-by: Nikhil Ashoka <[email protected]>
1 parent 5fb0ec9 commit 9d97e81

File tree

108 files changed

+1248
-2209
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+1248
-2209
lines changed

src/components/AppHeader/AppHeader.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ import IconMenu from '@carbon/icons-vue/es/menu/20';
119119
import IconRenew from '@carbon/icons-vue/es/renew/20';
120120
import StatusIcon from '@/components/Global/StatusIcon.vue';
121121
import useToast from '@/components/Composables/useToastComposable';
122-
import { AuthenticationStore, GlobalStore, EventLogStore } from '@/store';
122+
import stores from '@/store';
123123
import i18n from '@/i18n';
124124
import eventBus from '@/eventBus';
125125
import { useRouter } from 'vue-router';
126126
127127
const { errorToast } = useToast();
128128
const router = useRouter();
129129
130-
const authenticationStore = AuthenticationStore();
131-
const global = GlobalStore();
132-
const eventLogStore = EventLogStore();
130+
const authenticationStore = stores.AuthenticationStore();
131+
const global = stores.GlobalStore();
132+
const eventLogStore = stores.EventLogStore();
133133
134134
const props = defineProps({
135135
routerKey: {

src/components/AppNavigation/AppNavigation.vue

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<!-- Work Requird -->
21
<template>
3-
<div>
2+
<div
3+
v-if="(modelType !== '--' && hmcMangedInfo !== null) || loadingCompleted"
4+
>
45
<div class="nav-container" :class="{ open: isNavigationOpen }">
56
<nav ref="nav" :aria-label="$t('appNavigation.primaryNavigation')">
67
<BNav vertical class="mb-4">
@@ -29,9 +30,9 @@
2930
<icon-chevron-up class="icon-expand" />
3031
</BButton>
3132
<BCollapse :id="navItem.id" class="nav-item__nav">
32-
<li class="">
33+
<li>
3334
<router-link
34-
v-for="(subNavItem, i) of filteredNavItem(navItem.children)"
35+
v-for="(subNavItem, i) of navItem.children"
3536
:key="i"
3637
:to="subNavItem.route"
3738
:data-test-id="`nav-item-${subNavItem.id}`"
@@ -58,43 +59,53 @@
5859
</template>
5960

6061
<script setup>
61-
import { ref, watch } from 'vue';
62-
import { AppNavigationData } from './AppNavigationData';
62+
//Do not change Mixin import.
63+
//Exact match alias set to support
64+
//dotenv customizations.
65+
import { ref, watch, onMounted, computed } from 'vue';
66+
import AppNavigationData from './AppNavigationData';
6367
import { useRoute } from 'vue-router';
64-
import { onMounted } from 'vue';
65-
import { GlobalStore } from '@/store';
6668
import IconChevronUp from '@carbon/icons-vue/es/chevron--up/16';
69+
import stores from '@/store';
6770
import eventBus from '@/eventBus';
6871
69-
const globalStore = GlobalStore();
70-
const { navigationItems } = AppNavigationData();
71-
let isNavigationOpen = ref(false);
72-
const route = useRoute();
73-
let currentUserRole = ref(null);
74-
onMounted(() => {
75-
currentUserRole.value = globalStore.userPrivilege;
76-
eventBus.on('toggle-navigation', toggleIsOpen);
77-
});
78-
// provide('isNavigationOpen', isNavigationOpen);
79-
watch(route, () => {
80-
isNavigationOpen.value = false;
81-
});
82-
watch(isNavigationOpen, () => {
83-
eventBus.emit('change-is-navigation-open', isNavigationOpen.value);
84-
});
85-
const toggleIsOpen = () => {
86-
isNavigationOpen.value = !isNavigationOpen.value;
87-
};
88-
// provide('toggle-navigation', toggleIsOpen);
72+
const navigationItems = AppNavigationData().navigationItems;
73+
const globalStore = stores.GlobalStore();
74+
const userManagementStore = stores.UserManagementStore();
75+
const isNavigationOpen = ref(false);
76+
const loadingCompleted = ref(false);
77+
const route = useRoute();
8978
90-
const filteredNavItem = (navItem) => {
91-
if (currentUserRole.value) {
92-
return navItem.filter(({ exclusiveToRoles }) => {
93-
if (!exclusiveToRoles?.length) return true;
94-
return exclusiveToRoles.includes(currentUserRole);
79+
const modelType = computed(() => {
80+
return globalStore.modelTypeGetter;
81+
});
82+
const hmcMangedInfo = computed(() => {
83+
return globalStore.hmcManagedGetter;
84+
});
85+
const currentUser = computed(() => {
86+
return globalStore.currentUserGetter;
87+
});
88+
watch(route, () => {
89+
isNavigationOpen.value = false;
90+
});
91+
watch(isNavigationOpen, () => {
92+
eventBus.emit('change-is-navigation-open', isNavigationOpen.value);
93+
});
94+
onMounted(() => {
95+
eventBus.on('loading-bar-status', (value) => {
96+
loadingCompleted.value = value;
9597
});
96-
} else return navItem;
97-
};
98+
eventBus.on('toggle-navigation', toggleIsOpen);
99+
});
100+
const checkForUserData = () => {
101+
if (!currentUser.value) {
102+
userManagementStore.getUsers();
103+
globalStore.getCurrentUser();
104+
}
105+
};
106+
const toggleIsOpen = () => {
107+
isNavigationOpen.value = !isNavigationOpen.value;
108+
};
98109
</script>
99110

100111
<style scoped lang="scss">

0 commit comments

Comments
 (0)