[Library]: Move angular 11 to trunk. Remove no needed files. Delete angular upgrade branches

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@61381 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-07-14 11:19:57 +00:00
parent 5227f96b3b
commit 08bf703186
111 changed files with 744 additions and 858 deletions

View File

@ -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){

View File

@ -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';

View File

@ -12,7 +12,7 @@
<form class="">
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search links"
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search links"
[selected]="inputkeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="resetInput()"
[bordered]="true" colorClass="uk-text-secondary"></div>
</div>

View File

@ -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';

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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';

View File

@ -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({

View File

@ -43,7 +43,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanActivateChild {
return authorized;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(route.params['community'], state.url);
}

View File

@ -27,7 +27,7 @@ export class ConnectCommunityGuard implements CanActivate, CanActivateChild {
}));
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
let community = route.params['community'];
return community && this.check(community, state.url);
}

View File

@ -27,7 +27,7 @@ export class ConnectRIGuard implements CanActivate, CanActivateChild {
}));
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
let community = route.params['community'];
return community && this.check(community, state.url);
}

View File

@ -51,7 +51,7 @@ export class ConnectSubscriberGuard implements CanActivate, CanActivateChild {
return authorized;
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(route, state);
}

View File

@ -42,7 +42,7 @@ export class IsCommunity implements CanActivate, CanActivateChild {
}
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(route, state);
}

View File

