- connect(): Observable<EIJob[]> {
- const dataMutations = [
- this.eiJobSubject.asObservable(),
- this.sort.sortChange
- ];
- return merge(...dataMutations).pipe(map(() => {
- return this.getSortedData([...this.eiJobSubject.getValue()]);
- }));
- }
-
- disconnect(): void {
- this.eiJobSubject.complete();
- this.loadingSubject.complete();
- }
-
- private getSortedData(data: EIJob[]) {
- if (!this.sort || !this.sort.active || this.sort.direction === '') {
- return data;
- }
-
- return data.sort((a, b) => {
- const isAsc = this.sort.direction === 'asc';
- switch (this.sort.active) {
- case 'ei_job_identity': return compare(a.ei_job_identity, b.ei_job_identity, isAsc);
- case 'owner': return compare(a.owner, b.owner, isAsc);
- case 'ei_type_identity': return compare(a.ei_type_identity, b.ei_type_identity, isAsc);
- default: return 0;
- }
+ private getJobsForProducer(id: string) {
+ console.log('Getting jobs for producer ID: ', id);
+ this.eiSvc.getJobsForProducer(id).subscribe(producerJobs => {
+ this.jobs = this.jobs.concat(producerJobs);