From 2909a9e421c5e1701cbe07dfefe0ee87da134351 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 8 Oct 2019 10:55:14 +0000 Subject: [PATCH] [Admin]: Delete old community layout. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@57306 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../layout/community-layout-routing.module.ts | 14 -- .../layout/community-layout.component.html | 39 ----- .../layout/community-layout.component.ts | 141 ------------------ .../layout/community-layout.module.ts | 28 ---- 4 files changed, 222 deletions(-) delete mode 100644 src/app/pages/community/layout/community-layout-routing.module.ts delete mode 100644 src/app/pages/community/layout/community-layout.component.html delete mode 100644 src/app/pages/community/layout/community-layout.component.ts delete mode 100644 src/app/pages/community/layout/community-layout.module.ts diff --git a/src/app/pages/community/layout/community-layout-routing.module.ts b/src/app/pages/community/layout/community-layout-routing.module.ts deleted file mode 100644 index f3fc3c7..0000000 --- a/src/app/pages/community/layout/community-layout-routing.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import {RouterModule} from '@angular/router'; -import {CommunityLayoutComponent} from './community-layout.component'; -import {IsCommunity} from '../../../openaireLibrary/connect/communityGuard/isCommunity.guard'; -import {ConnectAdminLoginGuard} from '../../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: CommunityLayoutComponent} - ]) - ] -}) -export class CommunityLayoutRoutingModule { } diff --git a/src/app/pages/community/layout/community-layout.component.html b/src/app/pages/community/layout/community-layout.component.html deleted file mode 100644 index 3f0faa2..0000000 --- a/src/app/pages/community/layout/community-layout.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
-
Edit community layout
-
- - - - - - - - - -
Color: - - Change your community color
- - - - - - - - - - - -
-
- - - - -
-
-
-
diff --git a/src/app/pages/community/layout/community-layout.component.ts b/src/app/pages/community/layout/community-layout.component.ts deleted file mode 100644 index 8032a28..0000000 --- a/src/app/pages/community/layout/community-layout.component.ts +++ /dev/null @@ -1,141 +0,0 @@ -import {Component, OnInit, ElementRef} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; - - -import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; -import {LayoutService} from '../../../openaireLibrary/services/layout.service'; -import {Session} from '../../../openaireLibrary/login/utils/helper.class'; -import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; -import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class"; - -@Component({ - selector: 'community-layout', - templateUrl: './community-layout.component.html', -}) - -export class CommunityLayoutComponent implements OnInit { - - public showLoading = true; - public errorMessage = ''; - - public successfulSaveMessage = ''; - public successfulResetMessage = ''; - - public hasChanged = false; - public communityId = null; - public layout = null; - public properties: EnvProperties = null; - - constructor (private element: ElementRef, - private route: ActivatedRoute, - private _layoutService: LayoutService, - private _router: Router) { } - - - ngOnInit() { - this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { - this.properties = data.envSpecific; - this.route.queryParams.subscribe( - communityId => { - HelperFunctions.scroll(); - this.communityId = communityId['communityId']; - if (this.communityId != null && this.communityId !== '') { - this.showLoading = true; - this.errorMessage = ''; - this._layoutService.getLayout(this.communityId, - this.properties.adminToolsAPIURL).subscribe ( - layout => { - this.layout = layout; - this.showLoading = false; - }, - error => this.handleError('System error retrieving community layout', error) - ); - } - }); - }); - } - - public updateLayout() { - 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.showLoading = true; - this._layoutService.saveLayout(this.communityId, - this.properties.adminToolsAPIURL, this.layout).subscribe ( - layout => { - this.layout = layout; - this.showLoading = false; - this.handleSuccessfulSave('Community Layout saved!'); - }, - error => this.handleError('System error saving community layout', error) - ); - this.resetChange(); - } - } - - public resetLayout() { - 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.showLoading = true; - this._layoutService.getLayout(this.communityId, - this.properties.adminToolsAPIURL).subscribe ( - layout => { - this.layout = layout; - this.showLoading = false; - this.handleSuccessfulReset('Community Layout reset!'); - }, - error => this.handleError('System error retrieving community layout', error) - ); - this.resetChange(); - } - } - - public loadDefaultLayout() { - 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.showLoading = true; - this._layoutService.loadDefaultLayout(this.communityId, - this.properties.adminToolsAPIURL).subscribe ( - layout => { - this.layout = layout; - this.showLoading = false; - this.handleSuccessfulReset('Default Community Layout has been loaded!'); - }, - error => this.handleError('System error loading default community layout', error) - ); - this.resetChange(); - } - } - - private change() { - this.hasChanged = true; - this.successfulSaveMessage = ''; - this.successfulResetMessage = ''; - } - - private resetChange() { - this.hasChanged = false; - } - - handleError(message: string, error) { - this.errorMessage = message; - console.log('Server responded: ' + error); - - this.showLoading = false; - } - - handleSuccessfulSave(message) { - this.showLoading = false; - this.successfulSaveMessage = message; - } - - handleSuccessfulReset(message) { - this.showLoading = false; - this.successfulResetMessage = message; - } -} diff --git a/src/app/pages/community/layout/community-layout.module.ts b/src/app/pages/community/layout/community-layout.module.ts deleted file mode 100644 index a2a26e5..0000000 --- a/src/app/pages/community/layout/community-layout.module.ts +++ /dev/null @@ -1,28 +0,0 @@ -import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; -import {RouterModule} from '@angular/router'; - -import {CommunityLayoutComponent} from './community-layout.component'; - -import {CommunityLayoutRoutingModule} from './community-layout-routing.module'; -import {IsCommunity} from '../../../openaireLibrary/connect/communityGuard/isCommunity.guard'; -import {ConnectAdminLoginGuard} from '../../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; -import {ColorPickerModule} from 'ngx-color-picker'; -import {LayoutService} from '../../../openaireLibrary/services/layout.service'; - -@NgModule({ - imports: [ - CommunityLayoutRoutingModule, CommonModule, RouterModule, ColorPickerModule - ], - declarations: [ - CommunityLayoutComponent - ], - providers: [ - IsCommunity, ConnectAdminLoginGuard, LayoutService - ], - exports: [ - CommunityLayoutComponent - ] -}) - -export class CommunityLayoutModule { }