[Connect | Trunk]: Add verification manager route. Change ckeditor library

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@59272 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-08-14 09:55:06 +00:00
parent e6659bbe1a
commit 9aa9590c26
5 changed files with 63 additions and 12 deletions

View File

@ -29,7 +29,7 @@
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:prerender": "cd dist/browser && http-server",
"serve:ssr": "node dist/server",
"after-build-clean": "rm -rf src node_modules .idea/ installOpenaireLib.sh deploy dist/browser/assets/common-assets/.svn/ dist/browser/stats.json ; "
"after-build-clean": "rm -rf src node_modules .idea/ installOpenaireLib.sh deploy dist/browser/assets/common-assets/.svn/ dist/browser/stats.json ; "
},
"private": true,
"dependencies": {
@ -62,7 +62,7 @@
"wikidata-sdk": "^5.2.9",
"zone.js": "^0.8.26",
"ng-recaptcha": "^3.0.5",
"ng2-ckeditor": "1.1.9"
"ckeditor4-angular": "^1.2.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",

View File

@ -17,6 +17,7 @@ const routes: Routes = [
{ path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'contact-us', loadChildren: './contact/contact.module#ContactModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'verify/:id', loadChildren: './verification-manager/verification-manager.module#VerificationManagerModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
{ path: 'publications', loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},

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 {CKEditorModule} from 'ng2-ckeditor';
import {CKEditorModule} from 'ckeditor4-angular';
import {InviteComponent} from './invite.component';

View File

@ -1,13 +1,13 @@
import { NgModule} from '@angular/core';
import { RouterModule } from '@angular/router';
import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
import {VerificationComponent} from "../openaireLibrary/verification/verification.component";
import {VerificationGuard} from "../openaireLibrary/login/verification.guard";
import {VerificationManagerComponent} from "./verification-manager.component";
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: VerificationComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder]}
{ path: '', component: VerificationManagerComponent, canActivate: [VerificationGuard], canDeactivate: [PreviousRouteRecorder]}
])
]
})

View File

@ -1,9 +1,59 @@
import {Component} from "@angular/core";
import {Component, OnDestroy, OnInit} from "@angular/core";
import {UserRegistryService} from "../openaireLibrary/services/user-registry.service";
import {ActivatedRoute} from "@angular/router";
import {Subscription} from "rxjs";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {properties} from "../../environments/environment";
@Component({
selector: 'verification-manager',
template: `<div>test</div>`
template: `
<div class="uk-section uk-container">
<div class="uk-card uk-card-default uk-card-body">
<div *ngIf="loading" class="loading-gif"></div>
<div *ngIf="!loading && invitation">
<verification [name]="name" [invitation]="invitation"></verification>
</div>
</div>
</div>
`
})
export class VerificationManagerComponent {
export class VerificationManagerComponent implements OnInit, OnDestroy {
private subscriptions: any[] = [];
public loading = true;
public invitation;
public name;
constructor(private userRegistryService: UserRegistryService,
private communityService: CommunityService,
private route: ActivatedRoute) {
}
ngOnInit() {
this.subscriptions.push(this.route.params.subscribe(params => {
if (params && params['id']) {
this.subscriptions.push(this.userRegistryService.getInvitation(params['id']).subscribe(invitation => {
this.invitation = invitation;
this.subscriptions.push(this.communityService.
getCommunityByState(properties, properties.communityAPI + invitation.entity).subscribe(community => {
this.name = community.title;
this.loading = false;
}));
}, error => {
this.loading = false;
console.error(error);
}));
}
}));
}
ngOnDestroy() {
this.subscriptions.forEach(sub => {
if (sub instanceof Subscription) {
sub.unsubscribe();
}
});
}
}