11<template >
22 <div class =" pt-2 flex justify-end" >
3- <a :href = " linkHref " class =" text-lightPrimary hover:underline dark:text-darkPrimary break-all " >
3+ <RouterLink :to = " to " class =" text-lightPrimary hover:underline dark:text-darkPrimary break-all " >
44 <IconClockSolid class =" inline w-4 h-4 me-1 mb-0.5" />
5- Edits History</a >
5+ Edits History</RouterLink >
66 </div >
77</template >
88<script setup lang="ts">
@@ -17,7 +17,7 @@ const props = defineProps<{
1717 adminUser: any ;
1818}>();
1919
20- const linkHref = computed (() => {
20+ const to = computed (() => {
2121 try {
2222 const resourceIdCol = props .meta .resourceColumns .resourceIdColumnName ;
2323 const recordIdCol = props .meta .resourceColumns .resourceRecordIdColumnName ;
@@ -36,19 +36,19 @@ const linkHref = computed(() => {
3636 recordId = pkColName ? props .record ?.[pkColName ] : undefined ;
3737 }
3838
39- const params = new URLSearchParams () ;
40- params . set ( ' sort' , ` ${props .meta .resourceColumns .resourceCreatedColumnName }__desc ` ) ;
41- if (recordId ) params . set ( ` filter__${recordIdCol }__ilike ` , JSON .stringify (String (recordId ) ));
42- if (resourceId ) params . set ( ` filter__${resourceIdCol }__eq ` , JSON .stringify (String (resourceId ) ));
39+ const query : Record < string , string > = {} ;
40+ query [ ' sort' ] = ` ${props .meta .resourceColumns .resourceCreatedColumnName }__desc ` ;
41+ if (recordId ) query [ ` filter__${recordIdCol }__ilike ` ] = JSON .stringify (String (recordId ));
42+ if (resourceId ) query [ ` filter__${resourceIdCol }__eq ` ] = JSON .stringify (String (resourceId ));
4343
44- const origin = typeof window !== ' undefined' ? window .location .origin : ' ' ;
45- const adminBase = (props .meta ?.ADMIN_BASE_URL || ' ' ).toString ();
46- const basePath = adminBase .replace (/ \/ $ / , ' ' ).replace (/ ^ \s + | \s + $ / g , ' ' );
47- const prefix = basePath ? ` ${basePath } ` : ' ' ;
48- const path = ` ${prefix }/resource/${auditResourceId } ` .replace (/ \/\/ + / , ' /' );
49- return ` ${origin }${path }?${params .toString ()} ` ;
44+ return {
45+ name: ' resource-list' ,
46+ params: { resourceId: auditResourceId },
47+ query ,
48+ } as any ;
5049 } catch (e ) {
51- return ' #' ;
50+ console .error (' Error computing RelatedLogsLink to:' , e );
51+ return { name: ' resource-list' , params: { resourceId: ' audit_log' } } as any ;
5252 }
5353});
5454 </script >
0 commit comments