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:
konstantina.galouni 2018-11-13 15:26:49 +00:00
parent 3d64e0ebae
commit 9ddb0b32c9
27 changed files with 1375 additions and 810 deletions

View File

@ -2,7 +2,7 @@
* Created by stefania on 7/13/17. * Created by stefania on 7/13/17.
*/ */
import { Component, ViewChild, OnInit } from '@angular/core'; 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 { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms"; import { FormGroup } from "@angular/forms";
import { ModalFormComponent } from "../modal-form.component"; import { ModalFormComponent } from "../modal-form.component";
@ -11,6 +11,9 @@ import { CommunityFormComponent } from "./community-form.component";
import { CheckCommunity, Community } from "../../domain/community"; import { CheckCommunity, Community } from "../../domain/community";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'communities', selector: 'communities',
templateUrl: './communities.component.html', 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() { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -80,6 +87,7 @@ export class CommunitiesComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving communities', error)); error => this.handleError('System error retrieving communities', error));
}
} }
// public showModal():void { // public showModal():void {
@ -121,15 +129,24 @@ export class CommunitiesComponent implements OnInit {
} }
private confirmModalOpen() { private confirmModalOpen() {
this.alertModalDeleteCommunities.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeleteCommunities.okButton = true; console.info(this._router.url);
this.alertModalDeleteCommunities.alertTitle = "Delete Confirmation"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeleteCommunities.message = "Are you sure you want to delete the selected community(-ies)?"; } else {
this.alertModalDeleteCommunities.okButtonText = "Yes"; this.alertModalDeleteCommunities.cancelButton = true;
this.alertModalDeleteCommunities.open(); this.alertModalDeleteCommunities.okButton = true;
this.alertModalDeleteCommunities.alertTitle = "Delete Confirmation";
this.alertModalDeleteCommunities.message = "Are you sure you want to delete the selected community(-ies)?";
this.alertModalDeleteCommunities.okButtonText = "Yes";
this.alertModalDeleteCommunities.open();
}
} }
public confirmedDeleteCommunities(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -140,6 +157,7 @@ export class CommunitiesComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected communities', error) error => this.handleUpdateError('System error deleting the selected communities', error)
); );
}
} }
public editCommunity(i : number) { public editCommunity(i : number) {
@ -157,39 +175,54 @@ export class CommunitiesComponent implements OnInit {
} }
private communitiesModalOpen(modal: any, title: string, yesBtn: string) { private communitiesModalOpen(modal: any, title: string, yesBtn: string) {
modal.cancelButton = true; if(!Session.isLoggedIn()){
modal.okButton = true; console.info(this._router.url);
modal.alertTitle = title; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
modal.okButtonText = yesBtn; } else {
modal.open(); modal.cancelButton = true;
modal.okButton = true;
modal.alertTitle = title;
modal.okButtonText = yesBtn;
modal.open();
}
} }
public communitySaveConfirmed(data: any) { public communitySaveConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.communitiesModalOpen(this.alertModalSaveCommunity, "Save", "Add a new Community"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this.modalErrorMessage = ""; if(!this.formGroup.valid) {
this._helpContentService.saveCommunity(<Community> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( this.communitiesModalOpen(this.alertModalSaveCommunity, "Save", "Add a new Community");
community => { this.modalErrorMessage = "Please fill in all required fields marked with *";
this.communitySavedSuccessfully(community); } else {
}, this.modalErrorMessage = "";
error => this.handleUpdateError("System error creating community", error) this._helpContentService.saveCommunity(<Community> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); community => {
this.communitySavedSuccessfully(community);
},
error => this.handleUpdateError("System error creating community", error)
);
}
} }
} }
public communityUpdateConfirmed(data: any) { public communityUpdateConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.communitiesModalOpen(this.alertModalUpdateCommunity, "Update", "Update Community"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this._helpContentService.updateCommunity(<Community> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( if(!this.formGroup.valid) {
community => { this.communitiesModalOpen(this.alertModalUpdateCommunity, "Update", "Update Community");
this.communityUpdatedSuccessfully(community); this.modalErrorMessage = "Please fill in all required fields marked with *";
}, } else {
error => this.handleUpdateError("System error updating community", error) this._helpContentService.updateCommunity(<Community> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); community => {
this.communityUpdatedSuccessfully(community);
},
error => this.handleUpdateError("System error updating community", error)
);
}
} }
} }

View File

