diff --git a/claims/claim-utils/claimResultSearchForm.component.ts b/claims/claim-utils/claimResultSearchForm.component.ts index 7937e625..4ea59e23 100644 --- a/claims/claim-utils/claimResultSearchForm.component.ts +++ b/claims/claim-utils/claimResultSearchForm.component.ts @@ -8,8 +8,7 @@ import {ClaimEntity, ClaimResult} from './claimHelper.class'; import {DOI, StringUtils} from '../../utils/string-utils.class'; import {EnvProperties} from '../../utils/properties/env-properties'; import {Filter, Value} from "../../searchPages/searchUtils/searchHelperClasses.class"; -import {Observable, Subscriber} from "rxjs"; -import 'rxjs/add/observable/forkJoin' +import {forkJoin, Observable, Subscriber} from 'rxjs'; import {NewSearchPageComponent} from "../../searchPages/searchUtils/newSearchPage.component"; import {RangeFilter} from "../../utils/rangeFilter/rangeFilterHelperClasses.class"; import {SearchFields} from "../../utils/properties/searchFields"; @@ -689,7 +688,7 @@ export class ClaimResultSearchFormComponent { doiObservables.push(ob); } - this.subscriptions.push(Observable.forkJoin(doiObservables).subscribe( + this.subscriptions.push(forkJoin(doiObservables).subscribe( data => { //if DOI not found or an error occured the result will be null -- remove null values for(let result of data){ diff --git a/claims/claim-utils/claimResultSearchForm.module.ts b/claims/claim-utils/claimResultSearchForm.module.ts index df4b12e1..263a4419 100644 --- a/claims/claim-utils/claimResultSearchForm.module.ts +++ b/claims/claim-utils/claimResultSearchForm.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { SharedModule } from '../../shared/shared.module'; import { CommonModule } from '@angular/common'; -import { MatSelectModule } from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; import {ClaimResultSearchFormComponent} from './claimResultSearchForm.component'; import {ClaimResultsModule} from './claimResults.module'; diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index dff6ac40..95ecc167 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -12,7 +12,7 @@
-
diff --git a/claims/claim-utils/displayClaims/displayClaims.module.ts b/claims/claim-utils/displayClaims/displayClaims.module.ts index d70b2c15..197d42e5 100644 --- a/claims/claim-utils/displayClaims/displayClaims.module.ts +++ b/claims/claim-utils/displayClaims/displayClaims.module.ts @@ -2,7 +2,11 @@ import { NgModule} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import {MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSelectModule, MatSlideToggleModule} from '@angular/material'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatSelectModule } from '@angular/material/select'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {ClaimServiceModule} from '../service/claimsService.module'; import {DisplayClaimsComponent} from './displayClaims.component'; import {LoadingModalModule} from '../../../utils/modal/loadingModal.module'; diff --git a/claims/claim-utils/service/contexts.service.ts b/claims/claim-utils/service/contexts.service.ts index 094b47d7..5491cd2d 100644 --- a/claims/claim-utils/service/contexts.service.ts +++ b/claims/claim-utils/service/contexts.service.ts @@ -1,6 +1,5 @@ import {BehaviorSubject, from, Observable, Subscription, throwError as observableThrowError} from 'rxjs'; import {Injectable} from '@angular/core'; -import {Response} from '@angular/http'; import {HttpClient} from '@angular/common/http'; import {catchError, map} from "rxjs/operators"; import {properties} from "../../../../../environments/environment"; @@ -160,7 +159,7 @@ export class ContextsService { } - private handleError (error: Response) { + private handleError (error: any) { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console console.log(error); diff --git a/claims/claim-utils/service/searchCrossref.service.ts b/claims/claim-utils/service/searchCrossref.service.ts index 740cdf51..526a5f96 100644 --- a/claims/claim-utils/service/searchCrossref.service.ts +++ b/claims/claim-utils/service/searchCrossref.service.ts @@ -1,6 +1,5 @@ import {throwError as observableThrowError} from 'rxjs'; import {Injectable} from '@angular/core'; -import {Response} from '@angular/http'; import {HttpClient} from '@angular/common/http'; import {ClaimEntity, ClaimResult} from '../claimHelper.class'; import {map} from "rxjs/operators"; @@ -48,7 +47,7 @@ export class SearchCrossrefService { } - private handleError(error: Response) { + private handleError(error: any) { // in a real world app, we may send the error to some remote logging infrastructure // instead of just logging it to the console console.log(error); diff --git a/claims/claim-utils/service/searchDatacite.service.ts b/claims/claim-utils/service/searchDatacite.service.ts index 81c7f24a..03299674 100644 --- a/claims/claim-utils/service/searchDatacite.service.ts +++ b/claims/claim-utils/service/searchDatacite.service.ts @@ -1,12 +1,11 @@ -import {Observable, throwError as observableThrowError} from 'rxjs'; +import {of, throwError as observableThrowError} from 'rxjs'; import {Injectable} from '@angular/core'; -import {Response} from '@angular/http'; import {HttpClient} from '@angular/common/http'; import {EnvProperties} from '../../../utils/properties/env-properties'; import {ClaimEntity, ClaimResult} from '../claimHelper.class'; -import {map} from "rxjs/operators"; -import 'rxjs/add/operator/catch'; -import 'rxjs/add/observable/of'; +import {catchError, map} from 'rxjs/operators'; + + @Injectable() export class SearchDataciteService { constructor(private http: HttpClient ) {} @@ -24,9 +23,8 @@ export class SearchDataciteService { getDataciteResultByDOI(doi: string, properties: EnvProperties, parse: boolean = false): any { let url = properties.searchDataciteAPIURL + '/' + doi; let key = url; - return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) - .pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request))).catch(e => Observable.of(null)); + .pipe(map(request => (parse ? SearchDataciteService.parse([request["data"]])[0] : request)), catchError(err => of(null))); } @@ -37,7 +35,7 @@ export class SearchDataciteService { return observableThrowError(error || 'Server error'); } - private extractData(res: Response) { + private extractData(res: any) { if (res.status < 200 || res.status >= 300) { throw new Error('Bad response status: ' + res.status); } diff --git a/claims/linking/linkingGeneric.module.ts b/claims/linking/linkingGeneric.module.ts index 7bffbc00..ec5e3b68 100644 --- a/claims/linking/linkingGeneric.module.ts +++ b/claims/linking/linkingGeneric.module.ts @@ -1,5 +1,5 @@ import { NgModule } from '@angular/core'; -import { MatSelectModule } from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; import { SharedModule } from '../../shared/shared.module'; import {SelectedProjectsModule} from './selected/selectedProjects.module'; diff --git a/claims/linking/selected/metadataPreview.module.ts b/claims/linking/selected/metadataPreview.module.ts index d270363d..8d9174e9 100644 --- a/claims/linking/selected/metadataPreview.module.ts +++ b/claims/linking/selected/metadataPreview.module.ts @@ -4,7 +4,11 @@ import {MetadataPreviewComponent} from './metadataPreview.component'; import {AlertModalModule} from '../../../utils/modal/alertModal.module'; import {ClaimEntitiesMetadataModule} from "./ClaimEntitiesMetadata.module"; import {InsertClaimsModule} from "../insertClaim/insertClaim.module"; -import { MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule} from '@angular/material'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; import {HelperModule} from "../../../utils/helper/helper.module"; @NgModule({ diff --git a/connect/communityGuard/connectAdminLoginGuard.guard.ts b/connect/communityGuard/connectAdminLoginGuard.guard.ts index 7a7836cc..e718cd8e 100644 --- a/connect/communityGuard/connectAdminLoginGuard.guard.ts +++ b/connect/communityGuard/connectAdminLoginGuard.guard.ts @@ -43,7 +43,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanActivateChild { return authorized; } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(route.params['community'], state.url); } diff --git a/connect/communityGuard/connectCommunityGuard.guard.ts b/connect/communityGuard/connectCommunityGuard.guard.ts index e089ab7e..3709d4ed 100644 --- a/connect/communityGuard/connectCommunityGuard.guard.ts +++ b/connect/communityGuard/connectCommunityGuard.guard.ts @@ -27,7 +27,7 @@ export class ConnectCommunityGuard implements CanActivate, CanActivateChild { })); } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { let community = route.params['community']; return community && this.check(community, state.url); } diff --git a/connect/communityGuard/connectRIGuard.guard.ts b/connect/communityGuard/connectRIGuard.guard.ts index ba28867f..1e0f67a7 100644 --- a/connect/communityGuard/connectRIGuard.guard.ts +++ b/connect/communityGuard/connectRIGuard.guard.ts @@ -27,7 +27,7 @@ export class ConnectRIGuard implements CanActivate, CanActivateChild { })); } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { let community = route.params['community']; return community && this.check(community, state.url); } diff --git a/connect/communityGuard/connectSubscriber.guard.ts b/connect/communityGuard/connectSubscriber.guard.ts index 77647160..19eea1f8 100644 --- a/connect/communityGuard/connectSubscriber.guard.ts +++ b/connect/communityGuard/connectSubscriber.guard.ts @@ -51,7 +51,7 @@ export class ConnectSubscriberGuard implements CanActivate, CanActivateChild { return authorized; } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(route, state); } diff --git a/connect/communityGuard/isCommunity.guard.ts b/connect/communityGuard/isCommunity.guard.ts index 53dea6a5..76b6cb91 100644 --- a/connect/communityGuard/isCommunity.guard.ts +++ b/connect/communityGuard/isCommunity.guard.ts @@ -42,7 +42,7 @@ export class IsCommunity implements CanActivate, CanActivateChild { } } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(route, state); } diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 67a599a4..6c20c60f 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -6,7 +6,7 @@ export class ConnectHelper { public static getCommunityFromDomain(domain: string): string{ if(properties.environment == "development") { - domain = "beta.egi.openaire.eu"; //for testing + domain = "beta.connect.openaire.eu"; //for testing } domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix if (domain.indexOf('openaire.eu') === -1) { diff --git a/connect/userEmailPreferences/mailsPrefs.module.ts b/connect/userEmailPreferences/mailsPrefs.module.ts index bab5d54b..f670212e 100644 --- a/connect/userEmailPreferences/mailsPrefs.module.ts +++ b/connect/userEmailPreferences/mailsPrefs.module.ts @@ -6,7 +6,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MailPrefsComponent } from './mailPrefs.component'; import { MailPrefsService } from './mailPrefs.service'; import {ErrorMessagesModule} from '../../utils/errorMessages.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; @NgModule({ imports: [ diff --git a/contact-us/contact-us.module.ts b/contact-us/contact-us.module.ts index e80b8c22..7fecbb41 100644 --- a/contact-us/contact-us.module.ts +++ b/contact-us/contact-us.module.ts @@ -3,21 +3,21 @@ import {CommonModule} from '@angular/common'; import {RouterModule} from '@angular/router'; import {ContactUsComponent} from './contact-us.component'; -import {RecaptchaModule} from "ng-recaptcha"; import {ReactiveFormsModule} from "@angular/forms"; import {MatAutocompleteModule} from "@angular/material/autocomplete"; +import {RecaptchaModule} from "ng-recaptcha"; @NgModule({ imports: [ CommonModule, RouterModule, - RecaptchaModule.forRoot(), ReactiveFormsModule, MatAutocompleteModule], - declarations: [ - ContactUsComponent - ], - providers: [], - exports: [ - ContactUsComponent - ] + ReactiveFormsModule, MatAutocompleteModule, RecaptchaModule], + declarations: [ + ContactUsComponent + ], + providers: [], + exports: [ + ContactUsComponent + ] }) export class ContactUsModule { diff --git a/dashboard/divId/divIds.component.ts b/dashboard/divId/divIds.component.ts index 549895e7..8c3cec57 100644 --- a/dashboard/divId/divIds.component.ts +++ b/dashboard/divId/divIds.component.ts @@ -38,7 +38,6 @@ export class DivIdsComponent implements OnInit { public filterForm: FormGroup; private subscriptions: any[] = []; public allPages: Option[] = []; - @ViewChild('PageInput') pageInput: ElementRef; selectedCommunityPid = null; public portalUtils: PortalUtils = new PortalUtils(); private index: number; diff --git a/dashboard/divId/divIds.module.ts b/dashboard/divId/divIds.module.ts index 3a7ded00..e4221fc3 100644 --- a/dashboard/divId/divIds.module.ts +++ b/dashboard/divId/divIds.module.ts @@ -9,7 +9,8 @@ import {InputModule} from "../../sharedComponents/input/input.module"; import {MatAutocompleteModule} from '@angular/material/autocomplete'; -import {MatCheckboxModule, MatFormFieldModule} from "@angular/material"; +import { MatCheckboxModule } from "@angular/material/checkbox"; +import { MatFormFieldModule } from "@angular/material/form-field"; import {MatChipsModule} from '@angular/material/chips'; diff --git a/dashboard/divhelpcontent/class-help-content-form.component.html b/dashboard/divhelpcontent/class-help-content-form.component.html index e1a3fb12..fd8fe243 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.html +++ b/dashboard/divhelpcontent/class-help-content-form.component.html @@ -7,7 +7,7 @@ - Go back to class contents list + Go back to class help texts list @@ -16,7 +16,7 @@
-
{{pageHelpContent ? 'Update ' : 'Add new '}} class content
+
{{pageHelpContent ? 'Update ' : 'Add new '}} class help text
{{page.name}} (unsaved changes) diff --git a/dashboard/divhelpcontent/class-help-content-form.component.ts b/dashboard/divhelpcontent/class-help-content-form.component.ts index e88ece9b..164d48dc 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.ts +++ b/dashboard/divhelpcontent/class-help-content-form.component.ts @@ -8,10 +8,10 @@ import {EnvProperties} from '../../utils/properties/env-properties'; import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {properties} from '../../../../environments/environment'; -import {Observable, Subscriber, Subscription} from 'rxjs'; +import {Subscriber, Subscription, zip} from 'rxjs'; import {HelperFunctions} from '../../utils/HelperFunctions.class'; -import {ConnectHelper} from '../../connect/connectHelper'; import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; + declare var UIkit; @Component({ @@ -26,9 +26,7 @@ export class ClassContentFormComponent implements OnInit { pageContentId: string; page: Page; classOptions = []; - - public properties: EnvProperties = null; - + public properties: EnvProperties = properties; public showLoading: boolean = true; public errorMessage: string = ''; @Input() updateErrorMessage: string = ''; @@ -39,13 +37,9 @@ export class ClassContentFormComponent implements OnInit { } ngOnInit() { - - this.properties = properties; this.subs.push(this.route.params.subscribe(params => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); this.subs.push(this.route.queryParams.subscribe(params => { - HelperFunctions.scroll(); this.pageId = params['pageId']; this.myForm = this.form; this.pageContentId = params['pageContentId']; @@ -53,14 +47,6 @@ export class ClassContentFormComponent implements OnInit { this._router.navigate(['../'], {relativeTo: this.route}); } this.getInfo(this.pageId); - if (!Session.isLoggedIn()) { - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url - } - }); - } })); })); } @@ -75,7 +61,7 @@ export class ClassContentFormComponent implements OnInit { getInfo(pageId: string) { this.showLoading = true; - let obs = Observable.zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal), + let obs = zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal), this._helpContentService.getDivIdsFullByPortal(pageId, this.properties.adminToolsAPIURL, this.portal)); this.subs.push(obs.subscribe( results => { diff --git a/dashboard/divhelpcontent/class-help-content-form.module.ts b/dashboard/divhelpcontent/class-help-content-form.module.ts index a0f718e4..1765f1fc 100644 --- a/dashboard/divhelpcontent/class-help-content-form.module.ts +++ b/dashboard/divhelpcontent/class-help-content-form.module.ts @@ -6,7 +6,7 @@ import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; import {CKEditorModule} from 'ng2-ckeditor'; import {AdminToolServiceModule} from '../../services/adminToolService.module'; import {InputModule} from '../../sharedComponents/input/input.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {IconsModule} from '../../utils/icons/icons.module'; import {RouterModule} from '@angular/router'; import {LoadingModule} from '../../utils/loading/loading.module'; diff --git a/dashboard/divhelpcontent/class-help-contents.component.html b/dashboard/divhelpcontent/class-help-contents.component.html index ce267ecf..a4dddb10 100644 --- a/dashboard/divhelpcontent/class-help-contents.component.html +++ b/dashboard/divhelpcontent/class-help-contents.component.html @@ -1,15 +1,11 @@
-
+
+ +
+
+
+
    +
  • +
    +
    +
    +
    +
    +
    -
    -
    -
    - -
    - -
    +
    +

    {{check.divHelpContent.content|htmlToString}}

    +
    +
    +
    + Class: {{check.divHelpContent.divId.name ? check.divHelpContent.divId.name : check.divHelpContent.divId}} +
    +
    + Enable/disable: + +
    +
    +
    +
    +
    -
    -
    -
    -
    -
    -
      -
    • -
      -
      -
      -
      -
      -
      - -
      -

      {{check.divHelpContent.content|htmlToString}}

      -
      -
      -
      - Class: {{check.divHelpContent.divId.name?check.divHelpContent.divId.name:check.divHelpContent.divId}} -
      -
      - Enable/disable: - -
      -
      -
      - -
      -
      - -
      -
      -
      - - +
      +
      +
      + + Edit -
      -
      - - +
      +
      + + Delete -
      -
      -
      -
      -
      -
    • -
    +
    -
    -
    No page contents found
    -
    -
    -
    -
    +
  • +
+
+
+
No class help texts found
-
- +
+ diff --git a/dashboard/divhelpcontent/class-help-contents.component.ts b/dashboard/divhelpcontent/class-help-contents.component.ts index 09a0927c..aa3bf794 100644 --- a/dashboard/divhelpcontent/class-help-contents.component.ts +++ b/dashboard/divhelpcontent/class-help-contents.component.ts @@ -1,20 +1,20 @@ -import {Component, ViewChild, OnInit, ElementRef} from '@angular/core'; -import {FormBuilder, FormControl, FormGroup} from "@angular/forms"; -import {ActivatedRoute, Router} from "@angular/router"; -import {HelpContentService} from "../../services/help-content.service"; +import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; +import {FormBuilder, FormControl, FormGroup} from '@angular/forms'; +import {ActivatedRoute, Router} from '@angular/router'; +import {HelpContentService} from '../../services/help-content.service'; import {PageHelpContentFilterOptions} from '../../utils/entities/adminTool/page-help-content'; -import {Page} from "../../utils/entities/adminTool/page"; -import {Portal} from "../../utils/entities/adminTool/portal"; +import {Page} from '../../utils/entities/adminTool/page'; +import {Portal} from '../../utils/entities/adminTool/portal'; import {EnvProperties} from '../../utils/properties/env-properties'; import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; -import {HelperFunctions} from "../../utils/HelperFunctions.class"; -import {Subscriber} from "rxjs"; -import {properties} from "../../../../environments/environment"; +import {HelperFunctions} from '../../utils/HelperFunctions.class'; +import {Subscriber} from 'rxjs'; +import {properties} from '../../../../environments/environment'; import {DomSanitizer} from '@angular/platform-browser'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; -import {ConnectHelper} from '../../connect/connectHelper'; import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; + declare var UIkit; @@ -23,74 +23,51 @@ declare var UIkit; templateUrl: './class-help-contents.component.html', }) export class ClassHelpContentsComponent implements OnInit { - @ViewChild('AlertModalDeletePageHelpContents') alertModalDeletePageHelpContents; private selectedPageContents: string[] = []; - public checkboxes: CheckDivHelpContent[] = []; - - public pageHelpContents: DivHelpContent[] = []; - + public divHelpContents: DivHelpContent[] = []; public formGroup: FormGroup; - public pages: Page[]; - public checkboxAll: boolean = false; - public filters: PageHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')}; - public keyword: string = ""; - + public keyword: string = ''; public counter = {all: 0, active: 0, inactive: 0}; - public communities: Portal[] = []; - public portal: string; - public selectedPageId: string; - public community: Portal; - public page: Page; - public properties: EnvProperties = null; - + public properties: EnvProperties = properties; public showLoading: boolean = true; - public errorMessage: string = ''; - public updateErrorMessage: string = ''; public filterForm: FormControl; - public selectForm: FormControl; private subscriptions: any[] = []; public selectedKeyword: string; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; - + + constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { + } + ngOnInit() { this.filterForm = this._fb.control(''); - this.selectForm = this._fb.control(''); this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { this.filterBySearch(value); })); - this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => { - this.filterByPage(value); - })); - - this.properties = properties; this.subscriptions.push(this.route.params.subscribe(params => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); this.subscriptions.push(this.route.queryParams.subscribe(params => { HelperFunctions.scroll(); this.selectedPageId = params['pageId']; if (this.portal && this.selectedPageId) { this.getPage(this.selectedPageId); } - if(!this.selectedPageId) { - this.router.navigate(['../pages'], {relativeTo: this.route }); + if (!this.selectedPageId) { + this.router.navigate(['../pages'], {relativeTo: this.route}); } })); })); } - - constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { - } + ngOnDestroy(): void { this.subscriptions.forEach(value => { if (value instanceof Subscriber) { @@ -100,191 +77,145 @@ export class ClassHelpContentsComponent implements OnInit { } }); } - init(){ - - } + getPage(pageId: string) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + this.showLoading = true; + this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe( + page => { + if (this.properties.adminToolsPortalType != page.portalType) { + this.router.navigate(['./pageContents'], {queryParams: {'communityId': this.portal}}); + } else { + this.page = page; + this.getPageHelpContents(this.portal); } - }); - } else { - this.showLoading = true; - this.updateErrorMessage = ""; - this.errorMessage = ""; - this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe( - page => { - if (this.properties.adminToolsPortalType != page.portalType) { - this.router.navigate(['./pageContents'], {queryParams: {"communityId": this.portal}}); - } else { - this.page = page; - this.getPageHelpContents(this.portal); - } - }, - error => this.handleError('System error retrieving page', error))); - } + }, + error => this.handleError('System error retrieving page', error))); } - - - public countPageHelpContents() { + + + public countClassHelpContents() { this.counter = {all: 0, active: 0, inactive: 0}; let filter = Object.assign({}, this.filters); filter.active = null; - this.pageHelpContents.forEach(_ => { + this.divHelpContents.forEach(_ => { if (this.filterPageHelpContent(_, filter)) { - if (_.isActive == true) this.counter.active++; - else this.counter.inactive++ + if (_.isActive == true) { + this.counter.active++; + } else { + this.counter.inactive++; + } } }); this.counter.all = this.counter.active + this.counter.inactive; } - + getPageHelpContents(community_pid: string) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + this.subscriptions.push(this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe( + pageHelpContents => { + this.divHelpContents = pageHelpContents as Array; + this.counter.all = this.divHelpContents.length; + this.checkboxes = []; + + for (let i = this.divHelpContents.length - 1; i >= 0; i -= 1) { + this.checkboxes.unshift({divHelpContent: this.divHelpContents[i], checked: false}); } - }); - } else { - this.subscriptions.push(this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe( - pageHelpContents => { - this.pageHelpContents = pageHelpContents as Array; - this.counter.all = this.pageHelpContents.length; - this.checkboxes = []; - - for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) { - this.checkboxes.unshift({divHelpContent: this.pageHelpContents[i], checked: false}); - } - - this.countPageHelpContents(); - - this.showLoading = false; - }, - error => this.handleError('System error retrieving page contents', error))); - } + + this.countClassHelpContents(); + + this.showLoading = false; + }, + error => this.handleError('System error retrieving page contents', error))); } - - public toggleCheckBoxes(event) { - this.checkboxes.forEach(_ => _.checked = event.target.checked); - this.checkboxAll = event.target.checked; - } - + public applyCheck(flag: boolean) { this.checkboxes.forEach(_ => _.checked = flag); this.checkboxAll = false; } - + public getSelectedPageHelpContents(): string[] { return this.checkboxes.filter(pageHelpContent => pageHelpContent.checked == true) .map(checkedPageHelpContent => checkedPageHelpContent.divHelpContent).map(res => res._id); } - + public confirmDeletePageHelpContent(id: string) { this.selectedPageContents = [id]; this.confirmModalOpen(); } - + public confirmDeleteSelectedPageHelpContents() { - + this.selectedPageContents = this.getSelectedPageHelpContents(); this.confirmModalOpen(); } - + private confirmModalOpen() { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url - } - }); - } else { - this.alertModalDeletePageHelpContents.cancelButton = true; - this.alertModalDeletePageHelpContents.okButton = true; - this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation"; - this.alertModalDeletePageHelpContents.message = "Are you sure you want to delete the selected page content(s)?"; - this.alertModalDeletePageHelpContents.okButtonText = "Yes"; - this.alertModalDeletePageHelpContents.open(); - } + this.alertModalDeletePageHelpContents.cancelButton = true; + this.alertModalDeletePageHelpContents.okButton = true; + this.alertModalDeletePageHelpContents.alertTitle = 'Delete Confirmation'; + this.alertModalDeletePageHelpContents.message = 'Are you sure you want to delete the selected page content(s)?'; + this.alertModalDeletePageHelpContents.okButtonText = 'Yes'; + this.alertModalDeletePageHelpContents.open(); } - + public confirmedDeletePageHelpContents(data: any) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url - } - }); - } else { - this.showLoading = true; - this.updateErrorMessage = ""; - - this.subscriptions.push(this._helpService.deleteDivHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe( - _ => { - this.deletePageHelpContentsFromArray(this.selectedPageContents); - UIkit.notification('Page content(s) has been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - this.showLoading = false; - }, - error => this.handleUpdateError('System error deleting the selected page content(s)', error) - )); - } + this.showLoading = true; + this.subscriptions.push(this._helpService.deleteDivHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe( + _ => { + this.deletePageHelpContentsFromArray(this.selectedPageContents); + UIkit.notification('Page content(s) has been successfully deleted', { + status: 'success', + timeout: 6000, + pos: 'bottom-right' + }); + this.showLoading = false; + }, + error => this.handleUpdateError('System error deleting the selected page content(s)', error) + )); } - + private deletePageHelpContentsFromArray(ids: string[]): void { for (let id of ids) { - let iqc = this.checkboxes.findIndex(_ => _.divHelpContent._id == id); - let iq = this.pageHelpContents.findIndex(_ => _._id == id); - this.checkboxes.splice(iqc, 1); - this.pageHelpContents.splice(iqc, 1); + let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id); + let j = this.divHelpContents.findIndex(_ => _._id == id); + this.checkboxes.splice(i, 1); + this.divHelpContents.splice(j, 1); } - this.countPageHelpContents(); + this.countClassHelpContents(); } - + public editPageHelpContent(id: string) { if (this.selectedPageId) { this.router.navigate(['edit/'], { queryParams: { - "pageContentId": id, - "pageId": this.selectedPageId + 'pageContentId': id, + 'pageId': this.selectedPageId }, relativeTo: this.route }); } else { this.router.navigate(['edit/'], { queryParams: { - "pageContentId": id, + 'pageContentId': id, }, relativeTo: this.route }); } } - + public togglePageHelpContents(status: boolean, ids: string[]) { if (!Session.isLoggedIn()) { this.router.navigate(['/user-info'], { queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + 'errorCode': LoginErrorCodes.NOT_VALID, + 'redirectUrl': this.router.url } }); } else { - this.updateErrorMessage = ""; - this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe( () => { for (let id of ids) { let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id); this.checkboxes[i].divHelpContent.isActive = status; } - this.countPageHelpContents(); + this.countClassHelpContents(); this.applyCheck(false); UIkit.notification('Page content(s) has been successfully updated', { status: 'success', @@ -296,69 +227,70 @@ export class ClassHelpContentsComponent implements OnInit { )); } } - - - public filterPageHelpContent(pageHelpContent: DivHelpContent, filters: PageHelpContentFilterOptions): boolean { - let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active; - let textFlag = filters.text.toString() == '' || (pageHelpContent.content).match(filters.text) != null; - return activeFlag && textFlag; + + + public filterPageHelpContent(divHelpContent: DivHelpContent, filters: PageHelpContentFilterOptions): boolean { + let activeFlag = filters.active == null || divHelpContent.isActive == filters.active; + let textFlag = filters.text.toString() == '' || (divHelpContent.content && divHelpContent.content.match(filters.text) != null); + return activeFlag && textFlag; } - - + + public applyFilter() { this.checkboxes = []; - this.pageHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach( + this.divHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach( _ => { - this.checkboxes.push({divHelpContent: _, checked: false}) + this.checkboxes.push({divHelpContent: _, checked: false}); } ); } - - public filterByPage(event: any) { - if(event.target && event.target.value) { - this.filters.id = event.target.value; - this.applyFilter(); - } - } + public filterBySearch(text: string) { - this.filters.text = new RegExp(text, "i"); + this.filters.text = new RegExp(text, 'i'); this.applyFilter(); } - + handleError(message: string, error) { - this.errorMessage = message; + UIkit.notification(message, { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); console.log('Server responded: ' + error); - this.showLoading = false; } - + handleUpdateError(message: string, error) { - this.updateErrorMessage = message; + UIkit.notification(message, { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); console.log('Server responded: ' + error); - this.showLoading = false; } - + public newPageContent() { - this.router.navigate(['edit'], { - queryParams: { - pageId: this.selectedPageId - }, relativeTo: this.route - }); + this.router.navigate(['edit'], { + queryParams: { + pageId: this.selectedPageId + }, relativeTo: this.route + }); } - + public onSearchClose() { this.selectedKeyword = this.filterForm.value; } - + public reset() { this.selectedKeyword = null; - this.searchInputComponent.reset() + this.searchInputComponent.reset(); } - selectAll(){ - let checked = !!(this.getSelectedPageHelpContents().length != this.checkboxes.length); - for (let check of this.checkboxes) { - check.checked = checked; - } + + selectAll() { + let checked = (this.getSelectedPageHelpContents().length != this.checkboxes.length); + for (let check of this.checkboxes) { + check.checked = checked; + } } } diff --git a/dashboard/divhelpcontent/class-help-contents.module.ts b/dashboard/divhelpcontent/class-help-contents.module.ts index c7548b46..59843842 100644 --- a/dashboard/divhelpcontent/class-help-contents.module.ts +++ b/dashboard/divhelpcontent/class-help-contents.module.ts @@ -6,7 +6,7 @@ import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminL import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {AdminToolServiceModule} from '../../services/adminToolService.module'; import {InputModule} from '../../sharedComponents/input/input.module'; import {SearchInputModule} from '../../sharedComponents/search-input/search-input.module'; diff --git a/dashboard/entity/entities.component.ts b/dashboard/entity/entities.component.ts index a51eb5e7..3b4efb5c 100644 --- a/dashboard/entity/entities.component.ts +++ b/dashboard/entity/entities.component.ts @@ -6,11 +6,9 @@ import {CheckEntity, Entity} from '../../utils/entities/adminTool/entity'; import {Portal} from '../../utils/entities/adminTool/portal'; import {EnvProperties} from '../../utils/properties/env-properties'; import {Session} from '../../login/utils/helper.class'; -import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {UserManagementService} from '../../services/user-management.service'; import {Subscriber} from "rxjs"; import {properties} from "../../../../environments/environment"; -import {ConnectHelper} from "../../connect/connectHelper"; import {AlertModal} from "../../utils/modal/alert"; import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; import {StringUtils} from "../../utils/string-utils.class"; @@ -73,7 +71,6 @@ export class EntitiesComponent implements OnInit { })); this.userManagementService.getUserInfo().subscribe(user => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); if (this.route.snapshot.data.portal) { this.title.setTitle(StringUtils.capitalize(this.portal) + ' | Entities'); } else if (this.route.snapshot.params[this.route.snapshot.data.param]) { diff --git a/dashboard/entity/entities.module.ts b/dashboard/entity/entities.module.ts index 9a84af29..349c2adf 100644 --- a/dashboard/entity/entities.module.ts +++ b/dashboard/entity/entities.module.ts @@ -4,7 +4,7 @@ import {CommonModule} from '@angular/common'; import {EntitiesComponent} from './entities.component'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {AdminToolServiceModule} from "../../services/adminToolService.module"; import {InputModule} from "../../sharedComponents/input/input.module"; import {PageContentModule} from "../sharedComponents/page-content/page-content.module"; diff --git a/dashboard/helpTexts/page-help-content-form.component.html b/dashboard/helpTexts/page-help-content-form.component.html index cd94c931..d7a4e68c 100644 --- a/dashboard/helpTexts/page-help-content-form.component.html +++ b/dashboard/helpTexts/page-help-content-form.component.html @@ -7,7 +7,7 @@ - Go back to helptexts list + Go back to page help texts list
@@ -16,7 +16,7 @@
-
{{pageHelpContent ? 'Update ' : 'Add new '}} help text
+
{{pageHelpContent ? 'Update ' : 'Add new '}} page help text
{{page.name}} (unsaved changes) diff --git a/dashboard/helpTexts/page-help-content-form.component.ts b/dashboard/helpTexts/page-help-content-form.component.ts index 0f7dd90f..ce2b1ec6 100644 --- a/dashboard/helpTexts/page-help-content-form.component.ts +++ b/dashboard/helpTexts/page-help-content-form.component.ts @@ -5,10 +5,9 @@ import {Page} from '../../utils/entities/adminTool/page'; import {HelpContentService} from '../../services/help-content.service'; import {EnvProperties} from '../../utils/properties/env-properties'; import {properties} from '../../../../environments/environment'; -import {Observable, Subscriber, Subscription} from 'rxjs'; +import {Subscriber, Subscription, zip} from 'rxjs'; import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content'; -import {ConnectHelper} from "../../connect/connectHelper"; declare var UIkit; @@ -36,7 +35,6 @@ export class PageContentFormComponent implements OnInit { ngOnInit() { this.subs.push(this.route.params.subscribe(params => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); this.subs.push(this.route.queryParams.subscribe(params => { HelperFunctions.scroll(); this.pageId = params['pageId']; @@ -60,7 +58,7 @@ export class PageContentFormComponent implements OnInit { getInfo(pageId: string) { this.showLoading = true; - let obs = Observable.zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal), this._helpContentService.getCommunityPageHelpContents(this.portal, this.properties.adminToolsAPIURL, pageId)); + let obs = zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal), this._helpContentService.getCommunityPageHelpContents(this.portal, this.properties.adminToolsAPIURL, pageId)); this.subs.push(obs.subscribe( results => { this.page = results[0]; diff --git a/dashboard/helpTexts/page-help-content-form.module.ts b/dashboard/helpTexts/page-help-content-form.module.ts index 5412dc73..dfad8378 100644 --- a/dashboard/helpTexts/page-help-content-form.module.ts +++ b/dashboard/helpTexts/page-help-content-form.module.ts @@ -8,7 +8,7 @@ import {PageContentFormComponent} from './page-help-content-form.component'; import {PageHelpContentFormRoutingModule} from './page-help-content-form-routing.module'; import {AdminToolServiceModule} from '../../services/adminToolService.module'; import {InputModule} from '../../sharedComponents/input/input.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {IconsModule} from '../../utils/icons/icons.module'; import {PageContentModule} from '../sharedComponents/page-content/page-content.module'; import {RouterModule} from '@angular/router'; diff --git a/dashboard/helpTexts/page-help-contents.component.html b/dashboard/helpTexts/page-help-contents.component.html index 57cbc162..783ce5ee 100644 --- a/dashboard/helpTexts/page-help-contents.component.html +++ b/dashboard/helpTexts/page-help-contents.component.html @@ -24,18 +24,19 @@ - +
-
{{getSelectedPageHelpContents().length}} pages selected - Actions + Actions
-
-
-
-
-
    -
  • -
    -
    -
    -
    -
    -
    -
    -
    {{check.pageHelpContent.page.name}}
    -
    -
    -

    {{check.pageHelpContent.content|htmlToString}}

    -
    -
    -
    - Placement: {{check.pageHelpContent.placement}} -
    -
    - Order: {{check.pageHelpContent.order}} -
    -
    - Enable/disable: - -
    -
    -
    - +
    + +
    +
    +
    +
      +
    • +
      +
      +
      +
      +
      +
      +
      +
      {{check.pageHelpContent.page.name}}
      -
      - -
      -
      -
      - - - Edit - -
      -
      - - - Delete - -
      -
      -
      +
      +

      {{check.pageHelpContent.content|htmlToString}}

      +
      +
      +
      + Placement: {{check.pageHelpContent.placement}} +
      +
      + Order: {{check.pageHelpContent.order}} +
      +
      + Enable/disable: +
      -
    • -
    -
    -
    No page contents found
    +
    +
    +
    +
    +
    +
    + + Edit +
    +
    + + + Delete + +
    +
    +
    -
    +
  • +
+
+
+
No page help texts found
diff --git a/dashboard/helpTexts/page-help-contents.component.ts b/dashboard/helpTexts/page-help-contents.component.ts index 7939168e..054c0f72 100644 --- a/dashboard/helpTexts/page-help-contents.component.ts +++ b/dashboard/helpTexts/page-help-contents.component.ts @@ -1,23 +1,22 @@ -import {Component, ViewChild, OnInit, ElementRef} from '@angular/core'; -import {FormBuilder, FormControl, FormGroup} from "@angular/forms"; -import {ActivatedRoute, Router} from "@angular/router"; -import {HelpContentService} from "../../services/help-content.service"; +import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; +import {FormBuilder, FormControl, FormGroup} from '@angular/forms'; +import {ActivatedRoute, Router} from '@angular/router'; +import {HelpContentService} from '../../services/help-content.service'; import { - PageHelpContent, CheckPageHelpContent, + PageHelpContent, PageHelpContentFilterOptions -} from "../../utils/entities/adminTool/page-help-content"; -import {Page} from "../../utils/entities/adminTool/page"; -import {Portal} from "../../utils/entities/adminTool/portal"; +} from '../../utils/entities/adminTool/page-help-content'; +import {CheckPage, Page} from '../../utils/entities/adminTool/page'; +import {Portal} from '../../utils/entities/adminTool/portal'; import {EnvProperties} from '../../utils/properties/env-properties'; import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; -import {HelperFunctions} from "../../utils/HelperFunctions.class"; -import {Subscriber} from "rxjs"; -import {properties} from "../../../../environments/environment"; +import {HelperFunctions} from '../../utils/HelperFunctions.class'; +import {Subscriber} from 'rxjs'; +import {properties} from '../../../../environments/environment'; import {DomSanitizer} from '@angular/platform-browser'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; -import {ConnectHelper} from '../../connect/connectHelper'; declare var UIkit; @@ -34,7 +33,7 @@ export class PageHelpContentsComponent implements OnInit { public pages: Page[]; public checkboxAll: boolean = false; public filters: PageHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')}; - public keyword: string = ""; + public keyword: string = ''; public counter = {all: 0, active: 0, inactive: 0}; public communities: Portal[] = []; public portal: string; @@ -44,23 +43,20 @@ export class PageHelpContentsComponent implements OnInit { public properties: EnvProperties = properties; public showLoading: boolean = true; public filterForm: FormControl; - public selectForm: FormControl; private subscriptions: any[] = []; public selectedKeyword: string; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; + constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { + } + ngOnInit() { this.filterForm = this._fb.control(''); - this.selectForm = this._fb.control(''); this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { this.filterBySearch(value); })); - this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => { - this.filterByPage(value); - })); this.subscriptions.push(this.route.params.subscribe(params => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); this.subscriptions.push(this.route.queryParams.subscribe(params => { HelperFunctions.scroll(); this.selectedPageId = params['pageId']; @@ -74,9 +70,6 @@ export class PageHelpContentsComponent implements OnInit { })); } - constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) { - } - ngOnDestroy(): void { this.subscriptions.forEach(value => { if (value instanceof Subscriber) { @@ -88,74 +81,54 @@ export class PageHelpContentsComponent implements OnInit { } getPage(pageId: string) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + this.showLoading = true; + this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe( + page => { + if (this.properties.adminToolsPortalType != page.portalType) { + this.router.navigate(['./pageContents']); + } else { + this.page = page; + this.getPageHelpContents(this.portal); } - }); - } else { - this.showLoading = true; - this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe( - page => { - if (this.properties.adminToolsPortalType != page.portalType) { - this.router.navigate(['./pageContents']); - } else { - this.page = page; - this.getPageHelpContents(this.portal); - } - }, - error => this.handleError('System error retrieving page', error))); - } + }, + error => this.handleError('System error retrieving page', error))); } - + public countPageHelpContents() { this.counter = {all: 0, active: 0, inactive: 0}; let filter = Object.assign({}, this.filters); filter.active = null; this.pageHelpContents.forEach(_ => { if (this.filterPageHelpContent(_, filter)) { - if (_.isActive == true) this.counter.active++; - else this.counter.inactive++ + if (_.isActive == true) { + this.counter.active++; + } else { + this.counter.inactive++; + } } }); this.counter.all = this.counter.active + this.counter.inactive; } getPageHelpContents(community_pid: string) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + this.subscriptions.push(this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe( + pageHelpContents => { + this.pageHelpContents = pageHelpContents as Array; + this.counter.all = this.pageHelpContents.length; + this.checkboxes = []; + + for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) { + this.checkboxes.unshift({ + pageHelpContent: this.pageHelpContents[i], + checked: false + }); } - }); - } else { - this.subscriptions.push(this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe( - pageHelpContents => { - this.pageHelpContents = pageHelpContents as Array; - this.counter.all = this.pageHelpContents.length; - this.checkboxes = []; - - for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) { - this.checkboxes.unshift({ - pageHelpContent: this.pageHelpContents[i], - checked: false - }); - } - - this.countPageHelpContents(); - - this.showLoading = false; - }, - error => this.handleError('System error retrieving page contents', error))); - } - } - - public toggleCheckBoxes(event) { - this.checkboxes.forEach(_ => _.checked = event.target.checked); - this.checkboxAll = event.target.checked; + + this.countPageHelpContents(); + + this.showLoading = false; + }, + error => this.handleError('System error retrieving page contents', error))); } public applyCheck(flag: boolean) { @@ -179,56 +152,39 @@ export class PageHelpContentsComponent implements OnInit { } private confirmModalOpen() { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url - } - }); - } else { - this.alertModalDeletePageHelpContents.cancelButton = true; - this.alertModalDeletePageHelpContents.okButton = true; - this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation"; - this.alertModalDeletePageHelpContents.message = "Are you sure you want to delete the selected page content(s)?"; - this.alertModalDeletePageHelpContents.okButtonText = "Yes"; - this.alertModalDeletePageHelpContents.open(); - } + this.alertModalDeletePageHelpContents.cancelButton = true; + this.alertModalDeletePageHelpContents.okButton = true; + this.alertModalDeletePageHelpContents.alertTitle = 'Delete Confirmation'; + this.alertModalDeletePageHelpContents.message = 'Are you sure you want to delete the selected page content(s)?'; + this.alertModalDeletePageHelpContents.okButtonText = 'Yes'; + this.alertModalDeletePageHelpContents.open(); } public confirmedDeletePageHelpContents(data: any) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url - } - }); - } else { - this.showLoading = true; - this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe( - _ => { - this.deletePageHelpContentsFromArray(this.selectedPageContents); - UIkit.notification('Page content(s) has been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - this.showLoading = false; - }, - error => this.handleUpdateError('System error deleting the selected page content(s)', error) - )); - } + this.showLoading = true; + this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe( + _ => { + this.deletePageHelpContentsFromArray(this.selectedPageContents); + UIkit.notification('Page content(s) has been successfully deleted', { + status: 'success', + timeout: 6000, + pos: 'bottom-right' + }); + this.showLoading = false; + }, + error => this.handleUpdateError('System error deleting the selected page content(s)', error) + )); } private deletePageHelpContentsFromArray(ids: string[]): void { for (let id of ids) { - let iqc = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); - let iq = this.pageHelpContents.findIndex(_ => _._id == id); - this.checkboxes.splice(iqc, 1); - this.pageHelpContents.splice(iqc, 1); + let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); + let j = this.pageHelpContents.findIndex(_ => _._id == id); + this.checkboxes.splice(i, 1); + this.pageHelpContents.splice(j, 1); } this.countPageHelpContents(); + this.filterBySearch(this.filterForm.value); } public editPageHelpContent(id: string) { @@ -236,53 +192,44 @@ export class PageHelpContentsComponent implements OnInit { if (this.selectedPageId) { this.router.navigate(['edit/'], { queryParams: { - "pageContentId": id, - "pageId": this.selectedPageId + 'pageContentId': id, + 'pageId': this.selectedPageId }, relativeTo: this.route }); } else { this.router.navigate(['edit/'], { queryParams: { - "pageContentId": id + 'pageContentId': id }, relativeTo: this.route }); } } public togglePageHelpContents(status: boolean, ids: string[]) { - if (!Session.isLoggedIn()) { - this.router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this.router.url + this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe( + () => { + for (let id of ids) { + let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); + this.checkboxes[i].pageHelpContent.isActive = status; } - }); - } else { - this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe( - () => { - for (let id of ids) { - let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); - this.checkboxes[i].pageHelpContent.isActive = status; - } - UIkit.notification('Page content(s) has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - this.countPageHelpContents(); - this.applyCheck(false); - }, - error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) - )); - } + UIkit.notification('Page content(s) has been successfully updated', { + status: 'success', + timeout: 6000, + pos: 'bottom-right' + }); + this.countPageHelpContents(); + this.applyCheck(false); + }, + error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) + )); } - + public filterPageHelpContent(pageHelpContent: PageHelpContent, filters: PageHelpContentFilterOptions): boolean { let idFlag = filters.id == '' || (pageHelpContent.page)._id == filters.id; let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active; - let textFlag = filters.text.toString() == '' || (pageHelpContent.content).match(filters.text) != null - || ((pageHelpContent.page).name).match(filters.text) != null; + let textFlag = filters.text.toString() == '' || (pageHelpContent.content && pageHelpContent.content.match(filters.text) != null) + || (pageHelpContent.page && (pageHelpContent.page).name && (pageHelpContent.page).name.match(filters.text) != null); return idFlag && activeFlag && textFlag; } @@ -291,20 +238,13 @@ export class PageHelpContentsComponent implements OnInit { this.checkboxes = []; this.pageHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach( _ => { - this.checkboxes.push({pageHelpContent: _, checked: false}) + this.checkboxes.push({pageHelpContent: _, checked: false}); } ); } - public filterByPage(event: any) { - if (event.target && event.target.value) { - this.filters.id = event.target.value; - this.applyFilter(); - } - } - public filterBySearch(text: string) { - this.filters.text = new RegExp(text, "i"); + this.filters.text = new RegExp(text, 'i'); this.applyFilter(); } @@ -342,7 +282,7 @@ export class PageHelpContentsComponent implements OnInit { public reset() { this.selectedKeyword = null; - this.searchInputComponent.reset() + this.searchInputComponent.reset(); } selectAll() { diff --git a/dashboard/helpTexts/page-help-contents.module.ts b/dashboard/helpTexts/page-help-contents.module.ts index 5ae6bfc4..c4350d7d 100644 --- a/dashboard/helpTexts/page-help-contents.module.ts +++ b/dashboard/helpTexts/page-help-contents.module.ts @@ -5,7 +5,7 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {PageHelpContentsComponent} from './page-help-contents.component'; import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; -import {MatSlideToggleModule} from '@angular/material'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {AdminToolServiceModule} from '../../services/adminToolService.module'; import {InputModule} from '../../sharedComponents/input/input.module'; import {PageHelpContentsRoutingModule} from './page-help-contents-routing.module'; diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html index 385f2e40..f29a0f7a 100644 --- a/dashboard/page/pages.component.html +++ b/dashboard/page/pages.component.html @@ -90,20 +90,20 @@
-
Helptexts
+
Help texts
diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts index d51cba96..f4c55b06 100644 --- a/dashboard/page/pages.component.ts +++ b/dashboard/page/pages.component.ts @@ -8,15 +8,14 @@ import {EnvProperties} from '../../utils/properties/env-properties'; import {Session} from '../../login/utils/helper.class'; import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; import {UserManagementService} from '../../services/user-management.service'; -import {Subscriber} from "rxjs"; -import {PortalUtils} from "../portal/portalHelper"; -import {properties} from "../../../../environments/environment"; -import {ConnectHelper} from "../../connect/connectHelper"; -import {Option} from "../../sharedComponents/input/input.component"; -import {AlertModal} from "../../utils/modal/alert"; -import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; -import {Title} from "@angular/platform-browser"; -import {StringUtils} from "../../utils/string-utils.class"; +import {Subscriber} from 'rxjs'; +import {PortalUtils} from '../portal/portalHelper'; +import {properties} from '../../../../environments/environment'; +import {Option} from '../../sharedComponents/input/input.component'; +import {AlertModal} from '../../utils/modal/alert'; +import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; +import {Title} from '@angular/platform-browser'; +import {StringUtils} from '../../utils/string-utils.class'; declare var UIkit; @@ -92,7 +91,6 @@ export class PagesComponent implements OnInit { this.filterForm.get('type').setValue(params['type']); } this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; - ConnectHelper.setPortalTypeFromPid(this.portal); if (this.route.snapshot.data.portal) { this.title.setTitle(StringUtils.capitalize(this.portal) + ' | Pages'); } else if (this.route.snapshot.params[this.route.snapshot.data.param]) { @@ -347,8 +345,7 @@ export class PagesComponent implements OnInit { } public filterPages(page: Page): boolean { - let textFlag = this.searchText.toString() == '' || (page.route + ' ' + page.name + ' ' + page.portalType).match(this.searchText) != null; - return textFlag; + return this.searchText.toString() == '' || (page.route + ' ' + page.name + ' ' + page.portalType).match(this.searchText) != null; } handleError(message: string, error) { @@ -394,11 +391,6 @@ export class PagesComponent implements OnInit { return ''; } - // public filterByPortal(event: any) { - // this.portal = event.target.value; - // this.applyPortalFilter(this.portal); - // } - public applyPortalFilter(portal: string) { this.getPages(portal); } @@ -425,10 +417,6 @@ export class PagesComponent implements OnInit { } } - public capitalizeFirstLetter(str: string) { - return str.charAt(0).toUpperCase() + str.slice(1); - } - public onSearchClose() { this.selectedKeyword = this.filterForm.get('keyword').value; } @@ -439,7 +427,7 @@ export class PagesComponent implements OnInit { } selectAll() { - let checked = !!(this.getSelectedPages().length != this.checkboxes.length); + let checked = this.getSelectedPages().length != this.checkboxes.length; for (let check of this.checkboxes) { check.checked = checked; } diff --git a/dashboard/page/pages.module.ts b/dashboard/page/pages.module.ts index c7dfdb92..bdac5062 100644 --- a/dashboard/page/pages.module.ts +++ b/dashboard/page/pages.module.ts @@ -4,7 +4,10 @@ import {CommonModule} from '@angular/common'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {AlertModalModule} from '../../utils/modal/alertModal.module'; import {PagesComponent} from './pages.component'; -import {MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule} from '@angular/material'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import {AdminToolServiceModule} from "../../services/adminToolService.module"; import {InputModule} from "../../sharedComponents/input/input.module"; import {AdminTabsModule} from "../sharedComponents/admin-tabs/admin-tabs.module"; diff --git a/dashboard/users/role-users/role-users.component.ts b/dashboard/users/role-users/role-users.component.ts index eb31862a..cf3d9bd7 100644 --- a/dashboard/users/role-users/role-users.component.ts +++ b/dashboard/users/role-users/role-users.component.ts @@ -1,5 +1,4 @@ import {Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild} from '@angular/core'; -import {Subscription} from 'rxjs/Rx'; import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms'; import {AlertModal} from "../../../utils/modal/alert"; import {UserRegistryService} from "../../../services/user-registry.service"; @@ -10,7 +9,7 @@ import {UserManagementService} from "../../../services/user-management.service"; import {Router} from "@angular/router"; import {StringUtils} from "../../../utils/string-utils.class"; import {NotificationService} from "../../../notifications/notification.service"; -import {Affiliation} from "../../../utils/entities/CuratorInfo"; +import {Subscription} from "rxjs"; declare var UIkit; diff --git a/dashboard/users/subscribers/subscribers.component.ts b/dashboard/users/subscribers/subscribers.component.ts index e7dd0be7..10dddaa6 100644 --- a/dashboard/users/subscribers/subscribers.component.ts +++ b/dashboard/users/subscribers/subscribers.component.ts @@ -8,7 +8,6 @@ import { SimpleChanges, ViewChild } from '@angular/core'; -import {Subscription} from 'rxjs/Rx'; import {AbstractControl, FormBuilder, FormGroup, Validators} from '@angular/forms'; import {AlertModal} from "../../../utils/modal/alert"; import {UserRegistryService} from "../../../services/user-registry.service"; @@ -18,7 +17,7 @@ import {Role, Session, User} from "../../../login/utils/helper.class"; import {UserManagementService} from "../../../services/user-management.service"; import {Router} from "@angular/router"; import {SubscriberInviteComponent} from "../../../sharedComponents/subscriber-invite/subscriber-invite.component"; -import {zip} from "rxjs"; +import {Subscription, zip} from "rxjs"; declare var UIkit; diff --git a/error/errorPage.component.ts b/error/errorPage.component.ts index 68d2a881..bbbe85f3 100644 --- a/error/errorPage.component.ts +++ b/error/errorPage.component.ts @@ -2,9 +2,10 @@ import {Component, Inject, Input, Optional} from '@angular/core'; import {Location} from '@angular/common'; import {ActivatedRoute} from '@angular/router'; import {Title, Meta} from '@angular/platform-browser'; -import {RESPONSE} from "@nguniversal/express-engine/tokens"; import {SEOService} from "../sharedComponents/SEO/SEO.service"; import {properties} from "../../../environments/environment"; +import {RESPONSE} from '../utils/tokens'; +import {Response} from 'express'; @Component({ selector: 'error', @@ -49,7 +50,7 @@ export class ErrorPageComponent { constructor (private _location: Location, private _meta: Meta, private _title: Title, private route: ActivatedRoute, - @Optional() @Inject(RESPONSE) private response: any, + @Optional() @Inject(RESPONSE) private response: Response, private seoService: SEOService) {} ngOnInit() { diff --git a/error/isRouteEnabled.guard.ts b/error/isRouteEnabled.guard.ts index 8421265a..4d05d73b 100644 --- a/error/isRouteEnabled.guard.ts +++ b/error/isRouteEnabled.guard.ts @@ -1,7 +1,7 @@ import {Observable} from 'rxjs'; import {take, tap} from 'rxjs/operators'; import {Injectable} from '@angular/core'; -import {ActivatedRouteSnapshot, CanActivate, Data, Router, RouterStateSnapshot} from '@angular/router'; +import {ActivatedRouteSnapshot, CanActivate, Data, Router, RouterStateSnapshot, UrlTree} from '@angular/router'; import {ConfigurationService} from '../utils/configuration/configuration.service'; import {ConnectHelper} from '../connect/connectHelper'; import {properties} from "../../../environments/environment"; @@ -10,28 +10,29 @@ import {properties} from "../../../environments/environment"; export class IsRouteEnabled implements CanActivate { constructor(private router: Router, - private config: ConfigurationService) {} - + private config: ConfigurationService) { + } + check(data: Data, path: string): Observable | boolean { const customRedirect = data['redirect']; const redirect = customRedirect ? customRedirect : '/error'; - let community = ConnectHelper.getCommunityFromDomain(properties.domain); + let community = ConnectHelper.getCommunityFromDomain(properties.domain); if (!community && data['community']) { // for openaire or connect community = data['community']; } if (!community) { community = properties.adminToolsCommunity; } - return this.config.isPageEnabledByState(properties, community, '/'+path).pipe(take(1),tap((enabled) => { - if(!enabled){ + return this.config.isPageEnabledByState(properties, community, '/' + path).pipe(take(1), tap((enabled) => { + if (!enabled) { this.router.navigate([redirect], {queryParams: {'page': path}}); } })); - + } - - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(route.data, state.url); } - + } diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 05ffac83..09558a46 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -121,25 +121,25 @@ -
- Collected full-texts: {{dataProviderInfo.aggregationStatus.fulltexts | number}} - Results with funding information: - {{dataProviderInfo.aggregationStatus.fundedContent | number}} - - - Latest data aggregation: - {{dataProviderInfo.aggregationStatus.lastUpdateDate | date}} + {{dataProviderInfo.fundedContent | number}} + + + + +
- @@ -480,7 +480,7 @@
- + Powered by OpenAIRE Research Graph . Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 8a6ec709..4c33bd24 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -229,6 +229,7 @@ export class DataProviderComponent { this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url); if (typeof document !== 'undefined') { this.getDataProviderAggregationStatus(this.dataProviderInfo.originalId); + this.countResultsWithFundingInfo(); } else { this.aggregationStatusIsInitialized = true; } @@ -280,6 +281,18 @@ export class DataProviderComponent { } )); } + + private countResultsWithFundingInfo() { + this.subscriptions.push(this._searchResearchResultsService.countCollectedResultsWithFundingInfo(this.datasourceId).subscribe( + fundedContent => { + this.dataProviderInfo.fundedContent = fundedContent; + console.log(this.dataProviderInfo.fundedContent); + }, + err => { + this.handleError("Error getting results with funding information for datasource id: " + this.datasourceId, err); + } + )) + } private updateDescription(description: string) { this._meta.updateTag({content: description.substring(0, 160)}, "name='description'"); @@ -607,12 +620,15 @@ export class DataProviderComponent { } public get hasAggregationStatusInfo(): boolean { + // return (!!this.dataProviderInfo.aggregationStatus && + // ((!!this.dataProviderInfo.aggregationStatus.fulltexts && parseInt(this.dataProviderInfo.aggregationStatus.fulltexts) != -1) + // || (!!this.dataProviderInfo.aggregationStatus.fundedContent && parseInt(this.dataProviderInfo.aggregationStatus.fundedContent) != -1) + // || !!this.dataProviderInfo.aggregationStatus.lastUpdateDate)); + return (!!this.dataProviderInfo.aggregationStatus && - ((!!this.dataProviderInfo.aggregationStatus.fulltexts && parseInt(this.dataProviderInfo.aggregationStatus.fulltexts) != -1) - || (!!this.dataProviderInfo.aggregationStatus.fundedContent && parseInt(this.dataProviderInfo.aggregationStatus.fundedContent) != -1) - || !!this.dataProviderInfo.aggregationStatus.lastUpdateDate)); + ((!!this.dataProviderInfo.aggregationStatus.fulltexts && parseInt(this.dataProviderInfo.aggregationStatus.fulltexts) != -1))); } - + public get hasJournalInfo(): boolean { return (!!this.dataProviderInfo.journal && ( !!this.dataProviderInfo.journal['journal'] || !!this.dataProviderInfo.journal['issn'] || diff --git a/landingPages/dataProvider/dataProvider.service.ts b/landingPages/dataProvider/dataProvider.service.ts index 44bbe676..3882851f 100644 --- a/landingPages/dataProvider/dataProvider.service.ts +++ b/landingPages/dataProvider/dataProvider.service.ts @@ -36,18 +36,22 @@ export class DataProviderService { //let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); //let options = new RequestOptions({headers: headers}); - const options = { - headers: new HttpHeaders({ - 'Content-Type': 'application/json', - 'accept': 'application/json'}) - }; + // const options = { + // headers: new HttpHeaders({ + // 'Content-Type': 'application/json', + // 'accept': 'application/json'}) + // }; + // + // let page: number = 0; + // let size: number = 1; + // return this.http.post(properties.datasourcesAPI+page+"/"+size+"?requestSortBy=id&order=ASCENDING", JSON.stringify({ "id": original_id }), options) + // //.map(res => res.json()) + // .pipe(map(res => res['datasourceInfo'])) + // .pipe(map(res => this.parseDataproviderAggregationStatus(res))); - let page: number = 0; - let size: number = 1; - return this.http.post(properties.datasourcesAPI+page+"/"+size+"?requestSortBy=id&order=ASCENDING", JSON.stringify({ "id": original_id }), options) - //.map(res => res.json()) - .pipe(map(res => res['datasourceInfo'])) - .pipe(map(res => this.parseDataproviderAggregationStatus(res))); + return this.http.get(properties.datasourcesAPI+original_id) + .pipe(map(res => res['api'])) + .pipe(map(res => this.parseDataproviderAggregationStatus(res))); } private handleError (error: HttpErrorResponse) { @@ -57,27 +61,44 @@ export class DataProviderService { return throwError(error || 'Server error'); } - parseDataproviderAggregationStatus(data: any): any { - var aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string} = null; - if(data != null && data[0] != null) { - aggregationStatus = {"fundedContent": "-1", "indexRecords": "-1", "fulltexts": "-1", "lastUpdateDate": null}; - aggregationStatus.fundedContent = data[0].fundedContent; - aggregationStatus.indexRecords = data[0].indexRecords; - aggregationStatus.fulltexts = data[0].fulltexts; + parseDataproviderAggregationStatus(apis: any): any { + // var aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string} = null; + // if(data != null && data[0] != null) { + // aggregationStatus = {"fundedContent": "-1", "indexRecords": "-1", "fulltexts": "-1", "lastUpdateDate": null}; + // aggregationStatus.fundedContent = data[0].fundedContent; + // aggregationStatus.indexRecords = data[0].indexRecords; + // aggregationStatus.fulltexts = data[0].fulltexts; + // + // if(data[0].hasOwnProperty("aggregationHistory")) { + // let length = Array.isArray(data[0]["aggregationHistory"]) ? data[0]["aggregationHistory"].length : 1; + // + // for(let i=0; i - +
diff --git a/landingPages/landing-utils/citeThis/citeThis.module.ts b/landingPages/landing-utils/citeThis/citeThis.module.ts index 624602da..a5412a40 100644 --- a/landingPages/landing-utils/citeThis/citeThis.module.ts +++ b/landingPages/landing-utils/citeThis/citeThis.module.ts @@ -3,7 +3,7 @@ import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {CiteThisComponent} from './citeThis.component'; -import {MatSelectModule} from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; @NgModule({ imports: [ diff --git a/landingPages/landing-utils/metrics/metrics.component.ts b/landingPages/landing-utils/metrics/metrics.component.ts index 73a8ee30..2c75c8cb 100644 --- a/landingPages/landing-utils/metrics/metrics.component.ts +++ b/landingPages/landing-utils/metrics/metrics.component.ts @@ -15,7 +15,7 @@ import {animate, state, style, transition, trigger} from "@angular/animations"; click-outside-or-esc (clickOutside)="close($event)" id="metrics" targetId="metrics">
- +
{{total | number}}
@@ -101,7 +101,7 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 40561d85..c4928dba 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -1,6 +1,10 @@ import {HostedByCollectedFrom, Journal, Project, RelationResult} from "../../utils/result-preview/result-preview"; import {Reference} from "../../utils/entities/resultLandingInfo"; +import {Injectable} from '@angular/core'; +@Injectable({ + providedIn: 'root' +}) export class ParsingFunctions { public open = 'assets/common-assets/unlock.svg'; public closed = 'assets/common-assets/lock.svg'; diff --git a/landingPages/landing-utils/showPublisher.component.ts b/landingPages/landing-utils/showPublisher.component.ts index 97f41fea..0bf45828 100644 --- a/landingPages/landing-utils/showPublisher.component.ts +++ b/landingPages/landing-utils/showPublisher.component.ts @@ -61,7 +61,7 @@ import {EnvProperties} from "../../utils/properties/env-properties"; - + Copyright policy
diff --git a/landingPages/organization/organization.component.html b/landingPages/organization/organization.component.html index f18c3943..bc7f63d0 100644 --- a/landingPages/organization/organization.component.html +++ b/landingPages/organization/organization.component.html @@ -251,7 +251,7 @@
- + Powered by OpenAIRE Research Graph . Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} diff --git a/landingPages/project/project.component.html b/landingPages/project/project.component.html index 4b0d79f9..cb39b3fe 100644 --- a/landingPages/project/project.component.html +++ b/landingPages/project/project.component.html @@ -734,7 +734,7 @@
- + Powered by OpenAIRE Research Graph diff --git a/landingPages/project/project.module.ts b/landingPages/project/project.module.ts index c347af56..2010caf0 100644 --- a/landingPages/project/project.module.ts +++ b/landingPages/project/project.module.ts @@ -3,7 +3,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; -import {MatSelectModule} from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; import {ProjectComponent} from './project.component'; import {ProjectServiceModule} from './projectService.module'; diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 4d93f8c9..40d2e18d 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -107,7 +107,7 @@
  • - + add annotation @@ -115,7 +115,7 @@ [attr.uk-tooltip]="!pid?'Annotations are available only for resources with a PID (persistent identifier) like DOI, handle, PMID': 'Annotations are available only for logged in users'"> - + add annotation @@ -423,7 +423,8 @@
    - Enermaps tool preview + Enermaps tool preview

    Visit

    - + Powered by OpenAIRE Research Graph . Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}} diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index b76faa16..9af4dbda 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -661,7 +661,7 @@ export class ResultLandingComponent { ); // console.log("rich content " + allow) //spam words to exclude - let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI"]; + let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "TUBYDI", "电影","電影"]; let abstract_words = ["operacao-feliz-natal.blogspot.com", "moviedouban.site", "hack-expert-solution.link"]; allow = allow && !( (this.hasKeyword(this.resultLandingInfo.title,title_authors_words) || (this.resultLandingInfo.authors && this.hasKeyword(this.resultLandingInfo.authors.map(o => o.fullName).join(" "),title_authors_words)) diff --git a/login/adminLoginGuard.guard.ts b/login/adminLoginGuard.guard.ts index f0e08af4..3d29fbb6 100644 --- a/login/adminLoginGuard.guard.ts +++ b/login/adminLoginGuard.guard.ts @@ -40,7 +40,7 @@ export class AdminLoginGuard implements CanActivate, CanActivateChild { } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(state.url); } diff --git a/login/claimsCuratorGuard.guard.ts b/login/claimsCuratorGuard.guard.ts index e226fec7..724f0f0a 100644 --- a/login/claimsCuratorGuard.guard.ts +++ b/login/claimsCuratorGuard.guard.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router'; +import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router'; import {Observable} from 'rxjs'; import {Session} from './utils/helper.class'; import {LoginErrorCodes} from './utils/guardHelper.class'; @@ -32,7 +32,7 @@ export class ClaimsCuratorGuard implements CanActivate { })); } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(state.url); } diff --git a/login/freeGuard.guard.ts b/login/freeGuard.guard.ts index 7708ecdb..c2141a70 100644 --- a/login/freeGuard.guard.ts +++ b/login/freeGuard.guard.ts @@ -4,6 +4,7 @@ import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, + UrlTree } from '@angular/router'; import {Observable} from 'rxjs'; import {LoginErrorCodes} from './utils/guardHelper.class'; @@ -22,7 +23,7 @@ export class FreeGuard implements CanActivate { return valid; } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(state.url); } diff --git a/login/loginGuard.guard.ts b/login/loginGuard.guard.ts index ab778345..8b1a77f5 100644 --- a/login/loginGuard.guard.ts +++ b/login/loginGuard.guard.ts @@ -8,7 +8,7 @@ import { Router, RouterStateSnapshot, UrlTree } from '@angular/router'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; import {Session} from './utils/helper.class'; import {LoginErrorCodes} from './utils/guardHelper.class'; import {map, tap} from "rxjs/operators"; @@ -41,7 +41,7 @@ export class LoginGuard implements CanActivate, CanLoad, CanActivateChild { } } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { return this.check(state.url); } diff --git a/login/user.component.html b/login/user.component.html index 11b667bb..db670948 100644 --- a/login/user.component.html +++ b/login/user.component.html @@ -54,9 +54,8 @@
    The requested page requires authentication. - - Please sign in to continue. - + Please sign in to continue. +
    You are not authorized to use the requested page. diff --git a/monitor/how/how.component.css b/monitor/how/how.component.css index 1f1f3f41..ecb40f6d 100644 --- a/monitor/how/how.component.css +++ b/monitor/how/how.component.css @@ -8,7 +8,7 @@ text-align: center; padding-bottom: 5%; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/1.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/1.svg"); right: -21%; top: 33%; width: 20%; @@ -27,7 +27,7 @@ text-align: center; padding-bottom: 5%; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/2.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/2.svg"); right: -10%; top: 31%; width: 30%; @@ -50,7 +50,7 @@ padding-top: 5%; padding-bottom: 5%; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); bottom: 6%; left: 6%; transform: translateY(100%); @@ -74,7 +74,7 @@ text-align: center; padding-bottom: 5%; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/4.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/4.svg"); left: -18%; top: 35%; width: 30%; @@ -96,7 +96,7 @@ text-align: center; padding-bottom: 5%; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/5.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/5.svg"); left: -35%; top: 36%; width: 30%; @@ -124,7 +124,7 @@ .how .final > div:first-child:before { content: ""; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/6.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/6.svg"); left: -20%; top: -20%; height: 70%; @@ -137,7 +137,7 @@ .how .final > div:first-child:after { content: "We make visualizations, graphs, reports and deliver all in a customisable tool"; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/how/circle.png"); + background-image: url("~src/assets/common-assets/monitor-assets/how/circle.png"); right: -220px; top: -20%; width: 300px; @@ -173,7 +173,7 @@ text-align: center; padding: 25px 105px 25px 0; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); left: 26%; top: 72%; background-size: contain; @@ -191,7 +191,7 @@ text-align: center; padding: 25px 105px 25px 0; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); left: 25%; top: 70%; background-size: contain; @@ -209,7 +209,7 @@ text-align: center; padding: 25px 105px 25px 0; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); left: 17%; top: 75%; background-size: contain; @@ -231,7 +231,7 @@ text-align: center; padding: 25px 105px 25px 0; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); left: 26%; top: 79%; background-size: contain; @@ -249,7 +249,7 @@ text-align: center; padding: 25px 105px 25px 0; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/3.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/3.svg"); left: 27%; top: 76%; background-size: contain; @@ -276,7 +276,7 @@ .how .final > div:first-child:before { content: ""; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/green-arrows/6.svg"); + background-image: url("~src/assets/common-assets/monitor-assets/green-arrows/6.svg"); left: 32%; top: -80%; height: 70%; @@ -289,7 +289,7 @@ .how .final > div:first-child:after { content: "We make visualizations, graphs, reports and deliver all in a customisable tool"; position: absolute; - background-image: url("/assets/common-assets/monitor-assets/how/circle.png"); + background-image: url("~src/assets/common-assets/monitor-assets/how/circle.png"); left: -62%; top: 85%; width: 300px; diff --git a/monitor/how/how.component.ts b/monitor/how/how.component.ts index 0ff16355..1c8e44d8 100644 --- a/monitor/how/how.component.ts +++ b/monitor/how/how.component.ts @@ -7,7 +7,7 @@ import {Component} from "@angular/core";
    - +
    Starting from existing
    research-related data sources @@ -15,12 +15,12 @@ import {Component} from "@angular/core";
    - +
    - +
    build an open, global
    and trusted Research graph @@ -30,7 +30,7 @@ import {Component} from "@angular/core";
    - +
    we perform Statistical Analysis and produce @@ -39,7 +39,7 @@ import {Component} from "@angular/core";
    - +
    furthermore Network
    Analysis
    producing @@ -48,7 +48,7 @@ import {Component} from "@angular/core";
    - +
    Often combine with external data @@ -60,7 +60,7 @@ import {Component} from "@angular/core";
    - +
    diff --git a/monitor/services/stakeholder.service.ts b/monitor/services/stakeholder.service.ts index dac0c4d5..22291b47 100644 --- a/monitor/services/stakeholder.service.ts +++ b/monitor/services/stakeholder.service.ts @@ -8,7 +8,6 @@ import {ActivatedRoute} from "@angular/router"; import {properties} from "../../../../environments/environment"; import {CustomOptions} from "../../services/servicesUtils/customOptions.class"; import {StringUtils} from "../../utils/string-utils.class"; -import {el} from "@angular/platform-browser/testing/src/browser_util"; let maps: string[] = ['parameters', 'filters']; diff --git a/notifications/notify-form/notify-form.component.ts b/notifications/notify-form/notify-form.component.ts index 612f9cd4..c6ad531a 100644 --- a/notifications/notify-form/notify-form.component.ts +++ b/notifications/notify-form/notify-form.component.ts @@ -70,7 +70,7 @@ export class NotifyFormComponent implements OnInit, OnDestroy { public user: User; public focused: boolean = false; public groups: string[] = []; - @ViewChild('recipients') recipients: InputComponent; + @ViewChild('recipients', { static: false }) recipients: InputComponent; private notification: Notification; private subscriptions: any[] = []; public sending: boolean = false; diff --git a/orcid/my-orcid-links/myOrcidLinks.component.ts b/orcid/my-orcid-links/myOrcidLinks.component.ts index 2f41910e..d66b6c21 100644 --- a/orcid/my-orcid-links/myOrcidLinks.component.ts +++ b/orcid/my-orcid-links/myOrcidLinks.component.ts @@ -40,7 +40,7 @@ declare var UIkit: any;
    - Did you link a result with your ORCID + Did you link a result with your ORCID but the green icon is missing?
    No worries! It will appear, as soon as we synchronize again with ORCID data. diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index d41b87ef..b05845b5 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -44,7 +44,7 @@ declare var UIkit: any; Add to ORCID - {{" "}} + {{" "}} @@ -63,7 +63,7 @@ declare var UIkit: any; Delete from ORCID - {{" "}} + {{" "}} @@ -80,7 +80,7 @@ declare var UIkit: any; - + @@ -101,7 +101,7 @@ declare var UIkit: any; - + @@ -143,7 +143,7 @@ declare var UIkit: any; ORCID - + ACTIONS diff --git a/orcid/orcid.module.ts b/orcid/orcid.module.ts index ee03cb0b..7231b5dc 100644 --- a/orcid/orcid.module.ts +++ b/orcid/orcid.module.ts @@ -1,20 +1,20 @@ -import { NgModule, ModuleWithProviders } from '@angular/core'; -import { CommonModule } from '@angular/common'; +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; -import {RouterModule} from "@angular/router"; +import {RouterModule} from '@angular/router'; import {OrcidComponent} from './orcid.component'; -import {OrcidService} from "./orcid.service"; +import {OrcidService} from './orcid.service'; import {FreeGuard} from '../login/freeGuard.guard'; -import {PreviousRouteRecorder} from "../utils/piwik/previousRouteRecorder.guard"; -import {OrcidWorkComponent} from "./orcid-work.component"; -import {AlertModalModule} from "../utils/modal/alertModal.module"; -import {ResultLandingService} from "../landingPages/result/resultLanding.service"; -import {LoadingModule} from "../utils/loading/loading.module"; -import {ResultLandingUtilsModule} from "../landingPages/landing-utils/resultLandingUtils.module"; -import {IconsModule} from "../utils/icons/icons.module"; -import {IconsService} from "../utils/icons/icons.service"; -import {add, preview, refresh, remove} from "../utils/icons/icons"; +import {PreviousRouteRecorder} from '../utils/piwik/previousRouteRecorder.guard'; +import {OrcidWorkComponent} from './orcid-work.component'; +import {AlertModalModule} from '../utils/modal/alertModal.module'; +import {ResultLandingService} from '../landingPages/result/resultLanding.service'; +import {LoadingModule} from '../utils/loading/loading.module'; +import {ResultLandingUtilsModule} from '../landingPages/landing-utils/resultLandingUtils.module'; +import {IconsModule} from '../utils/icons/icons.module'; +import {IconsService} from '../utils/icons/icons.service'; +import {add, preview, refresh, remove} from '../utils/icons/icons'; @NgModule({ imports: [ diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index ca6eb7a1..e2ed0c9d 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -95,9 +95,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy { public verification: any; public code: FormControl; private subs: any[] = []; - @ViewChild('managerModal') managerModal: AlertModal; - @ViewChild('memberModal') memberModal: AlertModal; - @ViewChild('errorModal') errorModal: AlertModal; + @ViewChild('managerModal', { static: true }) managerModal: AlertModal; + @ViewChild('memberModal', { static: true }) memberModal: AlertModal; + @ViewChild('errorModal', { static: true }) errorModal: AlertModal; public error: string = null; public loading: boolean = false; public isMember: boolean = false; diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index c8c7654f..3cee92d1 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -113,10 +113,10 @@ export class SearchAllComponent { //new parameters = {}; disableForms: boolean = true; - @ViewChild (SearchResearchResultsComponent) searchResearchResultsComponent : SearchResearchResultsComponent ; - @ViewChild (SearchProjectsComponent) searchProjectsComponent : SearchProjectsComponent ; - @ViewChild (SearchDataProvidersComponent) searchDataprovidersComponent : SearchDataProvidersComponent ; - @ViewChild (SearchOrganizationsComponent) searchOrganizationsComponent : SearchOrganizationsComponent ; + @ViewChild(SearchResearchResultsComponent) searchResearchResultsComponent : SearchResearchResultsComponent ; + @ViewChild(SearchProjectsComponent) searchProjectsComponent : SearchProjectsComponent ; + @ViewChild(SearchDataProvidersComponent) searchDataprovidersComponent : SearchDataProvidersComponent ; + @ViewChild(SearchOrganizationsComponent) searchOrganizationsComponent : SearchOrganizationsComponent ; constructor(private route: ActivatedRoute, private _router: Router, private _searchResearchResultsService: SearchResearchResultsService, diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 6f865755..b3c4bffd 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -75,7 +75,7 @@ export class SearchDataProvidersComponent { @Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" = "all"; public refineFields: string[]; pageTitle; - @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; + @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; diff --git a/searchPages/searchOrganizations.component.ts b/searchPages/searchOrganizations.component.ts index 94376716..68c83d9d 100644 --- a/searchPages/searchOrganizations.component.ts +++ b/searchPages/searchOrganizations.component.ts @@ -65,7 +65,7 @@ export class SearchOrganizationsComponent { @Input() customFilter:SearchCustomFilter= null; public refineFields: string[] = this.searchFields.ORGANIZATION_REFINE_FIELDS; - @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; + @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; diff --git a/searchPages/searchProjects.component.ts b/searchPages/searchProjects.component.ts index b7a93b44..b5d15890 100644 --- a/searchPages/searchProjects.component.ts +++ b/searchPages/searchProjects.component.ts @@ -70,7 +70,7 @@ export class SearchProjectsComponent { public pagingLimit: number = 0; public isPiwikEnabled; public refineFields: string[] = this.searchFields.PROJECT_REFINE_FIELDS; - @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; + @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; @Input() simpleSearchLink: string = ""; advancedSearchLink: string = ""; diff --git a/searchPages/searchResearchResults.component.ts b/searchPages/searchResearchResults.component.ts index 536c8c4c..0b586a91 100644 --- a/searchPages/searchResearchResults.component.ts +++ b/searchPages/searchResearchResults.component.ts @@ -77,7 +77,7 @@ export class SearchResearchResultsComponent { public isPiwikEnabled; properties: EnvProperties = properties; public refineFields: string[] = this.searchFields.RESULT_REFINE_FIELDS; - @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent; + @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent; @Input() simpleView: boolean = true; quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { filter: null, diff --git a/searchPages/searchUtils/advancedSearchForm.module.ts b/searchPages/searchUtils/advancedSearchForm.module.ts index 87ec3891..ceed2a41 100644 --- a/searchPages/searchUtils/advancedSearchForm.module.ts +++ b/searchPages/searchUtils/advancedSearchForm.module.ts @@ -10,7 +10,7 @@ import {DateFilterModule} from './dateFilter.module'; import {SearchFormModule} from './searchForm.module'; import {QuickSelectionsModule} from "./quick-selections.module"; import {EntitiesSelectionModule} from "./entitiesSelection.module"; -import {MatSelectModule} from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; @NgModule({ diff --git a/searchPages/searchUtils/browseEntities.module.ts b/searchPages/searchUtils/browseEntities.module.ts index 2f8313d1..41942727 100644 --- a/searchPages/searchUtils/browseEntities.module.ts +++ b/searchPages/searchUtils/browseEntities.module.ts @@ -2,7 +2,7 @@ import { NgModule} from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import { MatSelectModule } from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; import {RefineFieldResultsServiceModule} from '../../services/refineFieldResultsService.module'; diff --git a/searchPages/searchUtils/dateFilter.component.ts b/searchPages/searchUtils/dateFilter.component.ts index 774e5636..7c595ba9 100644 --- a/searchPages/searchUtils/dateFilter.component.ts +++ b/searchPages/searchUtils/dateFilter.component.ts @@ -2,7 +2,7 @@ import {Component, Input} from '@angular/core'; import {DateValue} from './searchHelperClasses.class'; import {FormControl} from "@angular/forms"; -import {MatDatepickerInputEvent} from "@angular/material"; +import { MatDatepickerInputEvent } from "@angular/material/datepicker"; @Component({ selector: 'date-filter', diff --git a/searchPages/searchUtils/dateFilter.module.ts b/searchPages/searchUtils/dateFilter.module.ts index f1c4fd19..dc64b623 100644 --- a/searchPages/searchUtils/dateFilter.module.ts +++ b/searchPages/searchUtils/dateFilter.module.ts @@ -3,10 +3,11 @@ import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MyDatePickerModule } from '../../utils/my-date-picker/my-date-picker.module'; import {DateFilterComponent} from './dateFilter.component'; -import {MatNativeDateModule, MatSelectModule} from '@angular/material'; +import { MatNativeDateModule } from '@angular/material/core'; +import { MatSelectModule } from '@angular/material/select'; import {MatDatepickerModule} from '@angular/material/datepicker'; -import {MatFormFieldModule} from '@angular/material'; -import {MatInputModule} from '@angular/material'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; @NgModule({ imports: [ CommonModule, FormsModule, ReactiveFormsModule, MyDatePickerModule, diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index 8fc8ee9e..79255865 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -4,7 +4,7 @@ import {EnvProperties} from "../../utils/properties/env-properties"; import {SearchCustomFilter} from "./searchUtils.class"; import {ConfigurationService} from "../../utils/configuration/configuration.service"; import {Router} from "@angular/router"; -import {MatSelect} from "@angular/material"; +import { MatSelect } from "@angular/material/select"; import {Subscription} from "rxjs"; import {properties} from '../../../../environments/environment'; diff --git a/searchPages/searchUtils/entitiesSelection.module.ts b/searchPages/searchUtils/entitiesSelection.module.ts index 93fb44f4..829bba3f 100644 --- a/searchPages/searchUtils/entitiesSelection.module.ts +++ b/searchPages/searchUtils/entitiesSelection.module.ts @@ -3,7 +3,7 @@ import {CommonModule} from '@angular/common'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {RouterModule} from '@angular/router'; import {EntitiesSelectionComponent} from "./entitiesSelection.component"; -import {MatSelectModule} from "@angular/material"; +import { MatSelectModule } from "@angular/material/select"; @NgModule({ imports: [ diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 09217a9f..1dfbea8e 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -1,11 +1,11 @@ -
    +

    - {{customFilter.valueName}} + {{' '+customFilter.valueName}} @@ -23,7 +23,7 @@ fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"> - {{type.name}} + {{' '+type.name}} @@ -47,7 +47,7 @@ d="M16,4 L4,16"> - {{filter.selectedFromAndToValues}} + {{' '+filter.selectedFromAndToValues}} @@ -75,14 +75,15 @@ + [innerHtml]="' ' + + ((value.name.length > 34)?value.name.substring(0,34)+'...':value.name)"> -

    +
    @@ -185,7 +186,7 @@ >
    - +
    @@ -388,7 +389,7 @@ class="uk-margin-small-top uk-grid uk-child-width-1-2">
    - + Powered by OpenAIRE Research Graph
    diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index d13f5528..c86bb164 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -238,7 +238,7 @@ export class NewSearchPageComponent { } } } - let nonCanonicalizedPage = (filterArray.length > 0 && filterArray.length<3); + let nonCanonicalizedPage = filterArray.length > 0; this.metaDescription= (nonCanonicalizedPage?( (this.basicMetaDescription[0] + " filtered by: " + filterArray.join(" and ") + ". ") + (this.basicMetaDescription.length > 1 ?this.basicMetaDescription[1]:"")) :((this.basicMetaDescription.length > 2 ?this.basicMetaDescription[1] + this.basicMetaDescription[2]:this.basicMetaDescription[0]))); this._meta.updateTag({content: this.metaDescription}, "name='description'"); diff --git a/searchPages/searchUtils/portal-search-result.component.html b/searchPages/searchUtils/portal-search-result.component.html index d8bcb81c..24b5ea7a 100644 --- a/searchPages/searchUtils/portal-search-result.component.html +++ b/searchPages/searchUtils/portal-search-result.component.html @@ -24,9 +24,9 @@
    {{(result.title)?result.title:result.shortTitle}} logo + alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy"> {{(result.title)?result.title:result.shortTitle}} logo + alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy"> {{(result.title)?result.title:result.shortTitle}} logo + alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy"> {{(result.title)?result.title:result.shortTitle}} logo + alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy"> res['meta']['total'])); + } } diff --git a/services/user-management.service.ts b/services/user-management.service.ts index 16360a13..5c184c03 100644 --- a/services/user-management.service.ts +++ b/services/user-management.service.ts @@ -5,7 +5,6 @@ import {COOKIE, Session, User} from "../login/utils/helper.class"; import {map} from "rxjs/operators"; import {NavigationEnd, Router} from "@angular/router"; import {properties} from "../../../environments/environment"; -import {el} from "@angular/platform-browser/testing/src/browser_util"; import {StringUtils} from "../utils/string-utils.class"; @Injectable({ diff --git a/services/utilities.service.ts b/services/utilities.service.ts index 6da5b574..e9f59fce 100644 --- a/services/utilities.service.ts +++ b/services/utilities.service.ts @@ -1,5 +1,5 @@ import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; import {CustomOptions} from './servicesUtils/customOptions.class'; import {HttpClient} from '@angular/common/http'; diff --git a/shared/shared.module.ts b/shared/shared.module.ts index f0ce0d20..a5d38d73 100644 --- a/shared/shared.module.ts +++ b/shared/shared.module.ts @@ -37,7 +37,7 @@ const COMPONENTS = [ ] }) export class SharedModule { - static forRoot(): ModuleWithProviders { + static forRoot(): ModuleWithProviders { return { ngModule: SharedModule, }; diff --git a/sharedComponents/bottom.component.html b/sharedComponents/bottom.component.html index aae3f3c1..52b30a61 100644 --- a/sharedComponents/bottom.component.html +++ b/sharedComponents/bottom.component.html @@ -6,7 +6,7 @@
    flag black white low + alt="flag black white low" width="50" height="33" loading="lazy">
    @@ -25,7 +25,7 @@
    OpenAIRE + data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
    @@ -42,7 +42,7 @@ [class]="(centered?'uk-width-1-1 uk-width-1-4@m uk-text-center':'')"> OpenAIRE + data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
    @@ -61,7 +61,7 @@
    flag black white low + alt="flag black white low" width="50" height="33" loading="lazy">
    diff --git a/sharedComponents/numbers/numbers.component.ts b/sharedComponents/numbers/numbers.component.ts index 88b63a4b..ba94ba6a 100644 --- a/sharedComponents/numbers/numbers.component.ts +++ b/sharedComponents/numbers/numbers.component.ts @@ -177,10 +177,10 @@ export class NumbersComponent implements OnInit, OnDestroy { } setParams() { - this.params.set('publication', {type: 'publications', qf: 'false'}); - this.params.set('dataset', {type: 'datasets', qf: 'false'}); - this.params.set('software', {type: 'software', qf: 'false'}); - this.params.set('other', {type: 'other', qf: 'false'}); + this.params.set('publication', {type: 'publications'}); + this.params.set('dataset', {type: 'datasets'}); + this.params.set('software', {type: 'software'}); + this.params.set('other', {type: 'other'}); this.params.set('project', {}); this.params.set('datasource', {}); if (this.refineValue) { diff --git a/sharedComponents/schema2jsonld/schema2jsonld.component.ts b/sharedComponents/schema2jsonld/schema2jsonld.component.ts index b17e8690..a008f9cd 100644 --- a/sharedComponents/schema2jsonld/schema2jsonld.component.ts +++ b/sharedComponents/schema2jsonld/schema2jsonld.component.ts @@ -1,7 +1,7 @@ import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; import {OpenAireJsonldConverterService} from './service/open-aire-jsonld-converter.service'; import {JsonldDocumentSerializerService} from './service/jsonld-document-serializer.service'; -import {DomSanitizer} from "@angular/platform-browser"; +import {DomSanitizer} from '@angular/platform-browser'; @Component({ selector: 'schema2jsonld', @@ -9,36 +9,41 @@ import {DomSanitizer} from "@angular/platform-browser";
    ` }) -export class Schema2jsonldComponent implements OnInit, OnChanges { +export class Schema2jsonldComponent implements OnInit, OnChanges { @Input() data; // for project, organization, datasource @Input() URL; @Input() logoURL; // for home, search @Input() otherURL; //for project, datasource @Input() name; @Input() searchAction = false; - @Input() type = "result"; + @Input() type = 'result'; @Input() description = null; - @Input() searchActionRoute = "/search/find/"; + @Input() searchActionRoute = '/search/find/'; public json; public html; + constructor(private documentParser: OpenAireJsonldConverterService, private documentSerializer: JsonldDocumentSerializerService, private sanitizer: DomSanitizer) { } + ngOnChanges(changes: SimpleChanges): void { if (changes.description) { this.createJson(); } } + ngOnInit() { this.createJson(); } + getSafeHTML(value) { let json = JSON.stringify(value, null, 2); - let html = ""; + let html = ''; return this.sanitizer.bypassSecurityTrustHtml(html); }; - createJson(){ + + createJson() { var docOvject; if (this.type == 'project') { docOvject = this.documentParser.convertProject(this.data, this.URL); @@ -52,7 +57,7 @@ export class Schema2jsonldComponent implements OnInit, OnChanges { } else if (this.type == 'home') { this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL, this.description, this.searchActionRoute); } else if (this.type == 'search') { - this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction, this.description, this.searchActionRoute ); + this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction, this.description, this.searchActionRoute); } else if (this.type == 'result') { docOvject = this.documentParser.convertResult(this.data, this.URL); this.json = this.documentSerializer.serializeDataset(docOvject); diff --git a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts index 0c7774fa..28f315b4 100644 --- a/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts +++ b/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts @@ -1,7 +1,7 @@ -import { Injectable } from "@angular/core"; -import { JsonldDocument, Identifier, Person, License, Citation, Dataset, Organization } from "../model/jsonld-document"; -import * as _ from "lodash"; -import {properties} from "../../../../../environments/environment"; +import {Injectable} from '@angular/core'; +import {Citation, Dataset, Identifier, License, Organization, Person} from '../model/jsonld-document'; +import * as _ from 'lodash'; +import {properties} from '../../../../../environments/environment'; @Injectable() export class OpenAireJsonldConverterService { diff --git a/sharedComponents/search-input/search-input.component.ts b/sharedComponents/search-input/search-input.component.ts index e94dc47e..c4e9d4cf 100644 --- a/sharedComponents/search-input/search-input.component.ts +++ b/sharedComponents/search-input/search-input.component.ts @@ -10,7 +10,7 @@ import {MatAutocompleteTrigger} from '@angular/material/autocomplete';
    - {{" "}} - {{" "}} + {{" "}} + {{" "}} {{author.fullName + "; "}} @@ -34,8 +34,8 @@ import {properties} from "../../../../environments/environment";
    ORCID
    - {{" "}} - {{" "}} + {{" "}} + {{" "}} Harvested from ORCID Public Data File Derived by OpenAIRE algorithms or harvested from 3d party repositories diff --git a/utils/click/click-outside-or-esc.directive.ts b/utils/click/click-outside-or-esc.directive.ts index 0b6e069f..420d48fa 100644 --- a/utils/click/click-outside-or-esc.directive.ts +++ b/utils/click/click-outside-or-esc.directive.ts @@ -1,9 +1,6 @@ -import {Directive, OnInit, OnDestroy, Output, EventEmitter, ElementRef, Input} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import 'rxjs/add/observable/fromEvent'; -import 'rxjs/add/operator/delay'; -import 'rxjs/add/operator/do'; -import {Subscriber} from "rxjs"; +import {Directive, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core'; +import {fromEvent, Subscriber} from 'rxjs'; +import {delay, tap} from 'rxjs/operators'; @Directive({ selector: '[click-outside-or-esc]' @@ -27,20 +24,18 @@ export class ClickOutsideOrEsc implements OnInit, OnDestroy { ngOnInit() { if(typeof document !== 'undefined') { - this.subscriptions.push(Observable - .fromEvent(document, 'click') - .delay(1) - .do(() => { + this.subscriptions.push(fromEvent(document, 'click').pipe( + delay(1), + tap(() => { this.listening = true; - }).subscribe((event: MouseEvent) => { + })).subscribe((event: MouseEvent) => { this.onGlobalClick(event); })); - this.subscriptions.push(Observable - .fromEvent(document, 'keydown') - .delay(1) - .do(() => { + this.subscriptions.push(fromEvent(document, 'click').pipe( + delay(1), + tap(() => { this.listening = true; - }).subscribe((event: KeyboardEvent) => { + })).subscribe((event: KeyboardEvent) => { if (event.keyCode === 27 && this.escClose) { this.clickOutside.emit({ target: (event.target || null), diff --git a/utils/click/long-click.directive.ts b/utils/click/long-click.directive.ts index 789d1439..bc8b095a 100644 --- a/utils/click/long-click.directive.ts +++ b/utils/click/long-click.directive.ts @@ -1,7 +1,4 @@ import {Directive, EventEmitter, HostListener, Input, Output} from '@angular/core'; -import 'rxjs/add/observable/fromEvent'; -import 'rxjs/add/operator/delay'; -import 'rxjs/add/operator/do'; @Directive({ selector: '[long-click]' diff --git a/utils/entities/dataProviderInfo.ts b/utils/entities/dataProviderInfo.ts index 5b6f66c0..74fc0cff 100644 --- a/utils/entities/dataProviderInfo.ts +++ b/utils/entities/dataProviderInfo.ts @@ -13,8 +13,11 @@ export class DataProviderInfo { description: string; subjects: string[]; + fundedContent: string; // search query + //collected from datasource api - aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; + // aggregationStatus: {"fundedContent": string, "indexRecords": string, "fulltexts": string, "lastUpdateDate": string}; + aggregationStatus: {"fulltexts": string}; tabs: {"name": string, "content": string}[]; tabs2: string[] =[]; diff --git a/utils/gif-slider/gif-slider.component.ts b/utils/gif-slider/gif-slider.component.ts index e3cd6d6b..4f194e7a 100644 --- a/utils/gif-slider/gif-slider.component.ts +++ b/utils/gif-slider/gif-slider.component.ts @@ -13,7 +13,7 @@ import {Component, Input} from '@angular/core';
  • - +
    diff --git a/utils/my-date-picker/directives/my-date-picker.focus.directive.ts b/utils/my-date-picker/directives/my-date-picker.focus.directive.ts index 631ae76e..e6086d3e 100644 --- a/utils/my-date-picker/directives/my-date-picker.focus.directive.ts +++ b/utils/my-date-picker/directives/my-date-picker.focus.directive.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, Renderer, AfterViewInit, Input } from "@angular/core"; +import { Directive, ElementRef, AfterViewInit, Input, Renderer2 } from "@angular/core"; @Directive({ selector: "[mydpfocus]" @@ -7,7 +7,7 @@ import { Directive, ElementRef, Renderer, AfterViewInit, Input } from "@angular/ export class FocusDirective implements AfterViewInit { @Input("mydpfocus") value: string; - constructor(private el: ElementRef, private renderer: Renderer) {} + constructor(private el: ElementRef, private renderer: Renderer2) {} // Focus to element: if value 0 = don't set focus, 1 = set only focus, 2 = set focus and set cursor position ngAfterViewInit() { @@ -19,7 +19,7 @@ export class FocusDirective implements AfterViewInit { /*if (typeof document !== 'undefined') { this.el.nativeElement.focus(); }*/ - this.renderer.invokeElementMethod(this.el.nativeElement, "focus", []); + this.el.nativeElement.focus(); // Set cursor position at the end of text if input element if (this.value === "2") { diff --git a/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts b/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts index 89673395..4a4f3085 100644 --- a/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts +++ b/utils/my-date-picker/directives/my-date-picker.input.auto.fill.directive.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, Renderer, Input, HostListener } from "@angular/core"; +import { Directive, ElementRef, Input, HostListener, Renderer2 } from "@angular/core"; import { IMyInputAutoFill } from "../interfaces/my-input-auto-fill.interface"; @Directive({ @@ -8,7 +8,7 @@ import { IMyInputAutoFill } from "../interfaces/my-input-auto-fill.interface"; export class InputAutoFillDirective { @Input("myinputautofill") opts: IMyInputAutoFill; - constructor(private el: ElementRef, private rndr: Renderer) {} + constructor(private el: ElementRef, private rndr: Renderer2) {} @HostListener("keyup", ["$event"]) onKeyUp(evt: KeyboardEvent) { if (!this.opts.enabled || evt.keyCode === 8 || evt.keyCode === 46) { @@ -65,7 +65,7 @@ export class InputAutoFillDirective { private setInputValue(val: string): void { console.info(val); - this.rndr.setElementProperty(this.el.nativeElement, "value", val); + this.rndr.setProperty(this.el.nativeElement, "value", val); //this.rndr.setProperty(this.el.nativeElement, "value", val); } } \ No newline at end of file diff --git a/utils/my-date-picker/my-date-picker.component.ts b/utils/my-date-picker/my-date-picker.component.ts index 8107d938..dadbff54 100644 --- a/utils/my-date-picker/my-date-picker.component.ts +++ b/utils/my-date-picker/my-date-picker.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges, ElementRef, ViewEncapsulation, ChangeDetectorRef, Renderer, forwardRef } from "@angular/core"; +import { Component, Input, Output, EventEmitter, OnChanges, SimpleChanges, ElementRef, ViewEncapsulation, ChangeDetectorRef, forwardRef, Renderer2 } from "@angular/core"; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms"; import { IMyDate, IMyDateRange, IMyMonth, IMyCalendarDay, IMyWeek, IMyDayLabels, IMyMonthLabels, IMyOptions, IMyDateModel, IMyInputAutoFill, IMyInputFieldChanged, IMyCalendarViewChanged, IMyInputFocusBlur } from "./interfaces/index"; import { LocaleService } from "./services/my-date-picker.locale.service"; @@ -115,19 +115,19 @@ export class MyDatePicker implements OnChanges, ControlValueAccessor { ariaLabelNextYear: "Next Year" }; - constructor(public elem: ElementRef, private renderer: Renderer, private cdr: ChangeDetectorRef, private localeService: LocaleService, private utilService: UtilService) { + constructor(public elem: ElementRef, private renderer: Renderer2, private cdr: ChangeDetectorRef, private localeService: LocaleService, private utilService: UtilService) { this.setLocaleOptions(); - renderer.listenGlobal("document", "click", (event: any) => { - //renderer.listen("document", "click", (event: any) => { -console.info("listen global"); - if (this.showSelector && event.target && this.elem.nativeElement !== event.target && !this.elem.nativeElement.contains(event.target)) { - this.showSelector = false; - this.calendarToggle.emit(4); - } - if (this.opts.editableMonthAndYear && event.target && this.elem.nativeElement.contains(event.target)) { - this.resetMonthYearEdit(); - } - }); + renderer.listen("document", "click", (event: any) => { + //renderer.listen("document", "click", (event: any) => { + console.info("listen global"); + if (this.showSelector && event.target && this.elem.nativeElement !== event.target && !this.elem.nativeElement.contains(event.target)) { + this.showSelector = false; + this.calendarToggle.emit(4); + } + if (this.opts.editableMonthAndYear && event.target && this.elem.nativeElement.contains(event.target)) { + this.resetMonthYearEdit(); + } +}); } setLocaleOptions(): void { diff --git a/utils/properties/environment-specific.service.ts b/utils/properties/environment-specific.service.ts index 482ef7ff..db247224 100644 --- a/utils/properties/environment-specific.service.ts +++ b/utils/properties/environment-specific.service.ts @@ -1,10 +1,9 @@ import {Inject, Injectable, Optional} from '@angular/core'; import {HttpClient} from "@angular/common/http"; - import {Request} from 'express'; -import {REQUEST} from '@nguniversal/express-engine/tokens'; import {properties} from "../../../../environments/environment"; import {ConnectHelper} from "../../connect/connectHelper"; +import {REQUEST} from '../tokens'; @Injectable({ providedIn: 'root' @@ -29,7 +28,7 @@ export class EnvironmentSpecificService { private getDomain() { var domain = ""; - if (typeof document == 'undefined') { + if (this.request) { domain = this.request.get('host').split(":")[0]; } else { domain = document.location.hostname; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index ebb2e186..445f2721 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -2,7 +2,8 @@
    - Enermaps tool preview + Enermaps tool preview

    Visit - + diff --git a/utils/routerHelper.class.ts b/utils/routerHelper.class.ts index 36711a16..39c9710e 100644 --- a/utils/routerHelper.class.ts +++ b/utils/routerHelper.class.ts @@ -35,7 +35,7 @@ export class RouterHelper { return ""; }else{ for(let i=0; i< keys.length; i++){ - obj+=(i==0?"":"&")+keys[i]+"="+values[i]; + obj+=(i==0?"":"&")+encodeURIComponent(keys[i])+"="+encodeURIComponent(values[i]); } } return obj; diff --git a/utils/staticAutoComplete/ISVocabularies.service.ts b/utils/staticAutoComplete/ISVocabularies.service.ts index f5c33c89..bae49d72 100644 --- a/utils/staticAutoComplete/ISVocabularies.service.ts +++ b/utils/staticAutoComplete/ISVocabularies.service.ts @@ -1,11 +1,10 @@ import {Injectable} from '@angular/core'; -import {HttpClient, HttpErrorResponse} from "@angular/common/http"; -import {Observable, throwError, of, BehaviorSubject, from, Subscriber} from 'rxjs'; +import {HttpClient, HttpErrorResponse} from '@angular/common/http'; +import {BehaviorSubject, from, Observable, of, Subscriber, throwError, zip} from 'rxjs'; import {AutoCompleteValue} from '../../searchPages/searchUtils/searchHelperClasses.class'; -import 'rxjs/add/observable/zip'; import {EnvProperties} from '../properties/env-properties'; -import {catchError, map} from "rxjs/operators"; +import {catchError, map} from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ISVocabulariesService { @@ -52,7 +51,7 @@ export class ISVocabulariesService { return of([]); } else if (field == "type" && entity == "result" ) { //return Observable.zip(this.getVocabularyFromService("dnet:publication_resource.json", properties),this.getVocabularyFromService("dnet:dataCite_resource.json", properties)); - return Observable.zip(from(this.getVocabularyFromServiceAsync("dnet:publication_resource.json", properties)),from(this.getVocabularyFromServiceAsync("dnet:dataCite_resource.json", properties))); + return zip(from(this.getVocabularyFromServiceAsync("dnet:publication_resource.json", properties)),from(this.getVocabularyFromServiceAsync("dnet:dataCite_resource.json", properties))); } else if (field == "access" && (entity == "publication" || entity == "dataset" || entity == "software" || entity == "other" || entity == "result")) { // file= "accessMode.json"; // return this.getVocabularyFromFile(file); diff --git a/utils/subscribe/subscribe.service.ts b/utils/subscribe/subscribe.service.ts index 271abf70..22d6bee3 100644 --- a/utils/subscribe/subscribe.service.ts +++ b/utils/subscribe/subscribe.service.ts @@ -1,5 +1,9 @@ import {BehaviorSubject, Observable} from "rxjs"; +import { Injectable } from "@angular/core"; +@Injectable({ + providedIn: 'root' +}) export class SubscribeService { private loading: BehaviorSubject = new BehaviorSubject(false); diff --git a/utils/tokens.ts b/utils/tokens.ts new file mode 100644 index 00000000..63b7abd8 --- /dev/null +++ b/utils/tokens.ts @@ -0,0 +1,6 @@ +import {InjectionToken} from "@angular/core"; +import {Request, Response} from "express"; + +export const REQUEST: InjectionToken = new InjectionToken('Request'); + +export const RESPONSE: InjectionToken = new InjectionToken('Response');