Finish UI of subscribers, managers, notification settings and personal info. Change claims property to dl170 for development

This commit is contained in:
Konstantinos Triantafyllou 2022-06-28 21:15:05 +03:00
parent 27c85f102e
commit 82c8c7f5ea
15 changed files with 256 additions and 237 deletions

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0 --disable-host-check --port=5001",
"start": "ng serve --host 0.0.0.0 --disable-host-check --port=5000",
"build": "ng build",
"build-dev": "ng build --configuration=development",
"build-beta": "ng build --configuration=beta",

@ -1 +1 @@
Subproject commit 5e1fde78411e2913c3757534a073ace32a4eacf2
Subproject commit 9b5607fbd0204b44fb2c650df77fcb88f613fc2e

View File

@ -1,75 +1,73 @@
<div page-content>
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Notification Settings</div>
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
</div>
</div>
<users-tabs tab="notifications"></users-tabs>
</div>
<div inner>
<form>
<div class="uk-card-header">
<div class=" uk-margin-small-top uk-margin-small-bottom">
<button class="uk-float-right uk-button uk-margin-left uk-button-secondary " [disabled]="!hasChanged || showLoading"
(click)="updateUserNotifications()">Save
</button>
<button class=" uk-float-right uk-button uk-button-secondary outlined" [disabled]="!hasChanged || showLoading"
(click)="resetForm()">Reset
</button>
<div>Notifications settings</div>
</div>
<div class="uk-margin-top">
<div class="uk-flex uk-flex-center uk-flex-right@m">
<button class="uk-button uk-button-secondary" [class.uk-disabled]="!hasChanged || showLoading"
[disabled]="!hasChanged || showLoading"
(click)="resetForm()">Reset
</button>
<button class="uk-button uk-margin-left uk-button-primary"
[disabled]="!hasChanged || showLoading" [class.uk-disabled]="!hasChanged || showLoading"
(click)="updateUserNotifications()">Save
</button>
</div>
<div class="uk-card uk-card-default uk-position-relative" style="min-height: 60vh">
<div *ngIf="communityId && userNotifications && notifications && !showLoading" style="max-height: 60vh"
class="uk-overflow-auto uk-padding uk-padding-remove-bottom">
<!--<div class="uk-alert uk-alert-primary uk-flex-center" role="alert">Notification settings are related to your
personal
account.
</div>-->
<h5 class="uk-text-bold uk-margin-medium-bottom">Manage Notifications</h5>
<div class="uk-width-large uk-margin-bottom">
<div class="uk-margin uk-grid" >
<div class="uk-width-expand" title="Get e-mail notification when there are changes in the managers list of your community">
Notifications for manager list changes <span>{{userNotifications.notifyForNewManagers ? '(Enabled)' : '(Disabled)'}}</span></div>
<mat-slide-toggle [checked]="userNotifications.notifyForNewManagers"
(change)="($event.source.checked = userNotifications.notifyForNewManagers);changeValueForNewManagers(userNotifications.notifyForNewManagers)">
</mat-slide-toggle>
</div>
<div class="uk-section uk-section-small uk-container uk-container-small uk-position-relative">
<div *ngIf="!showLoading" class="uk-flex uk-flex-center">
<div class="uk-width-xlarge uk-margin-bottom">
<div class="uk-margin uk-grid" >
<div class="uk-width-expand" uk-tooltip="Get e-mail notification when there are changes in the managers list of your community">
Notify me for any changes in the managers list</div>
<mat-slide-toggle [checked]="userNotifications.notifyForNewManagers"
(change)="($event.source.checked = userNotifications.notifyForNewManagers);changeValueForNewManagers(userNotifications.notifyForNewManagers)">
{{userNotifications.notifyForNewManagers?' Enabled':'Disabled'}}
</mat-slide-toggle>
</div>
<div class="uk-margin uk-grid">
<div class="uk-width-expand" uk-tooltip="Get e-mail notification when a user subscribes in your community">
Notify me for new members
</div>
<mat-slide-toggle [checked]="userNotifications.notifyForNewSubscribers"
(change)="($event.source.checked = userNotifications.notifyForNewSubscribers);changeValueForNewSubscribers(userNotifications.notifyForNewSubscribers)">
{{userNotifications.notifyForNewSubscribers?' Enabled':'Disabled'}}
</mat-slide-toggle>
</div>
<hr class="uk-margin-medium">
<div *ngFor="let notification of notifications; let i=index">
<div class="uk-margin uk-grid">
<div class="uk-width-expand" title="Get e-mail notification when a user subscribes in your community">Notifications for new
subscribers <span>{{userNotifications.notifyForNewSubscribers ? '(Enabled)' : '(Disabled)'}}</span></div>
<mat-slide-toggle [checked]="userNotifications.notifyForNewSubscribers"
(change)="($event.source.checked = userNotifications.notifyForNewSubscribers);changeValueForNewSubscribers(userNotifications.notifyForNewSubscribers)">
<div class="uk-width-expand"
title="Get e-mail notification when users create new links related your community">
Notify me for any linking actions related to your community</div>
<mat-slide-toggle [checked]="notification.notify"
(change)="($event.source.checked = notification.notify);changeNotify(notification, !notification.notify, i)">
{{notification.notify?' Enabled':'Disabled'}}
</mat-slide-toggle>
</div>
<hr class="uk-margin-medium">
<div *ngFor="let notification of notifications; let i=index">
<div class="uk-margin uk-grid">
<div class="uk-width-expand"
title="Get e-mail notification when users create new links related your community">Notify for
links
<span>{{notification.notify ? '(Enabled)' : '(Disabled)'}}</span></div>
<mat-slide-toggle [checked]="notification.notify"
(change)="($event.source.checked = notification.notify);changeNotify(notification, !notification.notify, i)">
</mat-slide-toggle>
</div>
<div *ngIf="notification.notify" [class]="notification.notify ? 'uk-margin' :
'uk-margin cursor-not-allowed'">
<div class="input-box">
<mat-form-field class="uk-width-1-1">
<mat-select #select class="" [(ngModel)]="notification.frequency"
(ngModelChange)="changeFrequency()"
name="select_frequency" [disableOptionCentering]="true">
<mat-option *ngFor=" let fr of frequencyOptions let i = index"
[value]="fr.value">{{fr.label}}</mat-option>
</mat-select>
</mat-form-field>
</div>
<div *ngIf="notification.notify" class="uk-margin">
<div class="uk-text-emphasis uk-text-bold uk-margin-small-bottom">Set Notification Frequency</div>
<div class="uk-flex uk-flex-between">
<label *ngFor="let option of frequencyOptions">
<input class="uk-radio" type="radio" [checked]="notification.frequency === option.value"
(click)="notification.frequency = option.value">
<span class="uk-margin-small-left">{{option.label}}</span>
</label>
</div>
</div>
</div>
</div>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
</div>
</form>
<div *ngIf="showLoading" class="uk-position-center">
<loading></loading>
</div>
</div>
</div>
</div>

