diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue
index ab2931dfd2..eed2e192be 100644
--- a/src/components/LeftMenu.vue
+++ b/src/components/LeftMenu.vue
@@ -92,13 +92,11 @@ function findMatches(search, item) {
}
function addChildren(module, route, parent) {
- if (route.menus) {
- const mainMenus = route.menus[props.source];
- const matches = findMatches(mainMenus, route);
+ if (!route?.meta?.menu) return;
+ const matches = findMatches(route.meta.menu, route);
- for (const child of matches) {
- navigation.addMenuItem(module, child, parent);
- }
+ for (const child of matches) {
+ navigation.addMenuItem(module, child, parent);
}
}
@@ -120,15 +118,14 @@ function getRoutes() {
}
if (props.source === 'card') {
- const currentRoute = route.matched[1];
- const currentModule = toLowerCamel(currentRoute.name);
- const moduleDef = routes.find(
- (route) => toLowerCamel(route.name) === currentModule
- );
+ let menuRoute;
+ let index = route.matched.length - 1;
- if (!moduleDef) return;
-
- addChildren(currentModule, moduleDef, items.value);
+ while (!menuRoute && index > 0) {
+ if (route.matched[index]?.meta?.menu) menuRoute = route.matched[index];
+ index--;
+ }
+ addChildren('', menuRoute, items.value);
}
}
diff --git a/src/components/common/VnBreadcrumbs.vue b/src/components/common/VnBreadcrumbs.vue
index 02226e4975..334ab4d211 100644
--- a/src/components/common/VnBreadcrumbs.vue
+++ b/src/components/common/VnBreadcrumbs.vue
@@ -15,7 +15,7 @@ let root = ref(null);
watchEffect(() => {
matched.value = currentRoute.value.matched.filter(
- (matched) => Object.keys(matched.meta).length
+ (matched) => !!matched?.meta?.title || !!matched?.meta?.icon
);
breadcrumbs.value.length = 0;
if (!matched.value[0]) return;
diff --git a/src/components/common/VnCardMain.vue b/src/components/common/VnCardMain.vue
index ab664917ae..b222748b9f 100644
--- a/src/components/common/VnCardMain.vue
+++ b/src/components/common/VnCardMain.vue
@@ -2,25 +2,78 @@
import LeftMenu from '../LeftMenu.vue';
import { useStateStore } from 'stores/useStateStore';
import RightMenu from './RightMenu.vue';
+import VnSearchbar from 'components/ui/VnSearchbar.vue';
+import VnTableFilter from '../VnTable/VnTableFilter.vue';
+import { onBeforeMount } from 'vue';
+import { useArrayData } from 'src/composables/useArrayData';
const stateStore = useStateStore();
-defineProps({
+const $props = defineProps({
section: {
type: String,
required: true,
},
+ dataKey: {
+ type: String,
+ default: null,
+ },
+ searchBar: {
+ type: Boolean,
+ default: true,
+ },
+ prefix: {
+ type: String,
+ default: null,
+ },
+ rightFilter: {
+ type: Boolean,
+ default: true,
+ },
+ columns: {
+ type: Array,
+ default: null,
+ },
+ arrayDataProps: {
+ type: Object,
+ default: null,
+ },
+});
+
+onBeforeMount(() => {
+ if ($props.dataKey)
+ useArrayData($props.dataKey, {
+ searchUrl: 'table',
+ ...$props.arrayDataProps,
+ });
});
-
+
+
+
+
-
-
+
-
-
+
+
+
+
+
+
+
diff --git a/src/pages/Account/AccountList.vue b/src/pages/Account/AccountList.vue
index ed2030d296..34a653e61d 100644
--- a/src/pages/Account/AccountList.vue
+++ b/src/pages/Account/AccountList.vue
@@ -1,22 +1,17 @@
-
-
-
-
+
-
-
-
diff --git a/src/pages/Account/Role/AccountRoles.vue b/src/pages/Account/Role/AccountRoles.vue
index 9aebef64c5..8cc392f1bb 100644
--- a/src/pages/Account/Role/AccountRoles.vue
+++ b/src/pages/Account/Role/AccountRoles.vue
@@ -3,7 +3,6 @@ import { useI18n } from 'vue-i18n';
import { computed, ref } from 'vue';
import VnTable from 'components/VnTable/VnTable.vue';
import { useRoute } from 'vue-router';
-import VnSearchbar from 'components/ui/VnSearchbar.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import RoleSummary from './Card/RoleSummary.vue';
import VnCardMain from 'src/components/common/VnCardMain.vue';
@@ -86,21 +85,17 @@ const exprBuilder = (param, value) => {
-
-
-
-
+
import('src/pages/Account/Card/AccountCard.vue'),
+ meta: {
+ menu: [
+ 'AccountBasicData',
+ 'AccountInheritedRoles',
+ 'AccountMailForwarding',
+ 'AccountMailAlias',
+ 'AccountPrivileges',
+ 'AccountLog',
+ ],
+ },
children: [
{
name: 'AccountSummary',
diff --git a/src/router/modules/account/roleCard.js b/src/router/modules/account/roleCard.js
index 2a53875687..c36ce71b9d 100644
--- a/src/router/modules/account/roleCard.js
+++ b/src/router/modules/account/roleCard.js
@@ -3,6 +3,9 @@ export default {
path: ':id',
component: () => import('src/pages/Account/Role/Card/RoleCard.vue'),
redirect: { name: 'RoleSummary' },
+ meta: {
+ menu: ['RoleBasicData', 'SubRoles', 'InheritedRoles', 'RoleLog'],
+ },
children: [
{
name: 'RoleSummary',
diff --git a/src/utils/getSections.js b/src/utils/getSections.js
deleted file mode 100644
index f70daf4685..0000000000
--- a/src/utils/getSections.js
+++ /dev/null
@@ -1,8 +0,0 @@
-export default (sections) => {
- const names = [];
- for (const section of sections) {
- if (section.path == 'summary') continue;
- names.push(section.name);
- }
- return names;
-};