helper service: for monitor routes /_alias_/search_route split to remove alias

input: add check aboutlabel for checkbox
SideBar: add uk-bav-parent for sub menus


Piwik:
	- Search-download: get piwikId as input
	- Search page: pass piwik id in search download component
	- project landing - pass piwik id

Dashboard- Admin tools:
	- remove Guards from modules
	- add subscriptions array and unsubscribe them
	- read properties directly from file
	- update links to be relative



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60170 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-12-18 15:09:38 +00:00
parent 8d1eeefa33
commit 8e4c151640
24 changed files with 216 additions and 211 deletions

View File

@ -1,10 +1,9 @@
import { NgModule } from '@angular/core';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {DivIdsComponent} from './divIds.component';
import {AdminLoginGuard} from "../../login/adminLoginGuard.guard";
import {AdminToolServiceModule} from "../../services/adminToolService.module";
import {InputModule} from "../../sharedComponents/input/input.module";
@ -14,6 +13,7 @@ import {MatCheckboxModule, MatFormFieldModule} from "@angular/material";
import {MatChipsModule} from '@angular/material/chips';
@NgModule({
imports: [
CommonModule, RouterModule, FormsModule,
@ -21,7 +21,6 @@ import {MatChipsModule} from '@angular/material/chips';
MatCheckboxModule
],
declarations: [DivIdsComponent],
providers: [AdminLoginGuard],
exports: [DivIdsComponent]
})
export class DivIdsModule { }

View File

@ -19,7 +19,6 @@ import {InputModule} from "../../sharedComponents/input/input.module";
declarations: [
DivHelpContentsComponent
],
providers: [IsCommunity, ConnectAdminLoginGuard],
exports: [DivHelpContentsComponent]
})
export class DivHelpContentsModule { }

View File

@ -1,8 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
import {EditDivHelpContentComponent} from './edit-div-help-content.component';
import {DivHelpContentFormModule} from './div-help-content-form.module';
import {AdminToolServiceModule} from "../../services/adminToolService.module";
@ -15,7 +13,6 @@ import {AdminToolServiceModule} from "../../services/adminToolService.module";
declarations: [
EditDivHelpContentComponent
],
providers: [IsCommunity, ConnectAdminLoginGuard],
exports: [EditDivHelpContentComponent]
})
export class EditDivHelpContentModule { }

View File

@ -1,8 +1,6 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
import {NewDivHelpContentComponent} from './new-div-help-content.component';
import {DivHelpContentFormModule} from './div-help-content-form.module';
import {AdminToolServiceModule} from "../../services/adminToolService.module";
@ -15,7 +13,6 @@ import {AdminToolServiceModule} from "../../services/adminToolService.module";
declarations: [
NewDivHelpContentComponent
],
providers: [IsCommunity, ConnectAdminLoginGuard],
exports: [NewDivHelpContentComponent]
})
export class NewDivHelpContentModule { }

View File

@ -1,11 +1,10 @@
import { NgModule } from '@angular/core';
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {EntitiesComponent} from './entities.component';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {MatSlideToggleModule} from '@angular/material';
import {IsCommunityOrAdmin} from '../../connect/communityGuard/isCommunityOrAdmin';
import {AdminToolServiceModule} from "../../services/adminToolService.module";
import {InputModule} from "../../sharedComponents/input/input.module";
@ -15,7 +14,6 @@ import {InputModule} from "../../sharedComponents/input/input.module";
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule
],
declarations: [EntitiesComponent],
providers: [IsCommunityOrAdmin],
exports: [EntitiesComponent]
})
export class EntitiesModule { }

View File

