[Library | Trunk]: Rename community to portal in pages and entities

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60297 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-01-26 17:00:40 +00:00
parent 8ca5f8e411
commit d8fca31d81
4 changed files with 41 additions and 39 deletions

View File

@ -1,6 +1,6 @@
<div page-content class="admin-pages"> <div page-content class="admin-pages">
<div header> <div header>
<admin-tabs tab="entity" [portal]="selectedCommunityPid"></admin-tabs> <admin-tabs tab="entity" [portal]="portal"></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid> <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1"> <div class="uk-width-1-1">
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill"> <ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill">

View File

@ -34,7 +34,7 @@ export class EntitiesComponent implements OnInit {
public keyword = ''; public keyword = '';
public communities: Portal[] = []; public communities: Portal[] = [];
public selectedCommunityPid: string; public portal: string;
@ViewChild('AlertModalRelatedPages') alertModalRelatedPages; @ViewChild('AlertModalRelatedPages') alertModalRelatedPages;
@ -75,10 +75,12 @@ export class EntitiesComponent implements OnInit {
this.applyStatusFilter(); this.applyStatusFilter();
})); }));
this.userManagementService.getUserInfo().subscribe(user => { this.userManagementService.getUserInfo().subscribe(user => {
this.selectedCommunityPid = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
ConnectHelper.setPortalTypeFromPid(this.selectedCommunityPid ); if(this.portal === 'connect' || this.portal === 'explore') {
this.applyCommunityFilter(this.selectedCommunityPid); ConnectHelper.setPortalTypeFromPid(this.portal);
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid; }
this.applyPortalFilter(this.portal);
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
}); });
@ -94,7 +96,7 @@ export class EntitiesComponent implements OnInit {
}); });
} }
getEntities(community_pid: string) { getEntities(portal: string) {
if (!Session.isLoggedIn()) { if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], this._router.navigate(['/user-info'],
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}}); {queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
@ -102,8 +104,8 @@ export class EntitiesComponent implements OnInit {
this.showLoading = true; this.showLoading = true;
this.updateErrorMessage = ''; this.updateErrorMessage = '';
this.errorMessage = ''; this.errorMessage = '';
if (community_pid) { if (portal) {
this._helpContentService.getCommunityEntities(community_pid, this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getCommunityEntities(portal, this.properties.adminToolsAPIURL).subscribe(
entities => { entities => {
this.entities = entities; this.entities = entities;
this.checkboxes = []; this.checkboxes = [];
@ -321,8 +323,8 @@ export class EntitiesComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
} }
public applyCommunityFilter(community_pid: string) { public applyPortalFilter(portal: string) {
this.getEntities(community_pid); this.getEntities(portal);
} }
public toggleEntities(status: boolean, ids: string[]) { public toggleEntities(status: boolean, ids: string[]) {
@ -353,7 +355,7 @@ export class EntitiesComponent implements OnInit {
} else { } else {
this.updateErrorMessage = ''; this.updateErrorMessage = '';
this._helpContentService.toggleEntities( this._helpContentService.toggleEntities(
this.selectedCommunityPid, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe( this.portal, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
() => { () => {
for (let id of this.toggleIds) { for (let id of this.toggleIds) {
const i = this.checkboxes.findIndex(_ => _.entity._id === id); const i = this.checkboxes.findIndex(_ => _.entity._id === id);

View File

@ -1,6 +1,6 @@
<div page-content class="admin-pages"> <div page-content class="admin-pages">
<div header> <div header>
<admin-tabs tab="page" [portal]="selectedCommunityPid"></admin-tabs> <admin-tabs tab="page" [portal]="portal"></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid> <div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1"> <div class="uk-width-1-1">
<ul class="uk-subnav uk-subnav-pill"> <ul class="uk-subnav uk-subnav-pill">
@ -84,7 +84,7 @@
<div class=" uk-margin-small-bottom"><span class="title">Route: </span> {{check.page.route}}</div> <div class=" uk-margin-small-bottom"><span class="title">Route: </span> {{check.page.route}}</div>
<div *ngIf="!pagesType" class=" uk-margin-small-bottom"><span <div *ngIf="!pagesType" class=" uk-margin-small-bottom"><span
class="title">Type: </span> {{check.page.type}}</div> class="title">Type: </span> {{check.page.type}}</div>
<div *ngIf="!selectedCommunityPid" class=" uk-margin-small-bottom"> <div *ngIf="!portal" class=" uk-margin-small-bottom">
<span class="title">Portal type: </span>{{check.page.portalType}} <span class="title">Portal type: </span>{{check.page.portalType}}
</div> </div>
</div> </div>
@ -101,14 +101,14 @@
<div class=" uk-margin-small-bottom"> <div class=" uk-margin-small-bottom">
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right" <a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents" class="helpContents"
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" [queryParams]="{communityId: portal, pageId: check.page._id}"
routerLink="../../helptexts"> routerLink="../../helptexts">
manage help texts manage help texts
</a> </a>
</div> </div>
<div> <div>
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents" <a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents"
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" [queryParams]="{communityId: portal, pageId: check.page._id}"
routerLink="../../classContents">manage class contents</a> routerLink="../../classContents">manage class contents</a>
</div> </div>
</div> </div>

View File

@ -40,9 +40,7 @@ export class PagesComponent implements OnInit {
private searchText: RegExp = new RegExp(''); private searchText: RegExp = new RegExp('');
public keyword: string = ''; public keyword: string = '';
public communities: Portal[] = []; public portal: string;
public selectedCommunityPid: string;
public pagesType: string; public pagesType: string;
public properties: EnvProperties = null; public properties: EnvProperties = null;
@ -106,12 +104,14 @@ export class PagesComponent implements OnInit {
// this.pagesType = params['type']; // this.pagesType = params['type'];
this.filterForm.get('type').setValue(params['type']); this.filterForm.get('type').setValue(params['type']);
} }
this.selectedCommunityPid = (this.route.snapshot.data.portal)?this.route.snapshot.data.portal:this.route.snapshot.params[this.route.snapshot.data.param]; this.portal = (this.route.snapshot.data.portal)?this.route.snapshot.data.portal:this.route.snapshot.params[this.route.snapshot.data.param];
ConnectHelper.setPortalTypeFromPid(this.selectedCommunityPid); if(this.portal === 'connect' || this.portal === 'explore') {
ConnectHelper.setPortalTypeFromPid(this.portal);
}
this.keyword = ''; this.keyword = '';
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.applyCommunityFilter(this.selectedCommunityPid); this.applyPortalFilter(this.portal);
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid; this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal;
})); }));
})); }));
@ -135,7 +135,7 @@ export class PagesComponent implements OnInit {
}); });
} }
getPages(community_pid: string) { getPages(portal: string) {
if (!Session.isLoggedIn()) { if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
@ -154,12 +154,12 @@ export class PagesComponent implements OnInit {
if (this.pagesType) { if (this.pagesType) {
parameters = '?page_type=' + this.pagesType; parameters = '?page_type=' + this.pagesType;
} }
if (community_pid) { if (portal) {
this.subscriptions.push(this._helpContentService.getCommunityPagesByType(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._helpContentService.getCommunityPagesByType(portal, parameters, this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pagesReturned(pages); this.pagesReturned(pages);
//if(!this.pagesType || this.pagesType == "link") { //if(!this.pagesType || this.pagesType == "link") {
this.getPagesWithDivIds(community_pid); this.getPagesWithDivIds(portal);
//} else { //} else {
//this.showLoading = false; //this.showLoading = false;
//} //}
@ -178,7 +178,7 @@ export class PagesComponent implements OnInit {
} }
} }
getPagesWithDivIds(community_pid: string) { getPagesWithDivIds(portal: string) {
if (!Session.isLoggedIn()) { if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], { this._router.navigate(['/user-info'], {
queryParams: { queryParams: {
@ -187,7 +187,7 @@ export class PagesComponent implements OnInit {
} }
}); });
} else { } else {
this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(portal, this.properties.adminToolsAPIURL).subscribe(
pages => { pages => {
this.pageWithDivIds = pages; this.pageWithDivIds = pages;
this.showLoading = false; this.showLoading = false;
@ -208,13 +208,13 @@ export class PagesComponent implements OnInit {
} }
/* /*
getCommunities() { getPortals() {
this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe( this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
communities => { communities => {
this.communities = communities; this.communities = communities;
this.selectedCommunityPid = this.communities[0].pid; this.portal = this.communities[0].pid;
this.getPages(this.selectedCommunityPid); this.getPages(this.portal);
this.getPagesWithDivIds(this.selectedCommunityPid); this.getPagesWithDivIds(this.portal);
}, },
error => this.handleError('System error retrieving communities', error)); error => this.handleError('System error retrieving communities', error));
} }
@ -492,13 +492,13 @@ export class PagesComponent implements OnInit {
this.showLoading = false; this.showLoading = false;
} }
// public filterByCommunity(event: any) { // public filterByPortal(event: any) {
// this.selectedCommunityPid = event.target.value; // this.portal = event.target.value;
// this.applyCommunityFilter(this.selectedCommunityPid); // this.applyPortalFilter(this.portal);
// } // }
public applyCommunityFilter(community_pid: string) { public applyPortalFilter(portal: string) {
this.getPages(community_pid); this.getPages(portal);
} }
public togglePages(status: boolean, ids: string[]) { public togglePages(status: boolean, ids: string[]) {
@ -512,7 +512,7 @@ export class PagesComponent implements OnInit {
} else { } else {
this.updateErrorMessage = ''; this.updateErrorMessage = '';
this.subscriptions.push(this._helpContentService.togglePages(this.selectedCommunityPid, ids, status, this.properties.adminToolsAPIURL).subscribe( this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe(
() => { () => {
for (let id of ids) { for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.page._id == id); let i = this.checkboxes.findIndex(_ => _.page._id == id);