Skip to content

Commit

Permalink
fix(filter): wait for sourcefields (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelord authored and mbarbeau committed Apr 12, 2018
1 parent b2ea1ad commit ff25d1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ <h4 matLine [matTooltip]="datasource.title" matTooltipShowDelay="500">{{datasour
<mat-icon>file_download</mat-icon>
</button>
</span>
<button mat-icon-button tooltip-position="below" matTooltipShowDelay="500" [matTooltip]="'igo.filter.addFilter' | translate"
[color]="color" (click)="addFilterToSequence()">
<button [disabled]="datasource.options['sourceFields'].length === 0" mat-icon-button tooltip-position="below" matTooltipShowDelay="500"
[matTooltip]="'igo.filter.addFilter' | translate" [color]="color" (click)="addFilterToSequence()">
<mat-icon>
add
</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export class OgcFilterableItemComponent implements OnInit, OnDestroy {
addFilterToSequence() {
const arr = this.datasource.options.ogcFilters.interfaceOgcFilters
const lastLevel = arr.length === 0 ? 0 : arr[arr.length - 1].level;
const firstFieldName = this.datasource.options['sourceFields'][0].name === undefined ?
let firstFieldName = '';
if (this.datasource.options['sourceFields'].length > 0) {
firstFieldName = this.datasource.options['sourceFields'][0].name === undefined ?
'' : this.datasource.options['sourceFields'][0].name;
}
let fieldNameGeometry = undefined;
if (this.datasource.options['fieldNameGeometry']) {
fieldNameGeometry = this.datasource.options['fieldNameGeometry'];
Expand Down
6 changes: 5 additions & 1 deletion src/lib/layer/layer-item/layer-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export class LayerItemComponent implements OnDestroy {
private _edition: boolean = false;

@Input()
get color() { return this._color; }
get color() {
this._color = this.layer.visible ? 'primary' : 'background';
return this._color;
}

set color(value: string) {
this._color = value;
}
Expand Down

0 comments on commit ff25d1e

Please sign in to comment.