diff --git a/dashboard/entity/entities.component.html b/dashboard/entity/entities.component.html index 79cf5f9f..391abca7 100644 --- a/dashboard/entity/entities.component.html +++ b/dashboard/entity/entities.component.html @@ -1,6 +1,6 @@
- +
    diff --git a/dashboard/entity/entities.component.ts b/dashboard/entity/entities.component.ts index 823d6199..b6600429 100644 --- a/dashboard/entity/entities.component.ts +++ b/dashboard/entity/entities.component.ts @@ -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); diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html index a65aee4a..ff96afbc 100644 --- a/dashboard/page/pages.component.html +++ b/dashboard/page/pages.component.html @@ -1,6 +1,6 @@
    - +
    diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts index 72a02567..d2eb2e5f 100644 --- a/dashboard/page/pages.component.ts +++ b/dashboard/page/pages.component.ts @@ -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);