From d444a8721dab9dc9e1ea22c842cb180bae099b4c Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 6 May 2024 14:05:58 +0200 Subject: [PATCH 01/36] feat: refs #6891 create composable & update searchbar --- src/components/ui/VnSearchbar.vue | 31 ++++++------------------------- src/composables/useRedirect.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 src/composables/useRedirect.js diff --git a/src/components/ui/VnSearchbar.vue b/src/components/ui/VnSearchbar.vue index 344267ef7..ae8ac05dd 100644 --- a/src/components/ui/VnSearchbar.vue +++ b/src/components/ui/VnSearchbar.vue @@ -1,9 +1,9 @@ diff --git a/src/composables/useRedirect.js b/src/composables/useRedirect.js new file mode 100644 index 000000000..786e1378b --- /dev/null +++ b/src/composables/useRedirect.js @@ -0,0 +1,28 @@ +import { useRouter } from 'vue-router'; + +export default function useRedirect() { + const router = useRouter(); + + const navigate = (data, { customRouteRedirectName, searchText }) => { + if (customRouteRedirectName) + return router.push({ + name: customRouteRedirectName, + params: { id: searchText }, + }); + + const { matched: matches } = router.currentRoute.value; + const { path } = matches.at(-1); + const [, moduleName] = path.split('/'); + + if (!data.length || data.length > 1) + return router.push({ path: `/${moduleName}/list` }); + + const targetId = data[0].id; + + if (/\/list|-list/.test(path)) + router.push({ path: `/${moduleName}/${targetId}/summary` }); + else router.push({ path: path.replace(/:id/, targetId) }); + }; + + return { navigate }; +} From b487ff4adc96b9e845994ef21de4e0e5e0e29a68 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 6 May 2024 14:25:39 +0200 Subject: [PATCH 02/36] feat: refs #6891 create rightMenu --- src/components/common/RightMenu.vue | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/components/common/RightMenu.vue diff --git a/src/components/common/RightMenu.vue b/src/components/common/RightMenu.vue new file mode 100644 index 000000000..a83ebc390 --- /dev/null +++ b/src/components/common/RightMenu.vue @@ -0,0 +1,27 @@ + + From 15b080f7bd9b485169e8d1b3c81fa9fff373800b Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 6 May 2024 14:27:04 +0200 Subject: [PATCH 03/36] feat: refs #6891 add redirection on VnfilterPanel --- src/components/common/VnCard.vue | 46 ++++++++++++++++++----------- src/components/ui/VnFilterPanel.vue | 5 +++- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/components/common/VnCard.vue b/src/components/common/VnCard.vue index 6d0badffb..97c681b79 100644 --- a/src/components/common/VnCard.vue +++ b/src/components/common/VnCard.vue @@ -8,6 +8,7 @@ import useCardSize from 'src/composables/useCardSize'; import VnSubToolbar from '../ui/VnSubToolbar.vue'; import VnSearchbar from 'components/ui/VnSearchbar.vue'; import LeftMenu from 'components/LeftMenu.vue'; +import RightMenu from 'components/common/RightMenu.vue'; const props = defineProps({ dataKey: { type: String, required: true }, @@ -15,6 +16,7 @@ const props = defineProps({ customUrl: { type: String, default: undefined }, filter: { type: Object, default: () => {} }, descriptor: { type: Object, required: true }, + filterPanel: { type: Object, default: undefined }, searchbarDataKey: { type: String, default: undefined }, searchbarUrl: { type: String, default: undefined }, searchbarLabel: { type: String, default: '' }, @@ -49,24 +51,32 @@ if (props.baseUrl) { }