[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
This commit is contained in:
parent
aef5531945
commit
2909a9e421
|
@ -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 { }
|
|
|
@ -1,39 +0,0 @@
|
||||||
<div id="community-edit-form " class=" uk-card uk-card-default uk-padding">
|
|
||||||
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Edit community layout</div>
|
|
||||||
<div>
|
|
||||||
<div *ngIf="showLoading" class="uk-animation-fade uk-width-1-1" role="alert"><span class="loading-gif uk-align-center"></span></div>
|
|
||||||
<table *ngIf="communityId != null && layout !== null && !showLoading && !errorMessage" class="uk-width-1-1">
|
|
||||||
<tbody class="uk-table uk-align-center">
|
|
||||||
<tr>
|
|
||||||
<td for="color" class="uk-text-bold uk-width-1-3@xl uk-width-1-3@m uk-width-expand@s uk-text-right">Color:</td>
|
|
||||||
<td class="uk-text-left uk-width-1-3@xl uk-width-1-3@m uk-width-expand@s">
|
|
||||||
<button [(colorPicker)]="layout.color" [style.background]="layout.color"
|
|
||||||
id="color" class="uk-icon-button"
|
|
||||||
(click)="change()">
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
<td for="color" class="uk-text uk-width-1-3@xl uk-width-1-3@m uk-width-expand@s uk-text-left" [style.color]="layout.color">Change your community color</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
|
|
||||||
<div *ngIf="successfulSaveMessage" class="uk-alert uk-alert-success" role="alert">{{successfulSaveMessage}}</div>
|
|
||||||
<div *ngIf="successfulResetMessage" class="uk-alert uk-alert-warning" role="alert">{{successfulResetMessage}}</div>
|
|
||||||
|
|
||||||
<table *ngIf="communityId != null && layout != null && !showLoading && !errorMessage" class="uk-width-1-1">
|
|
||||||
<tbody class="uk-table uk-align-center">
|
|
||||||
<tr>
|
|
||||||
<td class="uk-width-1-3@xl uk-width-1-3@m uk-width-expand@s uk-text-right"></td>
|
|
||||||
<td class="uk-text-left">
|
|
||||||
<div class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom">
|
|
||||||
<button *ngIf="hasChanged" class="uk-button uk-button-primary" (click)="updateLayout()">Save</button>
|
|
||||||
<button *ngIf="!hasChanged" class="uk-button uk-button-default" disabled>Save</button>
|
|
||||||
<button class="uk-button" (click)="resetLayout()">Reset</button>
|
|
||||||
<button class="uk-button connect-default-button" (click)="loadDefaultLayout()">Default Layout</button>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 { }
|
|
Loading…
Reference in New Issue