diff --git a/interactiveminingv3.tgz b/interactiveminingv3.tgz index 81de013..b233449 100644 Binary files a/interactiveminingv3.tgz and b/interactiveminingv3.tgz differ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index abeb22a..e0aafe7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,23 +1,18 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HttpModule, JsonpModule } from '@angular/http'; -import { AppComponent } from "./app.component"; -import { routing, appRoutingProviders } from "./app.routing"; -import { DashboardComponent } from "./dashboard.component"; +import { AppComponent } from './app.component'; +import { routing, appRoutingProviders } from './app.routing'; import { TopicsComponent } from "./pages/faq/topics.components"; import { QuestionsComponent } from "./pages/faq/questions.component"; import { FAQService } from "./services/faq.service"; import { ModalModule } from 'ngx-bootstrap'; -//import { CollapseModule } from 'ngx-bootstrap'; -//import { AccordionModule } from 'ngx-bootstrap'; import { TopicsFormComponent } from "./pages/faq/topics-form.component"; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ModalFormComponent } from "./pages/modal-form.component"; import { QuestionsFormComponent } from "./pages/faq/questions-form.component"; import { DeleteConfirmationDialogComponent } from "./pages/delete-confirmation-dialog.component"; -//import { DeleteConfirmationDialogModule } from "./pages/delete-confirmation-dialog.module"; -// import { JWBootstrapSwitchModule } from 'jw-bootstrap-switch-ng2'; import { PagesComponent } from "./pages/page/pages.component"; import { HelpContentService } from "./services/help-content.service"; import { PageFormComponent } from "./pages/page/page-form.component"; @@ -32,12 +27,10 @@ import { EntitiesComponent } from "./pages/entity/entities.component"; import { EntityFormComponent } from "./pages/entity/entity-form.component"; import { DivIdsComponent } from "./pages/divId/divIds.component"; import { DivIdFormComponent } from "./pages/divId/divId-form.component"; -//import { DivIdModule } from './pages/divId/divId.module'; import { DivHelpContentsComponent } from "./pages/divhelpcontent/div-help-contents.component"; import { NewDivHelpContentComponent } from "./pages/divhelpcontent/new-div-help-content.component"; import { DivContentFormComponent } from "./pages/divhelpcontent/div-help-content-form.component"; import { EditDivHelpContentComponent } from "./pages/divhelpcontent/edit-div-help-content.component"; -//import { DivHelpContentsModule } from './pages/divhelpcontent/divhelpcontent.module'; import { HtmlPageContentModule } from "./pages/htmlpagecontent/htmlpagecontent.module"; @@ -59,29 +52,24 @@ import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard'; import { ConnectAdminLoginGuard} from './openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver'; import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; -import{ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module'; -import {StatsComponent} from "./pages/stats/stats.component"; -//, , ErrorModule CookieLawModule +import {ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module'; +import {StatsComponent} from './pages/stats/stats.component'; import { DataTablesModule } from 'angular-datatables'; import { CommunityProjectsModule } from './pages/community/projects/communityProjects.module'; import { CommunityContentProvidersModule } from './pages/community/content-providers/communityContentProviders.module'; -import {InteractiveMiningModule} from 'interactiveminingv3'; -import {MiningComponent} from './pages/mining/mining.component'; -import {CommunitiesService} from "./openaireLibrary/connect/communities/communities.service"; -import{CommunityErrorPageComponent} from './openaireLibrary/connect/communityGuard/communityErrorPage.component'; +import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; +import {CommunityErrorPageComponent} from './openaireLibrary/connect/communityGuard/communityErrorPage.component'; import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity.guard'; import {AdminErrorPageComponent} from './pages/error/errorPage.component'; import {ErrorModule} from './openaireLibrary/error/error.module'; -import {CommonModule, TitleCasePipe} from '@angular/common'; -import {WellcomeComponent} from './pages/wellcome/wellcome.component'; +import {TitleCasePipe} from '@angular/common'; import {AlertModalModule} from './openaireLibrary/utils/modal/alertModal.module'; import {FABModule} from './utils/fabModule.module'; import {SafeHtmlPipeModule} from './openaireLibrary/utils/pipes/safeHTMLPipe.module'; - -import {ManageUserNotificationsModule} from './pages/usernotifications/manage-user-notifications.module'; +import {InteractiveMiningModule} from 'interactiveminingv3'; @NgModule({ imports: [ @@ -90,11 +78,8 @@ import {ManageUserNotificationsModule} from './pages/usernotifications/manage-us HttpModule, JsonpModule, ModalModule.forRoot(), - //CollapseModule.forRoot(), - //AccordionModule.forRoot(), FormsModule, ReactiveFormsModule, - // JWBootstrapSwitchModule, CKEditorModule, BottomModule, FeedbackModule, NavigationBarModule, CookieLawModule, ClaimsAdminModule, CommunityProjectsModule, @@ -104,20 +89,13 @@ import {ManageUserNotificationsModule} from './pages/usernotifications/manage-us ManageSubscribersModule, SubjectsEditFormModule, DataTablesModule, - InteractiveMiningModule, ErrorModule, AlertModalModule, SafeHtmlPipeModule, FABModule, - HtmlPageContentModule, - // DivIdModule, - // DivHelpContentsModule - //DeleteConfirmationDialogModule - // , CookieLawModule, ErrorModule - ManageUserNotificationsModule + InteractiveMiningModule, ], declarations: [ AppComponent, - DashboardComponent, TopicsComponent, QuestionsComponent, TopicsFormComponent, @@ -142,17 +120,15 @@ import {ManageUserNotificationsModule} from './pages/usernotifications/manage-us DivContentFormComponent, ClaimsComponent, StatsComponent, - MiningComponent, CommunityErrorPageComponent, - AdminErrorPageComponent, - WellcomeComponent + AdminErrorPageComponent ], providers: [ FAQService, HelpContentService, appRoutingProviders, - FreeGuard, AdminLoginGuard,ConnectAdminLoginGuard,LoginGuard, - EnvironmentSpecificResolver,EnvironmentSpecificService, + FreeGuard, AdminLoginGuard, ConnectAdminLoginGuard, LoginGuard, + EnvironmentSpecificResolver, EnvironmentSpecificService, IsCommunity, CommunitiesService, TitleCasePipe ], diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts index 867cb50..ccab572 100644 --- a/src/app/app.routing.ts +++ b/src/app/app.routing.ts @@ -1,10 +1,8 @@ /** * Created by stefania on 9/16/16. */ -import { ModuleWithProviders } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; - -import { DashboardComponent } from "./dashboard.component"; +import { ModuleWithProviders } from '@angular/core'; +import { Routes, RouterModule} from '@angular/router'; import { CommunitiesComponent } from './pages/community/communities.component'; import { ZenodoCommunitiesComponent } from "./pages/zenodo-communities/zenodo-communities.component"; import { ManageSubscribersComponent } from "./pages/subscribers/manage-subscribers.component"; @@ -24,43 +22,32 @@ import {ClaimsComponent} from './pages/claims/claims.component'; import {FreeGuard} from './openaireLibrary/login/freeGuard.guard'; import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity.guard'; import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard'; -import { LoginGuard} from './openaireLibrary/login/loginGuard.guard'; import { ConnectAdminLoginGuard} from './openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver'; -import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; -import{ClaimsAdminComponent} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.component'; -import {StatsComponent} from "./pages/stats/stats.component"; -import {MiningComponent} from './pages/mining/mining.component'; +import {StatsComponent} from './pages/stats/stats.component'; import{CommunityErrorPageComponent} from './openaireLibrary/connect/communityGuard/communityErrorPage.component'; import {AdminErrorPageComponent} from './pages/error/errorPage.component'; import { ManageProjectsComponent } from './pages/community/projects/manage-projects.component'; import { ManageContentProvidersComponent } from './pages/community/content-providers/manage-content-providers.component'; -import {WellcomeComponent} from './pages/wellcome/wellcome.component'; -import {ManageUserNotificationsComponent} from './pages/usernotifications/manage-user-notifications.component'; - -//TODO replace IsCommunity with ConnectAdminLoginGuard -//, IsCommunity const appRoutes: Routes = [ { - path: '', - component: WellcomeComponent, - canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver } - // redirectTo: 'dashboard', - // pathMatch: 'full' + path: '', loadChildren: './pages/wellcome/wellcome.module#WellcomeModule', resolve: { envSpecific: EnvironmentSpecificResolver } }, { path: 'dashboard', - component: DashboardComponent, - canActivate: [IsCommunity, ConnectAdminLoginGuard],resolve: { envSpecific: EnvironmentSpecificResolver } + loadChildren: './pages/dashboard/dashboard.module#DashboardModule', + canLoad: [IsCommunity, ConnectAdminLoginGuard], + resolve: {envSpecific: EnvironmentSpecificResolver} }, { path: 'manage-user-notifications', - component: ManageUserNotificationsComponent, - canActivate: [IsCommunity, ConnectAdminLoginGuard], resolve: {envSpecific: EnvironmentSpecificResolver} + loadChildren: './pages/usernotifications/manage-user-notifications.module#ManageUserNotificationsModule', + canLoad: [IsCommunity, ConnectAdminLoginGuard], + resolve: {envSpecific: EnvironmentSpecificResolver} }, { path: 'communities', @@ -159,13 +146,13 @@ const appRoutes: Routes = [ }, { path: 'mining', - component: MiningComponent,canActivate: [IsCommunity,ConnectAdminLoginGuard] + loadChildren: './pages/mining/mining.module#MiningModule' }, { path: 'errorcommunity', component: CommunityErrorPageComponent,canActivate: [FreeGuard] }, - { path: '**',pathMatch: 'full',component: AdminErrorPageComponent } + { path: '**', pathMatch: 'full', component: AdminErrorPageComponent } ]; // @NgModule({ diff --git a/src/app/domain/active-topic-questions.ts b/src/app/domain/active-topic-questions.ts index eeee101..ace518e 100644 --- a/src/app/domain/active-topic-questions.ts +++ b/src/app/domain/active-topic-questions.ts @@ -1,10 +1,10 @@ /** * Created by stefania on 4/26/17. */ -import { Topic } from "./topic"; -import { Question } from "./question"; +import { Topic } from './topic'; +import { Question } from './question'; export interface ActiveTopicQuestions { topic: Topic; questionList: Question[]; -} \ No newline at end of file +} diff --git a/src/app/domain/community.ts b/src/app/domain/community.ts index 40467d9..9dd3177 100644 --- a/src/app/domain/community.ts +++ b/src/app/domain/community.ts @@ -10,6 +10,6 @@ export interface Community { } export interface CheckCommunity { - community : Community; - checked : boolean; + community: Community; + checked: boolean; } diff --git a/src/app/domain/div-help-content.ts b/src/app/domain/div-help-content.ts index 6864670..ed948a1 100644 --- a/src/app/domain/div-help-content.ts +++ b/src/app/domain/div-help-content.ts @@ -1,4 +1,4 @@ -import { DivId } from "./divId"; +import { DivId } from './divId'; import {Community} from './community'; export interface DivHelpContent { diff --git a/src/app/domain/divId.ts b/src/app/domain/divId.ts index 6368f82..5ab351d 100644 --- a/src/app/domain/divId.ts +++ b/src/app/domain/divId.ts @@ -7,6 +7,6 @@ export interface DivId { } export interface CheckDivId { - divId : DivId; - checked : boolean; + divId: DivId; + checked: boolean; } diff --git a/src/app/domain/entity.ts b/src/app/domain/entity.ts index 9b48e43..a3e34e7 100644 --- a/src/app/domain/entity.ts +++ b/src/app/domain/entity.ts @@ -2,10 +2,10 @@ export class Entity { _id: string; pid: string; name: string; - isEnabled :boolean; + isEnabled: boolean; } export interface CheckEntity { - entity : Entity; - checked : boolean; + entity: Entity; + checked: boolean; } diff --git a/src/app/domain/html-page-content.ts b/src/app/domain/html-page-content.ts index 34442db..4064356 100644 --- a/src/app/domain/html-page-content.ts +++ b/src/app/domain/html-page-content.ts @@ -9,6 +9,6 @@ export interface HtmlPageContent { } export interface CheckHtmlPageContent { - pageHelpContent : HtmlPageContent; - checked : boolean; + pageHelpContent: HtmlPageContent; + checked: boolean; } diff --git a/src/app/domain/page-help-content.ts b/src/app/domain/page-help-content.ts index d9c580f..8fe047b 100644 --- a/src/app/domain/page-help-content.ts +++ b/src/app/domain/page-help-content.ts @@ -1,14 +1,14 @@ /** * Created by stefania on 7/13/17. */ -import { Page } from "./page"; -import { Community } from "./community"; +import { Page } from './page'; +import { Community } from './community'; export interface PageHelpContent { _id: string; page: Page | string; community: Community | string; - placement : string; + placement: string; order: number; content: string; isActive: boolean; @@ -16,12 +16,12 @@ export interface PageHelpContent { } export interface CheckPageHelpContent { - pageHelpContent : PageHelpContent; - checked : boolean; + pageHelpContent: PageHelpContent; + checked: boolean; } export interface PageHelpContentFilterOptions { - id : string; - active : Boolean; - text : RegExp; + id: string; + active: Boolean; + text: RegExp; } diff --git a/src/app/domain/page.ts b/src/app/domain/page.ts index b428a9a..96f9eb3 100644 --- a/src/app/domain/page.ts +++ b/src/app/domain/page.ts @@ -5,13 +5,13 @@ export interface Page { route: string; name: string; type: string; - isEnabled :boolean; - connect :boolean; - openaire :boolean; + isEnabled: boolean; + connect: boolean; + openaire: boolean; entities: Entity[] | string[]; } export interface CheckPage { - page : Page; - checked : boolean; + page: Page; + checked: boolean; } diff --git a/src/app/domain/question.ts b/src/app/domain/question.ts index c4985ad..7476aab 100644 --- a/src/app/domain/question.ts +++ b/src/app/domain/question.ts @@ -1,13 +1,13 @@ /** * Created by stefania on 4/26/17. */ -import { Topic } from "./topic"; +import { Topic } from './topic'; export interface Question { _id: string; question: string; answer: string; - date : Date; + date: Date; isActive: boolean; weight: number; hitCount: number; @@ -15,12 +15,12 @@ export interface Question { } export interface CheckQuestion { - question : Question; - checked : boolean; + question: Question; + checked: boolean; } export interface QuestionFilterOptions { - id : string; - active : Boolean; - text : RegExp; -} \ No newline at end of file + id: string; + active: Boolean; + text: RegExp; +} diff --git a/src/app/domain/topic.ts b/src/app/domain/topic.ts index b876a1a..d290656 100644 --- a/src/app/domain/topic.ts +++ b/src/app/domain/topic.ts @@ -5,12 +5,12 @@ export interface Topic { _id: string; name: string; description: string; - date : Date; + date: Date; weight: number; questionOrder: string; } export interface CheckTopic { - topic : Topic; - checked : boolean; -} \ No newline at end of file + topic: Topic; + checked: boolean; +} diff --git a/src/app/login/libUser.module.ts b/src/app/login/libUser.module.ts index e343869..4aa62c7 100644 --- a/src/app/login/libUser.module.ts +++ b/src/app/login/libUser.module.ts @@ -1,6 +1,6 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; import {ConnectUserComponent } from './user.component'; import { UserRoutingModule } from './user-routing.module'; @@ -12,9 +12,8 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRout imports: [ CommonModule, FormsModule, UserRoutingModule, UserModule - ], - providers:[PreviousRouteRecorder], + providers: [PreviousRouteRecorder], declarations: [ConnectUserComponent] }) export class LibUserModule { } diff --git a/src/app/login/user.component.ts b/src/app/login/user.component.ts index 7fab498..5385aa6 100644 --- a/src/app/login/user.component.ts +++ b/src/app/login/user.component.ts @@ -1,5 +1,4 @@ -import {Component, ElementRef} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; +import {Component} from '@angular/core'; @Component({ selector: 'openaire-user', diff --git a/src/app/pages/dashboard/dashboard-routing.module.ts b/src/app/pages/dashboard/dashboard-routing.module.ts new file mode 100644 index 0000000..c65b50b --- /dev/null +++ b/src/app/pages/dashboard/dashboard-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {DashboardComponent} from './dashboard.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: DashboardComponent} + ]) + ] +}) +export class DashboardRoutingModule { } diff --git a/src/app/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html similarity index 100% rename from src/app/dashboard.component.html rename to src/app/pages/dashboard/dashboard.component.html diff --git a/src/app/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts similarity index 61% rename from src/app/dashboard.component.ts rename to src/app/pages/dashboard/dashboard.component.ts index 127f242..49cc017 100644 --- a/src/app/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -2,31 +2,29 @@ * Created by stefania on 3/21/16. */ -import { Component, ElementRef } from '@angular/core'; +import {Component, ElementRef, OnInit} from '@angular/core'; import {ActivatedRoute} from '@angular/router'; -import {CommunityService} from "./openaireLibrary/connect/community/community.service"; -import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; +import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; +import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; @Component({ selector: 'dashboard', templateUrl: 'dashboard.component.html', }) - -export class DashboardComponent { - communityId:string= null; +export class DashboardComponent implements OnInit { + communityId: string = null; communityType = null; - properties:EnvProperties; + properties: EnvProperties; - constructor( private element: ElementRef, private route: ActivatedRoute, private _communityService:CommunityService) {} + constructor( private element: ElementRef, private route: ActivatedRoute, private _communityService: CommunityService) {} ngOnInit() { this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { this.properties = data.envSpecific; this.route.queryParams.subscribe(data => { this.scroll(); - - this.communityId = ((data['communityId'])?data['communityId']:data['community']); - this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe ( + this.communityId = ((data['communityId']) ? data['communityId'] : data['community']); + this._communityService.getCommunity(this.properties, this.properties.communityAPI + this.communityId).subscribe ( community => { this.communityType = community.type; }, diff --git a/src/app/pages/dashboard/dashboard.module.ts b/src/app/pages/dashboard/dashboard.module.ts new file mode 100644 index 0000000..1708adf --- /dev/null +++ b/src/app/pages/dashboard/dashboard.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import {DashboardRoutingModule} from './dashboard-routing.module'; +import {RouterModule} from '@angular/router'; +import {DashboardComponent} from './dashboard.component'; +import {CommonModule} from '@angular/common'; + +@NgModule({ + imports: [ + CommonModule, DashboardRoutingModule, RouterModule + ], + declarations: [DashboardComponent], + exports: [DashboardComponent] +}) +export class DashboardModule { } diff --git a/src/app/pages/mining/mining.component.ts b/src/app/pages/mining/mining.component.ts deleted file mode 100644 index 52fdb0f..0000000 --- a/src/app/pages/mining/mining.component.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {Component, OnInit} from "@angular/core"; - -@Component({ - selector: 'mining', - template: ` -

