Merge branch 'develop' of code-repo.d4science.org:MaDgIK/openaire-library into develop
This commit is contained in:
commit
9025836af4
|
@ -32,6 +32,7 @@ export class SideBarComponent implements OnInit, AfterViewInit, OnDestroy, OnCha
|
||||||
@ViewChild("sidebar_offcanvas") sidebar_offcanvas: ElementRef;
|
@ViewChild("sidebar_offcanvas") sidebar_offcanvas: ElementRef;
|
||||||
public properties = properties;
|
public properties = properties;
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
|
private init: boolean = false;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private router: Router,
|
constructor(private route: ActivatedRoute, private router: Router,
|
||||||
private sanitizer: DomSanitizer, private layoutService: LayoutService,
|
private sanitizer: DomSanitizer, private layoutService: LayoutService,
|
||||||
|
@ -48,18 +49,15 @@ export class SideBarComponent implements OnInit, AfterViewInit, OnDestroy, OnCha
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
if(this.nav && typeof UIkit !== "undefined") {
|
this.toggle(true);
|
||||||
setTimeout(() => {
|
|
||||||
if(this.items[this.activeIndex]?.items?.length > 0) {
|
|
||||||
UIkit.nav(this.nav.nativeElement).toggle(this.activeIndex, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if(changes.activeItem || changes.activeSubItem || changes.items) {
|
if(changes.activeItem || changes.activeSubItem || changes.items) {
|
||||||
this.setActiveMenuItem();
|
this.setActiveMenuItem();
|
||||||
|
if(this.init && changes.items) {
|
||||||
|
this.toggle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +70,17 @@ export class SideBarComponent implements OnInit, AfterViewInit, OnDestroy, OnCha
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggle(init: boolean = false) {
|
||||||
|
this.init = this.init || init;
|
||||||
|
if(this.nav && typeof UIkit !== "undefined") {
|
||||||
|
setTimeout(() => {
|
||||||
|
if(this.items[this.activeIndex]?.items?.length > 0) {
|
||||||
|
UIkit.nav(this.nav.nativeElement).toggle(this.activeIndex, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get isBrowser() {
|
get isBrowser() {
|
||||||
return this.platformId === 'browser';
|
return this.platformId === 'browser';
|
||||||
}
|
}
|
||||||
|
@ -143,10 +152,6 @@ export class SideBarComponent implements OnInit, AfterViewInit, OnDestroy, OnCha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isTheActiveUrl(menuItemURL): boolean {
|
|
||||||
return (menuItemURL == this.router.url.split('?')[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
public get open() {
|
public get open() {
|
||||||
return this.layoutService.open;
|
return this.layoutService.open;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
this.updateLists();
|
this.updateLists();
|
||||||
this.userManagementService.getUserInfo().subscribe(user => {
|
this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
console.log(this.canDelete)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {HttpClient} from "@angular/common/http";
|
|
||||||
import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from "@angular/core";
|
import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from "@angular/core";
|
||||||
import {FormBuilder, FormControl, UntypedFormArray} from "@angular/forms";
|
import {FormBuilder, FormControl, UntypedFormArray} from "@angular/forms";
|
||||||
import {ActivatedRoute, Router} from "@angular/router";
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
|
@ -8,6 +7,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
import {StringUtils} from "../../utils/string-utils.class";
|
import {StringUtils} from "../../utils/string-utils.class";
|
||||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
|
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
|
||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
@ -44,7 +44,7 @@ export class FosSelectionComponent {
|
||||||
public sliderInit: boolean = false;
|
public sliderInit: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpClient: HttpClient,
|
private vocabulariesService: ISVocabulariesService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -53,7 +53,7 @@ export class FosSelectionComponent {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.httpClient.get(this.properties.domain+'/assets/common-assets/vocabulary/fos.json').subscribe(data => {
|
this.vocabulariesService.getFos(properties).subscribe(data => {
|
||||||
this.fos = data['fos'];
|
this.fos = data['fos'];
|
||||||
this.convertFosToOptions();
|
this.convertFosToOptions();
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
|
@ -240,4 +240,4 @@ export class FosSelectionComponent {
|
||||||
return this.contentHeight - this.searchElement.nativeElement.offsetHeight - 100;
|
return this.contentHeight - this.searchElement.nativeElement.offsetHeight - 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {SEOService} from "../sharedComponents/SEO/SEO.service";
|
||||||
import {PiwikService} from "../utils/piwik/piwik.service";
|
import {PiwikService} from "../utils/piwik/piwik.service";
|
||||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||||
import Timeout = NodeJS.Timeout;
|
import Timeout = NodeJS.Timeout;
|
||||||
|
import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ export class FosComponent implements OnInit, OnDestroy {
|
||||||
public sliderInit: boolean = false;
|
public sliderInit: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpClient: HttpClient,
|
private vocabulariesService: ISVocabulariesService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -70,7 +71,7 @@ export class FosComponent implements OnInit, OnDestroy {
|
||||||
this.updateUrl(this.url);
|
this.updateUrl(this.url);
|
||||||
this.updateTitle(this.pageTitle);
|
this.updateTitle(this.pageTitle);
|
||||||
this.updateDescription(this.pageDescription);
|
this.updateDescription(this.pageDescription);
|
||||||
this.httpClient.get(properties.domain+'/assets/common-assets/vocabulary/fos.json').subscribe(data => {
|
this.vocabulariesService.getFos(properties).subscribe(data => {
|
||||||
this.fos = data['fos'];
|
this.fos = data['fos'];
|
||||||
this.convertFosToOptions();
|
this.convertFosToOptions();
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {UntypedFormArray, UntypedFormBuilder} from "@angular/forms";
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
import {EnvProperties} from "../../utils/properties/env-properties";
|
import {EnvProperties} from "../../utils/properties/env-properties";
|
||||||
import {StringUtils} from "../../utils/string-utils.class";
|
import {StringUtils} from "../../utils/string-utils.class";
|
||||||
|
import {ISVocabulariesService} from "../../utils/staticAutoComplete/ISVocabularies.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'sdg-selection',
|
selector: 'sdg-selection',
|
||||||
|
@ -20,14 +21,14 @@ export class SdgSelectionComponent {
|
||||||
public sdgs: UntypedFormArray;
|
public sdgs: UntypedFormArray;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpClient: HttpClient,
|
private vocabulariesService: ISVocabulariesService,
|
||||||
private fb: UntypedFormBuilder
|
private fb: UntypedFormBuilder
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.sdgs = this.fb.array([]);
|
this.sdgs = this.fb.array([]);
|
||||||
this.httpClient.get(this.properties.domain+'/assets/common-assets/vocabulary/sdg.json').subscribe(data => {
|
this.vocabulariesService.getSDGs(properties).subscribe(data => {
|
||||||
data['sdg'].forEach(element => {
|
data['sdg'].forEach(element => {
|
||||||
// this.sdgs.push({code: element.code, id: element.id, label: element.label, html: element.html, checked: this.subjects?.includes(element.id)});
|
// this.sdgs.push({code: element.code, id: element.id, label: element.label, html: element.html, checked: this.subjects?.includes(element.id)});
|
||||||
this.sdgs.push(this.fb.group({
|
this.sdgs.push(this.fb.group({
|
||||||
|
@ -80,4 +81,4 @@ export class SdgSelectionComponent {
|
||||||
private getEntityName (entityType:string) {
|
private getEntityName (entityType:string) {
|
||||||
return StringUtils.getEntityName(entityType, false);
|
return StringUtils.getEntityName(entityType, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {Router} from '@angular/router';
|
||||||
import {Meta, Title} from "@angular/platform-browser";
|
import {Meta, Title} from "@angular/platform-browser";
|
||||||
import {SEOService} from "../sharedComponents/SEO/SEO.service";
|
import {SEOService} from "../sharedComponents/SEO/SEO.service";
|
||||||
import {PiwikService} from "../utils/piwik/piwik.service";
|
import {PiwikService} from "../utils/piwik/piwik.service";
|
||||||
|
import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'sdg',
|
selector: 'sdg',
|
||||||
|
@ -36,7 +37,7 @@ export class SdgComponent implements OnInit, OnDestroy {
|
||||||
subscriptions: Subscription[] = [];
|
subscriptions: Subscription[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private httpClient: HttpClient, private refineFieldResultsService: RefineFieldResultsService,
|
private vocabulariesService: ISVocabulariesService, private refineFieldResultsService: RefineFieldResultsService,
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _meta: Meta,
|
private _meta: Meta,
|
||||||
private _title: Title,
|
private _title: Title,
|
||||||
|
@ -54,7 +55,7 @@ export class SdgComponent implements OnInit, OnDestroy {
|
||||||
this.updateUrl(this.url);
|
this.updateUrl(this.url);
|
||||||
this.updateTitle(this.pageTitle);
|
this.updateTitle(this.pageTitle);
|
||||||
this.updateDescription(this.pageDescription);
|
this.updateDescription(this.pageDescription);
|
||||||
this.httpClient.get(properties.domain+'/assets/common-assets/vocabulary/sdg.json').subscribe(data => {
|
this.vocabulariesService.getSDGs(properties).subscribe(data => {
|
||||||
this.sdgs = data['sdg'];
|
this.sdgs = data['sdg'];
|
||||||
});
|
});
|
||||||
let refineParams = null;
|
let refineParams = null;
|
||||||
|
|
|
@ -107,21 +107,28 @@ export class ISVocabulariesService {
|
||||||
|
|
||||||
getLocalVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> {
|
getLocalVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> {
|
||||||
if(vocabularyName == "sdg"){
|
if(vocabularyName == "sdg"){
|
||||||
let url = properties.domain+"/assets/common-assets/vocabulary/sdg.json";
|
return this.getSDGs(properties)
|
||||||
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
|
||||||
//.map(res => <any> res.json())
|
|
||||||
.pipe(map(res => res['sdg']))
|
.pipe(map(res => res['sdg']))
|
||||||
.pipe(map(res => this.parseSDGs(res)))
|
.pipe(map(res => this.parseSDGs(res)))
|
||||||
.pipe(catchError(this.handleError));
|
.pipe(catchError(this.handleError));
|
||||||
}else if( vocabularyName == "fos"){
|
}else if( vocabularyName == "fos"){
|
||||||
let url = properties.domain+"/assets/common-assets/vocabulary/fos.json";
|
return this.getFos(properties)
|
||||||
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
|
||||||
//.map(res => <any> res.json())
|
|
||||||
.pipe(map(res => res['fos']))
|
.pipe(map(res => res['fos']))
|
||||||
.pipe(map(res => this.parseFOS(res)))
|
.pipe(map(res => this.parseFOS(res)))
|
||||||
.pipe(catchError(this.handleError));
|
.pipe(catchError(this.handleError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getFos(properties: EnvProperties): Observable<any> {
|
||||||
|
let url = "/assets/common-assets/vocabulary/fos.json";
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
}
|
||||||
|
|
||||||
|
getSDGs(properties: EnvProperties): Observable<any> {
|
||||||
|
let url = "/assets/common-assets/vocabulary/sdg.json";
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
}
|
||||||
|
|
||||||
parseSDGs(data: any): AutoCompleteValue[] {
|
parseSDGs(data: any): AutoCompleteValue[] {
|
||||||
var array: AutoCompleteValue[] = []
|
var array: AutoCompleteValue[] = []
|
||||||
|
@ -160,6 +167,7 @@ export class ISVocabulariesService {
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
parse(data: any, vocabularyName: string): AutoCompleteValue[] {
|
parse(data: any, vocabularyName: string): AutoCompleteValue[] {
|
||||||
var array: AutoCompleteValue[] = []
|
var array: AutoCompleteValue[] = []
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
|
|
@ -261,9 +261,9 @@ export class Identifier {
|
||||||
|
|
||||||
export class StringUtils {
|
export class StringUtils {
|
||||||
|
|
||||||
public static urlRegex = 'https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.' +
|
public static urlRegex = 'https?:\\/\\/(?:www(2?)\\.|(?!www(2?)))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www(2?)\\.' +
|
||||||
'[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.' +
|
'[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?:\\/\\/(?:www(2?)\\.|(?!www(2?)))[a-zA-Z0-9]+\\.[^\\s]{2,}|www(2?)\\.' +
|
||||||
'[a-zA-Z0-9]+\.[^\s]{2,}';
|
'[a-zA-Z0-9]+\\.[^\\s]{2,}';
|
||||||
|
|
||||||
public static routeRegex = '^[a-zA-Z0-9\/][a-zA-Z0-9\/-]*$';
|
public static routeRegex = '^[a-zA-Z0-9\/][a-zA-Z0-9\/-]*$';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue