diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 31ad9ebed..7a882e56c 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -92,13 +92,13 @@ function findMatches(search, item) { } function addChildren(module, route, parent) { - if (route.menus) { - const mainMenus = route.menus[props.source]; - const matches = findMatches(mainMenus, route); + const menus = route?.meta?.menu ?? route?.menus?.[props.source]; //backwards compatible + if (!menus) return; - for (const child of matches) { - navigation.addMenuItem(module, child, parent); - } + const matches = findMatches(menus, route); + + for (const child of matches) { + navigation.addMenuItem(module, child, parent); } } @@ -122,16 +122,26 @@ function getRoutes() { if (props.source === 'card') { const currentRoute = route.matched[1]; const currentModule = toLowerCamel(currentRoute.name); - const moduleDef = routes.find( + let moduleDef = routes.find( (route) => toLowerCamel(route.name) === currentModule ); if (!moduleDef) return; - + if (!moduleDef?.menus) moduleDef = betaGetRoutes(); addChildren(currentModule, moduleDef, items.value); } } +function betaGetRoutes() { + let menuRoute; + let index = route.matched.length - 1; + while (!menuRoute && index > 0) { + if (route.matched[index]?.meta?.menu) menuRoute = route.matched[index]; + index--; + } + return menuRoute; +} + async function togglePinned(item, event) { if (event.defaultPrevented) return; event.preventDefault(); diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index b2816975c..ef5bdc6ac 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -57,6 +57,7 @@ onMounted(() => stateStore.setMounted()); 'no-visible': !stateQuery.isLoading().value, }" size="xs" + data-cy="loading-spinner" /> diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 999133130..426f5c716 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -32,7 +32,10 @@ const $props = defineProps({ defineExpose({ addFilter, props: $props }); const model = defineModel(undefined, { required: true }); -const arrayData = useArrayData($props.dataKey, { searchUrl: $props.searchUrl }); +const arrayData = useArrayData( + $props.dataKey, + $props.searchUrl ? { searchUrl: $props.searchUrl } : null +); const columnFilter = computed(() => $props.column?.columnFilter); const updateEvent = { 'update:modelValue': addFilter }; diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index f09bed8ba..7886d0567 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -1,20 +1,21 @@ + diff --git a/src/components/VnTable/__tests__/VnTable.spec.js b/src/components/VnTable/__tests__/VnTable.spec.js index 162df727d..74ba06987 100644 --- a/src/components/VnTable/__tests__/VnTable.spec.js +++ b/src/components/VnTable/__tests__/VnTable.spec.js @@ -1,4 +1,4 @@ -import { describe, expect, it, beforeAll, beforeEach } from 'vitest'; +import { describe, expect, it, beforeAll, beforeEach, vi } from 'vitest'; import { createWrapper } from 'app/test/vitest/helper'; import VnTable from 'src/components/VnTable/VnTable.vue'; @@ -13,6 +13,15 @@ describe('VnTable', () => { }, }); vm = wrapper.vm; + + vi.mock('src/composables/useFilterParams', () => { + return { + useFilterParams: vi.fn(() => ({ + params: {}, + orders: {}, + })), + }; + }); }); beforeEach(() => (vm.selected = [])); diff --git a/src/components/common/VnBreadcrumbs.vue b/src/components/common/VnBreadcrumbs.vue index 02226e497..334ab4d21 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/VnCardBeta.vue b/src/components/common/VnCardBeta.vue new file mode 100644 index 000000000..349956be9 --- /dev/null +++ b/src/components/common/VnCardBeta.vue @@ -0,0 +1,67 @@ + + diff --git a/src/components/common/VnSectionMain.vue b/src/components/common/VnModule.vue similarity index 52% rename from src/components/common/VnSectionMain.vue rename to src/components/common/VnModule.vue index 15be6ad9a..505b3a8b5 100644 --- a/src/components/common/VnSectionMain.vue +++ b/src/components/common/VnModule.vue @@ -1,8 +1,8 @@