[Library | Trunk]: Dashboard: Admin tools pages: Fix no rasults card and loading. Add notifications on actions and errors.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60666 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2021-03-18 14:11:41 +00:00
parent 4e00cd1caa
commit 4ec2c7c124
14 changed files with 436 additions and 610 deletions

View File

@ -1,7 +1,7 @@
<div page-content class="admin-pages">
<div header>
<admin-tabs tab="class" header></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div *ngIf="!showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<ul class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
@ -14,9 +14,11 @@
</ul>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search class"
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
placeholder="Search class"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div class="show-options">
<button class="uk-button uk-button-secondary">Bulk Actions</button>
<div uk-dropdown="mode: click">
@ -41,70 +43,59 @@
</div>
</div>
<div inner>
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage">
<div class="md-card-content">
<div class="uk-overflow-container">
<table class="uk-table uk-table-striped uk-table-large">
<thead class="uk-card-header">
<tr>
<th
class="uk-width-small"><input id="allDivIdCheckbox" type="checkbox"
(change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th *ngIf="!selectedCommunityPid">Portal Type</th>
<th>Page</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.divId._id}}" class="checkBox" type="checkbox"
name="divIdscb[]" value="{{check.divId._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.divId.name}}</div>
</td>
<td *ngIf="!selectedCommunityPid">
<div class="portalType" href="#">{{check.divId.portalType}}</div>
</td>
<td>
<div class="pages" href="#">
<table *ngIf="checkboxes.length > 0"class="uk-table uk-table-striped uk-table-large">
<thead class="uk-card-header">
<tr>
<th
class="uk-width-small"><input id="allDivIdCheckbox" type="checkbox"
(change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th *ngIf="!selectedCommunityPid">Portal Type</th>
<th>Page</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.divId._id}}" class="checkBox" type="checkbox"
name="divIdscb[]" value="{{check.divId._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.divId.name}}</div>
</td>
<td *ngIf="!selectedCommunityPid">
<div class="portalType" href="#">{{check.divId.portalType}}</div>
</td>
<td>
<div class="pages" href="#">
<span *ngFor="let page of check.divId.pages let i=index">{{page.name}}<span
*ngIf="i<(check.divId.pages.length-1)">, </span></span>
</div>
</td>
<td>
<div class="actions" href="#">
<i class="clickable" uk-icon="pencil" (click)="editDivId(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeleteDivId(check.divId._id)"></i>
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning uk-alert">No classes found</div>
</div>
</div>
</div>
</div>
</td>
<td>
<div class="actions" href="#">
<i class="clickable" uk-icon="pencil" (click)="editDivId(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeleteDivId(check.divId._id)"></i>
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No classes found</div>
</div>
</div>
</div>
</div>
<modal-alert #editModal (alertOutput)="divIdSaveConfirmed($event)"
[okDisabled]="classForm && (classForm.invalid || !classForm.dirty)">
<div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
<form *ngIf="classForm" [formGroup]="classForm" class="uk-grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="classForm.get('name')"
type="text" label="Class Name" placeholder="Write a name">

View File

