Skip to content

Commit

Permalink
Merge pull request #288 from stuartwoodman/AUS-3962-Layer-empty-filters
Browse files Browse the repository at this point in the history
AUS-3962 Empty layer filters
  • Loading branch information
vjf authored Jul 11, 2023
2 parents 5a51da3 + b043525 commit 024049f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/app/menupanel/activelayers/activelayerspanel.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { CsMapService, LayerHandlerService, LayerModel, ResourceType, UtilitiesService } from '@auscope/portal-core-ui';
import { CsMapService, LayerModel, ResourceType, UtilitiesService } from '@auscope/portal-core-ui';
import { SplitDirection } from 'cesium';
import { UILayerModel } from '../common/model/ui/uilayer.model';
import { UILayerModelService } from 'app/services/ui/uilayer-model.service';
Expand All @@ -18,9 +18,8 @@ export class ActiveLayersPanelComponent {
bsModalRef: BsModalRef;

constructor(private csMapService: CsMapService,
private uiLayerModelService: UILayerModelService, private layerHandlerService: LayerHandlerService,
private layerManagerService: LayerManagerService, private legendUiService: LegendUiService,
private modalService: BsModalService) { }
private uiLayerModelService: UILayerModelService, private layerManagerService: LayerManagerService,
private legendUiService: LegendUiService, private modalService: BsModalService) { }

/**
* Get active layers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
</div>
</div>

<div *ngIf="!layerFilterCollection && !layerHasAdvancedFilterComponent(layer.id)">
<div *ngIf="(!layerFilterCollection || layerFilterCollection.optionalFilters?.length === 0) && !layerHasAdvancedFilterComponent(layer.id)">
<div class="alert alert-warning fade show">
<i class="ti-bell float-left"></i>
<p>There are no filters associated with this layer</p>
</div>
</div>

<fieldset *ngIf="layerFilterCollection && layerFilterCollection['optionalFilters']" class="show-fieldset-borders">
<fieldset *ngIf="layerFilterCollection?.optionalFilters && layerFilterCollection.optionalFilters.length > 0" class="show-fieldset-borders">
<legend><h5>Optional Filters</h5></legend>
<div class="form-group form-group-sm">
<label style="display:flex;font-size:0.9rem;" *ngIf="optionalFilters.length > 0" title="Remove filter"> Select Filter:<i style="margin-left:auto;font-size:0.9rem;" class="hasEvent red" (click)="refreshFilter()">Clear All</i></label>
Expand Down
11 changes: 6 additions & 5 deletions src/app/services/legend/legend-ui.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class LegendUiService {
* @returns the first WMS OnlineResourceModel for the layer, or undefined if one doesn't exist
*/
private getWMSOnlineResource(layer: LayerModel): OnlineResourceModel {
let wmsOnlineResource;
let wmsOnlineResource: OnlineResourceModel;
if (layer.cswRecords) {
for (const cswRecord of layer.cswRecords) {
if (cswRecord.onlineResources) {
Expand Down Expand Up @@ -158,7 +158,7 @@ export class LegendUiService {
if (layer.legendImg && layer.legendImg !== '') {
const requestUrl = environment.portalBaseUrl + 'legend/' + layer.legendImg;
const getRequest = this.http.get(requestUrl, { responseType: 'blob' }).pipe(
catchError(err => {
catchError(() => {
return of(undefined);
})
);
Expand All @@ -180,6 +180,7 @@ export class LegendUiService {
layer.filterCollection.mandatoryFilters = layerState['filterCollection']['mandatoryFilters'];
}
}

// We don't need optional parameters for legend but it can't be empty
const param: any = {};
param.optionalFilters = [];
Expand All @@ -197,14 +198,14 @@ export class LegendUiService {
// requests, so create lists of GET URLs and POST requests to throw everything at the wall and see what sticks.
const httpParams = this.getHttpParams(wmsOnlineResource.name, collatedParam, sldBody);
const postRequest = this.http.post(this.trimUrl(resource.url), httpParams, { responseType: 'blob' }).pipe(
catchError(err => {
catchError(() => {
return of(undefined);
})
);
legendRequestList.push(postRequest);
const requestUrl = this.createRequestUrl(resource.url, resource.name, sldBody);
const getRequest = this.http.get(requestUrl, { responseType: 'blob' }).pipe(
catchError(err => {
catchError(() => {
return of(undefined);
})
);
Expand All @@ -215,7 +216,7 @@ export class LegendUiService {
} else {
const requestUrl = this.createRequestUrl(wmsOnlineResource.url, wmsOnlineResource.name, null);
const getRequest = this.http.get(requestUrl, { responseType: 'blob' }).pipe(
catchError(err => {
catchError(() => {
return of(undefined);
})
);
Expand Down

0 comments on commit 024049f

Please sign in to comment.