@ -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) {

View File

@ -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: [

View File

@ -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 {

View File

@ -38,7 +38,6 @@ export class DivIdsComponent implements OnInit {
public filterForm: FormGroup;
private subscriptions: any[] = [];
public allPages: Option[] = [];
@ViewChild('PageInput') pageInput: ElementRef<HTMLInputElement>;
selectedCommunityPid = null;
public portalUtils: PortalUtils = new PortalUtils();
private index: number;

View File

@ -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';

View File

@ -7,7 +7,7 @@
<icon name="arrow_left"></icon>
</span>
<span class="space">
Go back to class contents list
Go back to class help texts list
</span>
</a>
</div>
@ -16,7 +16,7 @@
<div class="uk-card-header">
<div class="uk-flex uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-grid" uk-grid>
<div>
<div class="uk-text-small uk-text-muted"> {{pageHelpContent ? 'Update ' : 'Add new '}} class content</div>
<div class="uk-text-small uk-text-muted"> {{pageHelpContent ? 'Update ' : 'Add new '}} class help text</div>
<div>
<span *ngIf="page" class="uk-text-bold">{{page.name}}</span>
<span *ngIf="myForm.dirty"> (unsaved changes)</span>

View File

@ -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 => {

View File

@ -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';

View File

@ -1,15 +1,11 @@
<div page-content>
<div header>
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div class="uk-text-bold">
<span *ngIf="selectedPageId && page">{{page.name}}</span>
</div>
<div class="uk-margin-top">
<a routerLink="../pages/" class="uk-text-secondary uk-text-uppercase uk-text-bold uk-text-small">
<span class="uk-icon-button small uk-icon uk-button-secondary">
<span class="uk-icon-button small uk-icon uk-button-secondary">
<icon name="arrow_left"></icon>
</span>
<span class="space">
@ -20,124 +16,112 @@
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div #searchInputComponent search-input [control]="filterForm" [showSearch]="false" placeholder="Search helptext"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div>
<a (click)="newPageContent()"
class="uk-flex uk-flex-middle uk-text-uppercase">
<button class="large uk-icon-button uk-button-secondary">
<icon name="add"></icon>
</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Add new class content</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Add new class help text
</button>
</a>
</div>
</div>
<div *ngIf="checkboxes.length > 0"
class="uk-padding uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom"
<div *ngIf="showLoading && checkboxes.length > 0"
class="uk-padding uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom uk-display-inline"
[attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one help text"><input id="checkAll" type="checkbox" (click)="selectAll()"
[ngModel]="getSelectedPageHelpContents().length ==checkboxes.length"/>
<span *ngIf="getSelectedPageHelpContents().length > 0" class="uk-margin-left uk-text-muted">
{{getSelectedPageHelpContents().length}} pages selected </span>
<a class="uk-margin-left ">Actions </a>
<a class="uk-margin-left ">Actions </a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one help text">
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
(click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
</a></li>
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
(click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
</a>
</li>
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
(click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
</ul>
</div>
</div>
</div>
<div inner>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<div *ngIf="checkboxes.length > 0" class="uk-margin-medium-bottom">
<ul class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.divHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.divHelpContent._id}}"
[(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div class="content-wrapper" id="contentWrapper">
<div>
<div class="contentPanel">
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div *ngIf="showLoading" class="uk-position-center">
<loading *ngIf="showLoading"></loading>
</div>
<div class="content multi-line-ellipsis lines-2">
<p>{{check.divHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span
class="title">Class: </span>{{check.divHelpContent.divId.name ? check.divHelpContent.divId.name : check.divHelpContent.divId}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.divHelpContent.isActive"
(change)="($event.source.checked = check.divHelpContent.isActive);togglePageHelpContents(!check.divHelpContent.isActive,[check.divHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div *ngIf="!errorMessage && !showLoading">
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
<div class="md-card-content">
<div class="uk-overflow-container">
<div class="uk-overflow-container">
<ul class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.divHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.divHelpContent._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div class="content multi-line-ellipsis lines-2">
<p>{{check.divHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span class="title">Class: </span>{{check.divHelpContent.divId.name?check.divHelpContent.divId.name:check.divHelpContent.divId}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.divHelpContent.isActive"
(change)="($event.source.checked = check.divHelpContent.isActive);togglePageHelpContents(!check.divHelpContent.isActive,[check.divHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.divHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.divHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">
Edit
</span>
</div>
<div (click)="confirmDeletePageHelpContent(check.divHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
</div>
<div (click)="confirmDeletePageHelpContent(check.divHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
Delete
</span>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No page contents found</div>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No class help texts found</div>
</div>
</div>
</div>
</div>
<modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>
</div>
<modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>

View File

@ -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<DivHelpContent>;
this.counter.all = this.divHelpContents.length;
this.checkboxes = [];
for (let i = this.divHelpContents.length - 1; i >= 0; i -= 1) {
this.checkboxes.unshift(<CheckDivHelpContent>{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<DivHelpContent>;
this.counter.all = this.pageHelpContents.length;
this.checkboxes = [];
for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
this.checkboxes.unshift(<CheckDivHelpContent>{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 <b>successfully deleted</b>', {
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 <b>successfully deleted</b>', {
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 <b>successfully updated</b>', {
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(<CheckDivHelpContent>{divHelpContent: _, checked: false})
this.checkboxes.push(<CheckDivHelpContent>{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;
}
}
}

View File

@ -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';

View File

@ -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]) {

View File

@ -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";

View File

@ -7,7 +7,7 @@
<icon name="arrow_left"></icon>
</span>
<span class="space">
Go back to helptexts list
Go back to page help texts list
</span>
</a>
</div>
@ -16,7 +16,7 @@
<div class="uk-card-header">
<div class="uk-flex uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m uk-grid" uk-grid>
<div>
<div class="uk-text-small uk-text-muted"> {{pageHelpContent ? 'Update ' : 'Add new '}} help text</div>
<div class="uk-text-small uk-text-muted"> {{pageHelpContent ? 'Update ' : 'Add new '}} page help text</div>
<div>
<span *ngIf="page" class="uk-text-bold">{{page.name}}</span>
<span *ngIf="myForm.dirty"> (unsaved changes)</span>

View File

@ -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];

View File

@ -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';

View File

@ -24,18 +24,19 @@
<button class="large uk-icon-button uk-button-secondary">
<icon name="add"></icon>
</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Add new help text</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Add new page help text
</button>
</a>
</div>
</div>
<div *ngIf="checkboxes.length > 0"
class="uk-padding uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom"
<div *ngIf="!showLoading && checkboxes.length > 0"
class="uk-padding uk-flex uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom uk-display-inline"
[attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one help text"><input id="checkAll" type="checkbox" (click)="selectAll()"
[ngModel]="getSelectedPageHelpContents().length ==checkboxes.length"/>
<span *ngIf="getSelectedPageHelpContents().length > 0" class="uk-margin-left uk-text-muted">
{{getSelectedPageHelpContents().length}} pages selected </span>
<a class="uk-margin-left ">Actions </a>
<a class="uk-margin-left">Actions </a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
@ -54,74 +55,70 @@
</div>
</div>
<div inner>
<div class="content-wrapper" id="contentWrapper">
<div>
<div class="contentPanel">
<div *ngIf="!showLoading">
<ul *ngIf="checkboxes.length > 0" class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div *ngIf="!selectedPageId">
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</div>
<div class="content multi-line-ellipsis lines-2">
<p>{{check.pageHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span class="title">Placement: </span>{{check.pageHelpContent.placement}}
</div>
<div class=" ">
<span class="title">Order: </span>{{check.pageHelpContent.order}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.pageHelpContent.isActive"
(change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</div>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<div *ngIf="checkboxes.length > 0" class="uk-margin-medium-bottom">
<ul class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div *ngIf="!selectedPageId">
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">
Edit
</span>
</div>
<div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
Delete
</span>
</div>
</div>
</div>
<div class="content multi-line-ellipsis lines-2">
<p>{{check.pageHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span class="title">Placement: </span>{{check.pageHelpContent.placement}}
</div>
<div class=" ">
<span class="title">Order: </span>{{check.pageHelpContent.order}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.pageHelpContent.isActive"
(change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</li>
</ul>
<div *ngIf="checkboxes.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No page contents found</div>
</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">Edit</span>
</div>
<div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
Delete
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
</div>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No page help texts found</div>
</div>
</div>
</div>

View File

@ -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<PageHelpContent>;
this.counter.all = this.pageHelpContents.length;
this.checkboxes = [];
for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
this.checkboxes.unshift(<CheckPageHelpContent>{
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<PageHelpContent>;
this.counter.all = this.pageHelpContents.length;
this.checkboxes = [];
for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
this.checkboxes.unshift(<CheckPageHelpContent>{
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 <b>successfully deleted</b>', {
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 <b>successfully deleted</b>', {
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 <b>successfully updated</b>', {
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 <b>successfully updated</b>', {
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 == '' || (<Page>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
|| ((<Page>pageHelpContent.page).name).match(filters.text) != null;
let textFlag = filters.text.toString() == '' || (pageHelpContent.content && pageHelpContent.content.match(filters.text) != null)
|| (pageHelpContent.page && (<Page>pageHelpContent.page).name && (<Page>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(<CheckPageHelpContent>{pageHelpContent: _, checked: false})
this.checkboxes.push(<CheckPageHelpContent>{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() {

View File

@ -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';

View File

@ -90,20 +90,20 @@
</div>
<div *ngIf="!isPortalAdministrator && ((check.page.top || check.page.bottom || check.page.left ||
check.page.right) || pageWithDivIds.includes(check.page._id) )" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Helptexts</div>
<div class="title uk-margin-medium-bottom">Help texts</div>
<div class=" uk-margin-small-bottom">
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents"
[queryParams]="{pageId: check.page._id}"
routerLink="../helptexts">
Manage page contents
Manage page help texts
<span *ngIf="pageHelpContentsCount[check.page._id]">({{pageHelpContentsCount[check.page._id]}})</span>
</a>
</div>
<div>
<a *ngIf="pageWithDivIds.includes(check.page._id)"
[queryParams]="{ pageId: check.page._id}"
routerLink="../classContents">Manage class contents
routerLink="../classContents">Manage class help texts
<span *ngIf="pageClassContentsCount[check.page._id]">({{pageClassContentsCount[check.page._id]}})</span>
</a>
</div>

View File

@ -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;
}

View File

@ -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";

View File

@ -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;

View File

@ -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;

View File

@ -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() {

View File

@ -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> | 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> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(route.data, state.url);
}
}

View File

@ -121,25 +121,25 @@
<showPublisher [journal]="dataProviderInfo.journal" [properties]="properties"></showPublisher>
</ul>
<div *ngIf="hasAggregationStatusInfo"
<div *ngIf="hasAggregationStatusInfo || dataProviderInfo.fundedContent"
class="uk-margin-medium-bottom uk-animation-fade uk-animation-fast">
<span *ngIf="dataProviderInfo.aggregationStatus.fulltexts && dataProviderInfo.aggregationStatus.fulltexts != -1"
<span *ngIf="dataProviderInfo.aggregationStatus?.fulltexts && dataProviderInfo.aggregationStatus?.fulltexts != -1"
class="uk-margin-right">
<span class="uk-text-muted">Collected full-texts: </span>
{{dataProviderInfo.aggregationStatus.fulltexts | number}}
</span>
<span *ngIf="dataProviderInfo.aggregationStatus.fundedContent && dataProviderInfo.aggregationStatus.fundedContent != -1"
<span *ngIf="dataProviderInfo.fundedContent && dataProviderInfo.fundedContent > 0"
class="uk-display-inline-block">
<span class="uk-text-muted">Results with funding information: </span>
{{dataProviderInfo.aggregationStatus.fundedContent | number}}
</span>
<span *ngIf="dataProviderInfo.aggregationStatus.lastUpdateDate"
class="uk-display-inline-block">
<span class="uk-text-muted">Latest data aggregation: </span>
{{dataProviderInfo.aggregationStatus.lastUpdateDate | date}}
{{dataProviderInfo.fundedContent | number}}
</span>
<!-- <span *ngIf="dataProviderInfo.aggregationStatus.lastUpdateDate"-->
<!-- class="uk-display-inline-block">-->
<!-- <span class="uk-text-muted">Latest data aggregation: </span>-->
<!-- {{dataProviderInfo.aggregationStatus.lastUpdateDate | date}}-->
<!-- </span>-->
</div>
<div *ngIf="!aggregationStatusIsInitialized"
<div *ngIf="!aggregationStatusIsInitialized || !dataProviderInfo.fundedContent"
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center"></span>
</div>
@ -480,7 +480,7 @@
<div class="uk-margin-small-top uk-flex">
<!-- Last Index Info-->
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4" loading="lazy">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}

View File

@ -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'] ||

View File

@ -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 => <any> 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 => <any> 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<length; i++) {
// var aggregationHistory = Array.isArray(data[0]["aggregationHistory"]) ? data[0]["aggregationHistory"][i] : data[0]["aggregationHistory"];
// if(aggregationHistory && aggregationHistory.indexedVersion == true) {
// aggregationStatus.lastUpdateDate = aggregationHistory.date;
// break;
// }
// }
// }
// }
if(data[0].hasOwnProperty("aggregationHistory")) {
let length = Array.isArray(data[0]["aggregationHistory"]) ? data[0]["aggregationHistory"].length : 1;
var aggregationStatus: {"fulltexts": string} = null;
if(apis != null) {
aggregationStatus = {"fulltexts": "-1"};
for(let i=0; i<length; i++) {
var aggregationHistory = Array.isArray(data[0]["aggregationHistory"]) ? data[0]["aggregationHistory"][i] : data[0]["aggregationHistory"];
if(aggregationHistory && aggregationHistory.indexedVersion == true) {
aggregationStatus.lastUpdateDate = aggregationHistory.date;
break;
}
}
let mostRecentDate = null;
let length = Array.isArray(apis) ? apis.length : 1;
for (let i = 0; i < length; i++) {
let api = Array.isArray(apis) ? apis[i] : apis;
if(api.compatibility == "files" && (mostRecentDate == null || mostRecentDate < api.lastDownloadDate)) {
aggregationStatus.fulltexts = api.lastDownloadTotal;
mostRecentDate = api.lastDownloadDate;
}
}
return aggregationStatus;
}
return aggregationStatus;
}
parseDataProviderInfo (data: any):any {

View File

@ -9,9 +9,9 @@ import {EmailService} from "../../utils/email/email.service";
import {RecaptchaModule} from "ng-recaptcha";
@NgModule({
imports: [CommonModule, LandingHeaderModule, ReactiveFormsModule, MatSelectModule, AlertModalModule, RecaptchaModule.forRoot()],
imports: [CommonModule, LandingHeaderModule, ReactiveFormsModule, MatSelectModule, AlertModalModule, RecaptchaModule],
declarations: [FeedbackComponent],
providers: [EmailService],
exports: [FeedbackComponent]
})
export class FeedbackModule {}
export class FeedbackModule {}

View File

@ -11,7 +11,7 @@ import {properties} from "../../../../environments/environment";
class="uk-flex uk-flex-top"
[title]="available.bestAccessMode ? available.bestAccessMode : 'Not available'">
<span class="uk-margin-small-right">
<img [src]="available.icon">
<img [src]="available.icon" loading="lazy">
</span>
<div class="uk-width-expand uk-padding-small uk-padding-remove-left uk-padding-remove-vertical">
<span *ngIf="available.downloadUrl.length > 1" class="title">

View File

@ -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: [

View File

@ -15,7 +15,7 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
click-outside-or-esc (clickOutside)="close($event)"
id="metrics" targetId="metrics">
<div class="m-badge clickable" (click)="toggle($event)">
<img src="assets/common-assets/logo-small-usage-counts.png">
<img src="assets/common-assets/logo-small-usage-counts.png" loading="lazy">
<div class="number">{{total | number}}</div>
</div>
<div class="widget" [@widget]="state.toString()">
@ -101,7 +101,7 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
<div class="footer uk-flex uk-flex-middle" [@footer]="state.toString()">
<span>Powered by</span>
<a href="https://usagecounts.openaire.eu" target="_blank">
<img width="120" src="assets/common-assets/logo-large-usage-counts.png">
<img width="120" src="assets/common-assets/logo-large-usage-counts.png" loading="lazy">
</a>
</div>
</div>

View File

@ -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';

View File

@ -61,7 +61,7 @@ import {EnvProperties} from "../../utils/properties/env-properties";
<a target="_blank" class="uk-display-inline-block"
[href]="properties.sherpaURL+(journal['issn']?journal['issn']:(journal['eissn']?journal['eissn']:journal['lissn'] ))+properties.sherpaURLSuffix"
uk-tooltip="title: View information on Sherpa/RoMEO ">
<img src="assets/common-assets/common/SHERPA-RoMEO-short-logo.gif" width=16 height=16 alt="">
<img src="assets/common-assets/common/SHERPA-RoMEO-short-logo.gif" width=16 height=16 alt="" loading="lazy">
Copyright policy<span class="custom-external custom-icon space"></span>
</a>
</span>

View File

@ -251,7 +251,7 @@
<div class="uk-margin-small-top uk-flex">
<!-- Last Index Info-->
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4" loading="lazy">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}

View File

@ -734,7 +734,7 @@
<div class="uk-margin-small-top uk-flex">
<!-- Last Index Info-->
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4" loading="lazy">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a
href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">

View File

@ -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';

View File

@ -107,7 +107,7 @@
<li *ngIf="properties.b2noteAPIURL">
<a *ngIf="isLoggedIn && pid" class="uk-link-text uk-text-bold uk-text-uppercase" (click)="annotation.toggleAnnotation($event)">
<span class="uk-icon-button uk-button-primary uk-icon">
<img src="assets/common-assets/b2note.png">
<img src="assets/common-assets/b2note.png" loading="lazy">
</span>
<span class="uk-margin-small-left">add annotation</span>
</a>
@ -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'">
<span class="uk-icon-button uk-button-primary uk-icon uk-disabled">
<img src="assets/common-assets/b2note.png">
<img src="assets/common-assets/b2note.png" loading="lazy">
</span>
<span class="uk-margin-small-left">add annotation</span>
</span>
@ -423,7 +423,8 @@
<ng-template #enermaps_tab>
<div class="uk-padding">
<div class=" uk-inline uk-width-expand uk-text-center ">
<img class="uk-width-auto" [src]="properties.enermapsURL +'/images/' + enermapsId + '.png'" alt="Enermaps tool preview">
<img class="uk-width-auto" [src]="properties.enermapsURL +'/images/' + enermapsId + '.png'"
alt="Enermaps tool preview" loading="lazy">
<div class="uk-overlay uk-overlay-default uk-position-bottom">
<p>Visit <a
class=" uk-margin-right uk-margin-small-top"
@ -523,7 +524,7 @@
<div class="uk-margin-small-top uk-flex">
<!-- Last Index Info-->
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4" loading="lazy">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}

View File

@ -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))

View File

@ -40,7 +40,7 @@ export class AdminLoginGuard implements CanActivate, CanActivateChild {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(state.url);
}

View File

@ -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> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(state.url);
}

View File

@ -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> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(state.url);
}

View File

@ -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> | boolean {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return this.check(state.url);
}

View File

@ -54,9 +54,8 @@
</form-->
<div *ngIf="errorCode == '1'" class="uk-alert uk-alert-warning">
The requested page requires authentication.
<span *ngIf="!loggedIn">
Please <a class="" (click)="logIn()"> sign in</a> to continue.
</span>
<span *ngIf="!loggedIn">Please <a class="uk-link" (click)="logIn()"> sign in</a> to continue.
</span>
</div>
<div *ngIf="errorCode == '2' || errorCode == '4' || errorCode == '8'" class="uk-alert uk-alert-warning">
You are not authorized to use the requested page.

View File

@ -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;

View File

@ -7,7 +7,7 @@ import {Component} from "@angular/core";
<div class="uk-flex uk-flex-wrap">
<div class="uk-width-1-3@s first uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/1.png">
<img src="assets/common-assets/monitor-assets/how/1.png" loading="lazy">
</div>
<div class="uk-text-center">
<span class="uk-text-bold uk-text-uppercase">Starting</span> from existing<br>research-related data sources
@ -15,12 +15,12 @@ import {Component} from "@angular/core";
</div>
<div class="uk-width-1-3@s second uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/2.png">
<img src="assets/common-assets/monitor-assets/how/2.png" loading="lazy">
</div>
</div>
<div class="uk-width-1-3@s third uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/3.png">
<img src="assets/common-assets/monitor-assets/how/3.png" loading="lazy">
</div>
<div class="uk-text-center">
build an open, global<br>and trusted Research graph
@ -30,7 +30,7 @@ import {Component} from "@angular/core";
<div class="uk-flex uk-flex-wrap">
<div class="uk-width-1-3@s fourth uk-flex-last@s uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/4.png">
<img src="assets/common-assets/monitor-assets/how/4.png" loading="lazy">
</div>
<div class="uk-text-center">
we perform <span class="uk-text-bold uk-text-uppercase">Statistical Analysis</span> and produce
@ -39,7 +39,7 @@ import {Component} from "@angular/core";
</div>
<div class="uk-width-1-3@s fifth uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/5.png">
<img src="assets/common-assets/monitor-assets/how/5.png" loading="lazy">
</div>
<div class="uk-text-center">
furthermore <span class="uk-text-bold uk-text-uppercase">Network<br>Analysis</span> producing
@ -48,7 +48,7 @@ import {Component} from "@angular/core";
</div>
<div class="uk-width-1-3@s sixth uk-flex-first@s uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/6.png">
<img src="assets/common-assets/monitor-assets/how/6.png" loading="lazy">
</div>
<div class="uk-text-center">
Often combine with external data
@ -60,7 +60,7 @@ import {Component} from "@angular/core";
</div>
<div class="final uk-text-muted">
<div>
<img src="assets/common-assets/monitor-assets/how/7.png">
<img src="assets/common-assets/monitor-assets/how/7.png" loading="lazy">
</div>
</div>
</div>

View File

@ -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'];

View File

@ -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;

View File

@ -40,7 +40,7 @@ declare var UIkit: any;
<div class="uk-margin-top">
<span>
Did you link a result with your ORCID <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">
Did you link a result with your ORCID <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">
but the <span class="orcid-color">green icon</span> is missing?
<br>
No worries! It will appear, as soon as we synchronize again with ORCID data.

View File

@ -44,7 +44,7 @@ declare var UIkit: any;
<span class="uk-margin-small-left uk-flex uk-flex-middle">Add to
<span class="orcid-color space uk-flex uk-flex-middle">
<span>ORCID</span>
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">{{" "}}
</span>
</span>
</a>
@ -63,7 +63,7 @@ declare var UIkit: any;
<span class="uk-margin-small-left uk-flex uk-flex-middle">Delete from
<span class="orcid-color space uk-flex uk-flex-middle">
<span>ORCID</span>
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">{{" "}}
</span>
</span>
</a>
@ -80,7 +80,7 @@ declare var UIkit: any;
<a (click)="currentAction='add'; saveWorkPreparation();"
[class]="'orcid_icon_opacity uk-link-text uk-text-bold uk-text-uppercase '+ (showLoading ? 'uk-disabled' : '') + (!isLoggedIn || !pids ? 'uk-disabled uk-text-muted' : '')">
<span *ngIf="!showLoading" class="uk-icon">
<img src="assets/common-assets/common/orcid_add.svg" style="width: 42px; height: 42px">
<img src="assets/common-assets/common/orcid_add.svg" style="width: 42px; height: 42px" loading="lazy">
</span>
<span *ngIf="showLoading" class="uk-icon icon-button loading-action-button"><loading
[top_margin]="false"></loading></span>
@ -101,7 +101,7 @@ declare var UIkit: any;
<a (click)="currentAction='delete'; deleteWorks();"
[class]="'orcid_icon_opacity uk-link-text uk-text-bold uk-text-uppercase '+ (showLoading ? 'uk-disabled' : '') + (!isLoggedIn || !pids ? 'uk-disabled uk-text-muted' : '')">
<span *ngIf="!showLoading" class="uk-icon uk-preserve">
<img src="assets/common-assets/common/orcid_bin.svg" style="width: 42px; height: 42px">
<img src="assets/common-assets/common/orcid_bin.svg" style="width: 42px; height: 42px" loading="lazy">
</span>
<span *ngIf="showLoading" class="uk-icon icon-button loading-action-button"><loading
[top_margin]="false"></loading></span>
@ -143,7 +143,7 @@ declare var UIkit: any;
<ng-container *ngIf="pageType == 'my_search'">
<span class="uk-margin-bottom uk-flex uk-flex-middle uk-flex-center">
<span>ORCID</span>
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">
<img class="space" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">
<span class="space">ACTIONS</span>
</span>

View File

@ -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: [

View File

@ -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;

View File

@ -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,

View File

@ -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 = "";

View File

@ -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 = "";

View File

@ -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 = "";

View File

@ -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,

View File

@ -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({

View File

@ -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';

View File

@ -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',

View File

@ -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,

View File

@ -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';

View File

@ -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: [

View File

@ -1,11 +1,11 @@
<ng-template #selected_filters_pills>
<div class="uk-grid uk-grid-small uk-text-small" uk-grid>
<h1 class="uk-grid uk-grid-small uk-text-small" uk-grid>
<ng-container *ngIf="customFilter && ((customFilterEnabled &&
refineFields.indexOf(customFilter.queryFieldName) ==
-1) ||customFilter.isHiddenFilter)">
<span class="">
<span class="selectedFilterLabel customFilterLabel">
<span class="">{{customFilter.valueName}}</span>
<span class="">{{' '+customFilter.valueName}}</span>
</span>
</span>
</ng-container>
@ -23,7 +23,7 @@
fill="none" stroke="#000" stroke-width="1.6" d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left">{{type.name}}</span>
<span class="uk-margin-small-left">{{' '+type.name}}</span>
</a>
</span>
</span>
@ -47,7 +47,7 @@
d="M16,4 L4,16"></path></svg>
</span>
</span>
<span class="uk-margin-small-left">{{filter.selectedFromAndToValues}}</span>
<span class="uk-margin-small-left">{{' '+filter.selectedFromAndToValues}}</span>
</a>
</span>
</span>
@ -75,14 +75,15 @@
</span>
</span>
<span class="uk-margin-small-left"
[innerHtml]="(value.name.length > 34)?value.name.substring(0,34)+'...':value.name"></span>
[innerHtml]="' ' +
((value.name.length > 34)?value.name.substring(0,34)+'...':value.name)"></span>
</a>
</span>
</span>
</ng-container>
</ng-container>
</ng-container>
</div>
</h1>
</ng-template>
<ng-template #filters_column>
<div [class.filterLoading]="(disableForms || disableRefineForms)">
@ -185,7 +186,7 @@
>
</advanced-search-form>
<div *ngIf="entityType === 'community' || entityType === 'stakeholder' " class="uk-position-center-right uk-visible@m">
<img src="assets/common-assets/common/search.svg" class="uk-align-center" width="141" height="171">
<img src="assets/common-assets/common/search.svg" class="uk-align-center" width="141" height="171" loading="lazy">
</div>
</div>
</div>
@ -388,7 +389,7 @@
class="uk-margin-small-top uk-grid uk-child-width-1-2">
<!-- Last Index Info-->
<div class="">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4" loading="lazy">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by <a href="https://graph.openaire.eu" class="graph-color">OpenAIRE Research Graph</a></span>
</div>
<div class="uk-text-right">

View File

@ -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'");

View File

@ -24,9 +24,9 @@
<div class="uk-flex uk-flex-center">
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
[src]="properties.utilsService + '/download/' + result.logoUrl"
alt="{{(result.title)?result.title:result.shortTitle}} logo">
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
alt="{{(result.title)?result.title:result.shortTitle}} logo">
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<span *ngIf="result.logoUrl == null || result.logoUrl == ''" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
stroke="#000"
@ -47,9 +47,9 @@
<div class="uk-flex uk-flex-center">
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
[src]="properties.utilsService + '/download/' + result.logoUrl"
alt="{{(result.title)?result.title:result.shortTitle}} logo">
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
alt="{{(result.title)?result.title:result.shortTitle}} logo">
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<span *ngIf="(result.logoUrl == null || result.logoUrl == '' )" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
stroke="#000"

View File

@ -3,7 +3,8 @@ import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {QuickSelectionsComponent} from "./quick-selections.component";
import {MatCheckboxModule, MatSlideToggleModule} from "@angular/material";
import { MatCheckboxModule } from "@angular/material/checkbox";
import { MatSlideToggleModule } from "@angular/material/slide-toggle";
import {SearchFilterModule} from "./searchFilter.module";
@NgModule({

View File

@ -9,7 +9,6 @@ import {
} from '@angular/core';
import { Filter, Value} from './searchHelperClasses.class';
import {ActivatedRoute, Router} from "@angular/router";
import 'rxjs/add/operator/filter';
import {SearchFields} from "../../utils/properties/searchFields";
@Component({
selector: 'search-filter',

View File

@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms';
import {SearchFilterComponent} from './searchFilter.component';
import{SearchFilterModalComponent} from './searchFilterModal.component';
import {ModalModule} from '../../utils/modal/modal.module';
import {MatSelectModule} from "@angular/material";
import { MatSelectModule } from "@angular/material/select";
import {RouterModule} from "@angular/router";
@NgModule({

View File

@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import {SearchResultsPerPageComponent} from './searchResultsPerPage.component';
import {MatSelectModule} from "@angular/material";
import { MatSelectModule } from "@angular/material/select";
@NgModule({
imports: [

View File

@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import{SearchSortingComponent} from './searchSorting.component';
import {MatSelectModule} from "@angular/material";
import { MatSelectModule } from "@angular/material/select";
@NgModule({
imports: [

View File

@ -1,17 +1,17 @@
/**
* Created by stefania on 7/13/17.
*/
import { Injectable } from '@angular/core';
import {Injectable} from '@angular/core';
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import { Observable } from 'rxjs';
import { Page } from "../utils/entities/adminTool/page";
import { PageHelpContent } from "../utils/entities/adminTool/page-help-content";
import { Portal } from "../utils/entities/adminTool/portal";
import { Entity } from "../utils/entities/adminTool/entity";
import { DivId } from "../utils/entities/adminTool/divId";
import { DivHelpContent } from "../utils/entities/adminTool/div-help-content";
import {Observable, throwError} from 'rxjs';
import {Page} from "../utils/entities/adminTool/page";
import {PageHelpContent} from "../utils/entities/adminTool/page-help-content";
import {Portal} from "../utils/entities/adminTool/portal";
import {Entity} from "../utils/entities/adminTool/entity";
import {DivId} from "../utils/entities/adminTool/divId";
import {DivHelpContent} from "../utils/entities/adminTool/div-help-content";
import {StatisticsDisplay, StatisticsSummary} from '../connect/statistics/statisticsEntities';
import { CustomOptions } from './servicesUtils/customOptions.class';
import {CustomOptions} from './servicesUtils/customOptions.class';
import {catchError, map} from "rxjs/operators";
import {properties} from "../../../environments/environment";
@ -373,7 +373,7 @@ export class HelpContentService {
// in a real world app, we may send the error to some remote logging infrastructure
// instead of just logging it to the console
console.error(error);
return Observable.throw(error.error || 'Server error');
return throwError(error.error || 'Server error');
}
// getDataProviders() {

View File

@ -204,7 +204,7 @@ export class SearchResearchResultsService {
if (!Array.isArray(resData['pid'])) {
if (resData['pid'].classid && resData['pid'].classid == 'doi') {
if (resData['pid'].content != '' && resData['pid'].content != null) {
result.DOIs.push(resData['pid'].content.replace("https://doi.org/", ""));
result.DOIs.push((resData['pid'].content+"").replace("https://doi.org/", ""));
}
}
} else {
@ -538,4 +538,10 @@ export class SearchResearchResultsService {
return entityType;
}
}
public countCollectedResultsWithFundingInfo(datasourceId: string) {
let url = properties.searchAPIURLLAst + "resources?query=" + encodeURIComponent("(oaftype=result and collectedfromdatasourceid exact \""+datasourceId+"\" and relprojectid=*)") + "&page=0&size=0&format=json";
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
.pipe(map(res => res['meta']['total']));
}
}

View File

@ -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({

View File

@ -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';

View File

@ -37,7 +37,7 @@ const COMPONENTS = [
]
})
export class SharedModule {
static forRoot(): ModuleWithProviders {
static forRoot(): ModuleWithProviders<SharedModule> {
return {
ngModule: SharedModule,
};

View File

@ -6,7 +6,7 @@
<div>
<img style="margin-right: 8px; float: left;"
[src]="assetsPath + 'common/commission.jpg'"
alt="flag black white low" width="50" height="33">
alt="flag black white low" width="50" height="33" loading="lazy">
</div>
<helper *ngIf="divContents && divContents['footer']?.length > 0"
[texts]="divContents['footer']"></helper>
@ -25,7 +25,7 @@
<div *ngIf="showOpenaire" class="uk-text-right uk-width-1-2">
<img [src]="assetsPath + 'common/Logo_Horizontal_'+(darkBackground?'white':'dark')+'_small.png'"
data-width="126"
data-height="30" class="el-image" alt="OpenAIRE">
data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
</div>
</div>
</ng-container>
@ -42,7 +42,7 @@
[class]="(centered?'uk-width-1-1 uk-width-1-4@m uk-text-center':'')">
<img [src]="assetsPath + 'common/Logo_Horizontal_'+(darkBackground?'white':'dark')+'_small.png'"
data-width="126"
data-height="30" class="el-image" alt="OpenAIRE">
data-height="30" class="el-image" alt="OpenAIRE" loading="lazy">
</div>
<div *ngIf="showCommision" id="footer#5"
[class]="'uk-text-left '+(centered?' uk-margin uk-width-expand':' uk-margin-left')">
@ -61,7 +61,7 @@
<div>
<img style="margin-right: 8px; float: left;"
[src]="assetsPath + 'common/commission.jpg'"
alt="flag black white low" width="50" height="33">
alt="flag black white low" width="50" height="33" loading="lazy">
</div>
<div class="uk-margin-left">
<helper *ngIf="divContents && divContents['footer']?.length > 0"

File diff suppressed because one or more lines are too long

View File

@ -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) {

View File

@ -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";
<div *ngIf="html" [innerHTML]="html"></div>
`
})
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 = "<script type=\"application/ld+json\">" + json + "</script>";
let html = '<script type="application/ld+json">' + json + '</script>';
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);

View File

@ -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 {

View File

@ -10,7 +10,7 @@ import {MatAutocompleteTrigger} from '@angular/material/autocomplete';
<div *ngIf="control" class="uk-width-expand" [class.bordered]="bordered && (showSearch || selected)" [class.focused]="showSearch">
<form (ngSubmit)="search()">
<input #input type="text" class="uk-width-1-1"
[class.uk-animation-slide-right-medium]="showSearch"
[class.uk-animation-slide-right-medium]="showSearch && !selected"
[class.uk-hidden@m]="!showSearch"
[placeholder]="placeholder"
(blur)="closeSearch()"

View File

@ -19,8 +19,8 @@ import {properties} from "../../../../environments/environment";
</span>
<a *ngIf="(author.orcid || author.orcid_pending) && testBrowser" class="uk-display-inline-block space">
<span>
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="">{{" "}}
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">{{" "}}
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="" loading="lazy">{{" "}}
<span [class.uk-text-small]="small">
{{author.fullName + "; "}}
</span>
@ -34,8 +34,8 @@ import {properties} from "../../../../environments/environment";
<div class="uk-text-muted uk-margin-small-bottom uk-margin-small-top">ORCID</div>
<div class="uk-text-muted uk-text-small uk-margin-small-top uk-margin-small-bottom">
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">{{" "}}
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="">{{" "}}
<img *ngIf="author.orcid" src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="" loading="lazy">{{" "}}
<img *ngIf="!author.orcid && author.orcid_pending" src="assets/common-assets/common/ORCIDiD_iconbw16x16.png" alt="" loading="lazy">{{" "}}
<i *ngIf="author.orcid">Harvested from ORCID Public Data File</i>
<i *ngIf="!author.orcid && author.orcid_pending">Derived by OpenAIRE algorithms or harvested from 3d party repositories</i>

View File

@ -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),

View File

@ -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]'

Some files were not shown because too many files have changed in this diff Show More