@ -1,4 +1,5 @@
<div id="page_content_inner">
<div id="page_content">
<div id="page_content_inner">
<div id="editPageHelpContent" class="uk-card uk-card-default uk-padding">
<div id="content">
@ -28,3 +29,4 @@
</div>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
import { Component, ViewChild, OnInit, OnDestroy, ElementRef } from '@angular/core';
import { PageContentFormComponent } from "./page-help-content-form.component";
import { Subscription } from "rxjs";
import {Subscriber, Subscription} from "rxjs";
import { HelpContentService } from "../../services/help-content.service";
import { PageHelpContent } from "../../utils/entities/adminTool/page-help-content";
import { ActivatedRoute, Router } from "@angular/router";
@ -27,7 +27,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
public pageId: string;
public page: Page;
private sub: Subscription;
private subs: Subscription[]=[];
private pageHelpContent: PageHelpContent;
@ -45,26 +45,28 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
private _helpContentService: HelpContentService) {}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
let pageContentId = params['pageContentId'];
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
this.properties = properties;
this.subs.push(this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
if(!pageContentId) {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
}
let pageContentId = params['pageContentId'];
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
this.getPageHelpContent(pageContentId);
});
});
if(!pageContentId) {
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route});
}
this.getPageHelpContent(pageContentId);
}));
}
ngOnDestroy() {
this.sub.unsubscribe();
this.subs.forEach(value => {
if (value instanceof Subscriber) {
value.unsubscribe();
}
});
}
handleError(message: string, error) {
@ -80,10 +82,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
}
private getPage(pageId: string) {
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
this.subs.push(this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
page => {
if(this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid} , relativeTo: this.route});
} else {
this.page = page;
this.formComponent.setPlacements(this.page);
@ -91,7 +93,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
}
},
error => this.handleError('System error retrieving page with id: '+pageId, error)
);
));
}
private getPageHelpContent(pageContentId: string) {
@ -102,10 +104,10 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.errorMessage = "";
this.updateErrorMessage = "";
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
this.subs.push(this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
pageHelpContent => {
if(this.pageId && this.pageId != pageHelpContent.page) {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid} , relativeTo: this.route});
} else if(this.pageId) {
this.getPage(this.pageId);
} else {
@ -114,7 +116,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.updateForm(pageHelpContent);
//this.showLoading = false;
},
error => this.handleError('System error retrieving page help content', error));
error => this.handleError('System error retrieving page help content', error)));
}
}
@ -133,17 +135,17 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.updateErrorMessage = "";
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
this._helpContentService.updatePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
this.subs.push(this._helpContentService.updatePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
_ => {
if(this.pageId) {
this.router.navigate( ['/pageContents/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId }, relativeTo: this.route } );
} else {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} } );
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route } );
}
this.showLoading = false;
},
err => this.handleUpdateError('System error updating page content', err)
);
));
} else {
this.errorMessage = "Please fill all required fields";
}
@ -155,9 +157,9 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
this.updateErrorMessage = "";
if(this.pageId) {
this.router.navigate( ['/helptexts/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId }, relativeTo: this.route } );
} else {
this.router.navigate(['/helptexts'], { queryParams: { "communityId": this.communityPid} } );
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route } );
}
}
}

View File

@ -1,3 +1,4 @@
<div id="page_content">
<div id="page_content_inner">
<div id="newPageHelpContent" class="uk-card uk-card-default uk-padding">
@ -29,3 +30,4 @@
</div>
</div>
</div>
</div>

View File

@ -10,6 +10,7 @@ import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {Page} from "../../utils/entities/adminTool/page";
import {properties} from "../../../../environments/environment";
import {Subscriber, Subscription} from "rxjs";
@Component({
selector: 'new-page-help-content',
@ -33,7 +34,7 @@ export class NewPageHelpContentComponent {
public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
private subs: Subscription[]=[];
constructor(
private element: ElementRef,
private route: ActivatedRoute,
@ -41,29 +42,33 @@ export class NewPageHelpContentComponent {
private _helpContentService: HelpContentService) {}
ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
this.properties = properties;
this.subs.push(this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
if(this.pageId) {
this.getPage(this.pageId);
} else {
this.showLoading = false;
}
});
});
this.communityPid = params['communityId'];
this.pageId = params['pageId'];
if(this.pageId) {
this.getPage(this.pageId);
} else {
this.showLoading = false;
}
}));
}
ngOnDestroy() {
this.subs.forEach(value => {
if (value instanceof Subscriber) {
value.unsubscribe();
}
});
}
private getPage(pageId: string) {
this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
this.subs.push(this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
page => {
if(this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['/pageContents'], { queryParams: { "communityId": this.communityPid} });
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid} });
} else {
this.page = page;
this.formComponent.setPlacements(this.page);
@ -72,7 +77,7 @@ export class NewPageHelpContentComponent {
}
},
error => this.handleError('System error retrieving page with id: '+pageId, error)
);
));
}
public saveCustom() {
@ -87,17 +92,17 @@ export class NewPageHelpContentComponent {
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
_ => {
if(this.pageId) {
this.router.navigate( ['/helptexts/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId }, relativeTo: this.route } );
} else {
this.router.navigate(['/helptexts'], { queryParams: { "communityId": this.communityPid} });
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route });
}
this.showLoading = false;
},
err => this.handleUpdateError('System error saving page content', err)
);
));
} else {
this.errorMessage = "Please fill all required fields";
}
@ -106,9 +111,9 @@ export class NewPageHelpContentComponent {
public cancelCustom() {
if(this.pageId) {
this.router.navigate( ['/helptexts/'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId }, relativeTo: this.route } );
} else {
this.router.navigate(['/helptexts'], { queryParams: { "communityId": this.communityPid} } );
this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route } );
}
}

