Skip to content

Commit

Permalink
fix(spatial-filter): fix spatial filter results according to expansio… (
Browse files Browse the repository at this point in the history
#727)

* fix(spatial-filter): fix spatial filter results according to expansion panel

* lasts fix
  • Loading branch information
PhilippeLafreniere18 committed Sep 30, 2020
1 parent 720a0d0 commit 51c826b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,36 +121,12 @@
{{'igo.geo.spatialFilter.goSearch' | translate}}
</button>

<button mat-raised-button class="remove-button" [disabled]="!store.entities$.getValue().length" (click)="clearButton()">
<button mat-raised-button class="remove-button" [disabled]="!store.entities$.getValue().length && !zone && !drawZone" (click)="clearButton()">
{{'igo.geo.spatialFilter.removeLayer' | translate}}
</button>

<button mat-raised-button class="export-button" [disabled]="!store.entities$.getValue().length" (click)="export.emit()">
{{'igo.geo.spatialFilter.exportLayer' | translate}}
</button>

<button mat-raised-button class="workspace-button" [disabled]="!store.entities$.getValue().length" (click)="openWorkspace.emit()">
<mat-icon svgIcon="table"></mat-icon>
</button>

</div>

<div class="results" *ngIf="store">
<mat-table class="results-list" [dataSource]="store.entities$.value">

<!-- Type Column -->
<ng-container matColumnDef="typeResults">
<mat-header-cell *matHeaderCellDef>{{'igo.geo.spatialFilter.type' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let result"> {{result.meta.title}} </mat-cell>
</ng-container>

<!-- Name Column -->
<ng-container matColumnDef="nameResults">
<mat-header-cell *matHeaderCellDef>{{'igo.geo.spatialFilter.searchResults' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let result"> {{result.properties.nom}} </mat-cell>
</ng-container>

<mat-header-row *matHeaderRowDef="displayedColumnsResults"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumnsResults;"></mat-row>
</mat-table>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

.buttons {
margin-top: 10px;
margin-top: 15px;
}

.search-button {
Expand All @@ -66,13 +66,8 @@
width: 150px;
}

.workspace-button {
left: 10px;
width: 150px;
}

.thematics {
max-height: 150px;
max-height: 30%;
overflow: auto;
margin-top: 5px;
width: 98%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class SpatialFilterItemComponent implements OnDestroy, OnInit {
@Output() radiusEvent = new EventEmitter<number>();
@Output() freehandControl = new EventEmitter<boolean>();

@Output() clearButtonEvent = new EventEmitter<Layer[]>();
@Output() clearButtonEvent = new EventEmitter();

@Output() clearSearchEvent = new EventEmitter();

Expand All @@ -164,7 +164,6 @@ export class SpatialFilterItemComponent implements OnDestroy, OnInit {
public thematics: SpatialFilterThematic[] = [];
public dataSource = new MatTreeNestedDataSource<SpatialFilterThematic>();
public selectedThematics = new SelectionModel<SpatialFilterThematic>(true, []);
public displayedColumnsResults: string[] = ['typeResults', 'nameResults'];

// For geometry form field input
value$: BehaviorSubject<GeoJSONGeometry> = new BehaviorSubject(undefined);
Expand Down Expand Up @@ -466,6 +465,11 @@ export class SpatialFilterItemComponent implements OnDestroy, OnInit {
}
this.radiusEvent.emit(this.radius);
this.toggleSearch.emit();
setTimeout(() => {
if (this.store.entities$.getValue().length) {
this.openWorkspace.emit();
}
}, 500);
}

/**
Expand All @@ -478,7 +482,11 @@ export class SpatialFilterItemComponent implements OnDestroy, OnInit {
if (this.store) {
this.store.clear();
}
this.clearButtonEvent.emit([]);
if (this.isPoint() || this.isPolygon()) {
this.drawZone = undefined;
this.formControl.reset();
}
this.clearButtonEvent.emit();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(itemTypeChange)="itemType = $event"
(thematicChange)="thematics = $event"
(toggleSearch)="getOutputToggleSearch()"
(clearButtonEvent)="layers = $event"
(clearButtonEvent)="clearMap()"
(clearSearchEvent)="getOutputClearSearch()"
(export)="activateExportTool()"
(openWorkspace)="activateWorkspace()"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ export class SpatialFilterToolComponent {
this.queryType = undefined;
}

clearMap() {
this.layers = [];
this.zone = undefined;
}

private loadThematics() {
this.loading = true;
let zeroResults = true;
Expand Down

0 comments on commit 51c826b

Please sign in to comment.