Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUS-3962 Empty layer filters #288

Merged
merged 3 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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