Skip to content

Commit

Permalink
fix(api-form): read from allcollections instead of features only
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow authored and cmoinier committed May 31, 2024
1 parent 3b6ff25 commit de6c18f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libs/feature/dataviz/src/lib/service/data.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jest.mock('@camptocamp/ogc-client', () => ({
bulkDownloadLinks: { json: 'http://json', csv: 'http://csv' },
})
}
featureCollections = Promise.resolve(['collection1'])
allCollections = Promise.resolve([{ name: 'collection1' }])
},
}))

Expand Down
4 changes: 2 additions & 2 deletions libs/feature/dataviz/src/lib/service/data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ export class DataService {

async getDownloadUrlsFromOgcApi(url: string): Promise<OgcApiCollectionInfo> {
const endpoint = new OgcApiEndpoint(this.proxy.getProxiedUrl(url))
return await endpoint.featureCollections
return await endpoint.allCollections
.then((collections) => {
return endpoint.getCollectionInfo(collections[0])
return endpoint.getCollectionInfo(collections[0].name)
})
.catch((error) => {
throw new Error(`ogc.unreachable.unknown`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ export class RecordApiFormComponent {
this.supportOffset = this.endpoint.supportsStartIndex()
return this.endpoint.getServiceInfo() as OutputFormats
} else {
{
return (await this.endpoint.getCollectionInfo(
this.firstCollection
)) as OutputFormats
}
return (await this.endpoint.getCollectionInfo(
this.firstCollection
)) as OutputFormats
}
}

Expand All @@ -136,7 +134,7 @@ export class RecordApiFormComponent {
await (this.endpoint as WfsEndpoint).isReady()
} else {
this.endpoint = new OgcApiEndpoint(this.apiBaseUrl)
this.firstCollection = (await this.endpoint.featureCollections)[0]
this.firstCollection = (await this.endpoint.allCollections)[0].name
}
this.endpoint$.next(this.endpoint)
}
Expand Down

0 comments on commit de6c18f

Please sign in to comment.