@ -37,9 +37,6 @@ export class DivIdsComponent implements OnInit {
public properties: EnvProperties = properties;
public formPages: Page[] = [];
public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
public modalErrorMessage: string = '';
public filterForm: FormGroup;
private subscriptions: any[] = [];
public allPages: Option[] = [];
@ -93,9 +90,6 @@ export class DivIdsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this.subscriptions.push(this._helpContentService.getAllDivIdsFull( this.properties.adminToolsAPIURL).subscribe(
divIds => {
this.divIds = divIds;
@ -174,7 +168,6 @@ export class DivIdsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deleteDivIdsFromArray(this.selectedDivIds);
@ -219,7 +212,6 @@ export class DivIdsComponent implements OnInit {
pages: this.pagesCtrl,
portalType: this._fb.control('', Validators.required)
});
this.modalErrorMessage = "";
this.divIdsModalOpen("Create class", "Create");
}
@ -252,7 +244,6 @@ export class DivIdsComponent implements OnInit {
});
} else {
if (!this.classForm.value._id) {
this.modalErrorMessage = "";
this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe(
divId => {
this.divIdSavedSuccessfully(divId);
@ -317,27 +308,28 @@ export class DivIdsComponent implements OnInit {
if (error == null) {
// this.formComponent.reset();
} else {
this.updateErrorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
}
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
}
handleError(message: string, error) {
this.errorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
this.showLoading = false;
}
getPages() {
this.showLoading = true;
this.errorMessage = "";
this.subscriptions.push(this._helpContentService.getAllPages(this.properties.adminToolsAPIURL).subscribe(
pages => {
this.allPages = [];

View File

@ -1,7 +1,7 @@
<div page-content class="admin-pages">
<div header>
<admin-tabs tab="entity" [portal]="portal"></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div *ngIf="!showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="filterForm.get('status').value === 'all'"><a
@ -14,30 +14,12 @@
</ul>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-remove-top"
uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search entity"
uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
placeholder="Search entity"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<!--<div class="show-options">
<button class="uk-button uk-button-secondary">Bulk Actions</button>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one entity">
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
(click)="toggleEntities(true, getSelectedEntities())"><i></i>
Activate
</a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
(click)="toggleEntities(false, getSelectedEntities())"><i></i>
Deactivate
</a></li>
<li *ngIf="isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''"
(click)="confirmDeleteSelectedEntities()"><i></i> Delete </a></li>
</ul>
</div>
</div>-->
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<a (click)="newEntity()"
class="uk-flex uk-flex-middle uk-text-uppercase">
@ -48,29 +30,15 @@
</a>
</div>
</div>
<!--<div *ngIf="checkboxes.length > 0" class=" uk-margin-remove-top uk-margin-small-left"
[attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one entity">
<input id="checkAll" type="checkbox" (click)="selectAll()"
[ngModel]="getSelectedEntities().length ==checkboxes.length"/>
<a *ngIf="!isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length
== 0"
(click)="toggleEntities(true, getSelectedEntities())"><i></i> Activate </a>
<a *ngIf="!isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length == 0"
(click)="toggleEntities(false, getSelectedEntities())"><i></i> Deactivate </a>
<a *ngIf="isPortalAdministrator" class="uk-margin-left" [class.uk-disabled]="getSelectedEntities().length == 0"
(click)="confirmDeleteSelectedEntities()"><i></i> Delete </a>
</div>-->
</div>
<div *ngIf="!showLoading && checkboxes.length > 0"
class="uk-margin-remove-top uk-margin-small-left uk-margin-small-bottom uk-display-inline"
[attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : null"
title="Select at least one entity"><input id="checkAll" type="checkbox" (click)="selectAll()"
[ngModel]="getSelectedEntities().length ==checkboxes.length"/>
[ngModel]="getSelectedEntities().length ==checkboxes.length"/>
<span *ngIf="getSelectedEntities().length > 0" class="uk-margin-left uk-text-muted">
{{getSelectedEntities().length}} entities selected </span>
<a class="uk-margin-left ">Actions </a>
<a class="uk-margin-left ">Actions </a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
@ -90,85 +58,56 @@
</div>
<div inner>
<div *ngIf="showLoading" class="uk-position-center">
<loading *ngIf="showLoading"></loading>
<loading></loading>
</div>
<div *ngIf="!showLoading">
<!--<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
<div>
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
Disable an entity to hide it from community dashboard portal.
</div>
<div
class="uk-text-small">If an entity is disabled, all related search and advanced search pages will be
hidden from the community dashborad and a message "Can't find that page" will appear in case the url of that
page is loaded. If the related page belongs to the menu the link will be removed from menu, too.
</div>
<table *ngIf="checkboxes.length > 0 " class="uk-table uk-table-striped uk-table-hover uk-table-large">
<thead class="uk-card-header">
<tr>
<th class="uk-width-small"></th>
<th>Name</th>
<th *ngIf="!isPortalAdministrator">Status</th>
<th *ngIf="!isPortalAdministrator">Enable/Disable</th>
<th *ngIf="isPortalAdministrator">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.entity._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.entity._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.entity.name}}</div>
</td>
<td *ngIf="!isPortalAdministrator">
<div class="name" href="#">{{check.entity.isEnabled ? "Enabled" : "Disabled"}}</div>
</td>
<td *ngIf="!isPortalAdministrator">
<mat-slide-toggle [checked]="check.entity.isEnabled"
(change)="($event.source.checked = check.entity.isEnabled);toggleEntities(!check.entity.isEnabled,[check.entity._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable an entity to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If an entity is disabled, all related search and advanced search pages will be hidden from the community dashborad and a message 'Can't find that page' will appear in case the url of that page is loaded. If the related page belongs to the menu the link will be removed from menu, too.</div></div>"
></mat-slide-toggle>
</td>
</div>-->
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage">
<div class="md-card-content">
<div class="uk-overflow-container">
<table class="uk-table uk-table-striped uk-table-hover uk-table-large">
<thead class="uk-card-header">
<tr>
<th class="uk-width-small">
<!--<input id="allEntityCheckbox" type="checkbox"
(change)="toggleCheckBoxes($event)">-->
</th>
<th>Name</th>
<th *ngIf="!isPortalAdministrator">Status</th>
<th *ngIf="!isPortalAdministrator">Enable/Disable</th>
<th *ngIf="isPortalAdministrator">Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.entity._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.entity._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.entity.name}}</div>
</td>
<td *ngIf="!isPortalAdministrator">
<div class="name" href="#">{{check.entity.isEnabled ? "Enabled" : "Disabled"}}</div>
</td>
<td *ngIf="!isPortalAdministrator">
<mat-slide-toggle [checked]="check.entity.isEnabled"
(change)="($event.source.checked = check.entity.isEnabled);toggleEntities(!check.entity.isEnabled,[check.entity._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable an entity to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If an entity is disabled, all related search and advanced search pages will be hidden from the community dashborad and a message 'Can't find that page' will appear in case the url of that page is loaded. If the related page belongs to the menu the link will be removed from menu, too.</div></div>"
></mat-slide-toggle>
</td>
<td *ngIf="isPortalAdministrator">
<div class="actions" href="#">
<i class="clickable " uk-icon="pencil" (click)="editEntity(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeleteEntity(check.entity._id)"></i>
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length ==0 ">
<div class="uk-alert-warning" uk-alert>No entities found</div>
<td *ngIf="isPortalAdministrator">
<div class="actions" href="#">
<i class="clickable " uk-icon="pencil" (click)="editEntity(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeleteEntity(check.entity._id)"></i>
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No entities found</div>
</div>
</div>
</div>
</div>
<modal-alert #editModal (alertOutput)="entitySaveConfirmed($event)"
[okDisabled]="entityForm && (entityForm.invalid || !entityForm.dirty)">
<div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
<form *ngIf="entityForm" [formGroup]="entityForm" class="uk-grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="entityForm.get('name')"
type="text" placeholder="Write a name"
@ -180,7 +119,6 @@
</div>
</form>
</modal-alert>
<modal-alert #relatedPages (alertOutput)="continueToggling($event)"></modal-alert>
<modal-alert #deleteModal (alertOutput)="confirmedDeleteEntities($event)"></modal-alert>

View File

@ -44,9 +44,6 @@ export class EntitiesComponent implements OnInit {
public properties: EnvProperties = properties;
public showLoading = true;
public errorMessage = '';
public updateErrorMessage = '';
public modalErrorMessage = '';
public isPortalAdministrator = null;
public filterForm: FormGroup;
private subscriptions: any[] = [];
@ -98,8 +95,6 @@ export class EntitiesComponent implements OnInit {
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this.errorMessage = '';
if (portal) {
this._helpContentService.getCommunityEntities(portal, this.properties.adminToolsAPIURL).subscribe(
entities => {
@ -185,8 +180,6 @@ export class EntitiesComponent implements OnInit {
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this._helpContentService.deleteEntities(this.selectedEntities, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deleteEntitiesFromArray(this.selectedEntities);
@ -210,7 +203,6 @@ export class EntitiesComponent implements OnInit {
_id: this._fb.control(entity._id),
pid: this._fb.control(entity.pid, Validators.required)
});
this.modalErrorMessage = '';
this.entitiesModalOpen('Edit Entity', 'Save Changes');
}
@ -220,7 +212,6 @@ export class EntitiesComponent implements OnInit {
name: this._fb.control('', Validators.required),
pid: this._fb.control('', Validators.required)
});
this.modalErrorMessage = '';
this.entitiesModalOpen('Create Entity', 'Create');
}
@ -244,7 +235,6 @@ export class EntitiesComponent implements OnInit {
this._router.navigate(['/user-info'],
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
} else {
this.modalErrorMessage = '';
if (this.entityForm.value._id) {
this._helpContentService.updateEntity(
<Entity>this.entityForm.value, this.properties.adminToolsAPIURL).subscribe(
@ -308,9 +298,12 @@ export class EntitiesComponent implements OnInit {
}
handleError(message: string, error) {
this.errorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
this.showLoading = false;
}
@ -323,14 +316,13 @@ export class EntitiesComponent implements OnInit {
_id: ''
});
} else {
this.updateErrorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
}
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
}
@ -364,7 +356,6 @@ export class EntitiesComponent implements OnInit {
this._router.navigate(['/user-info'],
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
} else {
this.updateErrorMessage = '';
this._helpContentService.toggleEntities(
this.portal, this.toggleIds, this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
() => {

View File

@ -27,18 +27,14 @@
class="uk-button uk-button-secondary outlined uk-margin-small-right">Reset
</button>
<button (click)="saveCustom()" class="uk-button uk-button-secondary uk-margin-small-right"
[disabled]="showLoading || !myForm.dirty || !myForm.valid ">Save
[disabled]="showLoading || !myForm.dirty || myForm.invalid ">Save
</button>
</div>
</div>
</div>
<div class="uk-card uk-card-default uk-position-relative " style="min-height: 60vh">
<div style="max-height: 60vh" class="uk-padding-large uk-overflow-auto">
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger" role="alert">{{errorMessage}}</div>
<div class="uk-animation-fade uk-width-1-1" role="alert">
<div *ngIf="updateErrorMessage" class="uk-alert uk-alert-danger" role="alert">{{updateErrorMessage}}</div>
<div *ngIf="showLoading" class="uk-position-center">
<loading *ngIf="showLoading"></loading>
</div>
@ -57,17 +53,15 @@
</div>
<div class="form-group uk-margin-top">
<span class="uk-text-bold uk-margin-small-right">Select Status (Enable/ disable)</span>
<div class="uk-text-bold uk-margin-medium-bottom">Select Status (Enable/ disable)</div>
<mat-slide-toggle [checked]="myForm.get('isActive').value"
(change)="changeStatus()"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
<div class="form-group uk-margin-large-top"
<div class="form-group uk-margin-medium-top"
[ngClass]="{'has-error':!myForm.controls.content.valid &&
myForm.controls.content.dirty}"
>
myForm.controls.content.dirty}">
<label class="uk-text-bold">Content</label>
<div class="uk-margin-top">
<ckeditor (change)="contentChanged()"

View File

@ -13,6 +13,8 @@ import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content';
import {ConnectHelper} from "../../connect/connectHelper";
declare var UIkit;
@Component({
selector: 'page-content-form',
templateUrl: './page-help-content-form.component.html',
@ -28,14 +30,9 @@ export class PageContentFormComponent implements OnInit {
orderOptions = [];
private availablePages: Page[] = [];
//private errorMessage: string;
private ckeditorContent: string;
public properties: EnvProperties = null;
public showLoading: boolean = true;
public errorMessage: string = '';
@Input() updateErrorMessage: string = '';
private subs: Subscription[] = [];
public pageHelpContent: PageHelpContent;
@ -157,8 +154,6 @@ export class PageContentFormComponent implements OnInit {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this.showLoading = true;
this.errorMessage = "";
this.updateErrorMessage = "";
this.subs.push(this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
pageHelpContent => {
@ -244,7 +239,11 @@ export class PageContentFormComponent implements OnInit {
}
handleError(message: string, error) {
this.errorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.error('Server responded: ' + error);
this.showLoading = false;
@ -259,16 +258,18 @@ export class PageContentFormComponent implements OnInit {
}
});
} else {
//this.errorMessage = null;
if (this.myForm.valid) {
this.showLoading = true;
this.updateErrorMessage = "";
this.myForm.get('order').enable();
this.myForm.get('placement').enable();
let pageHelpContent: PageHelpContent = this.myForm.value;
this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => {
UIkit.notification('Page content has been <b>successfully ' + (this.pageContentId?'updated':'created') + '</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
this.showLoading = false;
},
@ -276,7 +277,6 @@ export class PageContentFormComponent implements OnInit {
));
} else {
this.showLoading = false;
this.errorMessage = "Please fill all required fields";
}
}
}
@ -292,8 +292,11 @@ export class PageContentFormComponent implements OnInit {
}
handleUpdateError(message: string, error) {
this.updateErrorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.error('Server responded: ' + error);
this.showLoading = false;

View File

@ -1,15 +1,11 @@
<div page-content>
<div header>
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div class="uk-text-bold">
<span *ngIf="selectedPageId && page">{{page.name}}</span>
</div>
<div class="uk-margin-top">
<a routerLink="../pages/" class="uk-text-secondary uk-text-uppercase uk-text-bold uk-text-small">
<span class="uk-icon-button small uk-icon uk-button-secondary">
<span class="uk-icon-button small uk-icon uk-button-secondary">
<icon name="arrow_left"></icon>
</span>
<span class="space">
@ -20,7 +16,8 @@
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div #searchInputComponent search-input [control]="filterForm" [showSearch]="false" placeholder="Search helptext"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div>
<a (click)="newPageContent()"
class="uk-flex uk-flex-middle uk-text-uppercase">
@ -38,111 +35,95 @@
[ngModel]="getSelectedPageHelpContents().length ==checkboxes.length"/>
<span *ngIf="getSelectedPageHelpContents().length > 0" class="uk-margin-left uk-text-muted">
{{getSelectedPageHelpContents().length}} pages selected </span>
<a class="uk-margin-left ">Actions </a>
<a class="uk-margin-left ">Actions </a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one help text">
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
(click)="togglePageHelpContents(true,getSelectedPageHelpContents())"><i></i> Enable
</a></li>
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
(click)="togglePageHelpContents(false,getSelectedPageHelpContents())"><i></i> Disable
</a>
</li>
<li><a [class]="getSelectedPageHelpContents().length == 0 ? 'uk-disabled' : ''"
(click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
(click)="confirmDeleteSelectedPageHelpContents()"><i></i> Delete </a></li>
</ul>
</div>
</div>
</div>
<div inner>
<div class="content-wrapper" id="contentWrapper">
<div>
<div class="contentPanel">
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div *ngIf="showLoading" class="uk-position-center">
<loading *ngIf="showLoading"></loading>
</div>
<div *ngIf="!errorMessage && !showLoading">
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading">
<div class="md-card-content">
<div class="uk-overflow-container">
<div class="uk-overflow-container">
<ul class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div *ngIf="!selectedPageId" >
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</div>
<div class="content multi-line-ellipsis lines-2">
<p>{{check.pageHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span class="title">Placement: </span>{{check.pageHelpContent.placement}}
</div>
<div class=" ">
<span class="title">Order: </span>{{check.pageHelpContent.order}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.pageHelpContent.isActive"
(change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</div>
<div *ngIf="!showLoading">
<ul *ngIf="checkboxes.length > 0" class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
<div class="uk-width-4-5 uk-first-column ">
<div class="uk-grid uk-flex uk-flex-middle">
<div><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand uk-margin-medium-bottom">
<div *ngIf="!selectedPageId">
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.pageHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">
Edit
</span>
</div>
<div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)" class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
Delete
</span>
</div>
</div>
</div>
<div class="content multi-line-ellipsis lines-2">
<p>{{check.pageHelpContent.content|htmlToString}}</p></div>
</div>
<div class="uk-grid uk-width-1-1 uk-margin-left">
<div class=" ">
<span class="title">Placement: </span>{{check.pageHelpContent.placement}}
</div>
<div class=" ">
<span class="title">Order: </span>{{check.pageHelpContent.order}}
</div>
<div class=" ">
<span class="title uk-margin-small-right">Enable/disable: </span>
<mat-slide-toggle [checked]="check.pageHelpContent.isActive"
(change)="($event.source.checked = check.pageHelpContent.isActive);togglePageHelpContents(!check.pageHelpContent.isActive,[check.pageHelpContent._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '> Enable or disable help text to show or hide it from the dashboard</div></div>"
></mat-slide-toggle>
</div>
</div>
</li>
</ul>
</div>
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No page contents found</div>
</div>
</div>
</div>
<div class="uk-width-1-5 uk-first-column">
<div class=" uk-flex-center uk-flex">
<div class="actions" href="#">
<div class="" (click)="editPageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable" uk-icon="pencil"
></i>
<span class="uk-margin-small-left">
Edit
</span>
</div>
<div (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)"
class="uk-button action uk-margin-top uk-flex uk-flex-middle ">
<i class="clickable " uk-icon="trash"
></i>
<span class="uk-margin-small-left">
Delete
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</li>
</ul>
<div *ngIf="checkboxes.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No page contents found</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>
</div>
<modal-alert #AlertModalDeletePageHelpContents (alertOutput)="confirmedDeletePageHelpContents($event)"></modal-alert>

View File

@ -19,52 +19,37 @@ import {DomSanitizer} from '@angular/platform-browser';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {ConnectHelper} from '../../connect/connectHelper';
declare var UIkit;
@Component({
selector: 'page-help-contents',
templateUrl: './page-help-contents.component.html',
})
export class PageHelpContentsComponent implements OnInit {
@ViewChild('AlertModalDeletePageHelpContents') alertModalDeletePageHelpContents;
private selectedPageContents: string[] = [];
public checkboxes: CheckPageHelpContent[] = [];
public pageHelpContents: PageHelpContent[] = [];
public formGroup: FormGroup;
public pages: Page[];
public checkboxAll: boolean = false;
public filters: PageHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')};
public keyword: string = "";
public counter = {all: 0, active: 0, inactive: 0};
public communities: Portal[] = [];
public portal: string;
public selectedPageId: string;
public community: Portal;
public page: Page;
public properties: EnvProperties = null;
public properties: EnvProperties = properties;
public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
public filterForm: FormControl;
public selectForm: FormControl;
public selectOptions = [];
private subscriptions: any[] = [];
public selectedKeyword: string;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
ngOnInit() {
this.filterForm = this._fb.control('');
this.selectForm = this._fb.control('');
@ -74,8 +59,6 @@ export class PageHelpContentsComponent implements OnInit {
this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => {
this.filterByPage(value);
}));
this.properties = properties;
this.subscriptions.push(this.route.params.subscribe(params => {
this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
ConnectHelper.setPortalTypeFromPid(this.portal);
@ -85,15 +68,16 @@ export class PageHelpContentsComponent implements OnInit {
if (this.portal && this.selectedPageId) {
this.getPage(this.selectedPageId);
}
if(!this.selectedPageId) {
this.router.navigate(['../pages'], {relativeTo: this.route });
if (!this.selectedPageId) {
this.router.navigate(['../pages'], {relativeTo: this.route});
}
}));
}));
}
constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) {
}
ngOnDestroy(): void {
this.subscriptions.forEach(value => {
if (value instanceof Subscriber) {
@ -103,9 +87,7 @@ export class PageHelpContentsComponent implements OnInit {
}
});
}
init(){
}
getPage(pageId: string) {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -116,12 +98,10 @@ export class PageHelpContentsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe(
page => {
if (this.properties.adminToolsPortalType != page.portalType) {
this.router.navigate(['./pageContents'], {queryParams: {"communityId": this.portal}});
this.router.navigate(['./pageContents']);
} else {
this.page = page;
this.getPageHelpContents(this.portal);
@ -130,7 +110,7 @@ export class PageHelpContentsComponent implements OnInit {
error => this.handleError('System error retrieving page', error)));
}
}
getPages(community_pid: string) {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -141,23 +121,20 @@ export class PageHelpContentsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.errorMessage = "";
//this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpService.getCommunityPagesWithPositions(community_pid,this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpService.getCommunityPagesWithPositions(community_pid, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.pages = pages;
this.getPageHelpContents(this.portal);
this.selectOptions = [{label:'All pages', value: ''}];
this.selectOptions = [{label: 'All pages', value: ''}];
for (let page of this.pages) {
this.selectOptions.push({label:page.name, value: page._id})
this.selectOptions.push({label: page.name, value: page._id})
}
},
error => this.handleError('System error retrieving pages', error)));
}
}
public countPageHelpContents() {
this.counter = {all: 0, active: 0, inactive: 0};
let filter = Object.assign({}, this.filters);
@ -170,7 +147,7 @@ export class PageHelpContentsComponent implements OnInit {
});
this.counter.all = this.counter.active + this.counter.inactive;
}
getPageHelpContents(community_pid: string) {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -185,55 +162,51 @@ export class PageHelpContentsComponent implements OnInit {
this.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
this.counter.all = this.pageHelpContents.length;
this.checkboxes = [];
for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
this.checkboxes.unshift(<CheckPageHelpContent>{
pageHelpContent: this.pageHelpContents[i],
checked: false
});
this.checkboxes.unshift(<CheckPageHelpContent>{
pageHelpContent: this.pageHelpContents[i],
checked: false
});
}
this.countPageHelpContents();
this.showLoading = false;
},
error => this.handleError('System error retrieving page contents', error)));
}
}
// public showModal():void {
// this.modal.showModal();
// }
public toggleCheckBoxes(event) {
this.checkboxes.forEach(_ => _.checked = event.target.checked);
this.checkboxAll = event.target.checked;
}
public applyCheck(flag: boolean) {
this.checkboxes.forEach(_ => _.checked = flag);
this.checkboxAll = false;
}
public getSelectedPageHelpContents(): string[] {
return this.checkboxes.filter(pageHelpContent => pageHelpContent.checked == true)
.map(checkedPageHelpContent => checkedPageHelpContent.pageHelpContent).map(res => res._id);
}
public confirmDeletePageHelpContent(id: string) {
//this.deleteConfirmationModal.ids = [id];
//this.deleteConfirmationModal.showModal();
this.selectedPageContents = [id];
this.confirmModalOpen();
}
public confirmDeleteSelectedPageHelpContents() {
//this.deleteConfirmationModal.ids = this.getSelectedPageHelpContents();
//this.deleteConfirmationModal.showModal();
this.selectedPageContents = this.getSelectedPageHelpContents();
this.confirmModalOpen();
}
private confirmModalOpen() {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -251,7 +224,7 @@ export class PageHelpContentsComponent implements OnInit {
this.alertModalDeletePageHelpContents.open();
}
}
public confirmedDeletePageHelpContents(data: any) {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -262,18 +235,21 @@ export class PageHelpContentsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = "";
this.subscriptions.push(this._helpService.deletePageHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => {
this.deletePageHelpContentsFromArray(this.selectedPageContents);
UIkit.notification('Page content(s) has been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
},
error => this.handleUpdateError('System error deleting the selected page content(s)', error)
));
}
}
private deletePageHelpContentsFromArray(ids: string[]): void {
for (let id of ids) {
let iqc = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
@ -283,27 +259,25 @@ export class PageHelpContentsComponent implements OnInit {
}
this.countPageHelpContents();
}
public editPageHelpContent(id: string) {
//this.router.navigate(['/pageContents/edit/', _id]);
if (this.selectedPageId) {
this.router.navigate(['edit/'], {
queryParams: {
"pageContentId": id,
"communityId": this.portal,
"pageId": this.selectedPageId
}, relativeTo: this.route
});
} else {
this.router.navigate(['edit/'], {
queryParams: {
"pageContentId": id,
"communityId": this.portal
"pageContentId": id``
}, relativeTo: this.route
});
}
}
public togglePageHelpContents(status: boolean, ids: string[]) {
if (!Session.isLoggedIn()) {
this.router.navigate(['/user-info'], {
@ -313,14 +287,17 @@ export class PageHelpContentsComponent implements OnInit {
}
});
} else {
this.updateErrorMessage = "";
this.subscriptions.push(this._helpService.togglePageHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
() => {
for (let id of ids) {
let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
this.checkboxes[i].pageHelpContent.isActive = status;
}
UIkit.notification('Page content(s) has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this.countPageHelpContents();
this.applyCheck(false);
},
@ -328,14 +305,14 @@ export class PageHelpContentsComponent implements OnInit {
));
}
}
public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) {
this.checkboxes.push(<CheckPageHelpContent>{pageHelpContent: pageHelpContent, checked: false});
this.pageHelpContents.push(pageHelpContent);
this.applyCheck(false);
this.countPageHelpContents();
}
public pageHelpContentUpdatedSuccessfully(pageHelpContent: PageHelpContent) {
this.checkboxes.find(checkItem => checkItem.pageHelpContent._id == pageHelpContent._id).pageHelpContent = pageHelpContent;
let index = this.pageHelpContents.findIndex(checkItem => checkItem._id == pageHelpContent._id);
@ -343,8 +320,8 @@ export class PageHelpContentsComponent implements OnInit {
this.applyCheck(false);
this.countPageHelpContents();
}
public filterPageHelpContent(pageHelpContent: PageHelpContent, filters: PageHelpContentFilterOptions): boolean {
let idFlag = filters.id == '' || (<Page>pageHelpContent.page)._id == filters.id;
let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
@ -352,8 +329,8 @@ export class PageHelpContentsComponent implements OnInit {
|| ((<Page>pageHelpContent.page).name).match(filters.text) != null;
return idFlag && activeFlag && textFlag;
}
public applyFilter() {
this.checkboxes = [];
this.pageHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach(
@ -363,68 +340,75 @@ export class PageHelpContentsComponent implements OnInit {
);
// this.countPageHelpContents();
}
public filterByPage(event: any) {
if(event.target && event.target.value) {
if (event.target && event.target.value) {
this.filters.id = event.target.value;
this.applyFilter();
}
}
public displayAllPageHelpContents() {
this.filters.active = null;
this.applyFilter();
}
public displayActivePageHelpContents() {
this.filters.active = true;
this.applyFilter();
}
public filterBySearch(text: string) {
this.filters.text = new RegExp(text, "i");
this.applyFilter();
}
public displayInactivePageHelpContents() {
this.filters.active = false;
this.applyFilter();
}
handleError(message: string, error) {
this.errorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
this.showLoading = false;
}
handleUpdateError(message: string, error) {
this.updateErrorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
this.showLoading = false;
}
public newPageContent() {
this.router.navigate(['edit'], {
queryParams: {
pageId: this.selectedPageId
}, relativeTo: this.route
});
this.router.navigate(['edit'], {
queryParams: {
pageId: this.selectedPageId
}, relativeTo: this.route
});
}
public onSearchClose() {
this.selectedKeyword = this.filterForm.value;
}
public reset() {
this.selectedKeyword = null;
this.searchInputComponent.reset()
}
selectAll(){
let checked = !!(this.getSelectedPageHelpContents().length != this.checkboxes.length);
for (let check of this.checkboxes) {
check.checked = checked;
}
selectAll() {
let checked = (this.getSelectedPageHelpContents().length != this.checkboxes.length);
for (let check of this.checkboxes) {
check.checked = checked;
}
}
}

View File

@ -1,7 +1,7 @@
<div page-content>
<div header>
<admin-tabs tab="page" [portal]="portal"></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div *ngIf="!showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<ul class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="filterForm.get('type').value === 'all'"><a
@ -11,11 +11,14 @@
(click)="filterForm.get('type').setValue(type.value)"><span>{{type.label}}</span></a></li>
</ul>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-remove-top"
uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search page"
<div
class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-remove-top"
uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
placeholder="Search page"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<a (click)="newPage()"
@ -32,117 +35,99 @@
class="uk-padding uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom uk-display-inline"
[attr.uk-tooltip]="getSelectedPages().length == 0 ? 'pos:left; cls: uk-active' : null"
title="Select at least one page"><input id="checkAll" type="checkbox" (click)="selectAll()"
[ngModel]="getSelectedPages().length ==checkboxes.length"/>
[ngModel]="getSelectedPages().length ==checkboxes.length"/>
<span *ngIf="getSelectedPages().length > 0" class="uk-margin-left uk-text-muted">
{{getSelectedPages().length}} pages selected </span>
<a class="uk-margin-left">Actions</a>
<a class="uk-margin-left">Actions</a>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav"
[attr.uk-tooltip]="getSelectedPages().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one page">
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
(click)="togglePages(true,getSelectedPages())"><i></i> Enable
(click)="togglePages(true,getSelectedPages())"><i></i> Enable
</a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
(click)="togglePages(false,getSelectedPages())"><i></i> Disable
(click)="togglePages(false,getSelectedPages())"><i></i> Disable
</a>
</li>
<li *ngIf="isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''"
(click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li>
(click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li>
</ul>
</div>
</div>
</div>
<div inner>
<div *ngIf="showLoading" class="uk-position-center">
<loading *ngIf="showLoading"></loading>
<loading></loading>
</div>
<div *ngIf="!showLoading">
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div class="uk-margin-medium-bottom" *ngIf="!errorMessage">
<div class="md-card-content">
<div class="uk-overflow-container">
<ul class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-padding">
<div class=""><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand">
<div class="title uk-margin-medium-bottom">Name</div>
<div class="name uk-margin-medium-bottom" href="#">{{check.page.name}}</div>
<div *ngIf="check.page.entities && check.page.entities.length > 0"><span
class="title">Entities: </span>
{{getEntitiesAsString(check.page)}}</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
class="title">Type: </span> {{check.page.type}}</div>
<div *ngIf="!portal" class=" uk-margin-small-bottom">
<span class="title">Portal type: </span>{{check.page.portalType}}
</div>
</div>
<div *ngIf="isPortalAdministrator" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Actions</div>
<div class="actions" href="#">
<i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
<i class="clickable uk-text-danger"
(click)="confirmDeletePage(check.page._id)" uk-icon="trash"></i>
</div>
</div>
<div *ngIf="!isPortalAdministrator && ((check.page.top || check.page.bottom || check.page.left ||
<ul *ngIf="checkboxes.length > 0" class="uk-list pages">
<li *ngFor="let check of checkboxes; let i=index" class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-grid uk-padding">
<div class=""><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
</div>
<div class="uk-width-expand">
<div class="title uk-margin-medium-bottom">Name</div>
<div class="name uk-margin-medium-bottom" href="#">{{check.page.name}}</div>
<div *ngIf="check.page.entities && check.page.entities.length > 0"><span
class="title">Entities: </span>
{{getEntitiesAsString(check.page)}}</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
class="title">Type: </span> {{check.page.type}}</div>
<div *ngIf="!portal" class=" uk-margin-small-bottom">
<span class="title">Portal type: </span>{{check.page.portalType}}
</div>
</div>
<div *ngIf="isPortalAdministrator" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Actions</div>
<div class="actions" href="#">
<i class="clickable " (click)="editPage(i)" uk-icon="pencil"></i>
<i class="clickable uk-text-danger"
(click)="confirmDeletePage(check.page._id)" uk-icon="trash"></i>
</div>
</div>
<div *ngIf="!isPortalAdministrator && ((check.page.top || check.page.bottom || check.page.left ||
check.page.right) || pageWithDivIds.includes(check.page._id) )" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Helptexts</div>
<div class=" uk-margin-small-bottom">
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents"
[queryParams]="{pageId: check.page._id}"
routerLink="../helptexts">
manage help texts
<span *ngIf="pageHelpContents[check.page._id]">({{pageHelpContents[check.page._id]}})</span>
</a>
<span *ngIf="!(check.page.top || check.page.bottom || check.page.left || check.page.right)"
class="helpContents">
no helptexts available
</span>
</div>
<div>
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents"
[queryParams]="{ pageId: check.page._id}"
routerLink="../classContents">manage class contents</a>
</div>
</div>
<div *ngIf="!isPortalAdministrator" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Enable/disable</div>
<mat-slide-toggle [checked]="check.page.isEnabled"
(change)="($event.source.checked = check.page.isEnabled);togglePages(!check.page.isEnabled,[check.page._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable a page to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If the page is disabled, a message 'Can't find that page' will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.</div></div>">
</mat-slide-toggle>
</div>
</div>
</li>
</ul>
<div *ngIf="checkboxes.length==0">
<div class="uk-alert-warning" uk-alert>No pages found</div>
<div class="title uk-margin-medium-bottom">Helptexts</div>
<div class=" uk-margin-small-bottom">
<a *ngIf="check.page.top || check.page.bottom || check.page.left || check.page.right"
class="helpContents"
[queryParams]="{pageId: check.page._id}"
routerLink="../helptexts">
Manage page contents
<span *ngIf="pageHelpContents[check.page._id]">({{pageHelpContents[check.page._id]}})</span>
</a>
</div>
<div>
<a *ngIf="pageWithDivIds.includes(check.page._id)"
[queryParams]="{ pageId: check.page._id}"
routerLink="../classContents">Manage class contents</a>
</div>
</div>
<div *ngIf="!isPortalAdministrator" class="uk-width-1-4">
<div class="title uk-margin-medium-bottom">Enable/disable</div>
<mat-slide-toggle [checked]="check.page.isEnabled"
(change)="($event.source.checked = check.page.isEnabled);togglePages(!check.page.isEnabled,[check.page._id])"
uk-tooltip="title:<div class='uk-padding-small uk-width-large'><div class='uk-text-bold '>Disable a page to hide it from community dashboard portal.</div><div class=' uk-margin-top'>If the page is disabled, a message 'Can't find that page' will appear in case the url of that page is loaded. If the disabled page belongs to the menu, the link will be removed from menu, too.</div></div>">
</mat-slide-toggle>
</div>
</div>
</div>
</li>
</ul>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No pages found</div>
</div>
</div>
</div>
</div>
<modal-alert #editModal (alertOutput)="pageSaveConfirmed($event)"
[okDisabled]="pageForm && (pageForm.invalid || !pageForm.dirty)">
<div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
<form *ngIf="pageForm" [formGroup]="pageForm" class="uk-grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="pageForm.get('route')"
<div dashboard-input [formInput]="pageForm.get('route')"
type="text" label="Page route" placeholder="Write a route">
</div>
<div dashboard-input [formInput]="pageForm.get('name')"
@ -159,23 +144,23 @@
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
[formInput]="pageForm.get('portalType')" [options]="portalUtils.portalTypes"></div>
<div class="form-group">
<div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at: </div>
<div class="uk-form-label uk-text-bold uk-margin-small-bottom"> Select if this page have helptext at:</div>
<div class="uk-grid uk-grid-small uk-child-width-1-4" uk-grid>
<div dashboard-input [formInput]="pageForm.get('top')"
type="checkbox"
label="Top">
type="checkbox"
label="Top">
</div>
<div dashboard-input [formInput]="pageForm.get('right')"
type="checkbox"
label="Right">
type="checkbox"
label="Right">
</div>
<div dashboard-input [formInput]="pageForm.get('bottom')"
type="checkbox"
label="Bottom">
type="checkbox"
label="Bottom">
</div>
<div dashboard-input [formInput]="pageForm.get('left')"
type="checkbox"
label="Left">
type="checkbox"
label="Left">
</div>
</div>
<label class="uk-text-danger">

View File

@ -47,9 +47,6 @@ export class PagesComponent implements OnInit {
public properties: EnvProperties = properties;
public showLoading: boolean = true;
public errorMessage: string = '';
public updateErrorMessage: string = '';
public modalErrorMessage: string = '';
public isPortalAdministrator = null;
public filterForm: FormGroup;
public typeOptions = [{label: 'Search', value: 'search'}, {
@ -135,8 +132,6 @@ export class PagesComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this.errorMessage = '';
this.pageWithDivIds = [];
let parameters = '';
if (this.pagesType) {
@ -270,8 +265,6 @@ export class PagesComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deletePagesFromArray(this.selectedPages);
@ -308,7 +301,6 @@ export class PagesComponent implements OnInit {
for (let i = 0; i < page.entities.length; i++) {
this.entitiesCtrl.push(this._fb.control(page.entities[i]));
}
this.modalErrorMessage = '';
this.pagesModalOpen('Edit Page', 'Save changes');
}
@ -330,7 +322,6 @@ export class PagesComponent implements OnInit {
type: this._fb.control(this.typeOptions[0].value, Validators.required),
entities: this.entitiesCtrl,
});
this.modalErrorMessage = '';
this.pagesModalOpen('Create Page', 'Create');
}
@ -363,7 +354,6 @@ export class PagesComponent implements OnInit {
});
} else {
if (!this.pageForm.value._id) {
this.modalErrorMessage = '';
this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe(
page => {
this.pageSavedSuccessfully(page, true);
@ -423,13 +413,12 @@ export class PagesComponent implements OnInit {
}
handleError(message: string, error) {
// if(error == null) {
// this.formComponent.reset();
// } else {
this.errorMessage = message;// + ' (Server responded: ' + error + ')';
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
//}
this.showLoading = false;
}
@ -450,14 +439,12 @@ export class PagesComponent implements OnInit {
_id: this._fb.control(''),
});
} else {
this.updateErrorMessage = message;// + ' (Server responded: ' + error + ')';
console.log('Server responded: ' + error);
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
}
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
}
@ -486,8 +473,6 @@ export class PagesComponent implements OnInit {
}
});
} else {
this.updateErrorMessage = '';
this.subscriptions.push(this._helpContentService.togglePages(this.portal, ids, status, this.properties.adminToolsAPIURL).subscribe(
() => {
for (let id of ids) {

View File

@ -1,7 +1,7 @@
<div page-content class="admin-pages">
<div header>
<admin-tabs tab="portal"></admin-tabs>
<div *ngIf="!errorMessage && !showLoading" class="uk-grid" uk-grid>
<div *ngIf="!showLoading" class="uk-grid" uk-grid>
<div class="uk-width-1-1">
<ul class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
@ -14,9 +14,11 @@
</ul>
</div>
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false" placeholder="Search portal"
<div #searchInputComponent search-input [control]="filterForm.controls.keyword" [showSearch]="false"
placeholder="Search portal"
[selected]="selectedKeyword" (closeEmitter)="onSearchClose()" (resetEmitter)="reset()"
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
[bordered]="true" colorClass="uk-text-secondary"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div class="show-options">
<button class="uk-button uk-button-secondary">Bulk Actions</button>
<div uk-dropdown="mode: click">
@ -41,57 +43,45 @@
</div>
</div>
<div inner>
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!showLoading">
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert>
<a class="uk-alert-close" uk-close></a>
{{updateErrorMessage}}
</div>
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top"
role="alert">{{errorMessage}}</div>
<div class=" uk-margin-medium-bottom" *ngIf="!errorMessage">
<div class="uk-overflow-container">
<table class="uk-table uk-table-striped uk-table-hover">
<thead class="uk-card-header">
<tr>
<th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th>Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.portal._id}}" class="checkBox" type="checkbox"
name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.portal.name}}</div>
</td>
<td>
<div class="type" href="#">{{check.portal.type}}</div>
</td>
<td>
<div class="actions" href="#">
<i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeletePortal(check.portal._id)"></i>
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="uk-alert-warning" uk-alert>No portals found</div>
<table *ngIf="checkboxes.length > 0" class="uk-table uk-table-striped uk-table-hover">
<thead class="uk-card-header">
<tr>
<th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th>Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let check of checkboxes; let i=index">
<td><input id="{{check.portal._id}}" class="checkBox" type="checkbox"
name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked">
</td>
<td>
<div class="name" href="#">{{check.portal.name}}</div>
</td>
<td>
<div class="type" href="#">{{check.portal.type}}</div>
</td>
<td>
<div class="actions" href="#">
<i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i>
<i class="clickable uk-text-danger" uk-icon="trash"
(click)="confirmDeletePortal(check.portal._id)"></i>
</div>
<!--<div class="uk-width-1-1 uk-flex uk-flex-center ">
<div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()">
<i class="" uk-icon="plus"></i>
</div>
</div>-->
</div>
</td>
</tr>
</tbody>
</table>
<div *ngIf="checkboxes.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No portals found</div>
</div>
</div>
</div>
@ -99,11 +89,12 @@
<modal-alert #editModal (alertOutput)="portalSaveConfirmed($event)"
[okDisabled]="portalForm && (portalForm.invalid || !portalForm.dirty)">
<div *ngIf="modalErrorMessage" class="uk-alert-danger" uk-alert aria-hidden="true">{{ modalErrorMessage }}</div>
<form *ngIf="portalForm" [formGroup]="portalForm" class="uk-grid uk-child-width-1-1" uk-grid>
<div dashboard-input [formInput]="portalForm.get('name')" type="text" label="Portal Name" placeholder="Write a name">
<div dashboard-input [formInput]="portalForm.get('name')" type="text" label="Portal Name"
placeholder="Write a name">
</div>
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type" [formInput]="portalForm.get('type')" [options]="portalUtils.portalTypes"></div>
<div dashboard-input type="select" label="Portal Type" placeholder="Choose a type"
[formInput]="portalForm.get('type')" [options]="portalUtils.portalTypes"></div>
<div dashboard-input [formInput]="portalForm.get('pid')"
type="text" placeholder="Write pid of portal"
label="Portal persistent id for portal">

View File

@ -40,9 +40,6 @@ export class PortalsComponent implements OnInit {
public properties: EnvProperties = null;
public showLoading = true;
public errorMessage = '';
public updateErrorMessage = '';
public modalErrorMessage = '';
public portalUtils: PortalUtils = new PortalUtils();
private index: number;
public selectedKeyword: string;
@ -89,10 +86,6 @@ export class PortalsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this.errorMessage = '';
this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe(
portals => {
this.portals = portals;
@ -164,8 +157,6 @@ export class PortalsComponent implements OnInit {
});
} else {
this.showLoading = true;
this.updateErrorMessage = '';
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deletePortalsFromArray(this.selectedPortals);
@ -192,7 +183,6 @@ export class PortalsComponent implements OnInit {
type: this._fb.control(portal.type, Validators.required),
});
this.portalForm.get('type').disable();
this.modalErrorMessage = '';
this.portalModalOpen('Edit Portal', 'Save');
}
@ -207,7 +197,6 @@ export class PortalsComponent implements OnInit {
piwik: this._fb.control(''),
type: this._fb.control('', Validators.required),
});
this.modalErrorMessage = '';
this.portalModalOpen('Create Portal', 'Create');
}
@ -239,7 +228,6 @@ export class PortalsComponent implements OnInit {
}
});
} else {
this.modalErrorMessage = '';
if (this.portalForm.value._id) {
this.portalForm.get('type').enable();
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
@ -313,19 +301,22 @@ export class PortalsComponent implements OnInit {
type: ''
});
} else {
this.updateErrorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
}
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
this.showLoading = false;
}
handleError(message: string, error) {
this.errorMessage = message;
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
this.showLoading = false;
}

View File

@ -31,14 +31,14 @@
</div>
</div>
<div inner>
<div *ngIf="loadActive || loadPending" class="uk-margin-large-top">
<div *ngIf="loadActive || loadPending" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loadActive && !loadPending">
<div *ngIf="(showActive && active.length == 0) || (!showActive && pending.length == 0)"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div *ngIf="showActive">No {{role}}s for {{name}}</div>
<div *ngIf="!showActive">No pending {{role}} invitations for {{name}}</div>
<div *ngIf="showActive">No {{role}}s found</div>
<div *ngIf="!showActive">No pending {{role}} invitations found</div>
</div>
<div *ngIf="(showActive && active.length > 0) || (!showActive && pending.length > 0)">
<div class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom"

View File

@ -24,13 +24,13 @@
</div>
</div>
<div inner>
<div *ngIf="loading" class="uk-margin-large-top">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loading">
<div *ngIf="showSubscribers.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No subscribers for {{name}}</div>
<div>No subscribers found</div>
</div>
<div *ngIf="showSubscribers.length > 0">
<no-load-paging [type]="(subscribers.length > 1)?'subscribers':'subscriber'"