For every page: when Session is expired, redirect to '/user-info' page to show a proper message.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@53735 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3d64e0ebae
commit
9ddb0b32c9
|
@ -2,7 +2,7 @@
|
|||
* Created by stefania on 7/13/17.
|
||||
*/
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ModalFormComponent } from "../modal-form.component";
|
||||
|
@ -11,6 +11,9 @@ import { CommunityFormComponent } from "./community-form.component";
|
|||
import { CheckCommunity, Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'communities',
|
||||
templateUrl: './communities.component.html',
|
||||
|
@ -62,10 +65,14 @@ export class CommunitiesComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
|
||||
|
||||
|
||||
getCommunities() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -81,6 +88,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving communities', error));
|
||||
}
|
||||
}
|
||||
|
||||
// public showModal():void {
|
||||
// this.modal.showModal();
|
||||
|
@ -121,6 +129,10 @@ export class CommunitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.alertModalDeleteCommunities.cancelButton = true;
|
||||
this.alertModalDeleteCommunities.okButton = true;
|
||||
this.alertModalDeleteCommunities.alertTitle = "Delete Confirmation";
|
||||
|
@ -128,8 +140,13 @@ export class CommunitiesComponent implements OnInit {
|
|||
this.alertModalDeleteCommunities.okButtonText = "Yes";
|
||||
this.alertModalDeleteCommunities.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeleteCommunities(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -141,6 +158,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected communities', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public editCommunity(i : number) {
|
||||
let community : Community = this.checkboxes[i].community;
|
||||
|
@ -157,14 +175,23 @@ export class CommunitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private communitiesModalOpen(modal: any, title: string, yesBtn: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
modal.cancelButton = true;
|
||||
modal.okButton = true;
|
||||
modal.alertTitle = title;
|
||||
modal.okButtonText = yesBtn;
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
public communitySaveConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.communitiesModalOpen(this.alertModalSaveCommunity, "Save", "Add a new Community");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -178,8 +205,13 @@ export class CommunitiesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public communityUpdateConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.communitiesModalOpen(this.alertModalUpdateCommunity, "Update", "Update Community");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -192,6 +224,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public communitySavedSuccessfully(community: Community) {
|
||||
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
||||
|
|
|
@ -10,6 +10,9 @@ import {EnvProperties} from '../../../openaire
|
|||
|
||||
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'community-edit-form',
|
||||
templateUrl: './community-edit-form.component.html',
|
||||
|
@ -55,6 +58,10 @@ export class CommunityEditFormComponent implements OnInit{
|
|||
communityId => {
|
||||
this.communityId = communityId['communityId'];
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
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.updateErrorMessage = "";
|
||||
|
@ -72,6 +79,7 @@ export class CommunityEditFormComponent implements OnInit{
|
|||
error => this.handleError('System error retrieving community profile', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -93,6 +101,10 @@ export class CommunityEditFormComponent implements OnInit{
|
|||
// }
|
||||
|
||||
public resetForm(communityId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if (communityId != null && communityId != '') {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -110,9 +122,13 @@ export class CommunityEditFormComponent implements OnInit{
|
|||
}
|
||||
this.resetChange();
|
||||
}
|
||||
}
|
||||
|
||||
public updateCommunity() {
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this.showLoading = true;
|
||||
var community = this.parseUpdatedCommunity();
|
||||
|
@ -156,6 +172,7 @@ export class CommunityEditFormComponent implements OnInit{
|
|||
}
|
||||
this.resetChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private parseUpdatedCommunity() : {} {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult';
|
||||
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
|
||||
import {SearchFields, FieldDetails} from '../../../openaireLibrary/utils/properties/searchFields';
|
||||
|
@ -9,6 +9,8 @@ import {SearchDataprovidersService} from '../../../openaireLibrary/services/sear
|
|||
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
|
||||
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
|
||||
import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service';
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'add-content-providers',
|
||||
|
@ -62,7 +64,7 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _searchContentProvidersService: SearchDataprovidersService, private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService) {
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _searchContentProvidersService: SearchDataprovidersService, private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||
}
|
||||
|
@ -80,6 +82,10 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public addContentProvider(contenProvider: SearchResult) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("Add: "+ contenProvider.id);
|
||||
this.subAdd = this._manageCommunityContentProvidersService.addContentProvider(this.properties, this.community, contenProvider).subscribe(
|
||||
data => {
|
||||
|
@ -96,8 +102,13 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public removeContentProvider(contentProviderId: string, communityContentProviderId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("REMOVE: "+ contentProviderId);
|
||||
this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, contentProviderId).subscribe(
|
||||
data => {
|
||||
|
@ -114,6 +125,7 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public inCommunity(contentProvider: any): any {
|
||||
for(let communityContentProvider of this.communityContentProviders) {
|
||||
|
@ -129,6 +141,10 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
private _getOpenaireContentProviders(parameters:string, page: number, size: number){
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("_getOpenaireContentProviders");
|
||||
if(page > this.pagingLimit) {
|
||||
size=0;
|
||||
|
@ -183,6 +199,7 @@ export class AddContentProvidersComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalPages(): number {
|
||||
let totalPages:any = this.openaireSearchUtils.totalResults/(this.rowsOnPage);
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
|
||||
import {AddContentProvidersComponent} from './add-content-providers.component';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'manage-content-providers',
|
||||
template: `
|
||||
|
@ -47,11 +50,15 @@ export class ManageContentProvidersComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router) {}
|
||||
|
||||
public ngOnDestroy() {}
|
||||
|
||||
public updateCommunityContentProviders() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.toggle = !this.toggle;
|
||||
if(this.toggle) {
|
||||
this.pageTitle = "Manage content providers";
|
||||
|
@ -59,10 +66,13 @@ export class ManageContentProvidersComponent implements OnInit {
|
|||
|
||||
this.removeContentProvidersComponent._getCommunityContentProviders();
|
||||
this.addContentProvidersComponent.undo = {};
|
||||
console.info("In remove");
|
||||
} else {
|
||||
this.updateCommunityContentProvidersOnToggle = false;
|
||||
this.pageTitle = "Search content providers";
|
||||
//this.toggleLinkMessage = "Manage content providers";
|
||||
console.info("In add");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { DataTableDirective } from 'angular-datatables';
|
||||
|
||||
|
@ -11,6 +11,9 @@ import {SearchCommunityDataprovidersService} from '../../../openaireLibrary/conn
|
|||
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
|
||||
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'remove-content-providers',
|
||||
templateUrl: './remove-content-providers.component.html',
|
||||
|
@ -85,7 +88,7 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
this.communitySearchUtils.keyword = "";
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
constructor(private route: ActivatedRoute, private _router: Router,
|
||||
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
|
||||
private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
|
@ -190,6 +193,10 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteContentProvider(data : any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("REMOVE: "+ this.selectedCommunityContentProvider.id);
|
||||
this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, this.selectedCommunityContentProvider.id).subscribe(
|
||||
data => {
|
||||
|
@ -212,8 +219,13 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public removeContentProvider(communityContentProvider: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.selectedCommunityContentProvider = communityContentProvider;
|
||||
this.alertModalDeleteCommunity.cancelButton = true;
|
||||
this.alertModalDeleteCommunity.okButton = true;
|
||||
|
@ -239,8 +251,14 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
this.alertModalDeleteCommunity.okButtonText = "Yes";
|
||||
this.alertModalDeleteCommunity.open();
|
||||
}
|
||||
}
|
||||
|
||||
public _getCommunityContentProviders(){
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("_getCommunityContentProviders");
|
||||
this.communitySearchUtils.status = this.errorCodes.LOADING;
|
||||
this.disableForms = true;
|
||||
this.communityContentProviders = [];
|
||||
|
@ -298,3 +316,4 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
//import { Subject } from 'rxjs/Subject';
|
||||
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult';
|
||||
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
|
||||
|
@ -11,6 +11,9 @@ import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
|
|||
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
|
||||
import {ManageCommunityProjectsService} from '../../../services/manageProjects.service';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'add-projects',
|
||||
templateUrl: './add-projects.component.html',
|
||||
|
@ -69,7 +72,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _searchProjectsService: SearchProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService) {
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _searchProjectsService: SearchProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||
}
|
||||
|
@ -90,6 +93,10 @@ export class AddProjectsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public addProject(project: SearchResult) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("Add: "+ project.id);
|
||||
this.subAdd = this._manageCommunityProjectsService.addProject(this.properties, this.community, project).subscribe(
|
||||
data => {
|
||||
|
@ -106,8 +113,13 @@ export class AddProjectsComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public removeProject(projectId: string, communityProjectId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("REMOVE: "+ projectId);
|
||||
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, projectId).subscribe(
|
||||
data => {
|
||||
|
@ -124,6 +136,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public inCommunity(project: any): any {
|
||||
for(let communityProject of this.communityProjects) {
|
||||
|
@ -144,6 +157,10 @@ export class AddProjectsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getFunders () {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("Getting Funders....");
|
||||
this.subFunders = this._searchProjectsService.getFunders(this.properties).subscribe(
|
||||
data => {
|
||||
|
@ -152,8 +169,13 @@ export class AddProjectsComponent implements OnInit {
|
|||
err => console.log(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private _getOpenaireProjects(parameters:string, page: number, size: number){
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("_getOpenaireProjects");
|
||||
if(page > this.pagingLimit) {
|
||||
size=0;
|
||||
|
@ -210,6 +232,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
totalPages(): number {
|
||||
let totalPages:any = this.openaireSearchUtils.totalResults/(this.rowsOnPage);
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
import {RemoveProjectsComponent} from './remove-projects.component';
|
||||
import {AddProjectsComponent} from './add-projects.component';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'manage-projects',
|
||||
template: `
|
||||
|
@ -48,11 +51,15 @@ export class ManageProjectsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router) {}
|
||||
|
||||
public ngOnDestroy() {}
|
||||
|
||||
public updateCommunityProjects() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.toggle = !this.toggle;
|
||||
if(this.toggle) {
|
||||
this.pageTitle = "Manage projects";
|
||||
|
@ -68,6 +75,7 @@ export class ManageProjectsComponent implements OnInit {
|
|||
//this.toggleLinkMessage = "Manage projects";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public communityProjectsChanged($event) {
|
||||
this.communityProjects = $event.value;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { DataTableDirective } from 'angular-datatables';
|
||||
|
||||
|
@ -11,6 +11,9 @@ import {SearchCommunityProjectsService} from '../../../openaireLibrary/connect/p
|
|||
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
|
||||
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'remove-projects',
|
||||
templateUrl: './remove-projects.component.html',
|
||||
|
@ -95,7 +98,7 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
this.communitySearchUtils.keyword = "";
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _manageCommunityProjectsService: ManageCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService) {
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _manageCommunityProjectsService: ManageCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService) {
|
||||
this.errorCodes = new ErrorCodes();
|
||||
this.communitySearchUtils.status = this.errorCodes.LOADING;
|
||||
}
|
||||
|
@ -215,6 +218,10 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteProject(data : any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("REMOVE: "+ this.selectedCommunityProject.id);
|
||||
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, this.selectedCommunityProject.id).subscribe(
|
||||
data => {
|
||||
|
@ -237,8 +244,13 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public removeProject(communityProject: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.selectedCommunityProject = communityProject;
|
||||
this.alertModalDeleteCommunity.cancelButton = true;
|
||||
this.alertModalDeleteCommunity.okButton = true;
|
||||
|
@ -264,8 +276,13 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
this.alertModalDeleteCommunity.okButtonText = "Yes";
|
||||
this.alertModalDeleteCommunity.open();
|
||||
}
|
||||
}
|
||||
|
||||
public _getCommunityProjects(){
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.communitySearchUtils.status = this.errorCodes.LOADING;
|
||||
this.disableForms = true;
|
||||
this.communityProjects = [];
|
||||
|
@ -325,6 +342,7 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private createFunderFilter(): Set<String> {
|
||||
this.funders = new Set<string>();
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { Page } from "../../domain/page";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'divId-form',
|
||||
templateUrl: './divId-form.component.html',
|
||||
|
@ -27,7 +30,7 @@ export class DivIdFormComponent implements OnInit{
|
|||
public showLoading: boolean = false;
|
||||
public errorMessage: string = '';
|
||||
selectedCommunityPid = null;
|
||||
constructor(private route: ActivatedRoute, public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.data
|
||||
|
@ -44,6 +47,10 @@ export class DivIdFormComponent implements OnInit{
|
|||
}
|
||||
|
||||
getPages(includedPages: Set<String>) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
|
||||
|
@ -62,8 +69,13 @@ export class DivIdFormComponent implements OnInit{
|
|||
error => this.handleError('System error retrieving pages', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public toggle() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed;
|
||||
///////
|
||||
if(!this.myForm.value.isCollapsed) {
|
||||
|
@ -89,6 +101,7 @@ export class DivIdFormComponent implements OnInit{
|
|||
this.getPages(includedPages);
|
||||
}
|
||||
}
|
||||
}
|
||||
/////
|
||||
}
|
||||
|
||||
|
@ -149,6 +162,10 @@ export class DivIdFormComponent implements OnInit{
|
|||
}
|
||||
}*/
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
let index: number = -1;
|
||||
for(let i=0; i<this.myForm.get('pages').value.length; i++) {
|
||||
if(this.myForm.get('pages').value[i]._id == page._id) {
|
||||
|
@ -167,6 +184,7 @@ export class DivIdFormComponent implements OnInit{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleError(message: string, error) {
|
||||
this.errorMessage = message;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ModalFormComponent } from "../modal-form.component";
|
||||
|
@ -10,6 +10,9 @@ import { CheckDivId, DivId } from "../../domain/divId";
|
|||
import { Page } from "../../domain/page";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'divIds',
|
||||
templateUrl: './divIds.component.html',
|
||||
|
@ -63,9 +66,13 @@ export class DivIdsComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getDivIds() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -84,6 +91,7 @@ export class DivIdsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving classes', error));
|
||||
}
|
||||
}
|
||||
|
||||
// public showModal():void {
|
||||
// this.modal.showModal();
|
||||
|
@ -124,6 +132,10 @@ export class DivIdsComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.alertModalDeleteDivIds.cancelButton = true;
|
||||
this.alertModalDeleteDivIds.okButton = true;
|
||||
this.alertModalDeleteDivIds.alertTitle = "Delete Confirmation";
|
||||
|
@ -131,8 +143,13 @@ export class DivIdsComponent implements OnInit {
|
|||
this.alertModalDeleteDivIds.okButtonText = "Yes";
|
||||
this.alertModalDeleteDivIds.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeleteDivIds(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -144,6 +161,7 @@ export class DivIdsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected classes', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public editDivId(i : number) {
|
||||
let divId : DivId = this.checkboxes[i].divId;
|
||||
|
@ -170,14 +188,23 @@ export class DivIdsComponent implements OnInit {
|
|||
}
|
||||
|
||||
private divIdsModalOpen(modal: any, title: string, yesBtn: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
modal.cancelButton = true;
|
||||
modal.okButton = true;
|
||||
modal.alertTitle = title;
|
||||
modal.okButtonText = yesBtn;
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
public divIdSaveConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.divIdsModalOpen(this.alertModalSaveDivId, "Save", "Add a new Class");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -191,8 +218,13 @@ export class DivIdsComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public divIdUpdateConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.divIdsModalOpen(this.alertModalUpdateDivId, "Update", "Update Class");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -205,6 +237,7 @@ export class DivIdsComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public divIdSavedSuccessfully(divId: DivId) {
|
||||
this.checkboxes.push(<CheckDivId>{divId : divId, checked : false});
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
|
||||
import { Page } from "../../domain/page";
|
||||
import { DivId } from "../../domain/divId";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'div-content-form',
|
||||
|
@ -41,7 +43,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
public errorMessage: string = '';
|
||||
@Input() updateErrorMessage: string = '';
|
||||
|
||||
constructor(private route: ActivatedRoute, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit() {
|
||||
this.myForm = this.form;
|
||||
|
@ -50,6 +52,10 @@ export class DivContentFormComponent implements OnInit{
|
|||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(this.pageId) {
|
||||
this.showPageSelect = false;
|
||||
this.getDivs(this.pageId);
|
||||
|
@ -65,20 +71,30 @@ export class DivContentFormComponent implements OnInit{
|
|||
}
|
||||
|
||||
this.getCommunity(this.communityPid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public pageSelected(event) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.getDivs(event.target.value);
|
||||
}
|
||||
}
|
||||
|
||||
public divIdSelected(div: DivId) {
|
||||
this.selectedDiv = div;
|
||||
}
|
||||
|
||||
public getCommunity(communityPid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = '';
|
||||
|
||||
|
@ -94,8 +110,13 @@ export class DivContentFormComponent implements OnInit{
|
|||
error => this.handleError('System error retrieving community', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public getDivs(pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = '';
|
||||
|
||||
|
@ -108,6 +129,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
}
|
||||
|
||||
// public selectedDiv(event) {
|
||||
// console.info(event.target.value);
|
||||
|
|
|
@ -10,6 +10,9 @@ import { DivId } from "../../domain/divId";
|
|||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'div-help-contents',
|
||||
templateUrl: './div-help-contents.component.html',
|
||||
|
@ -75,6 +78,10 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
constructor(private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {}
|
||||
|
||||
getPage(pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -86,8 +93,13 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page', error));
|
||||
}
|
||||
}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -99,6 +111,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
}
|
||||
|
||||
public countDivHelpContents() {
|
||||
this.counter = {all : 0, active : 0, inactive : 0};
|
||||
|
@ -114,6 +127,10 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getDivHelpContents(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
divHelpContents => {
|
||||
this.divHelpContents = divHelpContents as Array<DivHelpContent>;
|
||||
|
@ -138,6 +155,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page contents', error));
|
||||
}
|
||||
}
|
||||
|
||||
public toggleCheckBoxes(event) {
|
||||
this.checkboxes.forEach(_ => _.checked = event.target.checked);
|
||||
|
@ -169,6 +187,10 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.alertModalDeleteDivHelpContents.cancelButton = true;
|
||||
this.alertModalDeleteDivHelpContents.okButton = true;
|
||||
this.alertModalDeleteDivHelpContents.alertTitle = "Delete Confirmation";
|
||||
|
@ -176,8 +198,13 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
this.alertModalDeleteDivHelpContents.okButtonText = "Yes";
|
||||
this.alertModalDeleteDivHelpContents.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeleteDivHelpContents(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -189,6 +216,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected class content(s)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private deleteDivHelpContentsFromArray(ids : string[]) : void {
|
||||
for(let id of ids) {
|
||||
|
@ -210,6 +238,10 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public toggleDivHelpContents(status : boolean, ids : string[]) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -227,6 +259,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public divHelpContentSavedSuccessfully(divHelpContent: DivHelpContent) {
|
||||
this.checkboxes.push(<CheckDivHelpContent>{divHelpContent : divHelpContent, checked : false});
|
||||
|
|
|
@ -6,6 +6,9 @@ import { DivHelpContent } from "../../domain/div-help-content";
|
|||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-div-help-content',
|
||||
templateUrl: 'edit-div-help-content.component.html',
|
||||
|
@ -65,6 +68,10 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private getDivHelpContent(divContentId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -76,8 +83,13 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
},
|
||||
error => this.handleError('System error retrieving class help content', error));
|
||||
}
|
||||
}
|
||||
|
||||
getDivId(divId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
|
||||
this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL).subscribe(
|
||||
|
@ -93,6 +105,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
error => this.handleError('System error retrieving class', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private updateForm(divHelpContent : DivHelpContent) {
|
||||
this.divHelpContent = divHelpContent;
|
||||
|
@ -103,6 +116,10 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private saveCustom() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -125,6 +142,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
this.errorMessage = "";
|
||||
|
|
|
@ -5,6 +5,9 @@ import { DivHelpContent } from "../../domain/div-help-content";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'new-div-help-content',
|
||||
templateUrl: 'new-div-help-content.component.html',
|
||||
|
@ -43,6 +46,10 @@ export class NewDivHelpContentComponent {
|
|||
}
|
||||
|
||||
private saveCustom() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -65,6 +72,7 @@ export class NewDivHelpContentComponent {
|
|||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ModalFormComponent } from "../modal-form.component";
|
||||
|
@ -9,6 +9,7 @@ import { CheckEntity, Entity } from "../../domain/entity";
|
|||
import { Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'entities',
|
||||
|
@ -68,8 +69,12 @@ export class EntitiesComponent implements OnInit {
|
|||
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
|
||||
getEntities(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -88,6 +93,7 @@ export class EntitiesComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving entities', error));
|
||||
}
|
||||
}
|
||||
|
||||
// public showModal():void {
|
||||
// this.modal.showModal();
|
||||
|
@ -128,6 +134,10 @@ export class EntitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmDeleteEntitiesModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.alertModalDeleteEntities.cancelButton = true;
|
||||
this.alertModalDeleteEntities.okButton = true;
|
||||
this.alertModalDeleteEntities.alertTitle = "Delete Confirmation";
|
||||
|
@ -135,8 +145,13 @@ export class EntitiesComponent implements OnInit {
|
|||
this.alertModalDeleteEntities.okButtonText = "Yes";
|
||||
this.alertModalDeleteEntities.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeleteEntities(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -148,6 +163,7 @@ export class EntitiesComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected entities', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public editEntity(i : number) {
|
||||
let entity : Entity = this.checkboxes[i].entity;
|
||||
|
@ -164,14 +180,23 @@ export class EntitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private entitiesModalOpen(modal: any, title: string, yesBtn: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
modal.cancelButton = true;
|
||||
modal.okButton = true;
|
||||
modal.alertTitle = title;
|
||||
modal.okButtonText = yesBtn;
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
public entitySaveConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.entitiesModalOpen(this.alertModalSaveEntity, "Save", "Add a new Entity");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -185,8 +210,13 @@ export class EntitiesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public entityUpdateConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.entitiesModalOpen(this.alertModalUpdateEntity, "Update", "Update Entity");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -199,6 +229,7 @@ export class EntitiesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public entitySavedSuccessfully(entity: Entity) {
|
||||
this.checkboxes.push(<CheckEntity>{entity : entity, checked : false});
|
||||
|
@ -257,6 +288,10 @@ export class EntitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmRelatedPagesModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.alertModalRelatedPages.cancelButton = true;
|
||||
this.alertModalRelatedPages.okButton = true;
|
||||
this.alertModalRelatedPages.alertTitle = "Warning";
|
||||
|
@ -264,8 +299,13 @@ export class EntitiesComponent implements OnInit {
|
|||
this.alertModalRelatedPages.okButtonText = "Yes";
|
||||
this.alertModalRelatedPages.open();
|
||||
}
|
||||
}
|
||||
|
||||
public continueToggling(event: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -281,5 +321,6 @@ export class EntitiesComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ import { PageHelpContent } from "../../domain/page-help-content";
|
|||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-page-help-content',
|
||||
templateUrl: 'edit-page-help-content.component.html',
|
||||
|
@ -69,6 +72,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private getPageHelpContent(pageContentId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -80,6 +87,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
},
|
||||
error => this.handleError('System error retrieving page help content', error));
|
||||
}
|
||||
}
|
||||
|
||||
private updateForm(pageHelpContent : PageHelpContent) {
|
||||
this.pageHelpContent = pageHelpContent;
|
||||
|
@ -89,6 +97,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
private saveCustom() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -110,6 +122,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
this.errorMessage = "";
|
||||
|
|
|
@ -8,6 +8,9 @@ import { PageHelpContent } from "../../domain/page-help-content";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'new-page-help-content',
|
||||
templateUrl: 'new-page-help-content.component.html',
|
||||
|
@ -46,7 +49,10 @@ export class NewPageHelpContentComponent {
|
|||
}
|
||||
|
||||
private saveCustom() {
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
//this.errorMessage = null;
|
||||
|
||||
if(this.formComponent.myForm.valid) {
|
||||
|
@ -70,6 +76,7 @@ export class NewPageHelpContentComponent {
|
|||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
|
||||
import { Page } from "../../domain/page";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'page-content-form',
|
||||
|
@ -30,7 +32,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
public errorMessage: string = '';
|
||||
@Input() updateErrorMessage: string = '';
|
||||
|
||||
constructor(private route: ActivatedRoute,private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit() {
|
||||
this.myForm = this.form;
|
||||
|
@ -38,12 +40,17 @@ export class PageContentFormComponent implements OnInit{
|
|||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe(
|
||||
pages => {
|
||||
this.availablePages = pages;
|
||||
this.showLoading = false;
|
||||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,16 +3,18 @@
|
|||
*/
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } from "../../domain/page-help-content";
|
||||
import { Page } from "../../domain/page";
|
||||
import {Router} from "@angular/router";
|
||||
import { Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'page-help-contents',
|
||||
templateUrl: './page-help-contents.component.html',
|
||||
|
@ -86,9 +88,13 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
// this.formGroup = this.formComponent.form;
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {}
|
||||
constructor(private route: ActivatedRoute, private router : Router, private _helpService: HelpContentService) {}
|
||||
|
||||
getPage(pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -100,8 +106,13 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page', error));
|
||||
}
|
||||
}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -113,6 +124,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
}
|
||||
|
||||
public countPageHelpContents() {
|
||||
this.counter = {all : 0, active : 0, inactive : 0};
|
||||
|
@ -128,6 +140,10 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getPageHelpContents(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pageHelpContents => {
|
||||
this.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
|
||||
|
@ -149,6 +165,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page contents', error));
|
||||
}
|
||||
}
|
||||
|
||||
// public showModal():void {
|
||||
// this.modal.showModal();
|
||||
|
@ -184,6 +201,10 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.alertModalDeletePageHelpContents.cancelButton = true;
|
||||
this.alertModalDeletePageHelpContents.okButton = true;
|
||||
this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation";
|
||||
|
@ -191,8 +212,13 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.alertModalDeletePageHelpContents.okButtonText = "Yes";
|
||||
this.alertModalDeletePageHelpContents.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeletePageHelpContents(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -204,6 +230,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected page content(s)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private deletePageHelpContentsFromArray(ids : string[]) : void {
|
||||
for(let id of ids) {
|
||||
|
@ -225,6 +252,10 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public togglePageHelpContents(status : boolean, ids : string[]) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -243,6 +274,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) {
|
||||
this.checkboxes.push(<CheckPageHelpContent>{pageHelpContent : pageHelpContent, checked : false});
|
||||
|
|
|
@ -10,6 +10,9 @@ import { HtmlPageContentFormComponent } from "./html-page-content-form.component
|
|||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import { Subscription } from "rxjs/Subscription";
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-htmlpage-content',
|
||||
templateUrl: './edit-htmlpage-content.component.html',
|
||||
|
@ -74,6 +77,10 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
}
|
||||
|
||||
private getPage(communityId: string, pageId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
this.pageName = page.name;
|
||||
|
@ -81,8 +88,13 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page', error));
|
||||
}
|
||||
}
|
||||
|
||||
private getHtmlPageContent(communityId: string, pageRoute: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -96,6 +108,7 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving page help content', error));
|
||||
}
|
||||
}
|
||||
|
||||
private updateForm(htmlPageContent : HtmlPageContent) {
|
||||
this.htmlPageContent = htmlPageContent;
|
||||
|
@ -103,6 +116,10 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
}
|
||||
|
||||
private saveCustom() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this.router.url);
|
||||
this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
|
||||
} else {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -125,6 +142,7 @@ export class EditHtmlPageContentComponent implements OnInit {
|
|||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
this.errorMessage = "";
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
* Created by stefania on 7/13/17.
|
||||
*/
|
||||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import {Entity} from '../../domain/entity';
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'page-form',
|
||||
templateUrl: './page-form.component.html',
|
||||
|
@ -29,7 +32,7 @@ export class PageFormComponent implements OnInit{
|
|||
public showLoading: boolean = false;
|
||||
public errorMessage: string = '';
|
||||
|
||||
constructor(private route: ActivatedRoute,public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.data
|
||||
|
@ -39,6 +42,10 @@ export class PageFormComponent implements OnInit{
|
|||
}
|
||||
|
||||
public toggle() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed;
|
||||
|
||||
if(!this.myForm.value.isCollapsed) {
|
||||
|
@ -65,8 +72,13 @@ export class PageFormComponent implements OnInit{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public getEntities(includedEntities: Set<String>) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.errorMessage = "";
|
||||
|
||||
|
@ -83,6 +95,7 @@ export class PageFormComponent implements OnInit{
|
|||
},
|
||||
error => this.handleError('System error retrieving community entities', error));
|
||||
}
|
||||
}
|
||||
|
||||
public getKeys( map) {
|
||||
return Array.from(map.keys());
|
||||
|
@ -128,6 +141,10 @@ export class PageFormComponent implements OnInit{
|
|||
}
|
||||
|
||||
public toggleEntity(status : boolean, id : string, entity: Entity) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
let index: number = -1;
|
||||
for(let i=0; i<this.myForm.get('entities').value.length; i++) {
|
||||
if(this.myForm.get('entities').value[i]._id == entity._id) {
|
||||
|
@ -146,6 +163,7 @@ export class PageFormComponent implements OnInit{
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleError(message: string, error) {
|
||||
this.errorMessage = message;
|
||||
|
|
|
@ -134,10 +134,10 @@
|
|||
<!-- <fab *ngIf="isPortalAdministrator" (clicked)="showModal()"></fab> -->
|
||||
<fab *ngIf="isPortalAdministrator" (clicked)="newPage()"></fab>
|
||||
</div>
|
||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
|
||||
<!-- <modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleUpdateError($event)">
|
||||
<page-form [group]="formGroup"></page-form>
|
||||
</modal-form>
|
||||
</modal-form> -->
|
||||
|
||||
<!--<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleUpdateError($event)">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Created by stefania on 7/13/17.
|
||||
*/
|
||||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ModalFormComponent } from "../modal-form.component";
|
||||
|
@ -13,6 +13,7 @@ import { Community } from "../../domain/community";
|
|||
import { Entity } from "../../domain/entity";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'pages',
|
||||
|
@ -83,9 +84,13 @@ export class PagesComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
constructor(private route: ActivatedRoute, private _router: Router, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
this.errorMessage = "";
|
||||
|
@ -108,8 +113,13 @@ export class PagesComponent implements OnInit {
|
|||
error => this.handleError('System error retrieving pages', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
getPagesWithDivIds(community_pid: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this._helpContentService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
this.pageWithDivIds = pages;
|
||||
|
@ -117,6 +127,7 @@ export class PagesComponent implements OnInit {
|
|||
},
|
||||
error => this.handleError('System error retrieving information about pages\' classes', error));
|
||||
}
|
||||
}
|
||||
|
||||
pagesReturned(pages: Page[]) {
|
||||
this.pages = pages;
|
||||
|
@ -179,6 +190,10 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private confirmModalOpen() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.alertModalDeletePages.cancelButton = true;
|
||||
this.alertModalDeletePages.okButton = true;
|
||||
this.alertModalDeletePages.alertTitle = "Delete Confirmation";
|
||||
|
@ -186,8 +201,13 @@ export class PagesComponent implements OnInit {
|
|||
this.alertModalDeletePages.okButtonText = "Yes";
|
||||
this.alertModalDeletePages.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeletePages(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -199,6 +219,7 @@ export class PagesComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error deleting the selected pages', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public editPage(i : number) {
|
||||
let page : Page = this.checkboxes[i].page;
|
||||
|
@ -218,14 +239,23 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
private pagesModalOpen(modal: any, title: string, yesBtn: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
modal.cancelButton = true;
|
||||
modal.okButton = true;
|
||||
modal.alertTitle = title;
|
||||
modal.okButtonText = yesBtn;
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
public pageSaveConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.pagesModalOpen(this.alertModalSavePage, "Save", "Add a new Page");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -239,8 +269,13 @@ export class PagesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public pageUpdateConfirmed(data: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if(!this.formGroup.valid) {
|
||||
this.pagesModalOpen(this.alertModalUpdatePage, "Update", "Update Page");
|
||||
this.modalErrorMessage = "Please fill in all required fields marked with *";
|
||||
|
@ -253,6 +288,7 @@ export class PagesComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public pageSavedSuccessfully(page: Page) {
|
||||
this.checkboxes.push(<CheckPage>{page : page, checked : false});
|
||||
|
@ -317,6 +353,10 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public togglePages(status : boolean, ids : string[]) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -332,6 +372,7 @@ export class PagesComponent implements OnInit {
|
|||
error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public capitalizeFirstLetter(str: string) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {HelpContentService} from '../../services/help-content.service';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import { Community } from '../../domain/community';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
@ -9,6 +9,9 @@ import {availableEntitiesMap, StatisticsDisplay, StatisticsSummary} from '../../
|
|||
import {Observable} from 'rxjs/Observable';
|
||||
import {ConfigurationService} from '../../openaireLibrary/utils/configuration/configuration.service';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'stats',
|
||||
templateUrl: 'stats.component.html'
|
||||
|
@ -46,6 +49,7 @@ export class StatsComponent implements OnInit {
|
|||
constructor(private contentService: HelpContentService,
|
||||
private configService: ConfigurationService,
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private sanitizer: DomSanitizer,
|
||||
private titleCase: TitleCasePipe) {}
|
||||
|
||||
|
@ -64,6 +68,10 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getStatistics() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
// this.loadingMessage = 'Retrieving statistics';
|
||||
// this.errorMessage = '';
|
||||
this.showLoading = true;
|
||||
|
@ -93,8 +101,13 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
getDisplayOptions() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.contentService.getCommunityAdminStatisticsChoices(this.properties.adminToolsAPIURL, this.communityId)
|
||||
.subscribe(
|
||||
res => {
|
||||
|
@ -109,8 +122,13 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
getCommunityInfo() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
|
||||
this.configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe(
|
||||
res => {
|
||||
|
@ -124,8 +142,13 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onChangeEntity (entity: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
|
||||
this.deactivatedEntity = false;
|
||||
|
@ -157,6 +180,7 @@ export class StatsComponent implements OnInit {
|
|||
|
||||
this.showLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
changeDisplayedProjectChart(chartName: string) {
|
||||
this.displayedProjectChart = chartName;
|
||||
|
@ -190,6 +214,10 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
|
||||
toggleShowAllInMonitor(entity: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -304,10 +332,14 @@ export class StatsComponent implements OnInit {
|
|||
this.loadingMessage = '';
|
||||
}
|
||||
);*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
toggleShowAllInDashboard(entity: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -377,8 +409,13 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toggleShowInMonitor(entity: string, chartsOrNumbers: string, title: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -398,8 +435,13 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
toggleShowInDashboard(entity: string, chartsOrNumbers: string, title: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
||||
|
@ -419,6 +461,7 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
getCamelCaseString (inputString: string) {
|
||||
return this.titleCase.transform(inputString);
|
||||
|
|
|
@ -9,6 +9,10 @@ import {SubjectsService} from "../subjects.serv
|
|||
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
|
||||
|
||||
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
import { concat } from 'rxjs/observable/concat';
|
||||
@Component({
|
||||
selector: 'subjects-edit-form',
|
||||
|
@ -56,6 +60,10 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
communityId => {
|
||||
this.communityId = communityId['communityId'];
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
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.updateErrorMessage = "";
|
||||
|
@ -77,6 +85,7 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
error => this.handleError('System error retrieving community profile', error)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -84,14 +93,28 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
|
||||
|
||||
public addSubject() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.community.subjects.push("");
|
||||
}
|
||||
}
|
||||
|
||||
public removeSubject(i: any) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.community.subjects.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public resetForm(communityId: string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if (communityId != null && communityId != '') {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = "";
|
||||
|
@ -109,6 +132,7 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
}
|
||||
this.resetChange();
|
||||
}
|
||||
}
|
||||
|
||||
// save(newValue){
|
||||
// this.edit=null;
|
||||
|
@ -142,7 +166,10 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
|
||||
}
|
||||
public updateSubjects() {
|
||||
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this.showLoading = true;
|
||||
var subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(this.originalSubjects, this.community.subjects);
|
||||
|
@ -183,6 +210,7 @@ export class SubjectsEditFormComponent implements OnInit{
|
|||
}
|
||||
this.resetChange();
|
||||
}
|
||||
}
|
||||
afterUpdateActions(res){
|
||||
this.community.subjects = res["subjects"];
|
||||
this.originalSubjects = [];
|
||||
|
|
|
@ -13,6 +13,8 @@ import {RouterHelper} from '../../openaireLib
|
|||
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
|
||||
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'manage-subscribers',
|
||||
|
@ -172,6 +174,10 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public goTo(page:number = 1) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.subscribersSearchUtils.page=page;
|
||||
|
||||
var table = $('#dpTable').DataTable();
|
||||
|
@ -181,6 +187,7 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
console.info("records: "+info.recordsDisplay);
|
||||
this.subscribersSearchUtils.totalResults = info.recordsDisplay;
|
||||
}
|
||||
}
|
||||
|
||||
totalPages(): number {
|
||||
let totalPages:any = this.subscribersSearchUtils.totalResults/(this.rowsOnPage);
|
||||
|
@ -191,6 +198,10 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
}
|
||||
|
||||
public removeSubscriber(email:string) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.selectedSubscriberEmail = email;
|
||||
this.alertModalDeleteSubscriber.cancelButton = true;
|
||||
this.alertModalDeleteSubscriber.okButton = true;
|
||||
|
@ -205,8 +216,13 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
this.alertModalDeleteSubscriber.okButtonText = "Yes";
|
||||
this.alertModalDeleteSubscriber.open();
|
||||
}
|
||||
}
|
||||
|
||||
public confirmedDeleteSubscriber() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
console.info("REMOVE: "+ this.selectedSubscriberEmail);
|
||||
this.subRemove = this._subscribeService.unSubscribeToCommunity(this.communityId, this.selectedSubscriberEmail, this.properties.adminToolsAPIURL).subscribe(
|
||||
result => {
|
||||
|
@ -230,8 +246,13 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public _getCommunitySubscribers(){
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.subscribersSearchUtils.status = this.errorCodes.LOADING;
|
||||
this.disableForms = true;
|
||||
this.communitySubscribers = [];
|
||||
|
@ -288,3 +309,4 @@ export class ManageSubscribersComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import {SearchUtilsClass} from '../../openaireLib
|
|||
import {ManageZenodoCommunitiesService} from './manage-zenodo-communities.service';
|
||||
import {ZenodoCommunityInfo} from './zenodoCommunity/zenodoCommunityInfo';
|
||||
|
||||
import {Session} from '../../openaireLibrary/login/utils/helper.class';
|
||||
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
|
||||
|
||||
@Component({
|
||||
selector: 'manage-zenodo-communities',
|
||||
templateUrl: './manage-zenodo-communities.component.html',
|
||||
|
@ -44,6 +47,10 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
|
|||
this.route.queryParams.subscribe(
|
||||
communityId => {
|
||||
this.communityId = communityId['communityId'];
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
|
||||
zenodoCommunities => {
|
||||
|
@ -58,6 +65,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
|
|||
console.log(totalZenodoCommunities);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -65,6 +73,10 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public search() {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.zenodoCommunitySearchUtils.page = 1;
|
||||
if (this.communityId != null && this.communityId != '') {
|
||||
this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?q="+this.zenodoCommunitySearchUtils.keyword+"&page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
|
||||
|
@ -74,8 +86,13 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public goTo(page:number = 1) {
|
||||
if(!Session.isLoggedIn()){
|
||||
console.info(this._router.url);
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.zenodoCommunitySearchUtils.page=page;
|
||||
console.log("Page is: "+page);
|
||||
this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
|
||||
|
@ -85,6 +102,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
|
|||
console.log(this.zenodoCommunitySearchUtils.page);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
totalPages(): number {
|
||||
let totalPages:any = this.zenodoCommunitySearchUtils.totalResults/(this.rowsOnPage);
|
||||
|
|
Loading…
Reference in New Issue