View File

@ -7,6 +7,8 @@ import { EnvProperties } from '../../utils/properties/env-properties';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {properties} from "../../../../environments/environment";
import {Subscriber, Subscription} from "rxjs";
@Component({
selector: 'page-content-form',
@ -34,36 +36,39 @@ export class PageContentFormComponent implements OnInit{
public showLoading: boolean = true;
public errorMessage: string = '';
@Input() updateErrorMessage: string = '';
private subs: Subscription[] = [];
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
ngOnInit() {
this.myForm = this.form;
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
if(!this.pageId) {
this.myForm.valueChanges.subscribe(value => {
let pageId = value.page;
this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(page => {
this.setPlacements(page);
});
});
}
this._helpContentService.getCommunityPagesWithPositions(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.availablePages = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error));
this.properties = properties;
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
if(!this.pageId) {
this.subs.push(this.myForm.valueChanges.subscribe(value => {
let pageId = value.page;
this.subs.push(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(page => {
this.setPlacements(page);
}));
}));
}
this.subs.push(this._helpContentService.getCommunityPagesWithPositions(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.availablePages = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error)));
}
}
ngOnDestroy() {
this.subs.forEach(value => {
if (value instanceof Subscriber) {
value.unsubscribe();
}
});
}
public setPlacements(page: Page) {
this.placements.top = page.top;
this.placements.bottom = page.bottom;

View File

@ -128,7 +128,7 @@
<!-- </div>-->
<div class="actions" href="#">
<i class="clickable" ui-kit="pencil"
<i class="clickable" uk-icon="pencil"
(click)="editPageHelpContent(check.pageHelpContent._id)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeletePageHelpContent(check.pageHelpContent._id)"></i>
@ -152,7 +152,7 @@
<a *ngIf="selectedPageId && page" [queryParams]="{type: page.type, communityId: selectedCommunityPid}"
routerLink="/pages">Go back to {{page.type}} pages</a>
routerLink="../../pages/">Go back to {{page.type}} pages</a>
</div>
</div>
</div>

View File

@ -99,6 +99,9 @@ export class PageHelpContentsComponent implements OnInit {
value();
}
});
}
init(){
}
getPage(pageId: string) {
if (!Session.isLoggedIn()) {
@ -116,7 +119,7 @@ export class PageHelpContentsComponent implements OnInit {
this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
page => {
if (this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['/pageContents'], {queryParams: {"communityId": this.selectedCommunityPid}});
this.router.navigate(['./pageContents'], {queryParams: {"communityId": this.selectedCommunityPid}});
} else {
this.page = page;
this.getPageHelpContents(this.selectedCommunityPid);
@ -289,19 +292,19 @@ export class PageHelpContentsComponent implements OnInit {
public editPageHelpContent(id: string) {
//this.router.navigate(['/pageContents/edit/', _id]);
if (this.selectedPageId) {
this.router.navigate(['/helptexts/edit/'], {
this.router.navigate(['edit/'], {
queryParams: {
"pageContentId": id,
"communityId": this.selectedCommunityPid,
"pageId": this.selectedPageId
}
}, relativeTo: this.route
});
} else {
this.router.navigate(['/helptexts/edit/'], {
this.router.navigate(['edit/'], {
queryParams: {
"pageContentId": id,
"communityId": this.selectedCommunityPid
}
}, relativeTo: this.route
});
}
}
@ -377,8 +380,10 @@ export class PageHelpContentsComponent implements OnInit {
}
public filterByPage(event: any) {
this.filters.id = event.target.value;
this.applyFilter();
if(event.target && event.target.value) {
this.filters.id = event.target.value;
this.applyFilter();
}
}
public displayAllPageHelpContents() {
@ -417,14 +422,14 @@ export class PageHelpContentsComponent implements OnInit {
public newPageContent() {
if (this.selectedPageId) {
this.router.navigate(['/helptexts/new'], {
this.router.navigate(['new'], {
queryParams: {
communityId: this.selectedCommunityPid,
pageId: this.selectedPageId
}
}, relativeTo: this.route
});
} else {
this.router.navigate(['/helptexts/new'], {queryParams: {communityId: this.selectedCommunityPid}});
this.router.navigate(['new'], {queryParams: {communityId: this.selectedCommunityPid}, relativeTo: this.route});
}
}
}

View File

@ -116,7 +116,7 @@
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents"
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
routerLink="/helptexts">
routerLink="../../helptexts">
add help texts
</a>
<span
@ -126,7 +126,7 @@
class="uk-text-center">
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents"
[queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}"
routerLink="/classContents">add class contents</a>
routerLink="../../classContents">add class contents</a>
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td>
</tr>
@ -136,7 +136,7 @@
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No pages found</div>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-center ">
<div *ngIf="isPortalAdministrator" class="uk-width-1-1 uk-flex uk-flex-center ">
<div class="uk-width-small uk-button uk-button-default" (click)="newPage()">
<i class="" uk-icon="plus"></i>
</div>
@ -243,23 +243,24 @@
By disabling a position, all contents in this position will be deleted.
</label>
<div class="uk-text-muted"> Select if this page exists in:</div>
<span dashboard-input class="" [formInput]="myForm.get('top')"
type="checkbox"
label="Top">
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('right')"
type="checkbox"
label="Right">
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('bottom')"
type="checkbox"
label="Bottom">
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('left')"
type="checkbox"
label="Left">
</span>
<div class=" uk-grid">
<span dashboard-input class="" [formInput]="myForm.get('top')"
type="checkbox"
label="Top" >
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('right')"
type="checkbox"
label="Right">
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('bottom')"
type="checkbox"
label="Bottom">
</span>
<span dashboard-input class="uk-margin-small-left" [formInput]="myForm.get('left')"
type="checkbox"
label="Left">
</span>
</div>
</div>
<!-- <div class="form-group">-->
@ -282,10 +283,12 @@
<div class="uk-width-1-1 uk-margin-small-bottom">
Page exists in:
</div>
<span *ngFor="let option of portalUtils.portalTypes" class="radio">
<span class="uk-margin-small-right" style="font-weight: normal;">{{option.label}}</span>
<input type="radio" [value]="option.value" formControlName="portalType">
</span>
<div class="uk-child-width-1-2 uk-grid">
<span *ngFor="let option of portalUtils.portalTypes" class="radio ">
<span class="uk-margin-small-right" style="font-weight: normal;">{{option.label}}</span>
<input type="radio" [value]="option.value" formControlName="portalType">
</span>
</div>
</div>
<input type="hidden" formControlName="_id">

View File

@ -14,6 +14,7 @@ import {Observable, Subscriber} from "rxjs";
import {map, startWith} from "rxjs/operators";
import {MatAutocompleteSelectedEvent} from "@angular/material";
import {PortalUtils} from "../portal/portalHelper";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'pages',
@ -91,36 +92,33 @@ export class PagesComponent implements OnInit {
entities: this.entitiesCtrl,
_id: '',
});
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
this.properties = properties;
this.subscriptions.push(this.route.queryParams.subscribe(params => {
HelperFunctions.scroll();
this.pagesType = '';
if (params['type']) {
this.pagesType = params['type'];
}
this.pagesType = '';
if (params['type']) {
this.pagesType = params['type'];
}
this.keyword = '';
this.userManagementService.getUserInfo().subscribe(user => {
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
});
//this.getCommunities();
});
this.keyword = '';
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.selectedCommunityPid;
}));
//this.getCommunities();
}));
this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => {
this.allEntities = entities;
this.showLoading = false;
},
error => this.handleError('System error retrieving community entities', error));
this.subscriptions.push(this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => {
this.allEntities = entities;
this.showLoading = false;
},
error => this.handleError('System error retrieving community entities', error)));
});
}
ngOnDestroy(): void {
@ -153,7 +151,7 @@ export class PagesComponent implements OnInit {
parameters = '?page_type=' + this.pagesType;
}
if (community_pid) {
this._helpContentService.getCommunityPagesByType(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.getCommunityPagesByType(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.pagesReturned(pages);
//if(!this.pagesType || this.pagesType == "link") {
@ -163,15 +161,15 @@ export class PagesComponent implements OnInit {
//}
},
error => this.handleError('System error retrieving pages', error)
);
));
} else {
this._helpContentService.getAllPagesFull(this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.getAllPagesFull(this.properties.adminToolsAPIURL).subscribe(
pages => {
this.pagesReturned(pages);
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error)
);
));
}
}
}
@ -185,12 +183,12 @@ export class PagesComponent implements OnInit {
}
});
} else {
this._helpContentService.getPageIdsFromDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.getPageIdsFromDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.pageWithDivIds = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving information about pages\' classes', error));
error => this.handleError('System error retrieving information about pages\' classes', error)));
}
}
@ -281,13 +279,13 @@ export class PagesComponent implements OnInit {
this.showLoading = true;
this.updateErrorMessage = '';
this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deletePagesFromArray(this.selectedPages);
this.showLoading = false;
},
error => this.handleUpdateError('System error deleting the selected pages', error)
);
));
}
}
@ -382,19 +380,19 @@ export class PagesComponent implements OnInit {
this.myForm.controls['portalType'].enable();
this.modalErrorMessage = '';
this._helpContentService.savePage(<Page>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.savePage(<Page>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
page => {
this.pageSavedSuccessfully(page, true);
},
error => this.handleUpdateError('System error creating page', error)
);
));
} else {
this._helpContentService.updatePage(<Page>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.updatePage(<Page>this.myForm.value, this.properties.adminToolsAPIURL).subscribe(
page => {
this.pageSavedSuccessfully(page, false);
},
error => this.handleUpdateError('System error updating page', error)
);
));
}
}
@ -500,7 +498,7 @@ export class PagesComponent implements OnInit {
} else {
this.updateErrorMessage = '';
this._helpContentService.togglePages(this.selectedCommunityPid, ids, status, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.togglePages(this.selectedCommunityPid, ids, status, this.properties.adminToolsAPIURL).subscribe(
() => {
for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.page._id == id);
@ -509,7 +507,7 @@ export class PagesComponent implements OnInit {
this.applyCheck(false);
},
error => this.handleUpdateError('System error changing the status of the selected page(s)', error)
);
));
}
}