@ -10,6 +10,9 @@ import {EnvProperties} from '../../../openaire
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'community-edit-form', selector: 'community-edit-form',
templateUrl: './community-edit-form.component.html', templateUrl: './community-edit-form.component.html',
@ -55,22 +58,27 @@ export class CommunityEditFormComponent implements OnInit{
communityId => { communityId => {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId != '') { if(!Session.isLoggedIn()){
this.showLoading = true; console.info(this._router.url);
this.updateErrorMessage = ""; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.errorMessage = ""; } else {
if (this.communityId != null && this.communityId != '') {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe ( this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => { community => {
this.community = community; this.community = community;
this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; this.params = {community: encodeURIComponent('"'+community.queryId+'"')};
this.firstVersionOfManagers = community.managers.slice(); this.firstVersionOfManagers = community.managers.slice();
console.log("First version of managers " + this.firstVersionOfManagers); console.log("First version of managers " + this.firstVersionOfManagers);
console.log(community); console.log(community);
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving community profile', error) error => this.handleError('System error retrieving community profile', error)
); );
}
} }
}); });
}); });
@ -93,6 +101,10 @@ export class CommunityEditFormComponent implements OnInit{
// } // }
public resetForm(communityId: string) { 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 != '') { if (communityId != null && communityId != '') {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -109,10 +121,14 @@ export class CommunityEditFormComponent implements OnInit{
); );
} }
this.resetChange(); this.resetChange();
}
} }
public updateCommunity() { 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 != '') { if (this.communityId != null && this.communityId != '') {
this.showLoading = true; this.showLoading = true;
var community = this.parseUpdatedCommunity(); var community = this.parseUpdatedCommunity();
@ -155,6 +171,7 @@ export class CommunityEditFormComponent implements OnInit{
} }
} }
this.resetChange(); this.resetChange();
}
} }

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; 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 {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult';
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes';
import {SearchFields, FieldDetails} from '../../../openaireLibrary/utils/properties/searchFields'; 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 {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class'; import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service'; import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'add-content-providers', 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.errorCodes = new ErrorCodes();
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
} }
@ -80,39 +82,49 @@ export class AddContentProvidersComponent implements OnInit {
} }
public addContentProvider(contenProvider: SearchResult) { public addContentProvider(contenProvider: SearchResult) {
console.info("Add: "+ contenProvider.id); if(!Session.isLoggedIn()){
this.subAdd = this._manageCommunityContentProvidersService.addContentProvider(this.properties, this.community, contenProvider).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data ADD"); } else {
console.info(data); console.info("Add: "+ contenProvider.id);
this.undo[contenProvider.id] = data.id; this.subAdd = this._manageCommunityContentProvidersService.addContentProvider(this.properties, this.community, contenProvider).subscribe(
}, data => {
err => { console.info("data ADD");
console.info("error ADD"); console.info(data);
console.log(err.status); this.undo[contenProvider.id] = data.id;
}, },
() => { err => {
console.info("completed ADD"); console.info("error ADD");
} console.log(err.status);
) },
() => {
console.info("completed ADD");
}
)
}
} }
public removeContentProvider(contentProviderId: string, communityContentProviderId: string) { public removeContentProvider(contentProviderId: string, communityContentProviderId: string) {
console.info("REMOVE: "+ contentProviderId); if(!Session.isLoggedIn()){
this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, contentProviderId).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data REMOVE"); } else {
console.info(data); console.info("REMOVE: "+ contentProviderId);
}, this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, contentProviderId).subscribe(
err => { data => {
console.info("error REMOVE"); console.info("data REMOVE");
console.log(err); console.info(data);
}, },
() => { err => {
console.info("completed REMOVE"); console.info("error REMOVE");
this.undo[communityContentProviderId] = ""; console.log(err);
} },
) () => {
console.info("completed REMOVE");
this.undo[communityContentProviderId] = "";
}
)
}
} }
public inCommunity(contentProvider: any): any { public inCommunity(contentProvider: any): any {
@ -129,58 +141,63 @@ export class AddContentProvidersComponent implements OnInit {
} }
private _getOpenaireContentProviders(parameters:string, page: number, size: number){ private _getOpenaireContentProviders(parameters:string, page: number, size: number){
console.info("_getOpenaireContentProviders"); if(!Session.isLoggedIn()){
if(page > this.pagingLimit) { console.info(this._router.url);
size=0; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} } else {
console.info("_getOpenaireContentProviders");
if(page > this.pagingLimit) {
size=0;
}
if(this.openaireSearchUtils.status == this.errorCodes.LOADING) { if(this.openaireSearchUtils.status == this.errorCodes.LOADING) {
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
this.disableForms = true; this.disableForms = true;
this.openaireContentProviders = []; this.openaireContentProviders = [];
this.openaireSearchUtils.totalResults = 0; this.openaireSearchUtils.totalResults = 0;
this.subResults = this._searchContentProvidersService.searchDataproviders(parameters, null, page, size, [], this.properties).subscribe( this.subResults = this._searchContentProvidersService.searchDataproviders(parameters, null, page, size, [], this.properties).subscribe(
data => { data => {
this.undo = {}; this.undo = {};
console.info("total openaire content providers = "+data[0]); console.info("total openaire content providers = "+data[0]);
this.openaireSearchUtils.totalResults = data[0]; this.openaireSearchUtils.totalResults = data[0];
this.openaireContentProviders = data[1]; this.openaireContentProviders = data[1];
this.openaireSearchUtils.status = this.errorCodes.DONE; this.openaireSearchUtils.status = this.errorCodes.DONE;
if(this.openaireSearchUtils.totalResults == 0 ){ if(this.openaireSearchUtils.totalResults == 0 ){
this.openaireSearchUtils.status = this.errorCodes.NONE; this.openaireSearchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
if(this.openaireSearchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.openaireSearchUtils.totalResults/(this.openaireSearchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
} }
if(totalPages < page) {
this.openaireSearchUtils.totalResults = 0;
this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.openaireSearchUtils.status = this.errorCodes.ERROR;
} else {
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false; this.disableForms = false;
}
); if(this.openaireSearchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.openaireSearchUtils.totalResults/(this.openaireSearchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.openaireSearchUtils.totalResults = 0;
this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.openaireSearchUtils.status = this.errorCodes.ERROR;
} else {
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
}
);
}
} }
} }

View File

@ -1,9 +1,12 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core'; 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 {RemoveContentProvidersComponent} from './remove-content-providers.component';
import {AddContentProvidersComponent} from './add-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({ @Component({
selector: 'manage-content-providers', selector: 'manage-content-providers',
template: ` template: `
@ -47,22 +50,29 @@ export class ManageContentProvidersComponent implements OnInit {
}); });
} }
constructor(private route: ActivatedRoute) {} constructor(private route: ActivatedRoute, private _router: Router) {}
public ngOnDestroy() {} public ngOnDestroy() {}
public updateCommunityContentProviders() { public updateCommunityContentProviders() {
this.toggle = !this.toggle; if(!Session.isLoggedIn()){
if(this.toggle) { console.info(this._router.url);
this.pageTitle = "Manage content providers"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
//this.toggleLinkMessage = "Missing content providers?";
this.removeContentProvidersComponent._getCommunityContentProviders();
this.addContentProvidersComponent.undo = {};
} else { } else {
this.updateCommunityContentProvidersOnToggle = false; this.toggle = !this.toggle;
this.pageTitle = "Search content providers"; if(this.toggle) {
//this.toggleLinkMessage = "Manage content providers"; this.pageTitle = "Manage content providers";
//this.toggleLinkMessage = "Missing content providers?";
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");
}
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; 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 { Subject } from 'rxjs/Subject';
import { DataTableDirective } from 'angular-datatables'; import { DataTableDirective } from 'angular-datatables';
@ -11,6 +11,9 @@ import {SearchCommunityDataprovidersService} from '../../../openaireLibrary/conn
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.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({ @Component({
selector: 'remove-content-providers', selector: 'remove-content-providers',
templateUrl: './remove-content-providers.component.html', templateUrl: './remove-content-providers.component.html',
@ -85,7 +88,7 @@ export class RemoveContentProvidersComponent implements OnInit {
this.communitySearchUtils.keyword = ""; this.communitySearchUtils.keyword = "";
} }
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute, private _router: Router,
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService, private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService) { private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
@ -190,111 +193,127 @@ export class RemoveContentProvidersComponent implements OnInit {
} }
public confirmedDeleteContentProvider(data : any) { public confirmedDeleteContentProvider(data : any) {
console.info("REMOVE: "+ this.selectedCommunityContentProvider.id); if(!Session.isLoggedIn()){
this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, this.selectedCommunityContentProvider.id).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data REMOVE"); } else {
console.info(data); console.info("REMOVE: "+ this.selectedCommunityContentProvider.id);
}, this.subRemove = this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, this.selectedCommunityContentProvider.id).subscribe(
err => { data => {
console.info("error REMOVE"); console.info("data REMOVE");
console.log(err); console.info(data);
}, },
() => { err => {
console.info("completed REMOVE"); console.info("error REMOVE");
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider); console.log(err);
this.communityContentProviders.splice(index, 1); },
() => {
console.info("completed REMOVE");
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
this.communityContentProviders.splice(index, 1);
this.communitySearchUtils.totalResults--; this.communitySearchUtils.totalResults--;
this.communitySearchUtils.page=1; this.communitySearchUtils.page=1;
this.rerender(); this.rerender();
} }
) )
}
} }
public removeContentProvider(communityContentProvider: any) { public removeContentProvider(communityContentProvider: any) {
this.selectedCommunityContentProvider = communityContentProvider; if(!Session.isLoggedIn()){
this.alertModalDeleteCommunity.cancelButton = true; console.info(this._router.url);
this.alertModalDeleteCommunity.okButton = true; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeleteCommunity.alertTitle = "Remove content provider?"; } else {
let title = ""; this.selectedCommunityContentProvider = communityContentProvider;
if(communityContentProvider.name) { this.alertModalDeleteCommunity.cancelButton = true;
title = communityContentProvider.name; this.alertModalDeleteCommunity.okButton = true;
this.alertModalDeleteCommunity.alertTitle = "Remove content provider?";
let title = "";
if(communityContentProvider.name) {
title = communityContentProvider.name;
}
if(communityContentProvider.name && communityContentProvider.acronym) {
title += " (";
}
if(communityContentProvider.acronym) {
title += communityContentProvider.acronym;
}
if(communityContentProvider.name && communityContentProvider.acronym) {
title += ") ";
}
this.alertModalDeleteCommunity.message = "Content Provider";
if(title) {
this.alertModalDeleteCommunity.message += " '"+title+"' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
} }
if(communityContentProvider.name && communityContentProvider.acronym) {
title += " (";
}
if(communityContentProvider.acronym) {
title += communityContentProvider.acronym;
}
if(communityContentProvider.name && communityContentProvider.acronym) {
title += ") ";
}
this.alertModalDeleteCommunity.message = "Content Provider";
if(title) {
this.alertModalDeleteCommunity.message += " '"+title+"' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
} }
public _getCommunityContentProviders(){ public _getCommunityContentProviders(){
this.communitySearchUtils.status = this.errorCodes.LOADING; if(!Session.isLoggedIn()){
this.disableForms = true; console.info(this._router.url);
this.communityContentProviders = []; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.communitySearchUtils.totalResults = 0; } else {
this.communitySearchUtils.page=1; console.info("_getCommunityContentProviders");
this.communitySearchUtils.keyword = ""; this.communitySearchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.communityContentProviders = [];
this.communitySearchUtils.totalResults = 0;
this.communitySearchUtils.page=1;
this.communitySearchUtils.keyword = "";
this.subResults = this._searchCommunityContentProvidersService.searchDataproviders(this.properties, this.community).subscribe( this.subResults = this._searchCommunityContentProvidersService.searchDataproviders(this.properties, this.community).subscribe(
data => { data => {
console.info(data); console.info(data);
console.info("search Content Providers [total communityContentProviders:"+data.length+"]"); console.info("search Content Providers [total communityContentProviders:"+data.length+"]");
this.communityContentProviders = data; this.communityContentProviders = data;
this.communitySearchUtils.totalResults = data.length; this.communitySearchUtils.totalResults = data.length;
this.communitySearchUtils.status = this.errorCodes.DONE; this.communitySearchUtils.status = this.errorCodes.DONE;
// if(this.communitySearchUtils.totalResults == 0 ){ // if(this.communitySearchUtils.totalResults == 0 ){
// this.communitySearchUtils.status = this.errorCodes.NONE; // this.communitySearchUtils.status = this.errorCodes.NONE;
// } // }
this.disableForms = false; this.disableForms = false;
if(!this.triggered) { if(!this.triggered) {
this.triggerInitialLoad(); this.triggerInitialLoad();
} else { } else {
var table = $('#dpTable').DataTable(); var table = $('#dpTable').DataTable();
table.clear(); table.clear();
this.rerender(); this.rerender();
}
this.communityContentProvidersChanged.emit({
value: this.communityContentProviders,
});
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.communitySearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.communitySearchUtils.status = this.errorCodes.ERROR;
} else {
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
if(!this.triggered) {
this.triggerInitialLoad();
} else {
var table = $('#dpTable').DataTable();
table.clear();
this.rerender();
}
} }
);
this.communityContentProvidersChanged.emit({ }
value: this.communityContentProviders,
});
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.communitySearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.communitySearchUtils.status = this.errorCodes.ERROR;
} else {
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
if(!this.triggered) {
this.triggerInitialLoad();
} else {
var table = $('#dpTable').DataTable();
table.clear();
this.rerender();
}
}
);
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; 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 { Subject } from 'rxjs/Subject';
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult'; import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult';
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; 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 {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class';
import {ManageCommunityProjectsService} from '../../../services/manageProjects.service'; import {ManageCommunityProjectsService} from '../../../services/manageProjects.service';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'add-projects', selector: 'add-projects',
templateUrl: './add-projects.component.html', 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.errorCodes = new ErrorCodes();
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
} }
@ -90,39 +93,49 @@ export class AddProjectsComponent implements OnInit {
} }
public addProject(project: SearchResult) { public addProject(project: SearchResult) {
console.info("Add: "+ project.id); if(!Session.isLoggedIn()){
this.subAdd = this._manageCommunityProjectsService.addProject(this.properties, this.community, project).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data ADD"); } else {
console.info(data); console.info("Add: "+ project.id);
this.undo[project.id] = data.id; this.subAdd = this._manageCommunityProjectsService.addProject(this.properties, this.community, project).subscribe(
}, data => {
err => { console.info("data ADD");
console.info("error ADD"); console.info(data);
console.log(err.status); this.undo[project.id] = data.id;
}, },
() => { err => {
console.info("completed ADD"); console.info("error ADD");
} console.log(err.status);
) },
() => {
console.info("completed ADD");
}
)
}
} }
public removeProject(projectId: string, communityProjectId: string) { public removeProject(projectId: string, communityProjectId: string) {
console.info("REMOVE: "+ projectId); if(!Session.isLoggedIn()){
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, projectId).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data REMOVE"); } else {
console.info(data); console.info("REMOVE: "+ projectId);
}, this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, projectId).subscribe(
err => { data => {
console.info("error REMOVE"); console.info("data REMOVE");
console.log(err); console.info(data);
}, },
() => { err => {
console.info("completed REMOVE"); console.info("error REMOVE");
this.undo[communityProjectId] = ""; console.log(err);
} },
) () => {
console.info("completed REMOVE");
this.undo[communityProjectId] = "";
}
)
}
} }
public inCommunity(project: any): any { public inCommunity(project: any): any {
@ -144,70 +157,80 @@ export class AddProjectsComponent implements OnInit {
} }
getFunders () { getFunders () {
console.info("Getting Funders...."); if(!Session.isLoggedIn()){
this.subFunders = this._searchProjectsService.getFunders(this.properties).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.funders = data[1]; } else {
}, console.info("Getting Funders....");
err => console.log(err) this.subFunders = this._searchProjectsService.getFunders(this.properties).subscribe(
); data => {
this.funders = data[1];
},
err => console.log(err)
);
}
} }
private _getOpenaireProjects(parameters:string, page: number, size: number){ private _getOpenaireProjects(parameters:string, page: number, size: number){
console.info("_getOpenaireProjects"); if(!Session.isLoggedIn()){
if(page > this.pagingLimit) { console.info(this._router.url);
size=0; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} } else {
console.info("_getOpenaireProjects");
if(page > this.pagingLimit) {
size=0;
}
if(this.openaireSearchUtils.status == this.errorCodes.LOADING) { if(this.openaireSearchUtils.status == this.errorCodes.LOADING) {
this.openaireSearchUtils.status = this.errorCodes.LOADING; this.openaireSearchUtils.status = this.errorCodes.LOADING;
this.disableForms = true; this.disableForms = true;
this.openaireProjects = []; this.openaireProjects = [];
this.openaireSearchUtils.totalResults = 0; this.openaireSearchUtils.totalResults = 0;
this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, [], this.properties).subscribe( this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, [], this.properties).subscribe(
data => { data => {
this.undo = {}; this.undo = {};
console.info("total openaire projects = "+data[0]); console.info("total openaire projects = "+data[0]);
this.openaireSearchUtils.totalResults = data[0]; this.openaireSearchUtils.totalResults = data[0];
this.openaireProjects = data[1]; this.openaireProjects = data[1];
//this.searchPage.checkSelectedFilters(this.filters); //this.searchPage.checkSelectedFilters(this.filters);
this.openaireSearchUtils.status = this.errorCodes.DONE; this.openaireSearchUtils.status = this.errorCodes.DONE;
if(this.openaireSearchUtils.totalResults == 0 ){ if(this.openaireSearchUtils.totalResults == 0 ){
this.openaireSearchUtils.status = this.errorCodes.NONE; this.openaireSearchUtils.status = this.errorCodes.NONE;
}
this.disableForms = false;
if(this.openaireSearchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.openaireSearchUtils.totalResults/(this.openaireSearchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
} }
if(totalPages < page) {
this.openaireSearchUtils.totalResults = 0;
this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.openaireSearchUtils.status = this.errorCodes.ERROR;
} else {
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false; this.disableForms = false;
}
); if(this.openaireSearchUtils.status == this.errorCodes.DONE) {
// Page out of limit!!!
let totalPages:any = this.openaireSearchUtils.totalResults/(this.openaireSearchUtils.size);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
if(totalPages < page) {
this.openaireSearchUtils.totalResults = 0;
this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND;
}
}
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.openaireSearchUtils.status = this.errorCodes.ERROR;
} else {
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
}
);
}
} }
} }

