finaly after so much rage it works probaply...

This commit is contained in:
John Balasis 2023-01-23 16:38:09 +00:00
parent b044244685
commit 951ada0cb0
8 changed files with 76 additions and 186 deletions

View File

@ -3,9 +3,9 @@ import { NgModule } from '@angular/core';
import { HomeComponent } from './pages/landing/home/home.component';
import { AuthGuardService } from './services/auth-guard.service';
import { ForbiddenPageComponent } from './shared/reusablecomponents/403-forbidden-page.component';
import { EmptyPageComponent } from "./pages/emptypage/empty-page.component";
import { JoinComponent } from "./pages/join/join.component";
import { AboutComponent } from "./pages/landing/about/about.component";
import { EmptyPageComponent } from './pages/emptypage/empty-page.component';
import { JoinComponent } from './pages/join/join.component';
import { AboutComponent } from './pages/landing/about/about.component';
const appRoutes: Routes = [
{
@ -34,22 +34,13 @@ const appRoutes: Routes = [
{
path: 'repository',
loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
// loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
canActivate: [AuthGuardService]
},
{
path: 'repositoryAdmin',
loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
// loadChildren: () => import('./pages/repository/repository.module').then(m => m.RepositoryModule),
canActivate: [AuthGuardService]
},
// {
// path: 'dashboard',
// component: DashboardComponent,
// canActivate: [AuthGuardService]
// },
{
path: 'sources',
loadChildren: () => import('./pages/sources/sources.module').then(m => m.SourcesModule),
@ -64,11 +55,6 @@ const appRoutes: Routes = [
loadChildren: () => import('./pages/content/content.module').then(m => m.ContentModule),
canActivate: [AuthGuardService]
},
// {
// path: 'getImpact',
// loadChildren: './pages/metrics/metrics.module#MetricsModule',
// canActivate: [AuthGuardService]
// },
{
path: 'admin',
loadChildren: () => import('./pages/adminPg/adminPg.module').then(m => m.AdminPgModule),
@ -77,13 +63,8 @@ const appRoutes: Routes = [
path: '403-forbidden',
component: ForbiddenPageComponent
},
// {
// path: '',
// redirectTo: '/home',
// pathMatch: 'full'
// },
{
//fixme redirect to 404
// fixme redirect to 404
path: '**',
redirectTo: '/403-forbidden',
// component: ForbiddenPageComponent

View File

@ -56,28 +56,31 @@
<form class="" [formGroup]="agreementForm">
<div formArrayName="terms">
<table class="table">
<tr>
Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy.
</tr>
<tr>Thanks for being part of OpenAIRE. Please confirm the acceptance of our datasources policy.</tr>
<br>
<tr>
Being registered in OpenAIRE, you are giving consent to OpenAIRE to download, transform and enrich the metadata records, publishing them in the OpenAIRE Research Graph.
<tr>Being registered in OpenAIRE, you are giving consent to OpenAIRE to download, transform and enrich the
metadata records, publishing them in the OpenAIRE Research Graph.
</tr>
<tbody>
<tr class="el-item" *ngFor="let term of terms.controls; let i=index">
<br> {{term.get('name').value}} <br>
<div [formGroupName]="i">
<label>
<input id="consentTerms" type="checkbox" formControlName="consentTermsOfUse"> Accept the <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
<input id="consentTerms" type="checkbox" formControlName="consentTermsOfUse">
Accept the <a href="https://www.openaire.eu/terms-of-use-for-content-providers" target="_blank">Terms of Use</a>
</label>
<br>
<label>
<input id="consentText" type="checkbox" formControlName="fullTextDownload"> Agree to the <a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">re-use of full texts</a>
<input id="consentText" type="checkbox" formControlName="fullTextDownload">Agree to the
<a href="https://www.openaire.eu/terms-of-use-for-content-providers#consent" target="_blank">
re-use of full texts</a>
</label>
</div>
</tr>
</tbody>
<p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution, the users will access from the original datasource.</p>
<p class="uk-text-meta">Note: OpenAIRE will not provide the full text files for public distribution,
the users will access from the original datasource.
</p>
</table>
</div>
</form>

View File

@ -1,14 +1,12 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import { NavigationEnd, Router, RoutesRecognized } from '@angular/router';
import { AuthenticationService } from './services/authentication.service';
import { environment } from '../environments/environment';
import { MatomoTracker } from 'ngx-matomo';
import { ConfirmationDialogComponent } from './shared/reusablecomponents/confirmation-dialog.component';
import { RepositoryService } from './services/repository.service';
import {RepositorySnippet, TermsOfUse} from './domain/typeScriptClasses';
import {FormBuilder, FormGroup, FormControl, FormArray} from '@angular/forms';
import {element} from 'protractor';
import {timeout, timestamp} from 'rxjs/operators';
import {NavigationEnd, Router} from '@angular/router';
import {AuthenticationService} from './services/authentication.service';
import {environment} from '../environments/environment';
import {MatomoTracker} from 'ngx-matomo';
import {ConfirmationDialogComponent} from './shared/reusablecomponents/confirmation-dialog.component';
import {RepositoryService} from './services/repository.service';
import {RepositorySnippet} from './domain/typeScriptClasses';
import {FormBuilder, FormGroup, FormArray} from '@angular/forms';
@Component({
selector: 'oa-repo-manager',
@ -32,11 +30,8 @@ export class AppComponent implements OnInit {
open: boolean = true;
constructor(private router: Router,
private authService: AuthenticationService,
private matomoTracker: MatomoTracker,
private repositoryService: RepositoryService,
private fb: FormBuilder) {
constructor(private router: Router, private authService: AuthenticationService, private matomoTracker: MatomoTracker,
private repositoryService: RepositoryService, private fb: FormBuilder) {
// console.log('21-06-2019. Fixed matomo to log userIds?');
@ -56,33 +51,6 @@ export class AppComponent implements OnInit {
this.authService.tryLogin();
}
getReposOfUser(): void {
this.repositoryService.getRepositoriesSnippetsOfUser().subscribe(
repos => {
this.reposOfUser = repos;
},
error => {
console.log(error);
},
() => {
// console.log(this.reposOfUser);
this.reposOfUser.forEach(repo => {
if (repo.consentTermsOfUse === null || repo.fullTextDownload === null) {
this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse);
this.isModalShown = true;
}
});
}
);
}
updateTerms() {
this.repositoryService.updateRepositoriesTerms(this.agreementForm.value.terms).subscribe(
res => {},
err => {console.log(err)}
);
}
ngOnInit() {
this.router.events.subscribe((evt) => {
if (!(evt instanceof NavigationEnd)) {
@ -95,12 +63,41 @@ export class AppComponent implements OnInit {
});
this.authService.isLoggedIn.subscribe(
logged => {if(logged){this.getReposOfUser()}},
error => {console.log(error)}
logged => {if (logged) {this.getReposOfUser(); }},
error => {console.log(error); }
);
}
getReposOfUser(): void {
this.repositoryService.getRepositoriesSnippetsOfUser().subscribe(
repos => {
this.reposOfUser = repos;
},
error => {
console.log(error);
},
() => {
// console.log(this.reposOfUser);
if (this.agreementForm.get('terms').value.length === 0) {
this.reposOfUser.forEach(repo => {
if (repo.consentTermsOfUse === null || repo.fullTextDownload === null) {
this.addTerm(repo.officialname, repo.id, repo.consentTermsOfUse);
this.isModalShown = true;
}
});
}
}
);
}
updateTerms() {
this.repositoryService.updateRepositoriesTerms(this.agreementForm.value.terms).subscribe(
res => {},
err => {console.log(err); }
);
}
addTerm(name: string, id: string, consent: boolean) {
this.terms.push(this.newTerm(name, id, consent));
}

View File

@ -246,10 +246,12 @@ export class RegisterNewDatasourceComponent implements OnInit {
concatMap(intrf => {
if (intrf.id) {
// console.log('comments', intrf.comments);
return this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf, intrf.desiredCompatibilityLevel);
return this.repoService.updateInterface(this.repo.id, this.repo.registeredby, intrf.comments, intrf,
intrf.desiredCompatibilityLevel);
} else {
// console.log('comments', intrf.comments);
return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby, intrf.comments, intrf, intrf.desiredCompatibilityLevel);
return this.repoService.addInterface(this.repo.eoscDatasourceType, this.repo.id, this.repo.registeredby,
intrf.comments, intrf, intrf.desiredCompatibilityLevel);
}
})
).subscribe(

View File

@ -25,7 +25,7 @@ export class AuthenticationService {
public isLoggedIn_ = new BehaviorSubject(false);
public get isLoggedIn() {
return this.isLoggedIn_.asObservable();
return this.isLoggedIn_;
}
public loginWithState() {

View File

@ -33,7 +33,8 @@ export class RepositoryService {
constructor(private httpClient: HttpClient) { }
addInterface(datatype: string, repoId: string, registeredBy: string, comment: string, newInterface: RepositoryInterface, desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
addInterface(datatype: string, repoId: string, registeredBy: string, comment: string,
newInterface: RepositoryInterface, desiredCompatibilityLevel: string): Observable<RepositoryInterface> {
let url;
comment = newInterface.comments; // temp fix for emailing comment
if (comment == null || comment === '') {
@ -46,7 +47,8 @@ export class RepositoryService {
return this.httpClient.post<RepositoryInterface>(url, newInterface, headerOptions);
}
updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface, desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
updateInterface(repoId: string, registeredBy: string, comment: string, interfaceInfo: RepositoryInterface,
desiredCompatibilityLevel?: string): Observable<RepositoryInterface> {
let url;
comment = interfaceInfo.comments; // temp fix for emailing comment
if (comment == null || comment === '') {

View File

@ -57,7 +57,6 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
existingCompLevel: string;
classCodes: string[] = [];
compClasses: Map<string, string> = new Map<string, string>();
existingValSet: boolean;
interfaceInfo: InterfaceInformation;
constructor(private fb: FormBuilder,
@ -196,17 +195,8 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
this.successMessage = '';
if (this.formIsValid()) {
const baseurl = this.repoInterfaceForm.get('baseurl').value;
let valset = '';
if (this.existingValSet) {
valset = this.repoInterfaceForm.get('selectValidationSet').value;
}
let desiredCompLvl = '';
if (this.repoInterfaceForm.get('compatibilityLevel').value) {
// this.existingCompLevel = this.compClasses[this.repoInterfaceForm.get('compatibilityLevel').value];
// console.log('this.existingCompLevel is', this.existingCompLevel);
this.currentInterface.desiredCompatibilityLevel = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
desiredCompLvl = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
}
const valset = this.repoInterfaceForm.get('selectValidationSet').value;
const desiredCompLvl = this.repoInterfaceForm.get('desiredCompatibilityLevel').value;
const compLvl = this.existingCompLevel;
let comment = '';
if (this.repoInterfaceForm.get('comment').value) {
@ -231,7 +221,7 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
intrf = new RepositoryInterface();
}
intrf.baseurl = this.repoInterfaceForm.get('baseurl').value;
this.updateValidationSet(intrf, this.repoInterfaceForm.get(this.existingValSet ? 'selectValidationSet' : 'customValidationSet').value);
this.updateValidationSet(intrf, this.repoInterfaceForm.get('selectValidationSet').value);
console.log(intrf);
if (this.repoInterfaceForm.get('compatibilityLevel').value) {
intrf.compatibilityOverride = this.repoInterfaceForm.get('compatibilityLevel').value;
@ -266,7 +256,7 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
this.currentInterface.comments = comment;
if (!this.inRegister) {
this.addInterface(this.currentInterface);
this.addInterface();
} else {
this.successMessage = 'The harvesting settings are valid!';
console.log('SAVED !');
@ -274,14 +264,14 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
}
}
addInterface(newInterface: RepositoryInterface) {
addInterface() {
this.loadingMessage = formSubmitting;
this.repoService.addInterface(this.currentRepo.datasourceType, this.currentRepo.id,
this.currentRepo.registeredBy, this.currentRepo.comments, this.currentInterface,
this.repoInterfaceForm.get('desiredCompatibilityLevel').value).subscribe(
addedInterface => {
console.log(`addInterface responded ${JSON.stringify(addedInterface)}`);
// this.currentInterface = addedInterface;
this.currentInterface = addedInterface;
},
error => {
console.log(error);
@ -307,6 +297,7 @@ export class DatasourceNewInterfaceFormComponent implements OnInit {
this.updateValidationSet(this.currentInterface, valset);
this.currentInterface.baseurl = baseurl;
this.currentInterface.desiredCompatibilityLevel = desiredCompLvl;
console.log(this.currentInterface.desiredCompatibilityLevel);
this.currentInterface.compatibility = compLvl;
this.currentInterface.typology = this.currentRepo.datasourceClass;
this.currentInterface.comments = comment;

View File

@ -36,37 +36,6 @@
<a class="uk-search-input" [routerLink]="['emptyPage']" [routerLinkActive]="['uk-active']">Dashboard</a>
</li>
<!--Sources-->
<!--<ul>-->
<!--<li><a [routerLink]="['sources', 'register']" [routerLinkActive]="['uk-active']">Register</a></li>-->
<!--<li><a [routerLink]="['sources', 'update']" [routerLinkActive]="['uk-active']">Update</a></li>-->
<!--</ul>-->
<!--</li>-->
<!--<li>-->
<!--Compatibility-->
<!--<ul>-->
<!--<li><a [routerLink]="['compatibility', 'validate']" [routerLinkActive]="['uk-active']">Validate</a></li>-->
<!--<li><a [routerLink]="['compatibility', 'browseHistory']" [routerLinkActive]="['uk-active']">Validation History</a></li>-->
<!--<li><a [routerLink]="['compatibility', 'monitor']" [routerLinkActive]="['uk-active']">Collection Monitor</a></li>-->
<!--</ul>-->
<!--</li>-->
<!--<li>-->
<!--Content-->
<!--<ul>-->
<!--<li><a [routerLink]="['content', 'events']" [routerLinkActive]="['uk-active']">Events</a></li>-->
<!--<li><a [routerLink]="['content', 'notifications']" [routerLinkActive]="['uk-active']">Notifications</a></li>-->
<!--</ul>-->
<!--</li>-->
<!--<li>-->
<!--<a class="uk-search-input" [routerLink]="['getImpact']" [routerLinkActive]="['uk-active']">Metrics</a>-->
<!--</li>-->
<!--<li *ngIf="getIsUserAdmin()">-->
<!--Admin-->
<!--<ul>-->
<!--<li><a href="{{adminHomePage}}" target="_blank">Help Texts</a></li>-->
<!--<li><a [routerLink]="['admin', 'metrics']" [routerLinkActive]="['uk-active']">Validate</a></li>s-->
<!--</ul>-->
<!--</li>-->
<li><a (click)="logout()">Logout</a></li>
</ul>
</div>
@ -118,7 +87,7 @@
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<div class="uk-navbar-left">
<a [routerLink]="['landing']" class="uk-logo uk-navbar-item">
<a [routerLink]="['join']" class="uk-logo uk-navbar-item">
<img src="../../../assets/imgs/OA_PROVIDE_B.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
</div>
@ -127,19 +96,13 @@
<ul class="uk-navbar-nav" >
<li class="uk-parent" [routerLinkActive]="['uk-active']">
<a [routerLink]="['home']" [routerLinkActive]="['uk-active']">
Home
</a>
<a [routerLink]="['home']" [routerLinkActive]="['uk-active']">Home</a>
</li>
<li class="uk-parent" [routerLinkActive]="['uk-active']">
<a [routerLink]="['about']" [routerLinkActive]="['uk-active']">
About
</a>
<a [routerLink]="['about']" [routerLinkActive]="['uk-active']">About</a>
</li>
<li *ngIf="getIsUserLoggedIn()" class="uk-parent" [routerLinkActive]="['uk-active']">
<a [routerLink]="['join']" [routerLinkActive]="['uk-active']">
Dashboard
</a>
<a [routerLink]="['join']" [routerLinkActive]="['uk-active']">Dashboard</a>
</li>
<li *ngIf="!getIsUserLoggedIn()" class="uk-parent">
@ -183,55 +146,6 @@
</ul>
<!--<div class="uk-navbar-item">-->
<!--<ul *ngIf="!getIsUserLoggedIn()" class="uk-navbar-nav">-->
<!--<li class="uk-parent">-->
<!--<a class="" (click)="login()">-->
<!--Sign in-->
<!--<span class="uk-margin-small-left uk-icon">-->
<!--<svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg">-->
<!--<circle cx="9.9" cy="6.4" fill="none" r="4.4" stroke="#000" stroke-width="1.1"></circle>-->
<!--<path d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2" fill="none" stroke="#000" stroke-width="1.1"></path>-->
<!--</svg>-->
<!--</span>-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
<!--<ul *ngIf="getIsUserLoggedIn()" class="uk-navbar-nav">-->
<!--<li class="uk-parent">-->
<!--<a class="" aria-expanded="false">-->
<!--{{ getUserName() }}-->
<!--<span class="uk-margin-small-left uk-icon">-->
<!--<svg height="20" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg">-->
<!--<circle cx="9.9" cy="6.4" fill="none" r="4.4" stroke="#000" stroke-width="1.1"></circle>-->
<!--<path d="M1.5,19 C2.3,14.5 5.8,11.2 10,11.2 C14.2,11.2 17.7,14.6 18.5,19.2" fill="none" stroke="#000" stroke-width="1.1"></path>-->
<!--</svg>-->
<!--</span>-->
<!--</a>-->
<!--<div class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 106.55px;"-->
<!--id="userMenu" (click)="onClick('userMenu')">-->
<!--<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">-->
<!--<div class="uk-first-column">-->
<!--<ul class="uk-nav uk-navbar-dropdown-nav">-->
<!--&lt;!&ndash;<ul *ngIf="getIsUserAdmin()" class="uk-nav uk-navbar-dropdown-nav">&ndash;&gt;-->
<!--&lt;!&ndash;<li class="uk-nav-header" style="display: block;">Admin</li>&ndash;&gt;-->
<!--&lt;!&ndash;<li style="display: block"><a href="{{adminHomePage}}" target="_blank">Help Texts</a></li>&ndash;&gt;-->
<!--&lt;!&ndash;<li style="display: block"><a [routerLink]="['/admin/metrics']">Metrics</a></li>&ndash;&gt;-->
<!--&lt;!&ndash;<li style="display: block" class="uk-margin-small-bottom"><a [routerLink]="['/admin/registrations']">Registrations</a></li>&ndash;&gt;-->
<!--&lt;!&ndash;</ul>&ndash;&gt;-->
<!--<li><a class="" (click)="logout()">Log out</a></li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
</div>
</nav>