View File

@ -1,12 +1,10 @@
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {PagesComponent} from './pages.component';
import {MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule} from '@angular/material';
import {IsCommunityOrAdmin} from '../../connect/communityGuard/isCommunityOrAdmin';
import {AdminToolServiceModule} from "../../services/adminToolService.module";
import {InputModule} from "../../sharedComponents/input/input.module";
@ -16,7 +14,6 @@ import {InputModule} from "../../sharedComponents/input/input.module";
MatAutocompleteModule, MatFormFieldModule, MatChipsModule
],
declarations: [PagesComponent],
providers: [IsCommunityOrAdmin, ConnectAdminLoginGuard],
exports: [PagesComponent]
})
export class PagesModule { }

View File

@ -10,6 +10,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {Subscriber} from "rxjs";
import {CheckPortal, Portal} from "../../utils/entities/adminTool/portal";
import {PortalUtils} from "./portalHelper";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'portals',
@ -52,13 +53,10 @@ export class PortalsComponent implements OnInit {
this.filterBySearch(value);
}));
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
HelperFunctions.scroll();
HelperFunctions.scroll();
this.properties = properties;
this.getCommunities();
this.properties = data.envSpecific;
this.getCommunities();
});
}
constructor(private element: ElementRef, private route: ActivatedRoute,
@ -87,7 +85,7 @@ export class PortalsComponent implements OnInit {
this.errorMessage = '';
this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
communities => {
this.communities = communities;
if(communities) {
@ -97,7 +95,7 @@ export class PortalsComponent implements OnInit {
}
this.showLoading = false;
},
error => this.handleError('System error retrieving communities', error));
error => this.handleError('System error retrieving communities', error)));
}
}
@ -156,13 +154,13 @@ export class PortalsComponent implements OnInit {
this.showLoading = true;
this.updateErrorMessage = '';
this._helpContentService.deleteCommunities(this.selectedCommunities, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedCommunities, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deleteCommunitiesFromArray(this.selectedCommunities);
this.showLoading = false;
},
error => this.handleUpdateError('System error deleting the selected communities', error)
);
));
}
}
@ -217,21 +215,21 @@ export class PortalsComponent implements OnInit {
this.modalErrorMessage = '';
if (this.portalFG.getRawValue()['_id'].length > 0) {
this.portalFG.controls['type'].enable();
this._helpContentService.updateCommunity(<Portal>this.portalFG.value,
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalFG.value,
this.properties.adminToolsAPIURL).subscribe(
community => {
this.communityUpdatedSuccessfully(community);
},
error => this.handleUpdateError('System error updating portal', error)
);
));
}else{
this._helpContentService.saveCommunity(<Portal>this.portalFG.value,
this.subscriptions.push(this._helpContentService.saveCommunity(<Portal>this.portalFG.value,
this.properties.adminToolsAPIURL).subscribe(
community => {
this.communitySavedSuccessfully(community);
},
error => this.handleUpdateError('System error creating portal', error)
);
));
}
}
@ -244,13 +242,13 @@ export class PortalsComponent implements OnInit {
});
} else {
this.portalFG.controls['type'].enable();
this._helpContentService.updateCommunity(<Portal>this.portalFG.value,
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalFG.value,
this.properties.adminToolsAPIURL).subscribe(
community => {
this.communityUpdatedSuccessfully(community);
},
error => this.handleUpdateError('System error updating portal', error)
);
));
}
}