View File

@ -1,9 +1,12 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input } from '@angular/core'; 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 {RemoveProjectsComponent} from './remove-projects.component';
import {AddProjectsComponent} from './add-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({ @Component({
selector: 'manage-projects', selector: 'manage-projects',
template: ` template: `
@ -48,24 +51,29 @@ export class ManageProjectsComponent implements OnInit {
}); });
} }
constructor(private route: ActivatedRoute) {} constructor(private route: ActivatedRoute, private _router: Router) {}
public ngOnDestroy() {} public ngOnDestroy() {}
public updateCommunityProjects() { public updateCommunityProjects() {
this.toggle = !this.toggle; if(!Session.isLoggedIn()){
if(this.toggle) { console.info(this._router.url);
this.pageTitle = "Manage projects"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
// this.toggleLinkMessage = "Missing projects?";
//if(this.updateCommunityProjectsOnToggle) {
this.removeProjectsComponent._getCommunityProjects();
this.addProjectsComponent.undo = {};
//}
} else { } else {
this.updateCommunityProjectsOnToggle = false; this.toggle = !this.toggle;
this.pageTitle = "Search projects"; if(this.toggle) {
//this.toggleLinkMessage = "Manage projects"; this.pageTitle = "Manage projects";
// this.toggleLinkMessage = "Missing projects?";
//if(this.updateCommunityProjectsOnToggle) {
this.removeProjectsComponent._getCommunityProjects();
this.addProjectsComponent.undo = {};
//}
} else {
this.updateCommunityProjectsOnToggle = false;
this.pageTitle = "Search projects";
//this.toggleLinkMessage = "Manage projects";
}
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; 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 { Subject } from 'rxjs/Subject';
import { DataTableDirective } from 'angular-datatables'; import { DataTableDirective } from 'angular-datatables';
@ -11,6 +11,9 @@ import {SearchCommunityProjectsService} from '../../../openaireLibrary/connect/p
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class';
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.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({ @Component({
selector: 'remove-projects', selector: 'remove-projects',
templateUrl: './remove-projects.component.html', templateUrl: './remove-projects.component.html',
@ -95,7 +98,7 @@ export class RemoveProjectsComponent implements OnInit {
this.communitySearchUtils.keyword = ""; 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.errorCodes = new ErrorCodes();
this.communitySearchUtils.status = this.errorCodes.LOADING; this.communitySearchUtils.status = this.errorCodes.LOADING;
} }
@ -215,115 +218,130 @@ export class RemoveProjectsComponent implements OnInit {
} }
public confirmedDeleteProject(data : any) { public confirmedDeleteProject(data : any) {
console.info("REMOVE: "+ this.selectedCommunityProject.id); if(!Session.isLoggedIn()){
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, this.selectedCommunityProject.id).subscribe( console.info(this._router.url);
data => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
console.info("data REMOVE"); } else {
console.info(data); console.info("REMOVE: "+ this.selectedCommunityProject.id);
}, this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, this.selectedCommunityProject.id).subscribe(
err => { data => {
console.info("error REMOVE"); console.info("data REMOVE");
console.log(err); console.info(data);
}, },
() => { err => {
console.info("completed REMOVE"); console.info("error REMOVE");
let index = this.communityProjects.indexOf(this.selectedCommunityProject); console.log(err);
this.communityProjects.splice(index, 1); },
() => {
console.info("completed REMOVE");
let index = this.communityProjects.indexOf(this.selectedCommunityProject);
this.communityProjects.splice(index, 1);
this.communitySearchUtils.totalResults--; this.communitySearchUtils.totalResults--;
this.communitySearchUtils.page=1; this.communitySearchUtils.page=1;
this.rerender(); this.rerender();
} }
) )
}
} }
public removeProject(communityProject: any) { public removeProject(communityProject: any) {
this.selectedCommunityProject = communityProject; if(!Session.isLoggedIn()){
this.alertModalDeleteCommunity.cancelButton = true; console.info(this._router.url);
this.alertModalDeleteCommunity.okButton = true; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeleteCommunity.alertTitle = "Remove project?"; } else {
let title = ""; this.selectedCommunityProject = communityProject;
if(communityProject.name) { this.alertModalDeleteCommunity.cancelButton = true;
title = communityProject.name; this.alertModalDeleteCommunity.okButton = true;
this.alertModalDeleteCommunity.alertTitle = "Remove project?";
let title = "";
if(communityProject.name) {
title = communityProject.name;
}
if(communityProject.name && communityProject.acronym) {
title += " (";
}
if(communityProject.acronym) {
title += communityProject.acronym;
}
if(communityProject.name && communityProject.acronym) {
title += ")";
}
this.alertModalDeleteCommunity.message = "Project";
if(title) {
this.alertModalDeleteCommunity.message += " '"+title+"' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
} }
if(communityProject.name && communityProject.acronym) {
title += " (";
}
if(communityProject.acronym) {
title += communityProject.acronym;
}
if(communityProject.name && communityProject.acronym) {
title += ")";
}
this.alertModalDeleteCommunity.message = "Project";
if(title) {
this.alertModalDeleteCommunity.message += " '"+title+"' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
} }
public _getCommunityProjects(){ public _getCommunityProjects(){
this.communitySearchUtils.status = this.errorCodes.LOADING; if(!Session.isLoggedIn()){
this.disableForms = true; console.info(this._router.url);
this.communityProjects = []; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.communitySearchUtils.totalResults = 0; } else {
this.communitySearchUtils.page=1; this.communitySearchUtils.status = this.errorCodes.LOADING;
this.communitySearchUtils.keyword = ""; this.disableForms = true;
this.selectedFunder = ""; this.communityProjects = [];
this.communitySearchUtils.totalResults = 0;
this.communitySearchUtils.page=1;
this.communitySearchUtils.keyword = "";
this.selectedFunder = "";
this.subResults = this._searchCommunityProjectsService.searchProjects(this.properties, this.community).subscribe( this.subResults = this._searchCommunityProjectsService.searchProjects(this.properties, this.community).subscribe(
data => { data => {
console.info(data); console.info(data);
console.info("search Projects [total communityProjects:"+data.length+"]"); console.info("search Projects [total communityProjects:"+data.length+"]");
this.communityProjects = data; this.communityProjects = data;
this.communitySearchUtils.totalResults = data.length; this.communitySearchUtils.totalResults = data.length;
this.communitySearchUtils.status = this.errorCodes.DONE; this.communitySearchUtils.status = this.errorCodes.DONE;
// if(this.communitySearchUtils.totalResults == 0 ){ // if(this.communitySearchUtils.totalResults == 0 ){
// this.communitySearchUtils.status = this.errorCodes.NONE; // this.communitySearchUtils.status = this.errorCodes.NONE;
// } // }
this.disableForms = false; this.disableForms = false;
if(!this.triggered) { if(!this.triggered) {
this.triggerInitialLoad(); this.triggerInitialLoad();
} else { } else {
var table = $('#dpTable').DataTable(); var table = $('#dpTable').DataTable();
table.clear(); table.clear();
this.rerender(); this.rerender();
}
this.communityProjectsChanged.emit({
value: this.communityProjects,
});
this.createFunderFilter();
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.communitySearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.communitySearchUtils.status = this.errorCodes.ERROR;
} else {
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
if(!this.triggered) {
this.triggerInitialLoad();
} else {
var table = $('#dpTable').DataTable();
table.clear();
this.rerender();
}
} }
);
this.communityProjectsChanged.emit({ }
value: this.communityProjects,
});
this.createFunderFilter();
},
err => {
console.log(err);
//TODO check erros (service not available, bad request)
if(err.status == '404') {
this.communitySearchUtils.status = this.errorCodes.NOT_FOUND;
} else if(err.status == '500') {
this.communitySearchUtils.status = this.errorCodes.ERROR;
} else {
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.disableForms = false;
if(!this.triggered) {
this.triggerInitialLoad();
} else {
var table = $('#dpTable').DataTable();
table.clear();
this.rerender();
}
}
);
} }
private createFunderFilter(): Set<String> { private createFunderFilter(): Set<String> {

View File

@ -1,10 +1,13 @@
import {Component, OnInit, Input} from '@angular/core'; 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 {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { Page } from "../../domain/page"; import { Page } from "../../domain/page";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'divId-form', selector: 'divId-form',
templateUrl: './divId-form.component.html', templateUrl: './divId-form.component.html',
@ -27,7 +30,7 @@ export class DivIdFormComponent implements OnInit{
public showLoading: boolean = false; public showLoading: boolean = false;
public errorMessage: string = ''; public errorMessage: string = '';
selectedCommunityPid = null; 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 { ngOnInit(): void {
this.route.data this.route.data
@ -44,49 +47,59 @@ export class DivIdFormComponent implements OnInit{
} }
getPages(includedPages: Set<String>) { getPages(includedPages: Set<String>) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ""; 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._helpContentService.getPages(this.properties.adminToolsAPIURL,this.selectedCommunityPid).subscribe( this._helpContentService.getPages(this.properties.adminToolsAPIURL,this.selectedCommunityPid).subscribe(
pages => { pages => {
//this.allPages = allPages; //this.allPages = allPages;
for(let page of pages) { for(let page of pages) {
if(includedPages.has(page._id)) { if(includedPages.has(page._id)) {
this.allPages.set(page, true); this.allPages.set(page, true);
} else { } else {
this.allPages.set(page, false); this.allPages.set(page, false);
}
} }
} this.showLoading = false;
this.showLoading = false; },
}, error => this.handleError('System error retrieving pages', error)
error => this.handleError('System error retrieving pages', error) );
); }
} }
public toggle() { public toggle() {
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed; if(!Session.isLoggedIn()){
/////// console.info(this._router.url);
if(!this.myForm.value.isCollapsed) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
let includedPages: Set<String> = new Set<String>(); } else {
for(let pageName of this.myForm.value.pages) { this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed;
includedPages.add(pageName._id); ///////
} if(!this.myForm.value.isCollapsed) {
let includedPages: Set<String> = new Set<String>();
let allPages = this.allPages; for(let pageName of this.myForm.value.pages) {
includedPages.add(pageName._id);
let self = this;
allPages.forEach(function (status, page, map) {
if(includedPages.has(page._id)) {
self.allPages.set(page, true);
} else {
self.allPages.set(page, false);
} }
});
let allPages = this.allPages;
let self = this;
allPages.forEach(function (status, page, map) {
if(includedPages.has(page._id)) {
self.allPages.set(page, true);
} else {
self.allPages.set(page, false);
}
});
if(!this.gotPages) { if(!this.gotPages) {
this.gotPages = true; this.gotPages = true;
this.getPages(includedPages); this.getPages(includedPages);
}
} }
} }
///// /////
@ -149,21 +162,26 @@ export class DivIdFormComponent implements OnInit{
} }
}*/ }*/
let index: number = -1; if(!Session.isLoggedIn()){
for(let i=0; i<this.myForm.get('pages').value.length; i++) { console.info(this._router.url);
if(this.myForm.get('pages').value[i]._id == page._id) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
index = i; } else {
break; 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) {
index = i;
break;
}
} }
}
this.allPages.set(page, status); this.allPages.set(page, status);
if(status && index<0) { if(status && index<0) {
this.myForm.value.pages.push(page); this.myForm.value.pages.push(page);
} else if(!status){ } else if(!status){
if(index >= 0) { if(index >= 0) {
this.myForm.value.pages.splice(index, 1); this.myForm.value.pages.splice(index, 1);
}
} }
} }
} }

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit } from '@angular/core'; 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 { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms"; import { FormGroup } from "@angular/forms";
import { ModalFormComponent } from "../modal-form.component"; import { ModalFormComponent } from "../modal-form.component";
@ -10,6 +10,9 @@ import { CheckDivId, DivId } from "../../domain/divId";
import { Page } from "../../domain/page"; import { Page } from "../../domain/page";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'divIds', selector: 'divIds',
templateUrl: './divIds.component.html', 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() { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -83,6 +90,7 @@ export class DivIdsComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving classes', error)); error => this.handleError('System error retrieving classes', error));
}
} }
// public showModal():void { // public showModal():void {
@ -124,15 +132,24 @@ export class DivIdsComponent implements OnInit {
} }
private confirmModalOpen() { private confirmModalOpen() {
this.alertModalDeleteDivIds.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeleteDivIds.okButton = true; console.info(this._router.url);
this.alertModalDeleteDivIds.alertTitle = "Delete Confirmation"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeleteDivIds.message = "Are you sure you want to delete the selected class(es)?"; } else {
this.alertModalDeleteDivIds.okButtonText = "Yes"; this.alertModalDeleteDivIds.cancelButton = true;
this.alertModalDeleteDivIds.open(); this.alertModalDeleteDivIds.okButton = true;
this.alertModalDeleteDivIds.alertTitle = "Delete Confirmation";
this.alertModalDeleteDivIds.message = "Are you sure you want to delete the selected class(es)?";
this.alertModalDeleteDivIds.okButtonText = "Yes";
this.alertModalDeleteDivIds.open();
}
} }
public confirmedDeleteDivIds(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -143,6 +160,7 @@ export class DivIdsComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected classes', error) error => this.handleUpdateError('System error deleting the selected classes', error)
); );
}
} }
public editDivId(i : number) { public editDivId(i : number) {
@ -170,39 +188,54 @@ export class DivIdsComponent implements OnInit {
} }
private divIdsModalOpen(modal: any, title: string, yesBtn: string) { private divIdsModalOpen(modal: any, title: string, yesBtn: string) {
modal.cancelButton = true; if(!Session.isLoggedIn()){
modal.okButton = true; console.info(this._router.url);
modal.alertTitle = title; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
modal.okButtonText = yesBtn; } else {
modal.open(); modal.cancelButton = true;
modal.okButton = true;
modal.alertTitle = title;
modal.okButtonText = yesBtn;
modal.open();
}
} }
public divIdSaveConfirmed(data: any) { public divIdSaveConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.divIdsModalOpen(this.alertModalSaveDivId, "Save", "Add a new Class"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this.modalErrorMessage = ""; if(!this.formGroup.valid) {
this._helpContentService.saveDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( this.divIdsModalOpen(this.alertModalSaveDivId, "Save", "Add a new Class");
divId => { this.modalErrorMessage = "Please fill in all required fields marked with *";
this.divIdSavedSuccessfully(divId); } else {
}, this.modalErrorMessage = "";
error => this.handleUpdateError("System error creating class", error) this._helpContentService.saveDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); divId => {
this.divIdSavedSuccessfully(divId);
},
error => this.handleUpdateError("System error creating class", error)
);
}
} }
} }
public divIdUpdateConfirmed(data: any) { public divIdUpdateConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.divIdsModalOpen(this.alertModalUpdateDivId, "Update", "Update Class"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this._helpContentService.updateDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( if(!this.formGroup.valid) {
divId => { this.divIdsModalOpen(this.alertModalUpdateDivId, "Update", "Update Class");
this.divIdUpdatedSuccessfully(divId); this.modalErrorMessage = "Please fill in all required fields marked with *";
}, } else {
error => this.handleUpdateError("System error updating class", error) this._helpContentService.updateDivId(<DivId> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); divId => {
this.divIdUpdatedSuccessfully(divId);
},
error => this.handleUpdateError("System error updating class", error)
);
}
} }
} }

