@@ -43,7 +43,7 @@ import type { RouteLocationRaw } from 'vue-router'
4343import { mdiDatabaseOutline , mdiFullscreen } from ' @mdi/js'
4444
4545type ApplicationAction = NonNullable <NonNullable <ApplicationElement [' actionButtons' ]>[' items' ]>[number ]
46- type AppConfig = { datasets? : { id: string ; href: string }[] }
46+ type AppConfig = { datasets? : { id? : string ; slug ? : string ; href: string }[] }
4747
4848const { application, actions = [] } = defineProps <{
4949 application: Application
@@ -62,19 +62,19 @@ const appConfigFetch = showAction('datasets')
6262 ? fetcher (() => application .id ? ` /data-fair/api/v1/applications/${application .id }/configuration ` : ' ' )
6363 : undefined
6464
65- const datasetIds = computed (() => {
66- const datasets = appConfigFetch ?.data .value ?.datasets
67- if (! datasets ) return []
68- return datasets
69- .map (d => d .id || d .href .split (' /' ).pop ())
70- .filter ((id ): id is string => !! id )
65+ const datasets = computed (() => {
66+ const items = appConfigFetch ?.data .value ?.datasets
67+ if (! items ) return []
68+ return items
69+ .map (d => ({ id: d .id || d .href .split (' /' ).pop (), slug: d . slug } ))
70+ .filter ((d ): d is { id: string ; slug ?: string } => !! d . id )
7171})
72- const datasetsCount = computed (() => datasetIds .value .length )
72+ const datasetsCount = computed (() => datasets .value .length )
7373const datasetsLink = computed <RouteLocationRaw | undefined >(() => {
74- const ids = datasetIds .value
75- if (ids .length === 0 ) return undefined
76- if (ids .length === 1 ) return ` /datasets/${ids [0 ]} `
77- return { path: ' /datasets' , query: { ids: ids .join (' ,' ) } }
74+ const items = datasets .value
75+ if (items .length === 0 ) return undefined
76+ if (items .length === 1 ) return ` /datasets/${items [0 ]. slug || items [ 0 ]. id } `
77+ return { path: ' /datasets' , query: { ids: items . map ( d => d . id ) .join (' ,' ) } }
7878})
7979 </script >
8080
0 commit comments