View File

@ -1,10 +1,9 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {PortalsComponent} from './portals.component';
import {RouterModule} from '@angular/router';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {AlertModalModule} from '../../utils/modal/alertModal.module';
import {AdminLoginGuard} from '../../login/adminLoginGuard.guard';
import {AdminToolServiceModule} from "../../services/adminToolService.module";
import {InputModule} from "../../sharedComponents/input/input.module";
@ -15,7 +14,6 @@ import {InputModule} from "../../sharedComponents/input/input.module";
RouterModule, AdminToolServiceModule, InputModule
],
declarations: [PortalsComponent],
providers: [AdminLoginGuard],
exports: [PortalsComponent]
})
export class PortalModule { }

View File

@ -12,11 +12,11 @@
<div *ngIf="headerName" class="uk-disabled uk-text-muted uk-margin-small-left uk-margin-small-right" [class.uk-text-center]="!open" [ngClass]="open?('uk-text-' + headerPosition):''">{{headerName}}</div>
</a>
<div *ngIf="items.length > 0" class="menu_section uk-margin-xlarge-top">
<ul class="uk-list">
<ul class="uk-nav-default uk-list uk-nav-parent-icon" uk-nav>
<ng-template ngFor [ngForOf]="items" let-item let-i="index">
<li [class.uk-active]="isTheActiveMenuItem(item)"
[class.act_section]="item.open"
[class.submenu_trigger]="item.items.length > 1">
[class.uk-open]="isTheActiveMenuItem(item)"
[class.uk-parent]="item.items.length > 1">
<a *ngIf="item.items.length <= 1" [routerLink]="(item.route && !isTheActiveMenuItem(item))?item.route:null"
[queryParams]=item.params [queryParamsHandling]="queryParamsHandling" class="uk-text-center">
<div *ngIf="item.icon && !open" class="uk-margin-auto">
@ -27,12 +27,12 @@
<span [class.uk-text-small]="!open">{{item.title}}</span>
</a>
<ng-template [ngIf]="item.items.length > 1">
<a (click)="item.open = !item.open">
<a (click)="item.open = !item.open" class=" uk-parent uk-text-center">
<div *ngIf="item.icon && !open" class="menu_icon "><i class="material-icons">{{item.icon}}</i></div>
<span [class.uk-text-small]="!open">{{item.title}}</span>
</a>
<ul [class.uk-hidden]="!open">
<ul [class.uk-hidden]="!open" class="uk-nav-sub uk-text-center">
<ng-template ngFor [ngForOf]="item.items" let-subItem let-j="index">
<li *ngIf="subItem.route" [class.uk-active]="isTheActiveMenuItem(item, subItem)">
<a [routerLink]="!isTheActiveMenuItem(item, subItem)?subItem.route:null"

