Merge Angular 16 Irish Monitor to develop #33

Merged
k.triantafyllou merged 151 commits from angular-16-irish-monitor into develop 2024-02-13 09:32:41 +01:00
2 changed files with 57 additions and 1 deletions
Showing only changes of commit 52d63ece25 - Show all commits

View File

@ -21,7 +21,7 @@ import {Dates, StringUtils} from "../utils/string-utils.class";
import {Params} from "@angular/router";
import {StatisticsService} from "../monitor-admin/utils/services/statistics.service";
import {SearchResearchResultsService} from "../services/searchResearchResults.service";
import {CustomFilterService} from "../../shared/customFilter.service";
import {CustomFilterService} from "../shared/customFilter.service";
@Directive()
export abstract class MonitorIndicatorStakeholderBaseComponent extends IndicatorStakeholderBaseComponent implements OnInit {

View File

@ -0,0 +1,56 @@
import {Injectable} from "@angular/core";
import {HttpClient} from "@angular/common/http";
import {BehaviorSubject, from, Observable, Subscriber} from "rxjs";
import {SearchCustomFilter} from "../searchPages/searchUtils/searchUtils.class";
@Injectable({
providedIn: "root"
})
export class CustomFilterService {
private customFilterSubject: BehaviorSubject<SearchCustomFilter[]> = null;
private promise: Promise<void>;
private sub;
constructor(private http: HttpClient) {
this.customFilterSubject = new BehaviorSubject<SearchCustomFilter[]>(null);
}
ngOnDestroy() {
this.clearSubscriptions();
}
clearSubscriptions() {
if (this.sub instanceof Subscriber) {
this.sub.unsubscribe();
}
}
async getCustomFilterAsync() {
if (this.promise) {
await this.promise;
this.promise = null;
}
this.clearSubscriptions();
return this.customFilterSubject.getValue();
}
getCustomFilterAsObservable(): Observable<SearchCustomFilter[]> {
return this.customFilterSubject.asObservable();
}
setCustomFilter(customFilters: SearchCustomFilter[]) {
this.customFilterSubject.next(customFilters);
}
/*
static getDefaultFilters(){
let defaultFilters = new Map<string, SearchCustomFilter[]>();
defaultFilters.set("result",[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]);
defaultFilters.set("project",[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]);
defaultFilters.set("organization",[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]);
defaultFilters.set("datasource",[new SearchCustomFilter("National", "country", "IE", "Irish National Monitor")]);
return defaultFilters;
}*/
}