Skip to content

Commit

Permalink
Merge pull request #315 from liimaorg/bugix_reset_filter_add
Browse files Browse the repository at this point in the history
angular deploy: reset filter selection on change
  • Loading branch information
yvespp authored Dec 19, 2017
2 parents 9cc3d76 + efe9f74 commit 26c177e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>{{appState.get('pageTitle')}}</h1>
<div class="form-group">
<label for="selectFilterType" class="col-sm-1 control-label">Add filter</label>
<div class="col-sm-10">
<select id="selectFilterType" class="form-control" [(ngModel)]="selectedFilterType" (change)="addFilter()">
<select id="selectFilterType" #selectModel="ngModel" class="form-control" [(ngModel)]="selectedFilterType" (change)="addFilter()">
<option *ngFor="let filterType of filterTypes" [ngValue]="filterType">{{filterType.name}}</option>
</select>
</div>
Expand Down
7 changes: 5 additions & 2 deletions AMW_angular/io/src/app/deployment/deployments.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit, NgZone } from '@angular/core';
import { Component, OnInit, NgZone, ViewChild } from '@angular/core';
import { Location } from '@angular/common';
import { NgModel } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { AppState } from '../app.service';
import { ComparatorFilterOption } from './comparator-filter-option';
Expand All @@ -21,6 +22,7 @@ declare var $: any;
})

export class DeploymentsComponent implements OnInit {
@ViewChild('selectModel') private selectModel: NgModel;

defaultComparator: string = 'eq';

Expand Down Expand Up @@ -121,10 +123,11 @@ export class DeploymentsComponent implements OnInit {
newFilter.type = this.selectedFilterType.type;
newFilter.compOptions = this.comparatorOptionsForType(this.selectedFilterType.type);
this.setValueOptionsForFilter(newFilter);
this.filters.unshift(newFilter);
this.filters.push(newFilter);
this.enableDatepicker(newFilter.type);
this.offset = 0;
this.selectedFilterType = null;
this.selectModel.reset(null);
}
}

Expand Down

0 comments on commit 26c177e

Please sign in to comment.