import mining here

-` -}) - -export class MiningComponent { - -} diff --git a/src/app/pages/mining/mining.module.ts b/src/app/pages/mining/mining.module.ts new file mode 100644 index 0000000..15e7266 --- /dev/null +++ b/src/app/pages/mining/mining.module.ts @@ -0,0 +1,9 @@ +import { NgModule } from '@angular/core'; +import { InteractiveMiningModule, InteractiveMiningRoutingModule} from 'interactiveminingv3'; +@NgModule({ + imports: [ + InteractiveMiningModule, + InteractiveMiningRoutingModule + ] +}) +export class MiningModule { } diff --git a/src/app/pages/usernotifications/manage-user-notifications-routing.module.ts b/src/app/pages/usernotifications/manage-user-notifications-routing.module.ts new file mode 100644 index 0000000..22e6eb5 --- /dev/null +++ b/src/app/pages/usernotifications/manage-user-notifications-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {ManageUserNotificationsComponent} from './manage-user-notifications.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: ManageUserNotificationsComponent} + ]) + ] +}) +export class ManageUserNotificationsRoutingModule { } diff --git a/src/app/pages/usernotifications/manage-user-notifications.component.html b/src/app/pages/usernotifications/manage-user-notifications.component.html index 3dbd4a0..b121222 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.component.html +++ b/src/app/pages/usernotifications/manage-user-notifications.component.html @@ -92,5 +92,5 @@
- +
diff --git a/src/app/pages/usernotifications/manage-user-notifications.component.ts b/src/app/pages/usernotifications/manage-user-notifications.component.ts index 7f09269..09baddc 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.component.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.component.ts @@ -1,7 +1,6 @@ import {Component, OnInit, Input, ViewChild, ElementRef} from '@angular/core'; import {FormGroup, FormBuilder} from '@angular/forms'; import {ActivatedRoute, Router} from '@angular/router'; -import {CommonModule} from "@angular/common"; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; @@ -30,16 +29,16 @@ export class ManageUserNotificationsComponent implements OnInit { public initialUserNotifications = null; public userEmail = null; - public showLoading: boolean = true; - public errorMessage: string = ''; - public updateErrorMessage: string = ''; + public showLoading = true; + public errorMessage = ''; + public updateErrorMessage = ''; - public successfulSaveMessage: string = ''; - public successfulResetMessage: string = ''; + public successfulSaveMessage = ''; + public successfulResetMessage = ''; - public hasChanged: boolean = false; + public hasChanged = false; - @ViewChild (MailPrefsComponent) mailPrefs : MailPrefsComponent; + @ViewChild (MailPrefsComponent) mailPrefs: MailPrefsComponent; constructor (private route: ActivatedRoute, private _router: Router, public _fb: FormBuilder, private _manageUserNotificationsService: ManageUserNotificationsService, private element: ElementRef) { @@ -53,34 +52,35 @@ export class ManageUserNotificationsComponent implements OnInit { this.scroll(); this.communityId = communityId['communityId']; - if (this.communityId != null && this.communityId != '') { + if (this.communityId != null && this.communityId !== '') { this.showLoading = true; - this.updateErrorMessage = ""; - this.errorMessage = ""; - this.successfulSaveMessage = ""; + this.updateErrorMessage = ''; + this.errorMessage = ''; + this.successfulSaveMessage = ''; if (Session.getUser()) { this.userEmail = Session.getUserEmail(); - - this._manageUserNotificationsService.getUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", this.userEmail).subscribe( + this._manageUserNotificationsService.getUserNotifications( + this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications', this.userEmail). + subscribe( userNotifications => { this.initialUserNotifications = userNotifications; - - if (this.initialUserNotifications['notifyForNewManagers'] == null || this.initialUserNotifications['notifyForNewSubscribers'] == null) { + if (this.initialUserNotifications['notifyForNewManagers'] == null || + this.initialUserNotifications['notifyForNewSubscribers'] == null) { this.initialUserNotifications = this.initiateUserNotifications(); } this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); - //TODO remove after final testing + // TODO remove after final testing this.showLoading = false; }, error => { - if (error.status == '404') { + if (error.status === '404') { this.initialUserNotifications = this.initiateUserNotifications(); this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); } else { - this.handleError('System error retrieving user notifications', error) + this.handleError('System error retrieving user notifications', error); } this.showLoading = false; } @@ -92,8 +92,8 @@ export class ManageUserNotificationsComponent implements OnInit { }); } - public initiateUserNotifications() : UserNotificationsRights { - var notificationRights: UserNotificationsRights = new UserNotificationsRights(); + public initiateUserNotifications(): UserNotificationsRights { + const notificationRights: UserNotificationsRights = new UserNotificationsRights(); notificationRights['notifyForNewManagers'] = true; notificationRights['notifyForNewSubscribers'] = true; @@ -103,97 +103,80 @@ export class ManageUserNotificationsComponent implements OnInit { } public updateUserNotifications() { - if(!Session.isLoggedIn()){ - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + if (!Session.isLoggedIn()) { + this._router.navigate(['/user-info'], + { queryParams: { 'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); } else { - if (this.communityId != null && this.communityId != '') { - this.mailPrefs.saveNotification(0); + if (this.communityId != null && this.communityId !== '') { + this.mailPrefs.saveNotification(0); - this.successfulSaveMessage = ""; - this.showLoading = true; - var userNotifications = this.parseUpdatedUserNotifications(); - - this._manageUserNotificationsService.updateUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", userNotifications).subscribe( - userNotifications => { - this.initialUserNotifications = JSON.parse(JSON.stringify( this.userNotifications )); - this.handleSuccessfulSave('Notification settings saved!') - }, - error => this.handleUpdateError('System error updating user notifications', error) - ); - } - this.resetChange(); + this.successfulSaveMessage = ''; + this.showLoading = true; + const userNotifications = this.parseUpdatedUserNotifications(); + this._manageUserNotificationsService.updateUserNotifications( + this.properties.adminToolsAPIURL + 'community/' + this.communityId + '/notifications', + userNotifications).subscribe( + userNotifications => { + this.initialUserNotifications = JSON.parse(JSON.stringify( this.userNotifications )); + this.handleSuccessfulSave('Notification settings saved!'); + }, + error => this.handleUpdateError('System error updating user notifications', error) + ); + } + this.resetChange(); } } - private parseUpdatedUserNotifications() : {} { - var userNotifications = {}; + private parseUpdatedUserNotifications(): {} { + const userNotifications = {}; - userNotifications["notifyForNewManagers"] = this.userNotifications.notifyForNewManagers; - userNotifications["notifyForNewSubscribers"] = this.userNotifications.notifyForNewSubscribers; + userNotifications['notifyForNewManagers'] = this.userNotifications.notifyForNewManagers; + userNotifications['notifyForNewSubscribers'] = this.userNotifications.notifyForNewSubscribers; if (this.userNotifications.managerEmail) { - userNotifications["managerEmail"] = this.userNotifications.managerEmail; + userNotifications['managerEmail'] = this.userNotifications.managerEmail; } else { if (Session.getUser()) { - userNotifications["managerEmail"] = Session.getUserEmail(); + userNotifications['managerEmail'] = Session.getUserEmail(); } } return userNotifications; } - public resetForm(communityId:string) { - /* - if (communityId != null && communityId != '') { - this.showLoading = true; - this.updateErrorMessage = ""; - this.errorMessage = ""; - - this.mailPrefs.restoreNotification(0); - - this._manageUserNotificationsService.getUserNotifications(this.properties.adminToolsAPIURL + "community/" + this.communityId + "/notifications", this.userEmail).subscribe( - userNotifications => { - this.userNotifications = userNotifications; - this.showLoading = false; - console.log(userNotifications); - }, - error => this.handleError('System error retrieving user notifications', error) - ); - } - - */ - if(!Session.isLoggedIn()){ - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); + public resetForm() { + if (!Session.isLoggedIn()) { + this._router.navigate(['/user-info'], { + queryParams: { 'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); } else { - this.mailPrefs.restoreNotification(0); - - if(this.userNotifications && this.initialUserNotifications) { - this.successfulSaveMessage = ""; - this.showLoading = true; - this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); - this.showLoading = false; - } - - - this.resetChange(); + this.mailPrefs.restoreNotification(0); + if (this.userNotifications && this.initialUserNotifications) { + this.successfulSaveMessage = ''; + this.showLoading = true; + this.userNotifications = JSON.parse(JSON.stringify( this.initialUserNotifications )); + this.showLoading = false; + } + this.resetChange(); } } - public changeValueForNewManagers(notifyForManagers : any) { - if(!Session.isLoggedIn()){ - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } else { - this.userNotifications.notifyForNewManagers = !notifyForManagers; - this.change(); - } + public changeValueForNewManagers(notifyForManagers: any) { + if (!Session.isLoggedIn()) { + this._router.navigate(['/user-info'], { + queryParams: {' "errorCode"': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); + } else { + this.userNotifications.notifyForNewManagers = !notifyForManagers; + this.change(); + } } - public changeValueForNewSubscribers(notifyForSubscribers : any) { - if(!Session.isLoggedIn()){ - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } else { - this.userNotifications.notifyForNewSubscribers = !notifyForSubscribers; - this.change(); - } + public changeValueForNewSubscribers(notifyForSubscribers: any) { + if (!Session.isLoggedIn()) { + this._router.navigate(['/user-info'], { + queryParams: { 'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); + } else { + this.userNotifications.notifyForNewSubscribers = !notifyForSubscribers; + this.change(); + } } private change() { @@ -207,16 +190,17 @@ export class ManageUserNotificationsComponent implements OnInit { } public mailPrefsChanged(): boolean { - if(!Session.isLoggedIn()){ - this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); - } else { - return this.mailPrefs.prefsChanged["0"];//(0); - } + if (!Session.isLoggedIn()) { + this._router.navigate(['/user-info'], { + queryParams: { 'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} }); + } else { + return this.mailPrefs.prefsChanged['0']; + } } handleUpdateError(message: string, error) { this.updateErrorMessage = message; - console.log('Server responded: ' +error); + console.log('Server responded: ' + error); this.showLoading = false; } @@ -239,8 +223,8 @@ export class ManageUserNotificationsComponent implements OnInit { } public scroll() { - if (typeof document !== 'undefined') { - this.element.nativeElement.scrollIntoView(); - } + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } } } diff --git a/src/app/pages/usernotifications/manage-user-notifications.module.ts b/src/app/pages/usernotifications/manage-user-notifications.module.ts index c94979b..fe66652 100644 --- a/src/app/pages/usernotifications/manage-user-notifications.module.ts +++ b/src/app/pages/usernotifications/manage-user-notifications.module.ts @@ -5,21 +5,22 @@ import {FormsModule} from '@angular/forms'; import {ManageUserNotificationsComponent} from './manage-user-notifications.component'; import {ManageUserNotificationsService} from './manage-user-notifications.service'; -import { MailPrefsModule } from '../../openaireLibrary/connect/userEmailPreferences/mailsPrefs.module'; +import {MailPrefsModule} from '../../openaireLibrary/connect/userEmailPreferences/mailsPrefs.module'; +import {ManageUserNotificationsRoutingModule} from './manage-user-notifications-routing.module'; @NgModule({ imports: [ - RouterModule, CommonModule, FormsModule, MailPrefsModule + ManageUserNotificationsRoutingModule, RouterModule, CommonModule, FormsModule, MailPrefsModule ], declarations: [ ManageUserNotificationsComponent - ], + ], providers: [ ManageUserNotificationsService - ], + ], exports: [ ManageUserNotificationsComponent - ] + ] }) export class ManageUserNotificationsModule { diff --git a/src/app/pages/usernotifications/userNotificationsRights.ts b/src/app/pages/usernotifications/userNotificationsRights.ts index ba4493d..15328b0 100644 --- a/src/app/pages/usernotifications/userNotificationsRights.ts +++ b/src/app/pages/usernotifications/userNotificationsRights.ts @@ -1,5 +1,5 @@ export class UserNotificationsRights { - notifyForNewManagers:boolean; - notifyForNewSubscribers:boolean; - managerEmail:string; + notifyForNewManagers: boolean; + notifyForNewSubscribers: boolean; + managerEmail: string; } diff --git a/src/app/pages/wellcome/wellcome-routing.module.ts b/src/app/pages/wellcome/wellcome-routing.module.ts new file mode 100644 index 0000000..a5ddec9 --- /dev/null +++ b/src/app/pages/wellcome/wellcome-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {WellcomeComponent} from './wellcome.component'; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: WellcomeComponent} + ]) + ] +}) +export class WellcomeRoutingModule { } diff --git a/src/app/pages/wellcome/wellcome.module.ts b/src/app/pages/wellcome/wellcome.module.ts new file mode 100644 index 0000000..3a30296 --- /dev/null +++ b/src/app/pages/wellcome/wellcome.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import {WellcomeComponent} from './wellcome.component'; +import {WellcomeRoutingModule} from './wellcome-routing.module'; +import {RouterModule} from '@angular/router'; + +@NgModule({ + imports: [ + WellcomeRoutingModule, RouterModule + ], + declarations: [WellcomeComponent], + exports: [WellcomeComponent] +}) +export class WellcomeModule { } diff --git a/src/app/reload/libReload.module.ts b/src/app/reload/libReload.module.ts index d982aaa..0bc5699 100644 --- a/src/app/reload/libReload.module.ts +++ b/src/app/reload/libReload.module.ts @@ -1,23 +1,14 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; - import{ReloadModule} from '../openaireLibrary/reload/reload.module'; +import { ReloadModule } from '../openaireLibrary/reload/reload.module'; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ReloadModule - ], - declarations: [ - - ], - providers:[ - - ], - exports: [ - - ] + ] }) export class LibReloadModule { }