View File

@ -123,7 +123,6 @@ export class ProjectComponent {
subscriptions = [];
properties: EnvProperties;
constructor(private route: ActivatedRoute,
private _router: Router,
private _location: Location,
@ -432,7 +431,7 @@ export class ProjectComponent {
this.download(url, filename+".csv");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url).subscribe());
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe());
}
},
error => {
@ -538,7 +537,7 @@ export class ProjectComponent {
this.download(url, filename+".html");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url).subscribe());
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe());
}
},
err => {

View File

@ -326,7 +326,8 @@
<search-download
*ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'"
[isDisabled]="disableForms || disableRefineForms"
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults">
[type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"
[piwikSiteId]="piwikSiteId">
</search-download>
<!--<span *ngIf="tableViewLink">

View File

@ -146,7 +146,7 @@ export class NewSearchPageComponent {
this.isPiwikEnabled = this.properties.enablePiwikTrack;
this.updateUrl(this.properties.domain + this.properties.baseLink + this.router.url);
this.url = this.properties.domain + this.properties.baseLink + this.router.url;
if (typeof document !== 'undefined' && this.isPiwikEnabled && !this.includeOnlyResultsAndFilter) {
if (typeof document !== 'undefined' && this.isPiwikEnabled && !this.includeOnlyResultsAndFilter && this.piwikSiteId) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe());
}
this.route.queryParams.subscribe(params => {
@ -191,19 +191,16 @@ export class NewSearchPageComponent {
}
private getPageContents() {
if((this.customFilter && this.customFilter.queryFieldName == "communityId") && this.properties.adminToolsCommunity !== "monitor") {
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
this.pageContents = contents;
}));
}
private getDivContents() {
if((this.customFilter && this.customFilter.queryFieldName == "communityId") && this.properties.adminToolsCommunity !== "monitor") {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilter) ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
this.subscriptions.push(this.helper.getDivHelpContents(this.properties, (this.customFilter && this.customFilter.queryFieldName == "communityId") ? this.customFilter.valueId : this.properties.adminToolsCommunity, this.router.url).subscribe(contents => {
this.divContents = contents;
}));
}
}
ngOnDestroy() {
@ -311,7 +308,7 @@ export class NewSearchPageComponent {
//console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
if (this.isPiwikEnabled && (typeof document !== 'undefined')) {
if (this.isPiwikEnabled && (typeof document !== 'undefined') && this.piwikSiteId) {
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe());
}
/* End Piwik Code */

View File

@ -38,6 +38,7 @@ export class SearchDownloadComponent {
@Input() totalResults: number = 0;
@Input() csvParams: string;
@Input() type: string;
@Input() piwikSiteId = null;
@ViewChild(AlertModal) alertApplyAll: AlertModal;
downloadURLAPI: string;
@ -110,7 +111,7 @@ export class SearchDownloadComponent {
//window.location.href = window.URL.createObjectURL(data);
if (this.isPiwikEnabled && (typeof document !== 'undefined')) {
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url).subscribe());
this.subscriptions.push(this._piwikService.trackDownload(this.properties, url, this.piwikSiteId).subscribe());
}
},
error => {

View File

@ -15,7 +15,7 @@ export interface Option {
@Component({
selector: '[dashboard-input]',
template: `
<div *ngIf="label"
<div *ngIf="label && type != 'checkbox'"
class="uk-text-bold uk-form-label uk-margin-small-bottom">{{label + (required ? ' *' : '')}}</div>
<div *ngIf="hint" class="uk-margin-bottom uk-text-small uk-form-hint">{{hint}}</div>
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>

View File

@ -37,7 +37,8 @@ export class HelperService {
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/' + properties.adminToolsPortalType + '/' + communityId + '/pagehelpcontent/grouped?active=true&page=' + page_route;
url += '/' + properties.adminToolsPortalType + '/' + communityId + '/pagehelpcontent/grouped?active=true&page=' +
((page_route.indexOf("/"+communityId+"/")!=-1 ) ? ("/" + page_route.split("/"+communityId+"/")[1]) : page_route);
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url);
}else {
return of(null);
@ -51,7 +52,8 @@ export class HelperService {
if(typeof properties.useHelpTexts == "undefined" || properties.useHelpTexts) {
let page_route: string = router.split('?')[0].substring(0);
let url = properties.adminToolsAPIURL;
url += '/'+properties.adminToolsPortalType+'/' + communityId + '/divhelpcontent/grouped?active=true&page='+page_route;
url += '/'+properties.adminToolsPortalType+'/' + communityId + '/divhelpcontent/grouped?active=true&page='+
((page_route.indexOf("/"+communityId+"/")!=-1 ) ? ("/" + page_route.split("/"+communityId+"/")[1]) : page_route);
return this.http.get((properties.useLongCache)? (properties.cacheUrl+encodeURIComponent(url)): url);
}else {
return of(null);