#8045: Modified redirect from CardDescriptor #1495

Merged
jon merged 18 commits from 8045-FixIconDescriptorRedirect into dev 2025-03-07 12:09:21 +00:00
1 changed files with 33 additions and 16 deletions
Showing only changes of commit d64ac223e3 - Show all commits
src/components/ui

View File

@ -51,6 +51,9 @@ let store;
let entity;
const isLoading = ref(false);
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
const DESCRIPTOR_PROXY = 'DescriptorProxy';
const moduleName = ref();
const isSameModuleName = route.matched[1].meta.moduleName !== moduleName.value;
defineExpose({ getData });
onBeforeMount(async () => {
@ -77,15 +80,18 @@ onBeforeMount(async () => {
);
});
const routeName = computed(() => {
const DESCRIPTOR_PROXY = 'DescriptorProxy';
function getName() {
let name = $props.dataKey;
if ($props.dataKey.includes(DESCRIPTOR_PROXY)) {
name = name.split(DESCRIPTOR_PROXY)[0];
}
return `${name}Summary`;
return name;
}
const routeName = computed(() => {
let routeName = getName();
return `${routeName}Summary`;
});
async function getData() {
store.url = $props.url;
store.filter = $props.filter ?? {};
@ -121,16 +127,27 @@ function copyIdText(id) {
const emit = defineEmits(['onFetch']);
const iconModule = computed(
() =>
router.options.routes[1].children.find((r) => r.name === $props.dataKey).meta
.icon,
);
const toModule = computed(
() =>
router.options.routes[1].children.find((r) => r.name === $props.dataKey)
.children[0].redirect,
);
const iconModuleV = computed(() => {
Outdated
Review

Pq la V?

Pq la `V`?
moduleName.value = getName();
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.meta?.icon;
} else {
return route.matched[1].meta.icon;
}
});
const toModuleV = computed(() => {
moduleName.value = getName();
if (isSameModuleName) {
return router.options.routes[1].children.find((r) => r.name === moduleName.value)
?.children[0]?.redirect;
} else {
return route.matched[1].path.split('/').length > 2
? route.matched[1].redirect
: route.matched[1].children[0].redirect;
}
});
</script>
<template>
@ -143,10 +160,10 @@ const toModule = computed(
flat
dense
size="md"
:icon="iconModule"
:icon="iconModuleV"
color="white"
class="link"
:to="toModule"
:to="toModuleV"
>
<QTooltip>
{{ t('globals.goToModuleIndex') }}