add filter service and enable chart states to filter lists

This commit is contained in:
Jesse Lucas
2020-04-03 09:20:27 -05:00
parent cce8b60515
commit 3bdceb1d6b
15 changed files with 144 additions and 48 deletions
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { FilterService } from './filter.service';
describe('FilterService', () => {
let service: FilterService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(FilterService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+25
View File
@@ -0,0 +1,25 @@
import { Injectable } from '@angular/core';
import { StType } from '../type';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export interface FilterInput {
type: StType;
text: string
}
export class FilterService {
constructor() { }
private filterChangeSource = new BehaviorSubject<FilterInput>({ type: StType.Folder, text: "" });
filterChanged$ = this.filterChangeSource.asObservable();
changeFilter(input: FilterInput) {
this.filterChangeSource.next(input);
}
}