View File

@ -1,11 +1,13 @@
import { Component, OnInit, Input } from '@angular/core'; 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 { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { Page } from "../../domain/page"; import { Page } from "../../domain/page";
import { DivId } from "../../domain/divId"; import { DivId } from "../../domain/divId";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'div-content-form', selector: 'div-content-form',
@ -41,7 +43,7 @@ export class DivContentFormComponent implements OnInit{
public errorMessage: string = ''; public errorMessage: string = '';
@Input() updateErrorMessage: 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() { ngOnInit() {
this.myForm = this.form; this.myForm = this.form;
@ -50,28 +52,38 @@ export class DivContentFormComponent implements OnInit{
this.properties = data.envSpecific; this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
if(this.pageId) { if(!Session.isLoggedIn()){
this.showPageSelect = false; console.info(this._router.url);
this.getDivs(this.pageId); this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
if(!this.editMode) { if(this.pageId) {
this._helpContentService.getCommunityPagesWithDivId(this.communityPid, this.properties.adminToolsAPIURL).subscribe( this.showPageSelect = false;
pages => { this.getDivs(this.pageId);
this.availablePages = pages; } else {
this.showLoading = false; if(!this.editMode) {
}, this._helpContentService.getCommunityPagesWithDivId(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
error => this.handleError('System error retrieving pages', error)); pages => {
} this.availablePages = pages;
} this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error));
}
}
this.getCommunity(this.communityPid); this.getCommunity(this.communityPid);
}
}); });
}); });
} }
public pageSelected(event) { public pageSelected(event) {
this.getDivs(event.target.value); 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) { public divIdSelected(div: DivId) {
@ -79,34 +91,44 @@ export class DivContentFormComponent implements OnInit{
} }
public getCommunity(communityPid: string) { public getCommunity(communityPid: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ''; 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._helpContentService.getCommunity(this.communityPid, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getCommunity(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
community => { community => {
this.communityId = community._id; this.communityId = community._id;
this.myForm.patchValue({ this.myForm.patchValue({
community: this.communityId community: this.communityId
}); });
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving community', error) error => this.handleError('System error retrieving community', error)
); );
}
} }
public getDivs(pageId: string) { public getDivs(pageId: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ''; 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._helpContentService.getDivIdsFull(pageId, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getDivIdsFull(pageId, this.properties.adminToolsAPIURL).subscribe(
divs => { divs => {
this.availableDivs = divs; this.availableDivs = divs;
this.pageId = pageId; this.pageId = pageId;
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving pages', error)); error => this.handleError('System error retrieving pages', error));
}
} }
// public selectedDiv(event) { // public selectedDiv(event) {

View File

@ -10,6 +10,9 @@ import { DivId } from "../../domain/divId";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe'; 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({ @Component({
selector: 'div-help-contents', selector: 'div-help-contents',
templateUrl: './div-help-contents.component.html', templateUrl: './div-help-contents.component.html',
@ -75,19 +78,28 @@ export class DivHelpContentsComponent implements OnInit {
constructor(private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {} constructor(private route: ActivatedRoute, private _helpService: HelpContentService, private router : Router) {}
getPage(pageId: string) { getPage(pageId: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.updateErrorMessage = ""; console.info(this.router.url);
this.errorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe( this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
page => { page => {
this.page = page; this.page = page;
this.getDivHelpContents(this.selectedCommunityPid); this.getDivHelpContents(this.selectedCommunityPid);
}, },
error => this.handleError('System error retrieving page', error)); error => this.handleError('System error retrieving page', error));
}
} }
getPages(community_pid: string) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -98,6 +110,7 @@ export class DivHelpContentsComponent implements OnInit {
this.getDivHelpContents(this.selectedCommunityPid); this.getDivHelpContents(this.selectedCommunityPid);
}, },
error => this.handleError('System error retrieving pages', error)); error => this.handleError('System error retrieving pages', error));
}
} }
public countDivHelpContents() { public countDivHelpContents() {
@ -114,6 +127,10 @@ export class DivHelpContentsComponent implements OnInit {
} }
getDivHelpContents(community_pid: string) { 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( this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
divHelpContents => { divHelpContents => {
this.divHelpContents = divHelpContents as Array<DivHelpContent>; this.divHelpContents = divHelpContents as Array<DivHelpContent>;
@ -137,6 +154,7 @@ export class DivHelpContentsComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving page contents', error)); error => this.handleError('System error retrieving page contents', error));
}
} }
public toggleCheckBoxes(event) { public toggleCheckBoxes(event) {
@ -169,15 +187,24 @@ export class DivHelpContentsComponent implements OnInit {
} }
private confirmModalOpen() { private confirmModalOpen() {
this.alertModalDeleteDivHelpContents.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeleteDivHelpContents.okButton = true; console.info(this.router.url);
this.alertModalDeleteDivHelpContents.alertTitle = "Delete Confirmation"; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
this.alertModalDeleteDivHelpContents.message = "Are you sure you want to delete the help text(s)?"; } else {
this.alertModalDeleteDivHelpContents.okButtonText = "Yes"; this.alertModalDeleteDivHelpContents.cancelButton = true;
this.alertModalDeleteDivHelpContents.open(); this.alertModalDeleteDivHelpContents.okButton = true;
this.alertModalDeleteDivHelpContents.alertTitle = "Delete Confirmation";
this.alertModalDeleteDivHelpContents.message = "Are you sure you want to delete the help text(s)?";
this.alertModalDeleteDivHelpContents.okButtonText = "Yes";
this.alertModalDeleteDivHelpContents.open();
}
} }
public confirmedDeleteDivHelpContents(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -188,6 +215,7 @@ export class DivHelpContentsComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected class content(s)', error) error => this.handleUpdateError('System error deleting the selected class content(s)', error)
); );
}
} }
private deleteDivHelpContentsFromArray(ids : string[]) : void { private deleteDivHelpContentsFromArray(ids : string[]) : void {
@ -210,6 +238,10 @@ export class DivHelpContentsComponent implements OnInit {
} }
public toggleDivHelpContents(status : boolean, ids : string[]) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -226,6 +258,7 @@ export class DivHelpContentsComponent implements OnInit {
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
); );
}
} }
public divHelpContentSavedSuccessfully(divHelpContent: DivHelpContent) { public divHelpContentSavedSuccessfully(divHelpContent: DivHelpContent) {

View File

@ -6,6 +6,9 @@ import { DivHelpContent } from "../../domain/div-help-content";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'edit-div-help-content', selector: 'edit-div-help-content',
templateUrl: 'edit-div-help-content.component.html', templateUrl: 'edit-div-help-content.component.html',
@ -65,19 +68,28 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
} }
private getDivHelpContent(divContentId: string) { private getDivHelpContent(divContentId: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ""; console.info(this.router.url);
this.updateErrorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.errorMessage = "";
this.updateErrorMessage = "";
this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL).subscribe(
divHelpContent => { divHelpContent => {
this.updateForm(divHelpContent); this.updateForm(divHelpContent);
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving class help content', error)); error => this.handleError('System error retrieving class help content', error));
}
} }
getDivId(divId: string) { 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.showLoading = true;
this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL).subscribe(
@ -87,11 +99,12 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
if(!this.pageId) { if(!this.pageId) {
this.formComponent.getDivs(""); this.formComponent.getDivs("");
} }
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving class', error) error => this.handleError('System error retrieving class', error)
); );
}
} }
private updateForm(divHelpContent : DivHelpContent) { private updateForm(divHelpContent : DivHelpContent) {
@ -103,6 +116,10 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
} }
private saveCustom() { 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) { if(this.formComponent.myForm.valid) {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -124,6 +141,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
} else { } else {
this.errorMessage = "Please fill all required fields"; this.errorMessage = "Please fill all required fields";
} }
}
} }
private cancelCustom() { private cancelCustom() {

View File

@ -5,6 +5,9 @@ import { DivHelpContent } from "../../domain/div-help-content";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'new-div-help-content', selector: 'new-div-help-content',
templateUrl: 'new-div-help-content.component.html', templateUrl: 'new-div-help-content.component.html',
@ -43,6 +46,10 @@ export class NewDivHelpContentComponent {
} }
private saveCustom() { 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) { if(this.formComponent.myForm.valid) {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -64,6 +71,7 @@ export class NewDivHelpContentComponent {
} else { } else {
this.errorMessage = "Please fill all required fields"; this.errorMessage = "Please fill all required fields";
} }
}
} }
private cancelCustom() { private cancelCustom() {

View File

@ -1,5 +1,5 @@
import { Component, ViewChild, OnInit } from '@angular/core'; 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 { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms"; import { FormGroup } from "@angular/forms";
import { ModalFormComponent } from "../modal-form.component"; import { ModalFormComponent } from "../modal-form.component";
@ -9,6 +9,7 @@ import { CheckEntity, Entity } from "../../domain/entity";
import { Community } from "../../domain/community"; import { Community } from "../../domain/community";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../openaireLibrary/login/utils/helper.class'; import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'entities', 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) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -87,6 +92,7 @@ export class EntitiesComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving entities', error)); error => this.handleError('System error retrieving entities', error));
}
} }
// public showModal():void { // public showModal():void {
@ -128,15 +134,24 @@ export class EntitiesComponent implements OnInit {
} }
private confirmDeleteEntitiesModalOpen() { private confirmDeleteEntitiesModalOpen() {
this.alertModalDeleteEntities.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeleteEntities.okButton = true; console.info(this._router.url);
this.alertModalDeleteEntities.alertTitle = "Delete Confirmation"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeleteEntities.message = "Are you sure you want to delete the selected entity(-ies)?"; } else {
this.alertModalDeleteEntities.okButtonText = "Yes"; this.alertModalDeleteEntities.cancelButton = true;
this.alertModalDeleteEntities.open(); this.alertModalDeleteEntities.okButton = true;
this.alertModalDeleteEntities.alertTitle = "Delete Confirmation";
this.alertModalDeleteEntities.message = "Are you sure you want to delete the selected entity(-ies)?";
this.alertModalDeleteEntities.okButtonText = "Yes";
this.alertModalDeleteEntities.open();
}
} }
public confirmedDeleteEntities(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -147,6 +162,7 @@ export class EntitiesComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected entities', error) error => this.handleUpdateError('System error deleting the selected entities', error)
); );
}
} }
public editEntity(i : number) { public editEntity(i : number) {
@ -164,39 +180,54 @@ export class EntitiesComponent implements OnInit {
} }
private entitiesModalOpen(modal: any, title: string, yesBtn: string) { private entitiesModalOpen(modal: any, title: string, yesBtn: string) {
modal.cancelButton = true; if(!Session.isLoggedIn()){
modal.okButton = true; console.info(this._router.url);
modal.alertTitle = title; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
modal.okButtonText = yesBtn; } else {
modal.open(); modal.cancelButton = true;
modal.okButton = true;
modal.alertTitle = title;
modal.okButtonText = yesBtn;
modal.open();
}
} }
public entitySaveConfirmed(data: any) { public entitySaveConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.entitiesModalOpen(this.alertModalSaveEntity, "Save", "Add a new Entity"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this.modalErrorMessage = ""; if(!this.formGroup.valid) {
this._helpContentService.saveEntity(<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( this.entitiesModalOpen(this.alertModalSaveEntity, "Save", "Add a new Entity");
entity => { this.modalErrorMessage = "Please fill in all required fields marked with *";
this.entitySavedSuccessfully(entity); } else {
}, this.modalErrorMessage = "";
error => this.handleUpdateError("System error creating entity", error) this._helpContentService.saveEntity(<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); entity => {
this.entitySavedSuccessfully(entity);
},
error => this.handleUpdateError("System error creating entity", error)
);
}
} }
} }
public entityUpdateConfirmed(data: any) { public entityUpdateConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.entitiesModalOpen(this.alertModalUpdateEntity, "Update", "Update Entity"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this._helpContentService.updateEntity(<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( if(!this.formGroup.valid) {
entity => { this.entitiesModalOpen(this.alertModalUpdateEntity, "Update", "Update Entity");
this.entityUpdatedSuccessfully(entity); this.modalErrorMessage = "Please fill in all required fields marked with *";
}, } else {
error => this.handleUpdateError("System error updating entity", error) this._helpContentService.updateEntity(<Entity> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); entity => {
this.entityUpdatedSuccessfully(entity);
},
error => this.handleUpdateError("System error updating entity", error)
);
}
} }
} }
@ -257,29 +288,39 @@ export class EntitiesComponent implements OnInit {
} }
private confirmRelatedPagesModalOpen() { private confirmRelatedPagesModalOpen() {
this.alertModalRelatedPages.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalRelatedPages.okButton = true; console.info(this._router.url);
this.alertModalRelatedPages.alertTitle = "Warning"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalRelatedPages.message = "This action will affect all search pages related to this entity! Pages' status will change to entity's status! Do you want to continue?"; } else {
this.alertModalRelatedPages.okButtonText = "Yes"; this.alertModalRelatedPages.cancelButton = true;
this.alertModalRelatedPages.open(); this.alertModalRelatedPages.okButton = true;
this.alertModalRelatedPages.alertTitle = "Warning";
this.alertModalRelatedPages.message = "This action will affect all search pages related to this entity! Pages' status will change to entity's status! Do you want to continue?";
this.alertModalRelatedPages.okButtonText = "Yes";
this.alertModalRelatedPages.open();
}
} }
public continueToggling(event: any) { public continueToggling(event: any) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.updateErrorMessage = ""; 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._helpContentService.toggleEntities(this.selectedCommunityPid,this.toggleIds,this.toggleStatus, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.toggleEntities(this.selectedCommunityPid,this.toggleIds,this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
() => { () => {
for(let id of this.toggleIds) { for(let id of this.toggleIds) {
let i = this.checkboxes.findIndex(_ => _.entity._id == id); let i = this.checkboxes.findIndex(_ => _.entity._id == id);
this.checkboxes[i].entity.isEnabled=this.toggleStatus; this.checkboxes[i].entity.isEnabled=this.toggleStatus;
} }
this.applyCheck(false); this.applyCheck(false);
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error) error => this.handleUpdateError('System error changing the status of the selected entity(-ies)', error)
); );
}
} }
} }