View File

@ -11,73 +11,79 @@ import {UserManagementService} from '../../openaireLibrary/services/user-managem
import {Title} from '@angular/platform-browser';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {properties} from '../../../environments/environment';
import { Subscriber} from 'rxjs';
import {Subscriber} from 'rxjs';
import {MailPrefsService} from '../../openaireLibrary/connect/userEmailPreferences/mailPrefs.service';
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {Option} from "../../openaireLibrary/sharedComponents/input/input.component";
declare var UIkit;
@Component({
selector: 'manage-user-notifications',
templateUrl: './manage-user-notifications.component.html',
})
export class ManageUserNotificationsComponent implements OnInit {
@Input('group')
myForm: FormGroup;
public properties: EnvProperties = null;
public communityId;
public userNotifications:UserNotificationsRights = null;
public initialUserNotifications:UserNotificationsRights = null;
public community: CommunityInfo;
public userNotifications: UserNotificationsRights = null;
public initialUserNotifications: UserNotificationsRights = null;
public notifications = null;
public initialNotifications = [];
public userEmail = null;
public stickyPageHeader: boolean = false;
public showLoading = true;
public hasChanged = false;
public user: User;
private subscriptions = [];
frequencyOptions = [{label:"Daily", value: 24}, {label:"Every two days", value: 48}, {label:"Weekly", value: 168}]
frequencyOptions: Option[] = [{label: "Daily", value: 24}, {label: "Every two days", value: 48}, {label: "Weekly", value: 168}]
constructor(private route: ActivatedRoute, private _router: Router, public _fb: FormBuilder,
private title: Title,
private _manageUserNotificationsService: ManageUserNotificationsService,
private element: ElementRef, private userManagementService: UserManagementService, private communityService: CommunityService, private _mailPrefsService: MailPrefsService,) {
private manageUserNotificationsService: ManageUserNotificationsService,
private element: ElementRef, private userManagementService: UserManagementService,
private communityService: CommunityService,
private mailPrefsService: MailPrefsService) {
}
ngOnInit() {
this.properties = properties;
HelperFunctions.scroll();
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if(community) {
this.communityId =community.communityId;
this.title.setTitle( this.communityId.toUpperCase() + ' | User Notifications');
if (community) {
this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | User Notifications');
this.showLoading = true;
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if (this.user) {
this.userEmail = this.user.email;
this.subscriptions.push(this._manageUserNotificationsService.getUserNotifications(this.properties, this.communityId).subscribe(
this.subscriptions.push(this.manageUserNotificationsService.getUserNotifications(this.properties, this.community.communityId).subscribe(
userNotifications => {
this.initialUserNotifications = userNotifications;
if (this.initialUserNotifications['notifyForNewManagers'] == null ||
this.initialUserNotifications['notifyForNewSubscribers'] == null) {
if(Session.isManager("community",this.communityId, this.user)) {
if (Session.isManager("community", this.community.communityId, this.user)) {
this.initialUserNotifications = new UserNotificationsRights(true, true, "");
}else{
} else {
this.initialUserNotifications = new UserNotificationsRights(false, false, "");
}
}
this.userNotifications = JSON.parse(JSON.stringify(this.initialUserNotifications));
this.getClaimsNotifications();
},
error => {
if (error.status === 404) {
if(Session.isManager("community",this.communityId, this.user)) {
if (Session.isManager("community", this.community.communityId, this.user)) {
this.initialUserNotifications = new UserNotificationsRights(true, true, "");
}else{
} else {
this.initialUserNotifications = new UserNotificationsRights(false, false, "");
}
this.userNotifications = JSON.parse(JSON.stringify(this.initialUserNotifications));
@ -92,28 +98,38 @@ export class ManageUserNotificationsComponent implements OnInit {
}
}));
}
getClaimsNotifications(){
this.subscriptions.push(this._mailPrefsService.getUserEmailPreferencesForCommunity(this.communityId, this.properties.claimsAPIURL).subscribe(
getClaimsNotifications() {
this.subscriptions.push(this.mailPrefsService.getUserEmailPreferencesForCommunity(this.community.communityId, this.properties.claimsAPIURL).subscribe(
data => {
this.initialNotifications = data.data;
this.notifications = JSON.parse(JSON.stringify( this.initialNotifications ));
if (data.code != 204) {
this.initialNotifications = data.data;
} else {
if (Session.isManager("community", this.community.communityId, this.user)) {
this.initialNotifications = [{notify: true, frequency: 24, openaireId: this.community.communityId}];
} else {
this.initialNotifications = [{notify: false, frequency: 24, openaireId: this.community.communityId}];
}
}
this.notifications = JSON.parse(JSON.stringify(this.initialNotifications));
this.showLoading = false;
},
err => {
if(err.status === 404) {
if(Session.isManager("community",this.communityId, this.user)) {
this.initialNotifications = [{notify: true, frequency:24, openaireId: this.communityId}];
}else{
this.initialNotifications = [{notify: false, frequency:24, openaireId: this.communityId}];
if (err.status === 404) {
if (Session.isManager("community", this.community.communityId, this.user)) {
this.initialNotifications = [{notify: true, frequency: 24, openaireId: this.community.communityId}];
} else {
this.initialNotifications = [{notify: false, frequency: 24, openaireId: this.community.communityId}];
}
this.notifications = JSON.parse(JSON.stringify( this.initialNotifications ));
}else{
this.handleError("Error getting user email preferences for community with id: "+this.communityId, err);
this.notifications = JSON.parse(JSON.stringify(this.initialNotifications));
} else {
this.handleError("Error getting user email preferences for community with id: " + this.community.communityId, err);
}
this.showLoading = false;
}
));
}
ngOnDestroy() {
this.subscriptions.forEach(value => {
if (value instanceof Subscriber) {
@ -121,47 +137,44 @@ export class ManageUserNotificationsComponent implements OnInit {
}
});
}
public updateUserNotifications() {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'],
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}});
} else {
if (this.communityId != null && this.communityId !== '') {
// this.mailPrefs.saveNotification(0);
// this.successfulSaveMessage = '';
if (this.community.communityId != null && this.community.communityId !== '') {
this.showLoading = true;
const userNotifications = this.parseUpdatedUserNotifications();
this.subscriptions.push(this._manageUserNotificationsService.updateUserNotifications(this.properties, this.communityId, userNotifications).subscribe(
this.subscriptions.push(this.manageUserNotificationsService.updateUserNotifications(this.properties, this.community.communityId, userNotifications).subscribe(
userNotifications => {
this.initialUserNotifications = JSON.parse(JSON.stringify(this.userNotifications));
this.handleSuccessfulSave('Notification settings saved!');
},
error => this.handleUpdateError('System error updating user notifications', error)
));
this.subscriptions.push(this._mailPrefsService.saveUserEmailPreferences(this.notifications[0], this.properties.claimsAPIURL).subscribe(
this.subscriptions.push(this.mailPrefsService.saveUserEmailPreferences(this.notifications[0], this.properties.claimsAPIURL).subscribe(
data => {
this.initialNotifications[0] = JSON.parse(JSON.stringify( this.notifications[0] ));
this.initialNotifications[0] = JSON.parse(JSON.stringify(this.notifications[0]));
this.handleSuccessfulSave('Claims notification settings saved!');
},
err => {
//console.log(err);
this.handleError("Error saving user email preferences: "+JSON.stringify(this.notifications[0]), err);
this.handleError("Error saving user email preferences: " + JSON.stringify(this.notifications[0]), err);
}
));
}
this.resetChange();
}
}
private parseUpdatedUserNotifications(): {} {
const userNotifications = {};
userNotifications['notifyForNewManagers'] = this.userNotifications.notifyForNewManagers;
userNotifications['notifyForNewSubscribers'] = this.userNotifications.notifyForNewSubscribers;
if (this.userNotifications.managerEmail) {
userNotifications['managerEmail'] = this.userNotifications.managerEmail;
}
@ -172,7 +185,7 @@ export class ManageUserNotificationsComponent implements OnInit {
// }
return userNotifications;
}
public resetForm() {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], {
@ -180,8 +193,8 @@ export class ManageUserNotificationsComponent implements OnInit {
});
} else {
// this.mailPrefs.restoreNotification(0);
this.notifications[0] = JSON.parse(JSON.stringify( this.initialNotifications[0] ));
this.notifications[0] = JSON.parse(JSON.stringify(this.initialNotifications[0]));
if (this.userNotifications && this.initialUserNotifications) {
// this.successfulSaveMessage = '';
this.showLoading = true;
@ -191,7 +204,7 @@ export class ManageUserNotificationsComponent implements OnInit {
this.resetChange();
}
}
public changeValueForNewManagers(notifyForManagers: any) {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], {
@ -202,7 +215,7 @@ export class ManageUserNotificationsComponent implements OnInit {
this.change();
}
}
public changeValueForNewSubscribers(notifyForSubscribers: any) {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], {
@ -213,24 +226,24 @@ export class ManageUserNotificationsComponent implements OnInit {
this.change();
}
}
private change() {
this.hasChanged = true;
// this.successfulSaveMessage = '';
// this.successfulResetMessage = '';
}
private resetChange() {
this.hasChanged = false;
}
handleUpdateError(message: string, error) {
// this.updateErrorMessage = message;
console.log('Server responded: ' + error);
this.showLoading = false;
}
handleError(message: string, error) {
// this.errorMessage = message;
console.log('Server responded: ' + error);
@ -241,7 +254,7 @@ export class ManageUserNotificationsComponent implements OnInit {
});
this.showLoading = false;
}
handleSuccessfulSave(message) {
this.showLoading = false;
// this.successfulSaveMessage = message;
@ -251,15 +264,15 @@ export class ManageUserNotificationsComponent implements OnInit {
pos: 'bottom-right'
});
}
changeNotify(notification: any, checked: boolean, index: number) {
notification.notify = checked;
this.change();
notification.notify = checked;
this.change();
}
changeFrequency() {
this.change();
}
}

View File

@ -5,7 +5,6 @@ import {FormsModule} from '@angular/forms';
import {ManageUserNotificationsComponent} from './manage-user-notifications.component';
import {ManageUserNotificationsService} from './manage-user-notifications.service';
import {MailPrefsModule} from '../../openaireLibrary/connect/userEmailPreferences/mailsPrefs.module';
import {ManageUserNotificationsRoutingModule} from './manage-user-notifications-routing.module';
import {UsersTabsModule} from '../users/users-tabs.module';
import {PageContentModule} from '../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module';
@ -13,16 +12,18 @@ import { MatSelectModule } from '@angular/material/select';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import {LoadingModule} from '../../openaireLibrary/utils/loading/loading.module';
import {SharedModule} from '../../openaireLibrary/shared/shared.module';
import {MailPrefsService} from "../../openaireLibrary/connect/userEmailPreferences/mailPrefs.service";
import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module";
@NgModule({
imports: [
ManageUserNotificationsRoutingModule, RouterModule, CommonModule, FormsModule, MailPrefsModule, UsersTabsModule, PageContentModule, MatSlideToggleModule, LoadingModule, SharedModule, MatSelectModule
ManageUserNotificationsRoutingModule, RouterModule, CommonModule, FormsModule, UsersTabsModule, PageContentModule, MatSlideToggleModule, LoadingModule, SharedModule, MatSelectModule, InputModule
],
declarations: [
ManageUserNotificationsComponent
],
providers: [
ManageUserNotificationsService
ManageUserNotificationsService, MailPrefsService
],
exports: [
ManageUserNotificationsComponent

View File

@ -1,10 +1,4 @@
form {
font-family: "Roboto", sans-serif;
}
form .connected {
color: rgba(var(--text-color-rgb), 0.5);
}
@import (reference) "~src/assets/openaire-theme/less/_import-variables";
form .image {
position: relative;
@ -20,9 +14,8 @@ form .image icon {
}
form .image img {
box-shadow: 0 3px 6px #00000029;
box-shadow: @global-medium-box-shadow;
border-radius: 50%;
margin-bottom: 10px;
width: 120px;
height: 120px;
object-fit: cover;

View File

@ -15,39 +15,40 @@ import {HelpContentService} from "../../../services/help-content.service";
import {Page} from "../../../domain/page";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {StringUtils} from "../../../openaireLibrary/utils/string-utils.class";
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
declare var UIkit;
@Component({
selector: 'personal-info',
template: `
<div page-content>
<div page-content (stickyEmitter)="stickyPageHeader = $event">
<div header>
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Personal Info &
Affiliations
</div>
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
</div>
</div>
<users-tabs tab="personal"></users-tabs>
</div>
<div inner>
<div class="uk-card-header">
<div class="uk-flex uk-child-width-1-1 uk-child-width-1-2@m uk-grid" uk-grid>
<div>
<div class="uk-text-small title">
Personal Info & Affiliations
<span *ngIf="!loading && (curatorFb && curatorFb.dirty && !newCurator)"> (unsaved changes)</span>
</div>
</div>
<div class="uk-text-right@m uk-text-center">
<button class="uk-button uk-button-secondary outlined uk-margin-right"
(click)="reset()"
[disabled]="loading || !hasChanged">Reset
</button>
<button class="uk-button uk-button-secondary"
(click)="updateCurator()"
[disabled]="loading || !hasChanged || curatorFb.invalid">Save
</button>
</div>
<div class="uk-margin-top">
<div class="uk-flex uk-flex-center uk-flex-right@m">
<button class="uk-button uk-button-secondary" [class.uk-disabled]="!hasChanged || loading"
[disabled]="!hasChanged || loading"
(click)="reset()">Reset
</button>
<button class="uk-button uk-margin-left uk-button-primary"
[disabled]="!hasChanged || loading" [class.uk-disabled]="!hasChanged || loading"
(click)="updateCurator()">Save
</button>
</div>
</div>
<div class="uk-card uk-card-default uk-position-relative" style="min-height: 60vh">
<div [class.hidden]="loading" style="max-height: 60vh" class="uk-overflow-auto uk-padding-remove-bottom uk-padding-large">
<div class="uk-section uk-section-small">
<div *ngIf="!loading" class="uk-container">
<form *ngIf="curatorFb" [formGroup]="curatorFb">
<div class="uk-grid uk-margin-large-bottom" uk-grid>
<div class="uk-grid uk-width-1-1 uk-flex-middle" uk-grid>
@ -67,57 +68,61 @@ declare var UIkit;
</div>
</div>
<div class="uk-width-expand">
<h5 class="uk-text-secondary uk-text-bold">{{user.firstname + ' ' + user.lastname}}</h5>
<!--<div>
<span class="connected">Connected with: </span>
<span class="uk-text-secondary uk-text-bold">{{user.email}}</span>
</div>-->
<div dashboard-input class="uk-width-large@m uk-width-1-1" placeholder="Name"
[formInput]="curatorFb.get('name')" inputClass="border-bottom normal-font-size"></div>
</div>
</div>
<div dashboard-input class="uk-width-1-1" label="Display Name" placeholder="Write your name"
[formInput]="curatorFb.get('name')"></div>
<div dashboard-input class="uk-width-1-1" label="Biography" placeholder="Write biography..."
[formInput]="curatorFb.get('bio')" type="textarea" rows="4"></div>
<div dashboard-input class="uk-width-1-1" placeholder="Biography"
[formInput]="curatorFb.get('bio')" type="textarea" rows="8"></div>
<div class="uk-width-1-1">
<h5 class="uk-margin-large uk-text-bold">My Affiliations</h5>
<div class="uk-flex uk-flex-center">
<a (click)="editAffiliationOpen()" class="uk-flex uk-flex-middle uk-text-uppercase">
<button class="large uk-icon-button uk-button-secondary">
<icon name="add"></icon>
</button>
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">
Add New Affiliation
</button>
</a>
<button (click)="editAffiliationOpen()" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon [flex]="true" name="add"></icon>
<span class="uk-margin-small-left">Add New Affiliation</span>
</button>
</div>
<div class="uk-margin-medium">
<div *ngFor="let affiliation of affiliations.controls; let i=index"
class="uk-card uk-card-default uk-card-body uk-text-small uk-margin-bottom">
<div class="uk-grid uk-grid-divider uk-flex-middle" uk-grid>
<div class="uk-width-expand@m uk-width-1-1 uk-grid uk-flex-middle" uk-grid>
<div class="uk-margin-medium uk-grid uk-child-width-1-2@m uk-child-width-1-1" uk-grid>
<div *ngFor="let affiliation of affiliations.controls; let i=index">
<div class="uk-card uk-card-default uk-margin-bottom">
<div class="uk-card-body">
<div class="uk-grid uk-flex-middle" uk-grid>
<div class="uk-width-small">
<img [src]="affiliation.value.logo_url | urlPrefix">
</div>
<div class="uk-width-auto">
<div class="uk-width-expand">
<h6>{{affiliation.value.name}}</h6>
URL: <a [href]="affiliation.value.website_url | urlPrefix" target="_blank">{{affiliation.value.website_url}}</a>
</div>
</div>
<div class="uk-width-auto@m uk-width-1-1">
<div class="uk-width-1-1 uk-flex uk-flex-center">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="editAffiliationOpen(i)" class="uk-button action uk-flex uk-flex-middle">
<icon name="edit" ratio="0.7"></icon>
<span class="uk-margin-small-left">Edit Affiliation</span>
</a>
<a (click)="deleteAffiliationOpen(i)" class="uk-button action uk-flex uk-flex-middle uk-margin-small-top">
<icon name="remove" ratio="0.7"></icon>
<span class="uk-margin-small-left">Delete Affiliation</span>
</a>
<div class="uk-text-truncate">
<span class="uk-text-meta uk-margin-xsmall-right">URL:</span>
<a [href]="affiliation.value.website_url | urlPrefix" class="uk-link"
target="_blank">{{affiliation.value.website_url}}</a>
</div>
</div>
</div>
</div>
<div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="editAffiliationOpen(i)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="edit" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Edit</span>
</a>
</div>
</div>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="deleteAffiliationOpen(i)">
<icon name="delete" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Delete</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -134,7 +139,7 @@ declare var UIkit;
</div>
</div>
</div>
<modal-alert #privacyStatement (alertOutput)="privacyStatement.cancel()">
<modal-alert #privacyStatement [overflowBody]="false" (alertOutput)="privacyStatement.cancel()">
<div class="uk-text-small">
Your personal data and photo are processed by OpenAIRE in conformity with personal data protection legal
framework.
@ -145,26 +150,29 @@ declare var UIkit;
if you have any inquiries.
</div>
</modal-alert>
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid" (alertOutput)="editAffiliation()">
<modal-alert #affiliationModal [okDisabled]="affiliationFb && affiliationFb.invalid"
(alertOutput)="editAffiliation()">
<form *ngIf="affiliationFb" [formGroup]="affiliationFb">
<div class="uk-grid uk-padding uk-padding-remove-horizontal uk-child-width-1-1" uk-grid>
<div dashboard-input label="Name" placeholder="Write affiliation's name" [formInput]="affiliationFb.get('name')"></div>
<div dashboard-input label="Logo URL" type="logoURL" placeholder="Write your affiliation's logo URL" [formInput]="affiliationFb.get('logo_url')"></div>
<div dashboard-input label="Website URL" type="URL" placeholder="Write your affiliation's website URL" [formInput]="affiliationFb.get('website_url')"></div>
<div class="uk-grid uk-child-width-1-1" uk-grid>
<div input placeholder="Name"
[formInput]="affiliationFb.get('name')"></div>
<div input type="logoURL" placeholder="Logo URL"
[formInput]="affiliationFb.get('logo_url')"></div>
<div input type="URL" placeholder="Website URL"
[formInput]="affiliationFb.get('website_url')"></div>
</div>
</form>
</modal-alert>
<modal-alert #removeAffiliationModal (alertOutput)="removeAffiliation()">
<modal-alert #removeAffiliationModal [overflowBody]="false" (alertOutput)="removeAffiliation()">
</modal-alert>
<modal-alert #enableCuratorsModal (alertOutput)="enableCurators()">
<div class="uk-padding uk-padding-remove-horizontal">
Your personal information has been successfully saved.<br><br>
This information will be visible in <span class="uk-text-bold">Curators page</span> of Research Community Dashboard, which is <span class="uk-text-bold">disabled</span>.
Do you want to <span class="uk-text-bold">enable</span> it now?
</div>
<modal-alert #enableCuratorsModal [overflowBody]="false" (alertOutput)="enableCurators()">
Your personal information has been successfully saved.<br><br>
This information will be visible in <span class="uk-text-bold">Curators page</span> of Research Community
Dashboard, which is <span class="uk-text-bold">disabled</span>.
Do you want to <span class="uk-text-bold">enable</span> it now?
</modal-alert>
`,
styleUrls: ['personal-info.component.css']
styleUrls: ['personal-info.component.less']
})
export class PersonalInfoComponent implements OnInit, OnDestroy {
/** Curator information */
@ -175,7 +183,8 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
public properties: EnvProperties = properties;
public curatorsPage: Page;
public newCurator = false;
public communityId: string;
public community: CommunityInfo;
public stickyPageHeader: boolean = false;
/** Photo */
public photo: any = null;
private photoChanged: boolean = false;
@ -205,11 +214,11 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
ngOnInit() {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => {
this.communityId = community.communityId;
this.community = community;
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if (this.user) {
this.title.setTitle(community.communityId.toUpperCase() + " | Personal Info");
this.title.setTitle(community.shortTitle.toUpperCase() + " | Personal Info");
this.loading = true;
this.subs.push(this.curatorService.getCurator(properties).subscribe(curator => {
this.initCurator(curator);
@ -304,7 +313,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
this.deletePhoto = false;
this.initCurator(curator);
this.reset();
if(!this.curatorsEnabled) {
if (!this.curatorsEnabled) {
this.curatorsEnabledOpen();
}
this.loading = false;
@ -342,7 +351,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
}
private curatorsPageStatus() {
this.helpContentService.getCommunityPagesByRoute(this.communityId, '/curators', this.properties.adminToolsAPIURL).subscribe((page) => {
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/curators', this.properties.adminToolsAPIURL).subscribe((page) => {
this.curatorsPage = page;
});
}
@ -412,7 +421,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
editAffiliationOpen(index = -1) {
this.index = index;
let affiliation: Affiliation = new Affiliation();
if(index === -1) {
if (index === -1) {
this.affiliationModal.alertTitle = 'Add Affiliation';
this.affiliationModal.okButtonText = 'Add';
} else {
@ -436,14 +445,14 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
let affiliation: Affiliation = this.affiliations.at(index).value;
this.removeAffiliationModal.alertTitle = 'Delete Affiliation';
this.removeAffiliationModal.message = 'Do you want to remove <b>' +
affiliation.name + '</b> from your Affiliations?';
affiliation.name + '</b> from your Affiliations?';
this.removeAffiliationModal.okButtonText = 'Yes';
this.removeAffiliationModal.cancelButtonText = 'No';
this.removeAffiliationModal.open();
}
editAffiliation() {
if(this.index === -1) {
if (this.index === -1) {
this.affiliations.push(this.affiliationFb);
} else {
this.affiliations.at(this.index).setValue(this.affiliationFb.value);
@ -465,14 +474,14 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
}
enableCurators() {
this.helpContentService.togglePages(this.communityId, [this.curatorsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.helpContentService.togglePages(this.community.communityId, [this.curatorsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.curatorsPage.isEnabled = true;
UIkit.notification('Curators Page has been <b>enabled successfully</b>', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
},error => {
}, error => {
this.handleUpdateError('An error has occurred. Try again later!');
});
}

View File

@ -15,7 +15,7 @@ import {CommunityInfo} from "../../../openaireLibrary/connect/community/communit
[link]="link" [role]="'manager'" [message]="message" [emailComposer]="emailComposer" (stickyEmitter)="stickyPageHeader = $event">
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Users</div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Managers</div>
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
</div>
</div>

View File

@ -6,7 +6,7 @@ import {RouterModule} from '@angular/router';
RouterModule.forChild([
{path: '', redirectTo: 'manager', pathMatch: 'full'},
{path: 'manager', loadChildren: () => import('./users-managers/users-managers.module').then(m => m.UsersManagersModule)},
{path: 'subscriber', loadChildren: () => import('./users-subscribers/users-subscribers.module').then(m => m.UsersSubscribersModule)},
{path: 'member', loadChildren: () => import('./users-subscribers/users-subscribers.module').then(m => m.UsersSubscribersModule)},
{
path: 'notifications',
loadChildren: () => import('../usernotifications/manage-user-notifications.module').then(m => m.ManageUserNotificationsModule)

View File

@ -3,21 +3,28 @@ import {Title} from "@angular/platform-browser";
import {ActivatedRoute} from "@angular/router";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {Subscriber} from "rxjs";
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
@Component({
selector: 'users-subscribers',
template: `
<subscribers [id]="communityId" [type]="type" [name]="name" [inviteDisableMessage]="inviteDisableMessage">
<users-tabs tab="subscriber"></users-tabs>
<subscribers [id]="community.communityId" [type]="'community'" [name]="community.shortTitle"
[inviteDisableMessage]="inviteDisableMessage" (stickyEmitter)="stickyPageHeader = $event">
<div class="uk-flex uk-flex-middle uk-margin-top info" [class.uk-active]="stickyPageHeader">
<div>
<div class="uk-margin-remove uk-text-background uk-text-bold uk-h6">Admin Dashboard - Manage Members</div>
<h1 class="uk-h4 uk-margin-remove">{{community.shortTitle}}</h1>
</div>
</div>
<users-tabs tab="member"></users-tabs>
</subscribers>
`
})
export class UsersSubscribersComponent implements OnInit {
public communityId: string;
public name: string;
public type: string;
public community: CommunityInfo;
public loading: boolean;
public inviteDisableMessage: string;
public stickyPageHeader: boolean = false;
private subscriptions: any[] = [];
constructor(private communityService: CommunityService,
@ -29,10 +36,8 @@ export class UsersSubscribersComponent implements OnInit {
this.loading = true;
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if(community) {
this.communityId = community.communityId;
this.name = community.shortTitle;
this.title.setTitle(this.communityId.toUpperCase() + " | Subscribers");
this.type = 'community';
this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + " | Subscribers");
if(community.status !== "all") {
this.inviteDisableMessage = "<div class='uk-padding-small'>Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to subscribe to the Research community dashboard is disabled. Update the community status to enable invitations.</div>"
}

View File

@ -9,11 +9,11 @@ import {ActivatedRoute} from '@angular/router';
template: `
<ul class="uk-tab uk-flex uk-flex-center uk-flex-left@m" uk-tab>
<li [class.uk-active]="tab === 'manager'"><a routerLink="../manager">Managers</a></li>
<li [class.uk-active]="tab === 'subscriber'"><a routerLink="../subscriber">Subscribers</a></li>
<li [class.uk-active]="tab === 'member'"><a routerLink="../member">Members</a></li>
<li *ngIf="canManageNotifications" [class.uk-active]="tab === 'notifications'"><a routerLink="../notifications">Notification
settings</a></li>
<li [class.uk-active]="tab === 'claims'"><a routerLink="../claims">Links</a></li>
<li *ngIf="isAManager" [class.uk-active]="tab === 'personal'"><a routerLink="../personal">>Personal info</a></li>
<li *ngIf="isAManager" [class.uk-active]="tab === 'personal'"><a routerLink="../personal">Personal info</a></li>
</ul>
`
})
@ -21,7 +21,7 @@ export class UsersTabsComponent implements OnInit {
@Input()
public type: string;
@Input()
public tab: "manager"| "subscriber" | "notifications" | "claims" | "personal" = 'manager';
public tab: "manager"| "member" | "notifications" | "claims" | "personal" = 'manager';
private subscriptions = [];
isAManager: boolean = false;
canManageNotifications: boolean = false;

@ -1 +1 @@
Subproject commit 752859b10d3e110fdc9a4360bb7cb005ef6225ed
Subproject commit 65cbf342bc890aff15a8831711f69d9b35e6f85d

@ -1 +1 @@
Subproject commit cd1a176ceb3aaa3493e16fc4d7ef67749655f351
Subproject commit f79a0c8ddbbe2e0cb266034073513356fd801095

@ -1 +1 @@
Subproject commit ec73c67c591eca9fe68f7a6c6f65ce4332852b2f
Subproject commit 8c4585873a56165631bee6b9d33d11fe83fc897c

View File

@ -12,7 +12,7 @@ export let properties: EnvProperties = {
enablePiwikTrack: false,
useCache: false,
framesAPIURL: 'https://beta.openaire.eu/stats3/',
claimsAPIURL: 'http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/',
claimsAPIURL: 'http://dl170.madgik.di.uoa.gr:8180/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/',
statisticsAPIURL: 'https://beta.services.openaire.eu/stats-api/',
statisticsFrameAPIURL: 'https://beta.openaire.eu/stats/',
statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/",