Make some fixes after update to angular 12

This commit is contained in:
Konstantinos Triantafyllou 2022-09-23 12:24:15 +03:00
parent 032b91ae7a
commit 717ead02b2
8 changed files with 18 additions and 18 deletions

View File

@ -7,7 +7,7 @@ import {properties} from "../../../../../environments/environment";
@Injectable({ providedIn: 'root' })
export class ContextsService {
private communitiesSubject: BehaviorSubject<any> = new BehaviorSubject(null);
private promise: Promise<any>;
private promise: Promise<void>;
private sub: Subscription = null;
constructor(private http: HttpClient=null ) {
@ -34,7 +34,7 @@ export class ContextsService {
public initCommunities() {
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)
.pipe(map(res => this.parseCommunities(res, true) ))
.subscribe(

View File

@ -11,7 +11,7 @@ export class CommunityService {
public community: BehaviorSubject<CommunityInfo> = new BehaviorSubject(null);
public communityId: string = null;
private promise: Promise<boolean> = null;
private promise: Promise<void> = null;
private subs = [];
constructor(private http: HttpClient) {}
@ -40,7 +40,7 @@ export class CommunityService {
getCommunity(communityId: string, refresh = false) {
if (this.communityId !== communityId || !this.community.value || refresh) {
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.community.next(community);
resolve();

View File

@ -40,7 +40,7 @@ export class ResourcesService {
"", "", false, [], null, {}));
items.push(ResourcesService.setLink(new MenuItem("indicator-themes", "Indicator Themes",
"", "", 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 => {
ResourcesService.types.forEach((type, index) => {
if (status[index]) {

View File

@ -23,7 +23,7 @@ export interface Reorder {
export class StakeholderService {
private stakeholderSubject: BehaviorSubject<Stakeholder> = null;
private promise: Promise<any>;
private promise: Promise<void>;
private sub;
constructor(private http: HttpClient, private route: ActivatedRoute) {
@ -46,7 +46,7 @@ export class StakeholderService {
getStakeholder(alias: string): Observable<Stakeholder> {
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 => {
return this.formalize(this.checkIsUpload(stakeholder));
})).subscribe(stakeholder => {

View File

@ -91,7 +91,7 @@ export class OrcidComponent {
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>";
if(window && window.opener) {
window.opener.postMessage("success");
window.opener.postMessage("success", "*");
window.close();
}
setTimeout(() => {

View File

@ -97,7 +97,7 @@ export class SearchResearchResultsComponent {
@Input() stickyForm:boolean = false;
private timeoutId;
private promise: Promise<boolean> = null;
private promise: Promise<void> = null;
private publicCommunities = null;
@Input() usedBy: string = "search";
@ -194,7 +194,7 @@ export class SearchResearchResultsComponent {
}
public getPublicCommunities() {
this.promise = new Promise<any>(resolve => {
this.promise = new Promise<void>(resolve => {
this._contextService.getPublicCommunitiesByState().subscribe(
data => {
if(this.publicCommunities == null) {

View File

@ -11,7 +11,7 @@ import {properties} from "../../../../environments/environment";
export class ConfigurationService {
private communityInformation: BehaviorSubject<Portal> = new BehaviorSubject(null);
private sub: Subscription = null;
private promise: Promise<boolean> = null;
private promise: Promise<void> = null;
constructor(private http: HttpClient) {
}
@ -36,7 +36,7 @@ export class ConfigurationService {
}
public initStaticCommunityInformation(communityInformation: Portal) {
this.promise = new Promise<any>((resolve => {
this.promise = new Promise<void>((resolve => {
this.communityInformation.next(communityInformation);
resolve();
}));
@ -45,7 +45,7 @@ export class ConfigurationService {
public initCommunityInformation(properties: EnvProperties, community: string) {
if (community == null) return;
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(
(communityInformation: Portal) => {
this.communityInformation.next(communityInformation);

View File

@ -13,7 +13,7 @@ export class ISVocabulariesService {
private subjectsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
private relationsVocabulary: BehaviorSubject<any> = new BehaviorSubject<any>(null);
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) {}
ngOnDestroy() {
@ -72,7 +72,7 @@ export class ISVocabulariesService {
this.vocabularies.set(vocabularyName, new BehaviorSubject<any>(null));
if(!this.vocabulariesPromises.has(vocabularyName)) {
this.vocabulariesPromises.set(vocabularyName,
new Promise<any>(resolve => {
new Promise<void>(resolve => {
this.subscriptions.push(this.getVocabularyFromService(vocabularyName, properties).subscribe(
vocabularyRes => {
this.vocabularies.get(vocabularyName).next(vocabularyRes);
@ -183,7 +183,7 @@ export class ISVocabulariesService {
async getProvenanceActionVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
if(!this.provenanceActionVocabulary || !this.provenanceActionVocabulary.getValue()) {
await new Promise<any>(resolve => {
await new Promise<void>(resolve => {
this.subscriptions.push(this.getProvenanceActionVocabularyFromService(vocabularyName, properties).subscribe(
vocabularyRes => {
this.provenanceActionVocabulary.next(vocabularyRes);
@ -223,7 +223,7 @@ export class ISVocabulariesService {
async getSubjectsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
if(!this.subjectsVocabulary || !this.subjectsVocabulary.getValue()) {
await new Promise<any>(resolve => {
await new Promise<void>(resolve => {
this.subscriptions.push(this.getSubjectsVocabularyFromService(vocabularyName, properties).subscribe(
vocabularyRes => {
// console.log(vocabularyRes);
@ -267,7 +267,7 @@ export class ISVocabulariesService {
async getRelationsVocabularyFromServiceAsync (vocabularyName: string, properties: EnvProperties): Promise<{}> {
if(!this.relationsVocabulary || !this.relationsVocabulary.getValue()) {
await new Promise<any>(resolve => {
await new Promise<void>(resolve => {
this.subscriptions.push(this.getRelationsVocabularyFromService(vocabularyName, properties).subscribe(
vocabularyRes => {
this.relationsVocabulary.next(vocabularyRes);