View File

@ -9,6 +9,9 @@ import { PageHelpContent } from "../../domain/page-help-content";
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'edit-page-help-content', selector: 'edit-page-help-content',
templateUrl: 'edit-page-help-content.component.html', templateUrl: 'edit-page-help-content.component.html',
@ -69,16 +72,21 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
} }
private getPageHelpContent(pageContentId: string) { private getPageHelpContent(pageContentId: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ""; console.info(this.router.url);
this.updateErrorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.errorMessage = "";
this.updateErrorMessage = "";
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe(
pageHelpContent => { pageHelpContent => {
this.updateForm(pageHelpContent); this.updateForm(pageHelpContent);
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving page help content', error)); error => this.handleError('System error retrieving page help content', error));
}
} }
private updateForm(pageHelpContent : PageHelpContent) { private updateForm(pageHelpContent : PageHelpContent) {
@ -89,6 +97,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
} }
private saveCustom() { 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) { if(this.formComponent.myForm.valid) {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -109,6 +121,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
} else { } else {
this.errorMessage = "Please fill all required fields"; this.errorMessage = "Please fill all required fields";
} }
}
} }
private cancelCustom() { private cancelCustom() {

View File

@ -8,6 +8,9 @@ import { PageHelpContent } from "../../domain/page-help-content";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'new-page-help-content', selector: 'new-page-help-content',
templateUrl: 'new-page-help-content.component.html', templateUrl: 'new-page-help-content.component.html',
@ -46,7 +49,10 @@ export class NewPageHelpContentComponent {
} }
private saveCustom() { 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; //this.errorMessage = null;
if(this.formComponent.myForm.valid) { if(this.formComponent.myForm.valid) {
@ -69,6 +75,7 @@ export class NewPageHelpContentComponent {
} else { } else {
this.errorMessage = "Please fill all required fields"; this.errorMessage = "Please fill all required fields";
} }
}
} }
private cancelCustom() { private cancelCustom() {

View File

@ -1,10 +1,12 @@
import { Component, OnInit, Input } from '@angular/core'; 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 { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { Page } from "../../domain/page"; import { Page } from "../../domain/page";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'page-content-form', selector: 'page-content-form',
@ -30,7 +32,7 @@ export class PageContentFormComponent implements OnInit{
public errorMessage: string = ''; public errorMessage: string = '';
@Input() updateErrorMessage: 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() { ngOnInit() {
this.myForm = this.form; this.myForm = this.form;
@ -38,12 +40,17 @@ export class PageContentFormComponent implements OnInit{
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe( if(!Session.isLoggedIn()){
pages => { console.info(this._router.url);
this.availablePages = pages; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.showLoading = false; } else {
}, this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe(
error => this.handleError('System error retrieving pages', error)); pages => {
this.availablePages = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error));
}
}); });
} }

View File

@ -3,16 +3,18 @@
*/ */
import { Component, ViewChild, OnInit } from '@angular/core'; import { Component, ViewChild, OnInit } from '@angular/core';
import { FormGroup } from "@angular/forms"; import { FormGroup } from "@angular/forms";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component"; import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } from "../../domain/page-help-content"; import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } from "../../domain/page-help-content";
import { Page } from "../../domain/page"; import { Page } from "../../domain/page";
import {Router} from "@angular/router";
import { Community } from "../../domain/community"; import { Community } from "../../domain/community";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {SafeHtmlPipe} from '../../openaireLibrary/utils/pipes/safeHTML.pipe'; 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({ @Component({
selector: 'page-help-contents', selector: 'page-help-contents',
templateUrl: './page-help-contents.component.html', templateUrl: './page-help-contents.component.html',
@ -86,32 +88,42 @@ export class PageHelpContentsComponent implements OnInit {
// this.formGroup = this.formComponent.form; // 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) { getPage(pageId: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.updateErrorMessage = ""; console.info(this.router.url);
this.errorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe( this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
page => { page => {
this.page = page; this.page = page;
this.getPageHelpContents(this.selectedCommunityPid); this.getPageHelpContents(this.selectedCommunityPid);
}, },
error => this.handleError('System error retrieving page', error)); error => this.handleError('System error retrieving page', error));
}
} }
getPages(community_pid: string) { getPages(community_pid: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.updateErrorMessage = ""; console.info(this.router.url);
this.errorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe( this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pages = pages; this.pages = pages;
this.getPageHelpContents(this.selectedCommunityPid); this.getPageHelpContents(this.selectedCommunityPid);
}, },
error => this.handleError('System error retrieving pages', error)); error => this.handleError('System error retrieving pages', error));
}
} }
public countPageHelpContents() { public countPageHelpContents() {
@ -128,6 +140,10 @@ export class PageHelpContentsComponent implements OnInit {
} }
getPageHelpContents(community_pid: string) { 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( this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
pageHelpContents => { pageHelpContents => {
this.pageHelpContents = pageHelpContents as Array<PageHelpContent>; this.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
@ -148,6 +164,7 @@ export class PageHelpContentsComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving page contents', error)); error => this.handleError('System error retrieving page contents', error));
}
} }
// public showModal():void { // public showModal():void {
@ -184,15 +201,24 @@ export class PageHelpContentsComponent implements OnInit {
} }
private confirmModalOpen() { private confirmModalOpen() {
this.alertModalDeletePageHelpContents.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeletePageHelpContents.okButton = true; console.info(this.router.url);
this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation"; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
this.alertModalDeletePageHelpContents.message = "Are you sure you want to delete the selected page content(s)?"; } else {
this.alertModalDeletePageHelpContents.okButtonText = "Yes"; this.alertModalDeletePageHelpContents.cancelButton = true;
this.alertModalDeletePageHelpContents.open(); this.alertModalDeletePageHelpContents.okButton = true;
this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation";
this.alertModalDeletePageHelpContents.message = "Are you sure you want to delete the selected page content(s)?";
this.alertModalDeletePageHelpContents.okButtonText = "Yes";
this.alertModalDeletePageHelpContents.open();
}
} }
public confirmedDeletePageHelpContents(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -203,6 +229,7 @@ export class PageHelpContentsComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected page content(s)', error) error => this.handleUpdateError('System error deleting the selected page content(s)', error)
); );
}
} }
private deletePageHelpContentsFromArray(ids : string[]) : void { private deletePageHelpContentsFromArray(ids : string[]) : void {
@ -225,6 +252,10 @@ export class PageHelpContentsComponent implements OnInit {
} }
public togglePageHelpContents(status : boolean, ids : string[]) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -242,6 +273,7 @@ export class PageHelpContentsComponent implements OnInit {
}, },
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
); );
}
} }
public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) { public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) {

View File

@ -10,6 +10,9 @@ import { HtmlPageContentFormComponent } from "./html-page-content-form.component
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import { Subscription } from "rxjs/Subscription"; import { Subscription } from "rxjs/Subscription";
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'edit-htmlpage-content', selector: 'edit-htmlpage-content',
templateUrl: './edit-htmlpage-content.component.html', templateUrl: './edit-htmlpage-content.component.html',
@ -74,27 +77,37 @@ export class EditHtmlPageContentComponent implements OnInit {
} }
private getPage(communityId: string, pageId: string) { private getPage(communityId: string, pageId: string) {
this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe( if(!Session.isLoggedIn()){
page => { console.info(this.router.url);
this.pageName = page.name; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
this.getHtmlPageContent(communityId, page.route); } else {
}, this._helpContentService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
error => this.handleError('System error retrieving page', error)); page => {
this.pageName = page.name;
this.getHtmlPageContent(communityId, page.route);
},
error => this.handleError('System error retrieving page', error));
}
} }
private getHtmlPageContent(communityId: string, pageRoute: string) { private getHtmlPageContent(communityId: string, pageRoute: string) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ""; console.info(this.router.url);
this.updateErrorMessage = ""; this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
} else {
this.showLoading = true;
this.errorMessage = "";
this.updateErrorMessage = "";
this._htmlContentService.getHtmlPageContent(communityId, pageRoute, this.properties.adminToolsAPIURL).subscribe( this._htmlContentService.getHtmlPageContent(communityId, pageRoute, this.properties.adminToolsAPIURL).subscribe(
htmlPageContent => { htmlPageContent => {
if(htmlPageContent.length > 0) { if(htmlPageContent.length > 0) {
this.updateForm(htmlPageContent[0]); this.updateForm(htmlPageContent[0]);
} }
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving page help content', error)); error => this.handleError('System error retrieving page help content', error));
}
} }
private updateForm(htmlPageContent : HtmlPageContent) { private updateForm(htmlPageContent : HtmlPageContent) {
@ -103,6 +116,10 @@ export class EditHtmlPageContentComponent implements OnInit {
} }
private saveCustom() { 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) { if(this.formComponent.myForm.valid) {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -124,6 +141,7 @@ export class EditHtmlPageContentComponent implements OnInit {
this.mode = "edit"; this.mode = "edit";
this.errorMessage = "Please fill all required fields"; this.errorMessage = "Please fill all required fields";
} }
}
} }
private cancelCustom() { private cancelCustom() {

View File

@ -2,12 +2,15 @@
* Created by stefania on 7/13/17. * Created by stefania on 7/13/17.
*/ */
import {Component, OnInit, Input} from '@angular/core'; 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 {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
import {Entity} from '../../domain/entity'; import {Entity} from '../../domain/entity';
import { HelpContentService } from "../../services/help-content.service"; import { HelpContentService } from "../../services/help-content.service";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; 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({ @Component({
selector: 'page-form', selector: 'page-form',
templateUrl: './page-form.component.html', templateUrl: './page-form.component.html',
@ -29,7 +32,7 @@ export class PageFormComponent implements OnInit{
public showLoading: boolean = false; public showLoading: boolean = false;
public errorMessage: string = ''; 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 { ngOnInit(): void {
this.route.data this.route.data
@ -39,49 +42,59 @@ export class PageFormComponent implements OnInit{
} }
public toggle() { public toggle() {
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed; 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) { if(!this.myForm.value.isCollapsed) {
let includedEntities: Set<String> = new Set<String>(); let includedEntities: Set<String> = new Set<String>();
for(let entityName of this.myForm.value.entities) { for(let entityName of this.myForm.value.entities) {
includedEntities.add(entityName._id); includedEntities.add(entityName._id);
}
let allEntities = this.allEntities;
let self = this;
allEntities.forEach(function (status, entity, map) {
if(includedEntities.has(entity._id)) {
self.allEntities.set(entity, true);
} else {
self.allEntities.set(entity, false);
} }
});
let allEntities = this.allEntities;
let self = this;
allEntities.forEach(function (status, entity, map) {
if(includedEntities.has(entity._id)) {
self.allEntities.set(entity, true);
} else {
self.allEntities.set(entity, false);
}
});
if(!this.gotEntities) { if(!this.gotEntities) {
this.gotEntities = true; this.gotEntities = true;
this.getEntities(includedEntities); this.getEntities(includedEntities);
}
} }
} }
} }
public getEntities(includedEntities: Set<String>) { public getEntities(includedEntities: Set<String>) {
this.showLoading = true; if(!Session.isLoggedIn()){
this.errorMessage = ""; 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._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => { entities => {
for(let entity of entities) { for(let entity of entities) {
if(includedEntities.has(entity._id)) { if(includedEntities.has(entity._id)) {
this.allEntities.set(entity, true); this.allEntities.set(entity, true);
} else { } else {
this.allEntities.set(entity, false); this.allEntities.set(entity, false);
}
} }
} this.showLoading = false;
this.showLoading = false; },
}, error => this.handleError('System error retrieving community entities', error));
error => this.handleError('System error retrieving community entities', error)); }
} }
public getKeys( map) { public getKeys( map) {
@ -128,21 +141,26 @@ export class PageFormComponent implements OnInit{
} }
public toggleEntity(status : boolean, id : string, entity: Entity) { public toggleEntity(status : boolean, id : string, entity: Entity) {
let index: number = -1; if(!Session.isLoggedIn()){
for(let i=0; i<this.myForm.get('entities').value.length; i++) { console.info(this._router.url);
if(this.myForm.get('entities').value[i]._id == entity._id) { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
index = i; } else {
break; 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) {
index = i;
break;
}
} }
}
this.allEntities.set(entity, status); this.allEntities.set(entity, status);
if(status && index<0) { if(status && index<0) {
this.myForm.value.entities.push(entity); this.myForm.value.entities.push(entity);
} else if(!status){ } else if(!status){
if(index >= 0) { if(index >= 0) {
this.myForm.value.entities.splice(index, 1); this.myForm.value.entities.splice(index, 1);
}
} }
} }
} }

View File

@ -134,10 +134,10 @@
<!-- <fab *ngIf="isPortalAdministrator" (clicked)="showModal()"></fab> --> <!-- <fab *ngIf="isPortalAdministrator" (clicked)="showModal()"></fab> -->
<fab *ngIf="isPortalAdministrator" (clicked)="newPage()"></fab> <fab *ngIf="isPortalAdministrator" (clicked)="newPage()"></fab>
</div> </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)"> [isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleUpdateError($event)">
<page-form [group]="formGroup"></page-form> <page-form [group]="formGroup"></page-form>
</modal-form> </modal-form> -->
<!--<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'" <!--<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleUpdateError($event)"> [isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleUpdateError($event)">

View File

@ -2,7 +2,7 @@
* Created by stefania on 7/13/17. * Created by stefania on 7/13/17.
*/ */
import { Component, ViewChild, OnInit } from '@angular/core'; 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 { HelpContentService } from "../../services/help-content.service";
import { FormGroup } from "@angular/forms"; import { FormGroup } from "@angular/forms";
import { ModalFormComponent } from "../modal-form.component"; import { ModalFormComponent } from "../modal-form.component";
@ -13,6 +13,7 @@ import { Community } from "../../domain/community";
import { Entity } from "../../domain/entity"; import { Entity } from "../../domain/entity";
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties'; import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
import {Session} from '../../openaireLibrary/login/utils/helper.class'; import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'pages', 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) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
this.errorMessage = ""; this.errorMessage = "";
@ -107,15 +112,21 @@ export class PagesComponent implements OnInit {
}, },
error => this.handleError('System error retrieving pages', error) error => this.handleError('System error retrieving pages', error)
); );
}
} }
getPagesWithDivIds(community_pid: string) { getPagesWithDivIds(community_pid: string) {
this._helpContentService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe( if(!Session.isLoggedIn()){
pages => { console.info(this._router.url);
this.pageWithDivIds = pages; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.showLoading = false; } else {
}, this._helpContentService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
error => this.handleError('System error retrieving information about pages\' classes', error)); pages => {
this.pageWithDivIds = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving information about pages\' classes', error));
}
} }
pagesReturned(pages: Page[]) { pagesReturned(pages: Page[]) {
@ -179,15 +190,24 @@ export class PagesComponent implements OnInit {
} }
private confirmModalOpen() { private confirmModalOpen() {
this.alertModalDeletePages.cancelButton = true; if(!Session.isLoggedIn()){
this.alertModalDeletePages.okButton = true; console.info(this._router.url);
this.alertModalDeletePages.alertTitle = "Delete Confirmation"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.alertModalDeletePages.message = "Are you sure you want to delete the selected page(s)?"; } else {
this.alertModalDeletePages.okButtonText = "Yes"; this.alertModalDeletePages.cancelButton = true;
this.alertModalDeletePages.open(); this.alertModalDeletePages.okButton = true;
this.alertModalDeletePages.alertTitle = "Delete Confirmation";
this.alertModalDeletePages.message = "Are you sure you want to delete the selected page(s)?";
this.alertModalDeletePages.okButtonText = "Yes";
this.alertModalDeletePages.open();
}
} }
public confirmedDeletePages(data: any) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -198,6 +218,7 @@ export class PagesComponent implements OnInit {
}, },
error => this.handleUpdateError('System error deleting the selected pages', error) error => this.handleUpdateError('System error deleting the selected pages', error)
); );
}
} }
public editPage(i : number) { public editPage(i : number) {
@ -218,39 +239,54 @@ export class PagesComponent implements OnInit {
} }
private pagesModalOpen(modal: any, title: string, yesBtn: string) { private pagesModalOpen(modal: any, title: string, yesBtn: string) {
modal.cancelButton = true; if(!Session.isLoggedIn()){
modal.okButton = true; console.info(this._router.url);
modal.alertTitle = title; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
modal.okButtonText = yesBtn; } else {
modal.open(); modal.cancelButton = true;
modal.okButton = true;
modal.alertTitle = title;
modal.okButtonText = yesBtn;
modal.open();
}
} }
public pageSaveConfirmed(data: any) { public pageSaveConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.pagesModalOpen(this.alertModalSavePage, "Save", "Add a new Page"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this.modalErrorMessage = ""; if(!this.formGroup.valid) {
this._helpContentService.savePage(<Page> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( this.pagesModalOpen(this.alertModalSavePage, "Save", "Add a new Page");
page => { this.modalErrorMessage = "Please fill in all required fields marked with *";
this.pageSavedSuccessfully(page); } else {
}, this.modalErrorMessage = "";
error => this.handleUpdateError("System error creating page", error) this._helpContentService.savePage(<Page> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); page => {
this.pageSavedSuccessfully(page);
},
error => this.handleUpdateError("System error creating page", error)
);
}
} }
} }
public pageUpdateConfirmed(data: any) { public pageUpdateConfirmed(data: any) {
if(!this.formGroup.valid) { if(!Session.isLoggedIn()){
this.pagesModalOpen(this.alertModalUpdatePage, "Update", "Update Page"); console.info(this._router.url);
this.modalErrorMessage = "Please fill in all required fields marked with *"; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else { } else {
this._helpContentService.updatePage(<Page> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe( if(!this.formGroup.valid) {
page => { this.pagesModalOpen(this.alertModalUpdatePage, "Update", "Update Page");
this.pageUpdatedSuccessfully(page); this.modalErrorMessage = "Please fill in all required fields marked with *";
}, } else {
error => this.handleUpdateError("System error updating page", error) this._helpContentService.updatePage(<Page> this.formGroup.value, this.properties.adminToolsAPIURL).subscribe(
); page => {
this.pageUpdatedSuccessfully(page);
},
error => this.handleUpdateError("System error updating page", error)
);
}
} }
} }
@ -317,6 +353,10 @@ export class PagesComponent implements OnInit {
} }
public togglePages(status : boolean, ids : string[]) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -331,6 +371,7 @@ export class PagesComponent implements OnInit {
}, },
error => this.handleUpdateError('System error changing the status of the selected page(s)', error) error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
); );
}
} }
public capitalizeFirstLetter(str: string) { public capitalizeFirstLetter(str: string) {

View File

@ -1,6 +1,6 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {HelpContentService} from '../../services/help-content.service'; 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 {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import { Community } from '../../domain/community'; import { Community } from '../../domain/community';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
@ -9,6 +9,9 @@ import {availableEntitiesMap, StatisticsDisplay, StatisticsSummary} from '../../
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
import {ConfigurationService} from '../../openaireLibrary/utils/configuration/configuration.service'; 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({ @Component({
selector: 'stats', selector: 'stats',
templateUrl: 'stats.component.html' templateUrl: 'stats.component.html'
@ -46,6 +49,7 @@ export class StatsComponent implements OnInit {
constructor(private contentService: HelpContentService, constructor(private contentService: HelpContentService,
private configService: ConfigurationService, private configService: ConfigurationService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
private titleCase: TitleCasePipe) {} private titleCase: TitleCasePipe) {}
@ -64,6 +68,10 @@ export class StatsComponent implements OnInit {
} }
getStatistics() { 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.loadingMessage = 'Retrieving statistics';
// this.errorMessage = ''; // this.errorMessage = '';
this.showLoading = true; this.showLoading = true;
@ -92,9 +100,14 @@ export class StatsComponent implements OnInit {
this.getDisplayOptions(); this.getDisplayOptions();
} }
); );
}
} }
getDisplayOptions() { 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) this.contentService.getCommunityAdminStatisticsChoices(this.properties.adminToolsAPIURL, this.communityId)
.subscribe( .subscribe(
res => { res => {
@ -108,9 +121,14 @@ export class StatsComponent implements OnInit {
this.getCommunityInfo(); this.getCommunityInfo();
} }
); );
}
} }
getCommunityInfo() { 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}`); console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
this.configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe( this.configService.getCommunityInformation(this.properties.adminToolsAPIURL, this.communityId).subscribe(
res => { res => {
@ -123,9 +141,14 @@ export class StatsComponent implements OnInit {
this.onChangeEntity(this.entitiesList[0]); this.onChangeEntity(this.entitiesList[0]);
} }
); );
}
} }
onChangeEntity (entity: string) { 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.showLoading = true;
this.deactivatedEntity = false; this.deactivatedEntity = false;
@ -156,6 +179,7 @@ export class StatsComponent implements OnInit {
} }
this.showLoading = false; this.showLoading = false;
}
} }
changeDisplayedProjectChart(chartName: string) { changeDisplayedProjectChart(chartName: string) {
@ -190,6 +214,10 @@ export class StatsComponent implements OnInit {
} }
toggleShowAllInMonitor(entity: string) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -304,10 +332,14 @@ export class StatsComponent implements OnInit {
this.loadingMessage = ''; this.loadingMessage = '';
} }
);*/ );*/
}
} }
toggleShowAllInDashboard(entity: string) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -376,9 +408,14 @@ export class StatsComponent implements OnInit {
); );
} }
); );
}
} }
toggleShowInMonitor(entity: string, chartsOrNumbers: string, title: string) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -397,9 +434,14 @@ export class StatsComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
} }
); );
}
} }
toggleShowInDashboard(entity: string, chartsOrNumbers: string, title: string) { 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.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -418,6 +460,7 @@ export class StatsComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
} }
); );
}
} }
getCamelCaseString (inputString: string) { getCamelCaseString (inputString: string) {

View File

@ -5,11 +5,15 @@ import {ActivatedRoute, Router} from '@angular/router';
import {HelpContentService} from "../../../services/help-content.service"; import {HelpContentService} from "../../../services/help-content.service";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service"; import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {SubjectsService} from "../subjects.service" import {SubjectsService} from "../subjects.service"
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
import { concat } from 'rxjs/observable/concat';
import {Session} from '../../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class';
import { concat } from 'rxjs/observable/concat';
@Component({ @Component({
selector: 'subjects-edit-form', selector: 'subjects-edit-form',
templateUrl: './subjects-edit-form.component.html', templateUrl: './subjects-edit-form.component.html',
@ -56,26 +60,31 @@ export class SubjectsEditFormComponent implements OnInit{
communityId => { communityId => {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId != '') { if(!Session.isLoggedIn()){
this.showLoading = true; console.info(this._router.url);
this.updateErrorMessage = ""; this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.errorMessage = ""; } else {
if (this.communityId != null && this.communityId != '') {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe ( this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => { community => {
this.community = community; this.community = community;
this.params = {community: encodeURIComponent('"' + community.queryId + '"')}; this.params = {community: encodeURIComponent('"' + community.queryId + '"')};
this.originalSubjects = []; this.originalSubjects = [];
for (var i = 0; i < this.community.subjects.length; i++) { for (var i = 0; i < this.community.subjects.length; i++) {
this.originalSubjects.push(this.community.subjects[i]); this.originalSubjects.push(this.community.subjects[i]);
} }
if (this.community.subjects.length == 0) { if (this.community.subjects.length == 0) {
this.community.subjects.push(""); this.community.subjects.push("");
} }
this.showLoading = false; this.showLoading = false;
}, },
error => this.handleError('System error retrieving community profile', error) error => this.handleError('System error retrieving community profile', error)
); );
}
} }
}); });
}); });
@ -84,14 +93,28 @@ export class SubjectsEditFormComponent implements OnInit{
public addSubject() { 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(""); this.community.subjects.push("");
}
} }
public removeSubject(i: any) { 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); this.community.subjects.splice(i, 1);
}
} }
public resetForm(communityId: string) { 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 != '') { if (communityId != null && communityId != '') {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ""; this.updateErrorMessage = "";
@ -108,6 +131,7 @@ export class SubjectsEditFormComponent implements OnInit{
); );
} }
this.resetChange(); this.resetChange();
}
} }
// save(newValue){ // save(newValue){
@ -142,7 +166,10 @@ export class SubjectsEditFormComponent implements OnInit{
} }
public updateSubjects() { 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 != '') { if (this.communityId != null && this.communityId != '') {
this.showLoading = true; this.showLoading = true;
var subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(this.originalSubjects, this.community.subjects); var subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(this.originalSubjects, this.community.subjects);
@ -182,6 +209,7 @@ export class SubjectsEditFormComponent implements OnInit{
} }
this.resetChange(); this.resetChange();
}
} }
afterUpdateActions(res){ afterUpdateActions(res){
this.community.subjects = res["subjects"]; this.community.subjects = res["subjects"];

View File

@ -13,6 +13,8 @@ import {RouterHelper} from '../../openaireLib
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; 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({ @Component({
selector: 'manage-subscribers', selector: 'manage-subscribers',
@ -172,6 +174,10 @@ export class ManageSubscribersComponent implements OnInit {
} }
public goTo(page:number = 1) { 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; this.subscribersSearchUtils.page=page;
var table = $('#dpTable').DataTable(); var table = $('#dpTable').DataTable();
@ -180,6 +186,7 @@ export class ManageSubscribersComponent implements OnInit {
var info = table.page.info(); var info = table.page.info();
console.info("records: "+info.recordsDisplay); console.info("records: "+info.recordsDisplay);
this.subscribersSearchUtils.totalResults = info.recordsDisplay; this.subscribersSearchUtils.totalResults = info.recordsDisplay;
}
} }
totalPages(): number { totalPages(): number {
@ -191,6 +198,10 @@ export class ManageSubscribersComponent implements OnInit {
} }
public removeSubscriber(email:string) { 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.selectedSubscriberEmail = email;
this.alertModalDeleteSubscriber.cancelButton = true; this.alertModalDeleteSubscriber.cancelButton = true;
this.alertModalDeleteSubscriber.okButton = true; this.alertModalDeleteSubscriber.okButton = true;
@ -204,9 +215,14 @@ export class ManageSubscribersComponent implements OnInit {
this.alertModalDeleteSubscriber.message += "will be removed from your community. Are you sure?"; this.alertModalDeleteSubscriber.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteSubscriber.okButtonText = "Yes"; this.alertModalDeleteSubscriber.okButtonText = "Yes";
this.alertModalDeleteSubscriber.open(); this.alertModalDeleteSubscriber.open();
}
} }
public confirmedDeleteSubscriber() { 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); console.info("REMOVE: "+ this.selectedSubscriberEmail);
this.subRemove = this._subscribeService.unSubscribeToCommunity(this.communityId, this.selectedSubscriberEmail, this.properties.adminToolsAPIURL).subscribe( this.subRemove = this._subscribeService.unSubscribeToCommunity(this.communityId, this.selectedSubscriberEmail, this.properties.adminToolsAPIURL).subscribe(
result => { result => {
@ -229,9 +245,14 @@ export class ManageSubscribersComponent implements OnInit {
this.rerender(); this.rerender();
} }
) )
}
} }
public _getCommunitySubscribers(){ 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.subscribersSearchUtils.status = this.errorCodes.LOADING;
this.disableForms = true; this.disableForms = true;
this.communitySubscribers = []; this.communitySubscribers = [];
@ -286,5 +307,6 @@ export class ManageSubscribersComponent implements OnInit {
} }
} }
); );
}
} }
} }

View File

@ -11,6 +11,9 @@ import {SearchUtilsClass} from '../../openaireLib
import {ManageZenodoCommunitiesService} from './manage-zenodo-communities.service'; import {ManageZenodoCommunitiesService} from './manage-zenodo-communities.service';
import {ZenodoCommunityInfo} from './zenodoCommunity/zenodoCommunityInfo'; import {ZenodoCommunityInfo} from './zenodoCommunity/zenodoCommunityInfo';
import {Session} from '../../openaireLibrary/login/utils/helper.class';
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class';
@Component({ @Component({
selector: 'manage-zenodo-communities', selector: 'manage-zenodo-communities',
templateUrl: './manage-zenodo-communities.component.html', templateUrl: './manage-zenodo-communities.component.html',
@ -44,19 +47,24 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
if (this.communityId != null && this.communityId != '') { if(!Session.isLoggedIn()){
this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe( console.info(this._router.url);
zenodoCommunities => { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
this.zenodoCommunities = zenodoCommunities; } else {
console.log(zenodoCommunities); if (this.communityId != null && this.communityId != '') {
console.log(this.zenodoCommunitySearchUtils.page); this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
}); zenodoCommunities => {
this._manageΖenodoCommunitieService.getTotalZenodoCommunities(this.properties, this.properties.zenodoCommunities).subscribe( this.zenodoCommunities = zenodoCommunities;
totalZenodoCommunities => { console.log(zenodoCommunities);
this.totalZenodoCommunities = totalZenodoCommunities; console.log(this.zenodoCommunitySearchUtils.page);
this.zenodoCommunitySearchUtils.totalResults = totalZenodoCommunities; });
console.log(totalZenodoCommunities); this._manageΖenodoCommunitieService.getTotalZenodoCommunities(this.properties, this.properties.zenodoCommunities).subscribe(
}); totalZenodoCommunities => {
this.totalZenodoCommunities = totalZenodoCommunities;
this.zenodoCommunitySearchUtils.totalResults = totalZenodoCommunities;
console.log(totalZenodoCommunities);
});
}
} }
}); });
}); });
@ -65,6 +73,10 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
} }
public search() { 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; this.zenodoCommunitySearchUtils.page = 1;
if (this.communityId != null && this.communityId != '') { 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( this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?q="+this.zenodoCommunitySearchUtils.keyword+"&page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
@ -73,9 +85,14 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
console.log(zenodoCommunities); console.log(zenodoCommunities);
}); });
} }
}
} }
public goTo(page:number = 1) { 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; this.zenodoCommunitySearchUtils.page=page;
console.log("Page is: "+page); console.log("Page is: "+page);
this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe( this._manageΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
@ -84,6 +101,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
console.log(zenodoCommunities); console.log(zenodoCommunities);
console.log(this.zenodoCommunitySearchUtils.page); console.log(this.zenodoCommunitySearchUtils.page);
}); });
}
} }
totalPages(): number { totalPages(): number {