Skip to content

Commit

Permalink
fix: Sublegends of a remote planet project are not retrieved (closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
claustres committed Jun 21, 2024
1 parent cce4e04 commit c9b723d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion map/client/components/legend/KLegend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import _ from 'lodash'
import logger from 'loglevel'
import sift from 'sift'
import { ref, computed, watch } from 'vue'
import { i18n, Store } from '../../../../core/client'
import { api, i18n, Store } from '../../../../core/client'
import { useCurrentActivity, useCatalog } from '../../composables'
import KLayerLegend from './KLayerLegend.vue'
Expand Down Expand Up @@ -86,6 +86,13 @@ const props = defineProps({
}
})
// Get current project for activity if any
const { getActivityProject } = useCurrentActivity({ selection: false, probe: false })
const project = getActivityProject()
// We expect the project object to expose the underlying API
const planetApi = project && typeof project.getPlanetApi === 'function' ? project.getPlanetApi() : api
// Use target catalog according to project
const { getSublegends: getProjectSublegends } = useCatalog({ project, planetApi })
// Use global catalog
const { getSublegends } = useCatalog()
// Use local catalog if any
Expand Down Expand Up @@ -152,6 +159,9 @@ watch([() => props.sublegends, () => props.sublegendsFromCatalog], async () => {
// Retrieve the legends from catalog if required
if (props.sublegendsFromCatalog) {
sublegends.value = await getSublegends()
if (project) {
sublegends.value = sublegends.value.concat(await getProjectSublegends())
}
if (Store.get('context')) {
sublegends.value = sublegends.value.concat(await getContextSublegends())
}
Expand Down

0 comments on commit c9b723d

Please sign in to comment.