[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 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 class="uk-width-1-1">
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill">

View File

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

View File

@ -1,6 +1,6 @@
<div page-content class="admin-pages">
<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 class="uk-width-1-1">
<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 *ngIf="!pagesType" class=" uk-margin-small-bottom"><span
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}}
</div>
</div>
@ -101,14 +101,14 @@
<div class=" uk-margin-small-bottom">
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents"
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
[queryParams]="{communityId: portal, pageId: check.page._id}"
routerLink="../../helptexts">
manage help texts
</a>
</div>
<div>
<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>
</div>
</div>

View File

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