Dropdown Filter: Add overflow-auto. Fix all forms with disabled fields. Change all dashboard pages in order to apply sticky in actions instead of header.

This commit is contained in:
Konstantinos Triantafyllou 2022-07-13 20:25:19 +03:00
parent 770c3fb3ef
commit 3b6498cb2e
29 changed files with 458 additions and 680 deletions

View File

@ -106,7 +106,7 @@ export class ClaimDBRecord {
targetType: string;
semantics: string;
approved: string;
source: ClaimDBResult | ClaimProject | ClaimContext;
source: ClaimDBResult | ClaimDBProject | ClaimDBContext;
target: ClaimDBResult;
indexed:boolean;
}

View File

@ -1,108 +1,112 @@
<schema2jsonld *ngIf="url" [URL]="url" [name]="pageTitle" type="other"></schema2jsonld>
<div class="uk-grid">
<div class="uk-width-expand uk-position-relative">
<div>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<div *ngIf="filterForm" class="uk-margin-top">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle">
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<div *ngIf="filterForm" [id]="actions?'page_content_actions':null" [attr.uk-sticky]="(actions)?'media: @m':null" [attr.offset]="offset">
<div [class.uk-padding-small]="actions" class="uk-padding-remove-vertical">
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle">
<div search-input [disabled]="loading" [searchControl]="filterForm.controls.keyword" searchInputClass="outer"
placeholder="Search links" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"
(searchEmitter)="changeKeyword()" [expandable]="true"></div>
</div>
<div class="uk-margin-medium-top">
<results-and-pages [type]="resultsNum !== 1?'Links':'Link'" [page]="page" [pageSize]="size"
[totalResults]="resultsNum" customClasses="uk-margin-remove"></results-and-pages>
</div>
<div class="uk-grid uk-flex-middle uk-margin-medium-top" uk-grid>
<div>
<dropdown-filter #dropdownFilter dropdownClass="uk-width-medium uk-padding-small"
name="Type of Entity" [disabled]="loading" [count]="entities.length">
<h6 class="uk-margin-remove-bottom" title="Type of Entity">Type of Entity</h6>
<ul class="uk-list uk-margin-remove-bottom">
<li *ngFor="let option of allOptions">
<a class="uk-link-text">
<label (click)="select(option.value, $event, dropdownFilter)" class="uk-flex uk-flex-middle">
<input class="uk-checkbox"
type="checkbox" [checked]="isSelected(option.value)">
<span class="uk-margin-small-left">{{option.label}}</span>
</label>
</a>
</li>
</ul>
</dropdown-filter>
</div>
<div>
<div input inputClass="flat x-small" placeholder="Sort by"
[formInput]="filterForm.get('sort')" class="uk-width-small"
type="select" [options]="sortOptions">
</div>
</div>
<div class="uk-width-expand@l uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size"
[loading]="false" (pageChange)="pageChange($event)"></paging-no-load>
</div>
</div>
</div>
</div>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
<div [class.uk-padding]="actions" class="uk-padding-remove-vertical">
<div class="uk-margin-medium-top">
<results-and-pages [type]="resultsNum !== 1?'Links':'Link'" [page]="page" [pageSize]="size"
[totalResults]="resultsNum" customClasses="uk-margin-remove"></results-and-pages>
</div>
<div *ngIf="!loading">
<div *ngIf="claims && claims.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No links found</div>
<div class="uk-grid uk-flex-middle uk-margin-medium-top" uk-grid>
<div>
<dropdown-filter #dropdownFilter dropdownClass="uk-width-medium uk-padding-small"
name="Type of Entity" [disabled]="loading" [count]="entities.length">
<h6 class="uk-margin-remove-bottom" title="Type of Entity">Type of Entity</h6>
<ul class="uk-list uk-margin-remove-bottom">
<li *ngFor="let option of allOptions">
<a class="uk-link-text">
<label (click)="select(option.value, $event, dropdownFilter)" class="uk-flex uk-flex-middle">
<input class="uk-checkbox"
type="checkbox" [checked]="isSelected(option.value)">
<span class="uk-margin-small-left">{{option.label}}</span>
</label>
</a>
</li>
</ul>
</dropdown-filter>
</div>
<ul class="uk-margin-small-top uk-list uk-list-xlarge">
<li *ngFor="let claim of claims; let i=index" class="uk-card uk-card-default">
<div class="uk-card-body">
<div class="uk-grid uk-grid-small" uk-grid>
<div class="uk-width-expand">
<div class="uk-margin-bottom">
<claim-entity [entity]="claim.target" [type]="claim.targetType" [properties]=properties
[externalPortalUrl]=externalPortalUrl [source]="true"></claim-entity>
</div>
<div class="uk-margin-bottom">
<span *ngIf="isClaimAvailable(claim) else notAvailable" class="uk-label uk-label-success"
[attr.uk-tooltip]="'title: The link information is available in the portal and the APIs.'">available</span>
<ng-template #notAvailable>
<span class="uk-label uk-label-danger"
[attr.uk-tooltip]="'title:The link information will be added in the portal and the APIs in the next content provision workflow.'">pending</span>
</ng-template>
</div>
<div class="uk-text-small">
<div *ngIf="showUserEmail" class="uk-margin-small-bottom">
<span class="uk-text-meta">Claimed by:</span>
<span class="uk-margin-xsmall-left">{{claim.userMail}}</span>
<div>
<div input inputClass="flat x-small" placeholder="Sort by"
[formInput]="filterForm.get('sort')" class="uk-width-small"
type="select" [options]="sortOptions">
</div>
</div>
<div class="uk-width-expand@l uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size"
[loading]="false" (pageChange)="pageChange($event)"></paging-no-load>
</div>
</div>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<div *ngIf="!loading">
<div *ngIf="claims && claims.length == 0" class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No links found</div>
</div>
<ul class="uk-margin-small-top uk-list uk-list-xlarge">
<li *ngFor="let claim of claims; let i=index" class="uk-card uk-card-default">
<div class="uk-card-body">
<div class="uk-grid uk-grid-small" uk-grid>
<div class="uk-width-expand">
<div class="uk-margin-bottom">
<claim-entity [entity]="claim.target" [type]="claim.targetType" [properties]=properties
[externalPortalUrl]=externalPortalUrl [source]="true"></claim-entity>
</div>
<div>
<span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span>
<div class="uk-margin-bottom">
<span *ngIf="isClaimAvailable(claim) else notAvailable" class="uk-label uk-label-success"
[attr.uk-tooltip]="'title: The link information is available in the portal and the APIs.'">available</span>
<ng-template #notAvailable>
<span class="uk-label uk-label-danger"
[attr.uk-tooltip]="'title:The link information will be added in the portal and the APIs in the next content provision workflow.'">pending</span>
</ng-template>
</div>
<div class="uk-text-small">
<div *ngIf="showUserEmail" class="uk-margin-small-bottom">
<span class="uk-text-meta">Claimed by:</span>
<span class="uk-margin-xsmall-left">{{claim.userMail}}</span>
</div>
<div>
<span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span>
</div>
</div>
</div>
</div>
<div class="uk-visible@m">
<div class="claim-divider">
<icon class="uk-position-center uk-background-default" name="link" customClass="uk-text-primary" ratio="2" [flex]="true"></icon>
<div class="uk-visible@m">
<div class="claim-divider">
<icon class="uk-position-center uk-background-default" name="link" customClass="uk-text-primary" ratio="2" [flex]="true"></icon>
</div>
</div>
<div class="uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-column uk-flex-center">
<claim-entity [entity]="claim.source" [type]="claim.sourceType" [source]="false" [properties]=properties
[externalPortalUrl]=externalPortalUrl></claim-entity>
</div>
</div>
<div class="uk-width-1-2@m uk-width-1-1 uk-flex uk-flex-column uk-flex-center">
<claim-entity [entity]="claim.source" [type]="claim.sourceType" [source]="false" [properties]=properties
[externalPortalUrl]=externalPortalUrl></claim-entity>
</div>
</div>
</div>
<div class="uk-card-footer uk-flex uk-flex-right">
<button class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="deleteOpen(i)">
<icon name="delete" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Delete</span>
</button>
</div>
</li>
</ul>
<div class="uk-margin-medium-top uk-flex uk-flex-center uk-flex-right@m">
<paging-no-load *ngIf="resultsNum" [currentPage]="page" [totalResults]="resultsNum" [size]="size"
(pageChange)="pageChange($event)"></paging-no-load>
<div class="uk-card-footer uk-flex uk-flex-right">
<button class="uk-button uk-button-link uk-flex uk-flex-middle" (click)="deleteOpen(i)">
<icon name="delete" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Delete</span>
</button>
</div>
</li>
</ul>
<div class="uk-margin-medium-top uk-flex uk-flex-center uk-flex-right@m">
<paging-no-load *ngIf="resultsNum" [currentPage]="page" [totalResults]="resultsNum" [size]="size"
(pageChange)="pageChange($event)"></paging-no-load>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
import {Component, Input, ViewChild} from '@angular/core';
import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {Location} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router';
import {Subject, Subscriber} from 'rxjs';
@ -26,7 +26,7 @@ import {DropdownFilterComponent} from "../../../utils/dropdown-filter/dropdown-f
templateUrl: 'displayClaims.component.html',
styleUrls: ['displayClaims.component.less']
})
export class DisplayClaimsComponent {
export class DisplayClaimsComponent implements OnInit, OnDestroy {
@Input() piwikSiteId = null;
@Input() pageTitle: string = "";
properties: EnvProperties;
@ -79,12 +79,20 @@ export class DisplayClaimsComponent {
url = null;
public pageContents = null;
/* Sticky actions */
@Input()
public actions: boolean = false;
public offset: number;
constructor(private _claimService: ClaimsService, private route: ActivatedRoute, private _router: Router, private location: Location,
private _meta: Meta, private _title: Title, private _piwikService: PiwikService,
private seoService: SEOService, private indexInfoService: IndexInfoService, private helper: HelperService, private _fb: FormBuilder) {
}
ngOnInit() {
if (typeof document !== "undefined" && this.actions) {
this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--structure-header-height'));
}
this.entities = [];
this.filterForm = this._fb.group({
keyword: [''],

View File

@ -10,9 +10,9 @@ import {Subscriber} from "rxjs";
@Component({
selector: 'claims-admin',
template: `
<div class="uk-section">
<div [class.uk-section]="!isConnect">
<div uk-grid class="uk-margin-small-top">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first">
<div [class.uk-container]="!isConnect" [class.uk-container-large]="!isConnect">
<h1 *ngIf="!isConnect" class="uk-h2">
Manage links
@ -20,7 +20,7 @@ import {Subscriber} from "rxjs";
<div>
<displayClaims *ngIf="user" [user]="user" [enableDelete]=true [myClaims]=false
[isAdmin]=true [fetchBy]="(fetchId=='openaire')?null:fetchBy"
[fetchId]="(fetchId=='openaire')?null:fetchId"
[fetchId]="(fetchId=='openaire')?null:fetchId" [actions]="isConnect"
[communityId]="(fetchBy && fetchBy == 'Context' && fetchId && fetchId!='openaire')?fetchId:null"
[externalPortalUrl]=externalPortalUrl [claimsInfoURL]=claimsInfoURL
pageTitle="Manage links"></displayClaims>

View File

@ -1,42 +1,38 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<img src="assets/common-assets/placeholder.png" class="uk-margin-right">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Classes</div>
<h1 class="uk-h4 uk-margin-remove">Super Admin</h1>
</div>
</div>
<div class="uk-margin uk-margin-remove-bottom">
<admin-tabs tab="class"></admin-tabs>
</div>
<admin-tabs tab="class"></admin-tabs>
<ul class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue('all')"><span
class="title">All portals</span></a></li>
<li *ngFor="let type of portalUtils.portalTypes; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue(type.value)"><span
class="title">{{type.label}}</span></a></li>
</ul>
</div>
<div inner>
<div class="uk-grid uk-flex-middle uk-margin-top" 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
(click)="filterForm.get('type').setValue('all')"><span
class="title">All portals</span></a></li>
<li *ngFor="let type of portalUtils.portalTypes; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue(type.value)"><span
class="title">{{type.label}}</span></a></li>
</ul>
</div>
<div class="uk-width-1-1">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search class" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newDivId()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add class</span>
</button>
</div>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search class" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newDivId()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add class</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -11,17 +11,14 @@ import {properties} from "../../../../environments/environment";
import {PortalUtils} from "../portal/portalHelper";
import {AlertModal} from "../../utils/modal/alert";
import {Option} from "../../sharedComponents/input/input.component";
import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component";
import {Title} from "@angular/platform-browser";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'divIds',
templateUrl: './divIds.component.html',
})
export class DivIdsComponent implements OnInit {
@ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal;
@ -42,7 +39,6 @@ export class DivIdsComponent implements OnInit {
selectedCommunityPid = null;
public portalUtils: PortalUtils = new PortalUtils();
private index: number;
public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
private title: Title,
@ -145,11 +141,7 @@ export class DivIdsComponent implements OnInit {
this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deleteDivIdsFromArray(this.selectedDivIds);
UIkit.notification('Classes have been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Classes have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Class ids deleted");
},
@ -198,29 +190,20 @@ export class DivIdsComponent implements OnInit {
public divIdSaveConfirmed(data: any) {
this.showLoading = true;
if (!this.classForm.value._id) {
this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe(
if (!this.classForm.getRawValue()._id) {
this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
divId => {
this.divIdSavedSuccessfully(divId);
UIkit.notification('Class <b>' + divId.name + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("Class id saved");
},
error => this.handleUpdateError("System error creating class", error)
));
} else {
this.classForm.get('portalType').enable();
this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
divId => {
this.divIdUpdatedSuccessfully(divId);
UIkit.notification('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("Class id updated");
},
error => this.handleUpdateError("System error updating class", error)
@ -257,31 +240,22 @@ export class DivIdsComponent implements OnInit {
}
public filterDivIds(divId: DivId): boolean {
let textFlag = this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null;
return textFlag;
return this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null;
}
handleUpdateError(message: string, error) {
if (error == null) {
// this.formComponent.reset();
} else {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
handleUpdateError(message: string, error = null) {
if (error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message,'danger');
this.showLoading = false;
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if (error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message,'danger');
this.showLoading = false;
}

View File

@ -1,7 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info"
[class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info">
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-right">
<icon name="west" ratio="2" [flex]="true"></icon>
</a>
@ -13,9 +12,9 @@
</div>
</div>
</div>
<div inner>
<div class="uk-container uk-container-small">
<div class="uk-margin-top uk-flex uk-flex-center uk-flex-right@m">
<div actions>
<div class="uk-section-xsmall uk-container uk-container-small">
<div class="uk-flex uk-flex-center uk-flex-right@m">
<button class="uk-button uk-button-default uk-margin-right"
(click)="resetCustom()" [class.uk-disabled]="!myForm.dirty"
[disabled]="!myForm.dirty || showLoading">Reset
@ -24,6 +23,10 @@
(click)="saveCustom()" [disabled]="!myForm.dirty || myForm.disabled || showLoading">Save
</button>
</div>
</div>
</div>
<div inner>
<div class="uk-container uk-container-small">
<div *ngIf="myForm" style="min-height: 60vh"
class="uk-section uk-section-small uk-position-relative">
<div *ngIf="showLoading" class="uk-position-center">

View File

@ -1,21 +1,15 @@
import {Component, Input, OnInit} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {Page} from '../../utils/entities/adminTool/page';
import {HelpContentService} from '../../services/help-content.service';
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, zip} from 'rxjs';
import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
import {NotificationHandler} from "../../utils/notification-handler";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
@Component({
selector: 'class-content-form',
templateUrl: './class-help-content-form.component.html',
@ -32,7 +26,6 @@ export class ClassContentFormComponent implements OnInit {
public showLoading: boolean = true;
private subs: Subscription[] = [];
public pageHelpContent: DivHelpContent;
public stickyPageHeader: boolean = false;
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder,
private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) {
@ -145,16 +138,11 @@ export class ClassContentFormComponent implements OnInit {
public saveCustom() {
if (this.myForm.valid) {
this.showLoading = true;
this.myForm.get('divId').enable();
let pageHelpContent: DivHelpContent = this.myForm.value;
let pageHelpContent: DivHelpContent = this.myForm.getRawValue();
this.subs.push(this._helpContentService.insertOrUpdateDivHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
_ => {
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
UIkit.notification('Page content has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Page content has been <b>successfully updated</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Class help text saved or updated");
},

View File

@ -1,7 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info"
[class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-right">
<icon name="west" ratio="2" [flex]="true"></icon>
</a>
@ -13,18 +12,22 @@
</div>
</div>
</div>
<div inner>
<div class="uk-margin-top uk-margin-medium-bottom uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm" searchInputClass="outer" placeholder="Search helptext" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button (click)="newPageContent()" [disabled]="showLoading" [class.uk-disabled]="showLoading"
class="uk-flex uk-flex-middle uk-button uk-button-default">
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add class help text</span>
</button>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm" searchInputClass="outer" placeholder="Search helptext" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button (click)="newPageContent()" [disabled]="showLoading" [class.uk-disabled]="showLoading"
class="uk-flex uk-flex-middle uk-button uk-button-default">
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add class help text</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -15,9 +15,7 @@ import {DomSanitizer} from '@angular/platform-browser';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'class-help-contents',
@ -43,7 +41,6 @@ export class ClassHelpContentsComponent implements OnInit {
public showLoading: boolean = true;
public filterForm: FormControl;
private subscriptions: any[] = [];
public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router,
private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer,
@ -156,11 +153,7 @@ export class ClassHelpContentsComponent implements OnInit {
this.subscriptions.push(this._helpService.deleteDivHelpContents(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'
});
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Class text texts deleted");
},
@ -204,11 +197,7 @@ export class ClassHelpContentsComponent implements OnInit {
}
this.countClassHelpContents();
this.applyCheck(false);
UIkit.notification('Page content(s) has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
this._clearCacheService.clearCache("class help text's status changed");
},
error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
@ -237,23 +226,19 @@ export class ClassHelpContentsComponent implements OnInit {
this.applyFilter();
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
handleUpdateError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleUpdateError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}

View File

@ -1,6 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<ng-container *ngIf="showLogo">
<img [src]="entity | logoUrl" class="uk-margin-right uk-blend-multiply">
</ng-container>
@ -9,37 +9,33 @@
<h1 class="uk-h4 uk-margin-remove">{{name?name:'Super Admin'}}</h1>
</div>
</div>
<div class="uk-margin uk-margin-remove-bottom">
<admin-tabs tab="entity" [portal]="portal"></admin-tabs>
</div>
</div>
<div inner>
<div class="uk-grid uk-flex-middle uk-margin-top" 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
(click)="filterForm.get('status').setValue('all')"><span
class="title">All entities</span></a></li>
<li [class.uk-active]="filterForm.get('status').value === 'enabled'"><a
(click)="filterForm.get('status').setValue('enabled')"><span class="title">Enabled</span></a></li>
<li [class.uk-active]="filterForm.get('status').value === 'disabled'"><a
(click)="filterForm.get('status').setValue('disabled')"><span class="title">Disabled</span></a></li>
</ul>
</div>
<div class="uk-width-1-1">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search entity"
[disabled]="showLoading" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newEntity()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add entity</span>
</button>
</div>
<admin-tabs tab="entity" [portal]="portal"></admin-tabs>
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li [class.uk-active]="filterForm.get('status').value === 'all'"><a
(click)="filterForm.get('status').setValue('all')"><span
class="title">All entities</span></a></li>
<li [class.uk-active]="filterForm.get('status').value === 'enabled'"><a
(click)="filterForm.get('status').setValue('enabled')"><span class="title">Enabled</span></a></li>
<li [class.uk-active]="filterForm.get('status').value === 'disabled'"><a
(click)="filterForm.get('status').setValue('disabled')"><span class="title">Disabled</span></a></li>
</ul>
</div>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search entity"
[disabled]="showLoading" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newEntity()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add entity</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -19,8 +19,7 @@ import {CommunityService} from "../../connect/community/community.service";
import {CommunityInfo} from "../../connect/community/communityInfo";
import {Stakeholder, StakeholderInfo} from "../../monitor/entities/stakeholder";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'entities',
@ -57,7 +56,6 @@ export class EntitiesComponent implements OnInit {
public filterForm: FormGroup;
private subscriptions: any[] = [];
private index: number;
public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute,
private _router: Router, private title: Title,
@ -202,11 +200,7 @@ export class EntitiesComponent implements OnInit {
this._helpContentService.deleteEntities(this.selectedEntities, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deleteEntitiesFromArray(this.selectedEntities);
UIkit.notification('Entities have been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Entities have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("entities deleted");
},
@ -243,29 +237,21 @@ export class EntitiesComponent implements OnInit {
public entitySaveConfirmed(data: any) {
this.showLoading = true;
if (this.entityForm.value._id) {
if (this.entityForm.getRawValue()._id) {
this._helpContentService.updateEntity(
<Entity>this.entityForm.value, this.properties.adminToolsAPIURL).subscribe(
<Entity>this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
entity => {
this.entityUpdatedSuccessfully(entity);
UIkit.notification('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("entity updated");
},
error => this.handleUpdateError('System error updating entity', error)
);
} else {
this._helpContentService.saveEntity(<Entity>this.entityForm.value, this.properties.adminToolsAPIURL).subscribe(
this._helpContentService.saveEntity(<Entity>this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
entity => {
this.entitySavedSuccessfully(entity);
UIkit.notification('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("entity saved");
},
error => this.handleUpdateError('System error creating entity', error)
@ -306,18 +292,16 @@ export class EntitiesComponent implements OnInit {
return status == "all" || (status == "disabled" && !entity.isEnabled) || (status == "enabled" && entity.isEnabled);
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
handleUpdateError(message: string, error) {
if (error == null) {
handleUpdateError(message: string, error = null) {
if (!error) {
this.entityForm = this._fb.group({
pid: ['', Validators.required],
name: ['', Validators.required],
@ -325,13 +309,9 @@ export class EntitiesComponent implements OnInit {
_id: ''
});
} else {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}

View File

@ -1,7 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info"
[class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top uk-margin-bottom info">
<a routerLink="../" [queryParams]=" { 'pageId': pageId }" class="uk-button uk-button-link uk-margin-right">
<icon name="west" ratio="2" [flex]="true"></icon>
</a>
@ -13,9 +12,9 @@
</div>
</div>
</div>
<div inner>
<div class="uk-container uk-container-small">
<div class="uk-margin-top uk-flex uk-flex-center uk-flex-right@m">
<div actions>
<div class="uk-section-xsmall uk-container uk-container-small">
<div class="uk-flex uk-flex-center uk-flex-right@m">
<button class="uk-button uk-button-default uk-margin-right"
(click)="resetCustom()" [class.uk-disabled]="!myForm.dirty"
[disabled]="!myForm.dirty || showLoading">Reset
@ -24,6 +23,10 @@
(click)="saveCustom()" [disabled]="!myForm.dirty || myForm.disabled || showLoading">Save
</button>
</div>
</div>
</div>
<div inner>
<div class="uk-container uk-container-small">
<div *ngIf="myForm" style="min-height: 60vh"
class="uk-section uk-section-small uk-position-relative">
<div *ngIf="showLoading" class="uk-position-center">

View File

@ -9,8 +9,7 @@ import {Subscriber, Subscription, zip} from 'rxjs';
import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'page-content-form',
@ -29,7 +28,6 @@ export class PageContentFormComponent implements OnInit {
public showLoading: boolean = true;
private subs: Subscription[] = [];
public pageHelpContent: PageHelpContent;
public stickyPageHeader: boolean = false;
constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder,
private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) {
@ -204,30 +202,21 @@ export class PageContentFormComponent implements OnInit {
this.myForm.markAsPristine();
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.error('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.error('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
public saveCustom() {
if (this.myForm.valid) {
this.showLoading = true;
this.myForm.get('order').enable();
this.myForm.get('placement').enable();
let pageHelpContent: PageHelpContent = this.myForm.value;
let pageHelpContent: PageHelpContent = this.myForm.getRawValue();
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'
});
NotificationHandler.rise('Page content has been <b>successfully ' + (this.pageContentId ? 'updated' : 'created') + '</b>');
this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
this.showLoading = false;
this._clearCacheService.clearCache("page help content saved");
@ -249,14 +238,11 @@ export class PageContentFormComponent implements OnInit {
this.showLoading = false;
}
handleUpdateError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.error('Server responded: ' + error);
handleUpdateError(message: string, error = null) {
if(error) {
console.error('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}

View File

@ -1,7 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info"
[class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<a routerLink="../pages" class="uk-button uk-button-link uk-margin-right">
<icon name="west" ratio="2" [flex]="true"></icon>
</a>
@ -13,18 +12,22 @@
</div>
</div>
</div>
<div inner>
<div class="uk-margin-top uk-margin-medium-bottom uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm" searchInputClass="outer" placeholder="Search helptext" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button (click)="newPageContent()" [disabled]="showLoading" [class.uk-disabled]="showLoading"
class="uk-flex uk-flex-middle uk-button uk-button-default">
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add page help text</span>
</button>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid>
<div search-input [disabled]="showLoading" [expandable]="true" [searchControl]="filterForm" searchInputClass="outer" placeholder="Search helptext" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button (click)="newPageContent()" [disabled]="showLoading" [class.uk-disabled]="showLoading"
class="uk-flex uk-flex-middle uk-button uk-button-default">
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add page help text</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -7,19 +7,16 @@ import {
PageHelpContent,
PageHelpContentFilterOptions
} from '../../utils/entities/adminTool/page-help-content';
import {CheckPage, Page} from '../../utils/entities/adminTool/page';
import {Page} from '../../utils/entities/adminTool/page';
import {Portal} from '../../utils/entities/adminTool/portal';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {Subscriber} from 'rxjs';
import {properties} from '../../../../environments/environment';
import {DomSanitizer} from '@angular/platform-browser';
import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'page-help-contents',
@ -46,7 +43,6 @@ export class PageHelpContentsComponent implements OnInit {
public filterForm: FormControl;
private subscriptions: any[] = [];
public selectedKeyword: string;
public stickyPageHeader: boolean = false;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router,
@ -167,11 +163,7 @@ export class PageHelpContentsComponent implements OnInit {
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'
});
NotificationHandler.rise('Page content(s) has been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Help texts deleted");
},
@ -215,11 +207,7 @@ export class PageHelpContentsComponent implements OnInit {
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'
});
NotificationHandler.rise('Page content(s) has been <b>successfully updated</b>');
this.countPageHelpContents();
this.applyCheck(false);
this._clearCacheService.clearCache("Help text's status changed");
@ -252,23 +240,19 @@ export class PageHelpContentsComponent implements OnInit {
this.applyFilter();
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
handleUpdateError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleUpdateError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}

View File

@ -1,6 +1,6 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<ng-container *ngIf="showLogo">
<img [src]="entity | logoUrl" class="uk-margin-right uk-blend-multiply">
</ng-container>
@ -9,36 +9,32 @@
<h1 class="uk-h4 uk-margin-remove">{{name ? name : 'Super Admin'}}</h1>
</div>
</div>
<div class="uk-margin uk-margin-remove-bottom">
<admin-tabs tab="page" [portal]="portal"></admin-tabs>
<admin-tabs tab="page" [portal]="portal"></admin-tabs>
<ul class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li [class.uk-active]="filterForm.get('type').value === 'all'"><a
(click)="filterForm.get('type').setValue('all')"><span>All pages</span></a></li>
<li *ngFor="let type of typeOptions; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value"><a
(click)="filterForm.get('type').setValue(type.value)"><span>{{type.label}}</span></a></li>
</ul>
</div>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
placeholder="Search page" [disabled]="showLoading"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newPage()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add page</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-grid uk-flex-middle uk-margin-top" 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
(click)="filterForm.get('type').setValue('all')"><span>All pages</span></a></li>
<li *ngFor="let type of typeOptions; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value"><a
(click)="filterForm.get('type').setValue(type.value)"><span>{{type.label}}</span></a></li>
</ul>
</div>
<div class="uk-width-1-1">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer"
placeholder="Search page" [disabled]="showLoading"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div *ngIf="isPortalAdministrator">
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newPage()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add page</span>
</button>
</div>
</div>
</div>
</div>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -21,8 +21,7 @@ import {CommunityInfo} from "../../connect/community/communityInfo";
import {Stakeholder} from "../../monitor/entities/stakeholder";
import {CommunityService} from "../../connect/community/community.service";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'pages',
@ -70,7 +69,6 @@ export class PagesComponent implements OnInit {
private index: number;
pageHelpContentsCount = {};
pageClassContentsCount = {};
public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute,
private title: Title,
@ -249,11 +247,7 @@ export class PagesComponent implements OnInit {
this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deletePagesFromArray(this.selectedPages);
UIkit.notification('Pages have been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Pages have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Pages deleted");
},
@ -317,29 +311,20 @@ export class PagesComponent implements OnInit {
public pageSaveConfirmed(data: any) {
this.showLoading = true;
if (!this.pageForm.value._id) {
this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe(
if (!this.pageForm.getRawValue()._id) {
this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
page => {
this.pageSavedSuccessfully(page, true);
UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("Page saved");
},
error => this.handleUpdateError('System error creating page', error)
));
} else {
this.pageForm.get('portalType').enable();
this.subscriptions.push(this._helpContentService.updatePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe(
this.subscriptions.push(this._helpContentService.updatePage(<Page>this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe(
page => {
this.pageSavedSuccessfully(page, false);
UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Page <b>' + page.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("Page updated");
},
error => this.handleUpdateError('System error updating page', error)
@ -375,19 +360,16 @@ export class PagesComponent implements OnInit {
return this.searchText.toString() == '' || (page.route + ' ' + page.name + ' ' + page.portalType).match(this.searchText) != null;
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.error('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
handleUpdateError(message: string, error) {
if (error == null) {
// this.formComponent.reset();
handleUpdateError(message: string, error = null) {
if (!error) {
this.pageForm = this._fb.group({
route: this._fb.control('', Validators.required),
name: this._fb.control('', Validators.required),
@ -402,12 +384,9 @@ export class PagesComponent implements OnInit {
_id: this._fb.control(''),
});
} else {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.error('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}

View File

@ -1,43 +1,39 @@
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div page-content>
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div class="uk-flex uk-flex-middle uk-margin-top info">
<img src="assets/common-assets/placeholder.png" class="uk-margin-right">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Portals</div>
<h1 class="uk-h4 uk-margin-remove">Super Admin</h1>
</div>
</div>
<div class="uk-margin uk-margin-remove-bottom">
<admin-tabs tab="portal"></admin-tabs>
</div>
<admin-tabs tab="portal"></admin-tabs>
<ul class="uk-subnav uk-subnav-pill uk-margin-medium-top">
<li [class.uk-active]="filterForm.get('type').value === 'all'" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue('all')"><span
class="title">All portals</span></a></li>
<li *ngFor="let type of portalUtils.portalTypes; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue(type.value)"><span
class="title">{{type.label}}</span></a></li>
</ul>
</div>
<div inner>
<div class="uk-grid uk-flex-middle uk-margin-top" 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
(click)="filterForm.get('type').setValue('all')"><span
class="title">All portals</span></a></li>
<li *ngFor="let type of portalUtils.portalTypes; let i=index"
[class.uk-active]="filterForm.get('type').value === type.value" class="uk-margin-small-bottom"><a
(click)="filterForm.get('type').setValue(type.value)"><span
class="title">{{type.label}}</span></a></li>
</ul>
</div>
<div class="uk-width-1-1">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search portal"
[disabled]="showLoading" 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>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newPortal()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add portal</span>
</button>
</div>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid>
<div search-input [expandable]="true" [searchControl]="filterForm.get('keyword')" searchInputClass="outer" placeholder="Search portal"
[disabled]="showLoading" 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>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="newPortal()"
[disabled]="showLoading" [class.uk-disabled]="showLoading">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Add portal</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>

View File

@ -3,20 +3,15 @@ import {ActivatedRoute, Router} from '@angular/router';
import {HelpContentService} from '../../services/help-content.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Session} from '../../login/utils/helper.class';
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
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";
import {AlertModal} from "../../utils/modal/alert";
import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component";
import {Title} from "@angular/platform-browser";
import {ClearCacheService} from "../../services/clear-cache.service";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'portals',
@ -44,7 +39,6 @@ export class PortalsComponent implements OnInit {
public showLoading = true;
public portalUtils: PortalUtils = new PortalUtils();
private index: number;
public stickyPageHeader: boolean = false;
constructor(private element: ElementRef, private route: ActivatedRoute,
private title: Title,
@ -141,11 +135,7 @@ export class PortalsComponent implements OnInit {
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe(
_ => {
this.deletePortalsFromArray(this.selectedPortals);
UIkit.notification('Portals have been <b>successfully deleted</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Portals have been <b>successfully deleted</b>');
this.showLoading = false;
this._clearCacheService.clearCache("Portals deleted");
},
@ -192,31 +182,22 @@ export class PortalsComponent implements OnInit {
public portalSaveConfirmed(data: any) {
this.showLoading = true;
if (this.portalForm.value._id) {
this.portalForm.get('type').enable();
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value,
if (this.portalForm.getRawValue()._id) {
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.getRawValue(),
this.properties.adminToolsAPIURL).subscribe(
portal => {
this.portalUpdatedSuccessfully(portal);
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>');
this._clearCacheService.clearCache("Portal updated");
},
error => this.handleUpdateError('System error updating portal', error)
));
} else {
this.subscriptions.push(this._helpContentService.saveCommunity(<Portal>this.portalForm.value,
this.subscriptions.push(this._helpContentService.saveCommunity(<Portal>this.portalForm.getRawValue(),
this.properties.adminToolsAPIURL).subscribe(
portal => {
this.portalSavedSuccessfully(portal);
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>');
this._clearCacheService.clearCache("Portal saved");
},
error => this.handleUpdateError('System error creating portal', error)
@ -252,12 +233,11 @@ export class PortalsComponent implements OnInit {
}
public filterPortals(portal: Portal): boolean {
const textFlag = this.searchText.toString() === '' || (portal.name || portal.type).match(this.searchText) != null;
return textFlag;
return this.searchText.toString() === '' || (portal.name || portal.type).match(this.searchText) != null;
}
handleUpdateError(message: string, error) {
if (error == null) {
handleUpdateError(message: string, error = null) {
if (!error) {
this.portalForm = this._fb.group({
name: '',
_id: '',
@ -266,23 +246,17 @@ export class PortalsComponent implements OnInit {
type: ''
});
} else {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
console.log('Server responded: ' + error);
handleError(message: string, error = null) {
if(error) {
console.log('Server responded: ' + error);
}
NotificationHandler.rise(message, 'danger');
this.showLoading = false;
}
}

View File

@ -8,7 +8,7 @@ import { properties } from 'src/environments/environment';
@Component({
selector: 'admin-tabs',
template: `
<ul class="uk-tab" uk-tab>
<ul class="uk-tab uk-margin-top uk-flex uk-flex-center uk-flex-left@m" uk-tab>
<li *ngIf="isPortalAdmin && !portal" [class.uk-active]="tab === 'portal'"><a routerLink="../portals">Portals</a></li>
<li [class.uk-active]="tab === 'page'"><a routerLink="../pages">Pages</a></li>
<li [class.uk-active]="tab === 'entity'"><a routerLink="../entities">Entities</a></li>
@ -20,7 +20,6 @@ import { properties } from 'src/environments/environment';
`
})
export class AdminTabsComponent implements OnInit {
@Input()
public type: string;
@Input()
@ -29,10 +28,9 @@ export class AdminTabsComponent implements OnInit {
public user: User;
@Input()
public tab: "portal" | "page" | "entity" | "menu" | "class" = 'page';
public env = properties.environment;
private subscriptions: any[] = [];
constructor(private route: ActivatedRoute, private userManagementService: UserManagementService) {
}
@ -41,6 +39,7 @@ export class AdminTabsComponent implements OnInit {
this.user = user;
}));
}
ngOnDestroy(): void {
this.subscriptions.forEach(value => {
if (value instanceof Subscriber) {
@ -51,7 +50,6 @@ export class AdminTabsComponent implements OnInit {
});
}
public get isPortalAdmin() {
return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user);
}

View File

@ -1,21 +1,25 @@
import {AfterViewInit, Component, EventEmitter, OnDestroy, OnInit, Output} from "@angular/core";
import {Subscription} from "rxjs";
declare var UIkit;
import {AfterViewInit, Component, Input, OnDestroy, OnInit} from "@angular/core";
@Component({
selector: '[page-content]',
template: `
<div id="page_content">
<div id="page_content_header" class="uk-display-block" [attr.uk-sticky]="shouldSticky?'media: @m':null" [attr.offset]="offset">
<div class="uk-container uk-container-large uk-padding-remove-vertical">
<div id="page_content_header" [attr.uk-sticky]="(headerSticky && shouldSticky)?'media: @m':null" [attr.offset]="offset">
<div class="uk-container uk-container-large">
<div class="uk-padding-small uk-padding-remove-vertical">
<ng-content select="[header]"></ng-content>
</div>
</div>
</div>
<div id="page_content_actions" [attr.uk-sticky]="(!headerSticky && shouldSticky)?'media: @m':null" [attr.offset]="offset">
<div class="uk-container uk-container-large">
<div class="uk-padding-small uk-padding-remove-vertical">
<ng-content select="[actions]"></ng-content>
</div>
</div>
</div>
<div id="page_content_inner" class="uk-container uk-container-large">
<div class="uk-padding uk-padding-remove-vertical">
<div class="uk-padding-small uk-padding-remove-vertical">
<ng-content select="[inner]"></ng-content>
</div>
</div>
@ -23,13 +27,11 @@ declare var UIkit;
`,
})
export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
@Input()
public headerSticky: boolean = false;
public offset: number;
public sticky: boolean = false;
public shouldSticky: boolean = true;
@Output()
public stickyEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
private observer: IntersectionObserver;
private subscriptions: any[] = [];
constructor() {
}
@ -37,7 +39,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
ngOnInit() {
if (typeof document !== "undefined") {
this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--structure-header-height'));
this.initSticky();
}
}
@ -48,7 +49,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
this.observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
this.shouldSticky = !entry.isIntersecting;
this.initSticky();
})
});
this.observer.observe(bottom);
@ -56,32 +56,7 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy {
}
}
initSticky() {
this.clear();
if(this.shouldSticky) {
this.subscriptions.push(UIkit.util.on(document, 'active', '#page_content_header', () => {
this.sticky = true;
this.stickyEmitter.emit(this.sticky);
}));
this.subscriptions.push(UIkit.util.on(document, 'inactive', '#page_content_header', () => {
this.sticky = false;
this.stickyEmitter.emit(this.sticky);
}));
}
}
clear() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
subscription.unsubscribe();
} else if (subscription instanceof Function) {
subscription();
}
});
}
ngOnDestroy() {
this.clear();
if(this.observer) {
this.observer.disconnect();
}

View File

@ -1,41 +1,43 @@
<div page-content (stickyEmitter)="stickyEmitter.emit($event)">
<div page-content>
<div header>
<ng-content></ng-content>
</div>
<div inner>
<div class="uk-grid uk-margin-top" uk-grid>
<div class="uk-flex uk-flex-left@m uk-flex-center uk-width-expand">
<ul class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="showCurrent" (click)="showCurrent = true">
<a class="uk-text-capitalize">{{role}}s</a>
</li>
<li [class.uk-active]="!showCurrent" (click)="showCurrent = false">
<a>Pending {{role}}s</a>
</li>
</ul>
</div>
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle uk-flex-right@m uk-flex-center uk-margin-remove-left" uk-grid>
<div *ngIf="showCurrent" [disabled]="loadActive" search-input class="uk-width-expand@l uk-width-1-1"
[searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + role + 's'" searchInputClass="outer">
</div>
<div *ngIf="!showCurrent" [disabled]="loadPending" search-input class="uk-width-expand@l uk-width-1-1"
[searchControl]="filterForm.get('pending')" [expandable]="true" [placeholder]="'Search invitations'" searchInputClass="outer">
</div>
<div>
<button *ngIf="exists" class="uk-button uk-button-default uk-flex uk-flex-middle"
[attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loadPending || !!inviteDisableMessage"
[disabled]="loadPending || !!inviteDisableMessage" (click)="openInviteModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite {{role}}</span>
</button>
<button *ngIf="!exists && isPortalAdmin" class="uk-button uk-button-default uk-flex uk-flex-middle"
(click)="openCreateRoleModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Create Group</span>
</button>
</div>
</div>
<div class="uk-margin-medium-top">
<ul class="uk-subnav uk-subnav-pill">
<li [class.uk-active]="showCurrent" (click)="showCurrent = true">
<a class="uk-text-capitalize">{{role}}s</a>
</li>
<li [class.uk-active]="!showCurrent" (click)="showCurrent = false">
<a>Pending {{role}}s</a>
</li>
</ul>
</div>
</div>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-grid uk-flex-right@m uk-flex-center uk-flex-middle" uk-grid>
<div *ngIf="showCurrent" [disabled]="loadActive" search-input class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"
[searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + role + 's'" searchInputClass="outer">
</div>
<div *ngIf="!showCurrent" [disabled]="loadPending" search-input class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"
[searchControl]="filterForm.get('pending')" [expandable]="true" [placeholder]="'Search invitations'" searchInputClass="outer">
</div>
<div>
<button *ngIf="exists" class="uk-button uk-button-default uk-flex uk-flex-middle"
[attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loadPending || loadPending"
[disabled]="loadActive || loadPending || !!inviteDisableMessage" (click)="openInviteModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite {{role}}</span>
</button>
<button *ngIf="!exists && isPortalAdmin" class="uk-button uk-button-default uk-flex uk-flex-middle"
(click)="openCreateRoleModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Create Group</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loadActive || loadPending" class="uk-position-center">
<loading></loading>

View File

@ -10,8 +10,7 @@ import {Router} from "@angular/router";
import {StringUtils} from "../../../utils/string-utils.class";
import {NotificationService} from "../../../notifications/notification.service";
import {Subscription} from "rxjs";
declare var UIkit;
import {NotificationHandler} from "../../../utils/notification-handler";
@Component({
selector: 'role-users',
@ -37,8 +36,6 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
public notificationFn: Function;
@Input()
public inviteDisableMessage: string;
@Output()
public stickyEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
public user: User = null;
public active: any[] = [];
public showActive: any[] = [];
@ -199,18 +196,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
}
this.filterActiveBySearch(this.filterForm.value.active);
this.userManagementService.updateUserInfo();
UIkit.notification(this.selectedUser + ' <b>is no longer</b> ' + this.role + ' of ' + this.name + ' Dashboard', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise(this.selectedUser + ' <b>is no longer</b> ' + this.role + ' of ' + this.name + ' Dashboard');
this.loadActive = false;
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.loadActive = false;
}));
}
@ -223,18 +212,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
if (this.currentPendingPage.length === 0) {
this.pendingPage = 1;
}
UIkit.notification(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been <b>canceled</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been <b>canceled</b>');
this.loadPending = false;
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.loadPending = false;
}));
}
@ -255,31 +236,15 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
}
if (this.notificationFn) {
this.subs.push(this.notificationService.sendNotification(this.notificationFn(this.name, this.invited.value, this.role, invitation)).subscribe(notification => {
UIkit.notification('A notification has been <b>sent</b> successfully', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('A notification has been <b>sent</b> successfully');
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
}));
}
UIkit.notification(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been <b>sent</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been <b>sent</b>');
this.loadPending = false;
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.loadPending = false;
}));
}
@ -287,20 +252,11 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
createGroup() {
this.loadActive = true;
this.loadPending = true;
this.roleFb.get('name').enable();
this.userRegistryService.createRole(this.type, this.id).subscribe(() => {
UIkit.notification('Group has been <b> successfully created</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Group has been <b> successfully created</b>');
this.updateLists();
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.loadActive = false;
this.loadPending = false;
});

View File

@ -1,27 +1,30 @@
<div page-content (stickyEmitter)="stickyEmitter.emit($event)">
<div page-content>
<div header>
<ng-content></ng-content>
</div>
<div inner>
<div [class.uk-invisible]="loading"
class="uk-flex uk-flex-right@m uk-flex-center uk-margin-top uk-flex-middle uk-grid" uk-grid>
<div search-input [searchControl]="filterForm.get('keyword')" placeholder="Search members"
[expandable]="true" searchInputClass="outer" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button *ngIf="exists" class="uk-button uk-button-default uk-flex uk-flex-middle"
[attr.uk-tooltip]="inviteDisableMessage"
[disabled]="!subscriberInvite || subscriberInvite.loading || !!inviteDisableMessage" (click)="openInviteModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite to join</span>
</button>
<button *ngIf="!exists && isPortalAdmin" class="uk-button uk-button-default uk-flex uk-flex-middle"
(click)="openCreateRoleModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Create Group</span>
</button>
<div actions>
<div class="uk-section-xsmall">
<div class="uk-grid uk-flex-right@m uk-flex-center uk-flex-middle" uk-grid>
<div search-input [searchControl]="filterForm.get('keyword')" placeholder="Search members"
[expandable]="true" [disabled]="loading || !subscriberInvite || subscriberInvite.loading" searchInputClass="outer" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
</div>
<div>
<button *ngIf="exists" class="uk-button uk-button-default uk-flex uk-flex-middle"
[attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loading || !subscriberInvite || subscriberInvite.loading"
[disabled]="loading || !subscriberInvite || subscriberInvite.loading || !!inviteDisableMessage" (click)="openInviteModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Invite to join</span>
</button>
<button *ngIf="!exists && isPortalAdmin" class="uk-button uk-button-default uk-flex uk-flex-middle"
(click)="openCreateRoleModal()">
<icon name="person_add" [flex]="true" type="filled"></icon>
<span class="uk-margin-small-left uk-text-bold uk-text-uppercase">Create Group</span>
</button>
</div>
</div>
</div>
</div>
<div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>

View File

@ -39,8 +39,6 @@ export class SubscribersComponent implements OnInit, OnDestroy, OnChanges {
public message: string = null;
@Input()
public inviteDisableMessage: string;
@Output()
public stickyEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();
public user: User = null;
public subscribers: any[];
public showSubscribers: any[];

View File

@ -10,8 +10,7 @@ import {Session, User} from "../../login/utils/helper.class";
import {EmailService} from "../../utils/email/email.service";
import {properties} from "../../../../environments/environment";
import {CommunityInfo} from "../../connect/community/communityInfo";
declare var UIkit;
import {NotificationHandler} from "../../utils/notification-handler";
@Component({
selector: 'subscriber-invite',
@ -94,9 +93,7 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
this.community = community;
if(this.community) {
this.inviteForm.get('name').enable();
this.inviteForm.get('name').setValue(this.user.fullname);
this.inviteForm.get('name').disable();
this.body = Composer.initializeInvitationsBody(community.communityId, community.title, this.user.fullname);
this.email = Composer.initializeInvitationsEmail(community.title);
this.inviteForm.get('message').setValue(this.body.paragraphs);
@ -109,31 +106,19 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy {
invite() {
this.loading = true;
this.body.paragraphs = this.inviteForm.value.message;
this.body.paragraphs = this.inviteForm.getRawValue().message;
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
this.email.recipients = this.inviteForm.get('recipients').value;
this.subscriptions.push(this.emailService.sendEmail(properties, this.email).subscribe(res => {
if(res['success']) {
UIkit.notification('Invitation to subscribe has been <b>sent</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('Invitation to subscribe has been <b>sent</b>');
} else {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
}
this.reset();
this.loading = false;
},error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
NotificationHandler.rise('An error has occurred. Please try again later', 'danger');
this.reset();
this.loading = false;
}));

View File

@ -1,8 +1,9 @@
export class HelperFunctions {
public static scroll() {
HelperFunctions.scrollTo(0,0);
HelperFunctions.scrollTo(0,0);
}
public static scrollTo(x,y) {
if (typeof document !== 'undefined') {
window.scrollTo(x,y);

View File

@ -10,8 +10,10 @@ declare var UIkit;
<span>{{name}}<span *ngIf="count > 0">({{count}})</span></span>
<icon [flex]="true" class="uk-margin-xsmall-left" [name]="'expand_' + (isOpen?'less':'more')"></icon>
</button>
<div #dropdownElement class="uk-dropdown" [ngClass]="dropdownClass" uk-dropdown="mode: click; delay-hide: 0;">
<ng-content></ng-content>
<div #dropdownElement class="uk-dropdown uk-height-max-medium uk-overflow-auto" [ngClass]="dropdownClass" uk-dropdown="mode: click; delay-hide: 0;">
<div>
<ng-content></ng-content>
</div>
</div>
`
})