[umbrella | WIP] stakeholders: add new fields for class, new function for service

This commit is contained in:
Alex Martzios 2024-05-30 10:41:26 +03:00
parent 2af1d0037d
commit 91f1dc0780
3 changed files with 22 additions and 2 deletions

View File

@ -46,9 +46,11 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
this.isMobile = isMobile; this.isMobile = isMobile;
this.cdr.detectChanges(); this.cdr.detectChanges();
})); }));
this.stakeholderType = this._route.snapshot.data.type;
if (!this.stakeholderType) { if (!this.stakeholderType) {
this.navigateToError(); this.stakeholderType = this._route.snapshot.data.type;
if (!this.stakeholderType) {
this.navigateToError();
}
} }
this.init(); this.init();
this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => { this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => {

View File

@ -47,6 +47,8 @@ export class Stakeholder {
copy: boolean = true; copy: boolean = true;
standalone: boolean = true; standalone: boolean = true;
umbrella: Umbrella; umbrella: Umbrella;
parent: Stakeholder;
otherParents: Stakeholder[] = [];
details?: any; details?: any;
constructor(_id: string, type: StakeholderType, index_id: string, index_name: string, index_shortName: string, alias: string, visibility: Visibility, logoUrl: string, defaultId: string = null, description: string = null) { constructor(_id: string, type: StakeholderType, index_id: string, index_name: string, index_shortName: string, alias: string, visibility: Visibility, logoUrl: string, defaultId: string = null, description: string = null) {

View File

@ -66,6 +66,22 @@ export class StakeholderService {
return from(this.getStakeholderAsync()); return from(this.getStakeholderAsync());
} }
getChildStakeholder(parent: string, type: string, child: string, shouldUpdate: boolean = false): Observable<Stakeholder> {
// TODO: if statement
this.promise = new Promise<void>((resolve, reject) => {
this.sub = this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(parent) + '/' + type + '/' + encodeURIComponent(child), CustomOptions.registryOptions()).pipe(map(stakeholder => {
return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholder));
})).subscribe(stakeholder => {
this.stakeholderSubject.next(stakeholder);
resolve();
}, error => {
this.stakeholderSubject.next(null);
resolve();
});
});
return from(this.getStakeholderAsync());
}
getResearcherStakeholder(orcid, name, results, shouldUpdate: boolean = false): Observable<Stakeholder> { getResearcherStakeholder(orcid, name, results, shouldUpdate: boolean = false): Observable<Stakeholder> {
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== orcid || shouldUpdate) { if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== orcid || shouldUpdate) {
this.promise = new Promise<void>((resolve, reject) => { this.promise = new Promise<void>((resolve, reject) => {