[umbrella | WIP] stakeholders: add new fields for class, new function for service
This commit is contained in:
parent
2af1d0037d
commit
91f1dc0780
|
@ -46,9 +46,11 @@ export class BrowseStakeholderBaseComponent<T> extends StakeholderBaseComponent
|
|||
this.isMobile = isMobile;
|
||||
this.cdr.detectChanges();
|
||||
}));
|
||||
this.stakeholderType = this._route.snapshot.data.type;
|
||||
if (!this.stakeholderType) {
|
||||
this.navigateToError();
|
||||
this.stakeholderType = this._route.snapshot.data.type;
|
||||
if (!this.stakeholderType) {
|
||||
this.navigateToError();
|
||||
}
|
||||
}
|
||||
this.init();
|
||||
this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => {
|
||||
|
|
|
@ -47,6 +47,8 @@ export class Stakeholder {
|
|||
copy: boolean = true;
|
||||
standalone: boolean = true;
|
||||
umbrella: Umbrella;
|
||||
parent: Stakeholder;
|
||||
otherParents: Stakeholder[] = [];
|
||||
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) {
|
||||
|
|
|
@ -66,6 +66,22 @@ export class StakeholderService {
|
|||
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> {
|
||||
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== orcid || shouldUpdate) {
|
||||
this.promise = new Promise<void>((resolve, reject) => {
|
||||
|
|
Loading…
Reference in New Issue