Skip to content

Commit

Permalink
fix(imagearcgisrest/layer-legend): release 1.7 various fix (#848)
Browse files Browse the repository at this point in the history
* fix(layer-legend/imageArcGISRest): various fix 1.7 release

* fix(imagerest-datasource)

* Update imagearcgisrest-datasource.ts

Co-authored-by: Marc-André Barbeau <marc-andre.barbeau@msp.gouv.qc.ca>
  • Loading branch information
PhilippeLafreniere18 and mbarbeau authored May 3, 2021
1 parent 99f9d75 commit 5ab57af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export class ImageArcGISRestDataSource extends DataSource {
}

protected createOlSource(): ImageArcGISRest {

const params = !this.options.layer ? this.options.params : Object.assign(
const params = this.options.layer === undefined ? this.options.params : Object.assign(
{LAYERS: `show:${this.options.layer}`},
this.options.params
);
Expand All @@ -47,9 +46,9 @@ export class ImageArcGISRestDataSource extends DataSource {
}

getLegend(): Legend[] {
const legendInfo = this.options.options.legendInfo;
const legendInfo = this.options.options?.legendInfo || this.params?.legendInfo;
const legend = super.getLegend();
if (legendInfo === undefined || !this.options.layer || legend.length > 0) {
if (legendInfo === undefined || this.options.layer === undefined || legend.length > 0) {
return legend;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ export class LayerLegendComponent implements OnInit, OnDestroy {
const secureIMG = new SecureImagePipe(this.http);
secureIMG.transform(item.url).pipe(
catchError((err) => {
err.error.caught = true;
this.getLegend = false;
this.cdRef.detectChanges();
return err;
if (err.error) {
err.error.caught = true;
this.getLegend = false;
this.cdRef.detectChanges();
return err;
}
})
).subscribe((legend: string) => {
this.legendGraphic = legend;
Expand Down

0 comments on commit 5ab57af

Please sign in to comment.