Make some fixes after update to angular 12
This commit is contained in:
parent
032b91ae7a
commit
717ead02b2
|
@ -7,7 +7,7 @@ import {properties} from "../../../../../environments/environment";
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class ContextsService {
|
export class ContextsService {
|
||||||
private communitiesSubject: BehaviorSubject<any> = new BehaviorSubject(null);
|
private communitiesSubject: BehaviorSubject<any> = new BehaviorSubject(null);
|
||||||
private promise: Promise<any>;
|
private promise: Promise<void>;
|
||||||
private sub: Subscription = null;
|
private sub: Subscription = null;
|
||||||
|
|
||||||
constructor(private http: HttpClient=null ) {
|
constructor(private http: HttpClient=null ) {
|
||||||
|
@ -34,7 +34,7 @@ export class ContextsService {
|
||||||
|
|
||||||
public initCommunities() {
|
public initCommunities() {
|
||||||
let url = properties.contextsAPI + 's/';
|
let url = properties.contextsAPI + 's/';
|
||||||
this.promise = new Promise<any>((resolve => {
|
this.promise = new Promise<void>((resolve => {
|
||||||
this.sub = this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
this.sub = this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
.pipe(map(res => this.parseCommunities(res, true) ))
|
.pipe(map(res => this.parseCommunities(res, true) ))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
|
@ -11,7 +11,7 @@ export class CommunityService {
|
||||||
|
|
||||||
public community: BehaviorSubject<CommunityInfo> = new BehaviorSubject(null);
|
public community: BehaviorSubject<CommunityInfo> = new BehaviorSubject(null);
|
||||||
public communityId: string = null;
|
public communityId: string = null;
|
||||||
private promise: Promise<boolean> = null;
|
private promise: Promise<void> = null;
|
||||||
private subs = [];
|
private subs = [];
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
@ -40,7 +40,7 @@ export class CommunityService {
|
||||||
getCommunity(communityId: string, refresh = false) {
|
getCommunity(communityId: string, refresh = false) {
|
||||||
if (this.communityId !== communityId || !this.community.value || refresh) {
|
if (this.communityId !== communityId || !this.community.value || refresh) {
|
||||||
this.communityId = communityId;
|
this.communityId = communityId;
|
||||||
this.promise = new Promise<any>((resolve, reject) => {
|
this.promise = new Promise<void>((resolve, reject) => {
|
||||||
this.subs.push(this.getCommunityInfo(communityId).subscribe(community => {
|
this.subs.push(this.getCommunityInfo(communityId).subscribe(community => {
|
||||||
this.community.next(community);
|
this.community.next(community);
|
||||||
resolve();
|
resolve();
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class ResourcesService {
|
||||||
"", "", false, [], null, {}));
|
"", "", false, [], null, {}));
|
||||||
items.push(ResourcesService.setLink(new MenuItem("indicator-themes", "Indicator Themes",
|
items.push(ResourcesService.setLink(new MenuItem("indicator-themes", "Indicator Themes",
|
||||||
"", "", false, [], null, {}, null, null, null, null, '_self'), prefix + "/indicators/themes", portal));
|
"", "", false, [], null, {}, null, null, null, null, '_self'), prefix + "/indicators/themes", portal));
|
||||||
let promise = new Promise(resolve => {
|
let promise = new Promise<void>(resolve => {
|
||||||
this.isPagesEnabled().subscribe(status => {
|
this.isPagesEnabled().subscribe(status => {
|
||||||
ResourcesService.types.forEach((type, index) => {
|
ResourcesService.types.forEach((type, index) => {
|
||||||
if (status[index]) {
|
if (status[index]) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ export interface Reorder {
|
||||||
export class StakeholderService {
|
export class StakeholderService {
|
||||||
|
|
||||||
private stakeholderSubject: BehaviorSubject<Stakeholder> = null;
|
private stakeholderSubject: BehaviorSubject<Stakeholder> = null;
|
||||||
private promise: Promise<any>;
|
private promise: Promise<void>;
|
||||||
private sub;
|
private sub;
|
||||||
|
|
||||||
constructor(private http: HttpClient, private route: ActivatedRoute) {
|
constructor(private http: HttpClient, private route: ActivatedRoute) {
|
||||||
|
@ -46,7 +46,7 @@ export class StakeholderService {
|
||||||
|
|
||||||
getStakeholder(alias: string): Observable<Stakeholder> {
|
getStakeholder(alias: string): Observable<Stakeholder> {
|
||||||
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== alias) {
|
||||||
this.promise = new Promise<any>((resolve, reject) => {
|
this.promise = new Promise<void>((resolve, reject) => {
|
||||||
this.sub = this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias), CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
this.sub = this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent(alias), CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||||
return this.formalize(this.checkIsUpload(stakeholder));
|
return this.formalize(this.checkIsUpload(stakeholder));
|
||||||
})).subscribe(stakeholder => {
|
})).subscribe(stakeholder => {
|
||||||
|
|
|
@ -91,7 +91,7 @@ export class OrcidComponent {
|
||||||
this.message = "<div>Thank you for connecting your ORCID iD with OpenAIRE!</div>" +
|
this.message = "<div>Thank you for connecting your ORCID iD with OpenAIRE!</div>" +
|
||||||
"<div class='uk-margin-small-top'>This window will automatically close and you will be ready to link OpenAIRE research results with your ORCID iD.</div>";
|
"<div class='uk-margin-small-top'>This window will automatically close and you will be ready to link OpenAIRE research results with your ORCID iD.</div>";
|
||||||
if(window && window.opener) {
|
if(window && window.opener) {
|
||||||
window.opener.postMessage("success");
|
window.opener.postMessage("success", "*");
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
@ -97,7 +97,7 @@ export class SearchResearchResultsComponent {
|
||||||
@Input() stickyForm:boolean = false;
|
@Input() stickyForm:boolean = false;
|
||||||
|
|
||||||
private timeoutId;
|
private timeoutId;
|
||||||
private promise: Promise<boolean> = null;
|
private promise: Promise<void> = null;
|
||||||
private publicCommunities = null;
|
private publicCommunities = null;
|
||||||
|
|
||||||
@Input() usedBy: string = "search";
|
@Input() usedBy: string = "search";
|
||||||
|
@ -194,7 +194,7 @@ export class SearchResearchResultsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPublicCommunities() {
|
public getPublicCommunities() {
|
||||||
this.promise = new Promise<any>(resolve => {
|
this.promise = new Promise<void>(resolve => {
|
||||||
this._contextService.getPublicCommunitiesByState().subscribe(
|
this._contextService.getPublicCommunitiesByState().subscribe(
|
||||||
data => {
|
data => {
|
||||||
if(this.publicCommunities == null) {
|
if(this.publicCommunities == null) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
export class ConfigurationService {
|
export class ConfigurationService {
|
||||||
private communityInformation: BehaviorSubject<Portal> = new BehaviorSubject(null);
|
private communityInformation: BehaviorSubject<Portal> = new BehaviorSubject(null);
|
||||||
private sub: Subscription = null;
|
private sub: Subscription = null;
|
||||||
private promise: Promise<boolean> = null;
|
private promise: Promise<void> = null;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
constructor(private http: HttpClient) {
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ export class ConfigurationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public initStaticCommunityInformation(communityInformation: Portal) {
|
public initStaticCommunityInformation(communityInformation: Portal) {
|
||||||
this.promise = new Promise<any>((resolve => {
|
this.promise = new Promise<void>((resolve => {
|
||||||
this.communityInformation.next(communityInformation);
|
this.communityInformation.next(communityInformation);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
@ -45,7 +45,7 @@ export class ConfigurationService {
|
||||||
public initCommunityInformation(properties: EnvProperties, community: string) {
|
public initCommunityInformation(properties: EnvProperties, community: string) {
|
||||||
if (community == null) return;
|
if (community == null) return;
|
||||||
let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + community + "/full";
|
let url = properties.adminToolsAPIURL + "/" + properties.adminToolsPortalType + "/" + community + "/full";
|
||||||
this.promise = new Promise<any>((resolve => {
|
this.promise = new Promise<void>((resolve => {
|
||||||
this.sub = this.http.get<Portal>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url).subscribe(
|
this.sub = this.http.get<Portal>((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url).subscribe(
|
||||||
(communityInformation: Portal) => {
|
(communityInformation: Portal) => {
|
||||||
this.communityInformation.next(communityInformation);
|
this.communityInformation.next(communityInformation);
|
||||||
|
|
|
@ -13,7 +13,7 @@ export class ISVocabulariesService {
|
||||||
private subjectsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
private subjectsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
||||||
private relationsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
private relationsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
|
||||||
private subscriptions = [];
|
private subscriptions = [];
|
||||||
private vocabulariesPromises: Map<string, Promise<any>> = new Map<string, Promise<any>>();
|
private vocabulariesPromises: Map<string, Promise<void>> = new Map<string, Promise<void>>();
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
|
@ -72,7 +72,7 @@ export class ISVocabulariesService {
|
||||||
this.vocabularies.set(vocabularyName, new BehaviorSubject<any>(null));
|
this.vocabularies.set(vocabularyName, new BehaviorSubject<any>(null));
|
||||||
if(!this.vocabulariesPromises.has(vocabularyName)) {
|
if(!this.vocabulariesPromises.has(vocabularyName)) {
|
||||||
this.vocabulariesPromises.set(vocabularyName,
|
this.vocabulariesPromises.set(vocabularyName,
|
||||||
new Promise<any>(resolve => {
|
new Promise<void>(resolve => {
|
||||||
this.subscriptions.push(this.getVocabularyFromService(vocabularyName, properties).subscribe(
|
this.subscriptions.push(this.getVocabularyFromService(vocabularyName, properties).subscribe(
|
||||||
vocabularyRes => {
|
vocabularyRes => {
|
||||||
this.vocabularies.get(vocabularyName).next(vocabularyRes);
|
this.vocabularies.get(vocabularyName).next(vocabularyRes);
|
||||||
|
@ -183,7 +183,7 @@ export class ISVocabulariesService {
|
||||||
|
|
||||||
async getProvenanceActionVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
async getProvenanceActionVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
||||||
if(!this.provenanceActionVocabulary || !this.provenanceActionVocabulary.getValue()) {
|
if(!this.provenanceActionVocabulary || !this.provenanceActionVocabulary.getValue()) {
|
||||||
await new Promise<any>(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
this.subscriptions.push(this.getProvenanceActionVocabularyFromService(vocabularyName, properties).subscribe(
|
this.subscriptions.push(this.getProvenanceActionVocabularyFromService(vocabularyName, properties).subscribe(
|
||||||
vocabularyRes => {
|
vocabularyRes => {
|
||||||
this.provenanceActionVocabulary.next(vocabularyRes);
|
this.provenanceActionVocabulary.next(vocabularyRes);
|
||||||
|
@ -223,7 +223,7 @@ export class ISVocabulariesService {
|
||||||
|
|
||||||
async getSubjectsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
async getSubjectsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
||||||
if(!this.subjectsVocabulary || !this.subjectsVocabulary.getValue()) {
|
if(!this.subjectsVocabulary || !this.subjectsVocabulary.getValue()) {
|
||||||
await new Promise<any>(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
this.subscriptions.push(this.getSubjectsVocabularyFromService(vocabularyName, properties).subscribe(
|
this.subscriptions.push(this.getSubjectsVocabularyFromService(vocabularyName, properties).subscribe(
|
||||||
vocabularyRes => {
|
vocabularyRes => {
|
||||||
// console.log(vocabularyRes);
|
// console.log(vocabularyRes);
|
||||||
|
@ -267,7 +267,7 @@ export class ISVocabulariesService {
|
||||||
|
|
||||||
async getRelationsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
async getRelationsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
|
||||||
if(!this.relationsVocabulary || !this.relationsVocabulary.getValue()) {
|
if(!this.relationsVocabulary || !this.relationsVocabulary.getValue()) {
|
||||||
await new Promise<any>(resolve => {
|
await new Promise<void>(resolve => {
|
||||||
this.subscriptions.push(this.getRelationsVocabularyFromService(vocabularyName, properties).subscribe(
|
this.subscriptions.push(this.getRelationsVocabularyFromService(vocabularyName, properties).subscribe(
|
||||||
vocabularyRes => {
|
vocabularyRes => {
|
||||||
this.relationsVocabulary.next(vocabularyRes);
|
this.relationsVocabulary.next(vocabularyRes);
|
||||||
|
|
Loading…
Reference in New Issue