Restyles profile page
This commit is contained in:
parent
1d0a375453
commit
2c5feb5fa9
|
@ -0,0 +1,16 @@
|
|||
export enum RoleOrganizationType {
|
||||
Faculty = "Faculty",
|
||||
Librarian = "Librarian",
|
||||
Researcher = "Researcher",
|
||||
Student = "Student (BA/BSc, MSc)",
|
||||
EarlyCareerResearcher = "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
ResearchAdministrator = "Research Administrator",
|
||||
RepositoryManager = "Repository Manager",
|
||||
ResearchInfrastructure = "Research Infrastructure",
|
||||
ServiceProvider = "Service Provider",
|
||||
Publisher = "Publisher",
|
||||
ResearchFunder = "Research Funder",
|
||||
Policymaker = "Policymaker",
|
||||
SMEIndustry = "SME/ Industry",
|
||||
Other = "Other"
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||
import { AppRole } from "../../common/enum/app-role";
|
||||
import { OrganizationModel } from '../organisation/organization';
|
||||
|
||||
export interface UserListingModel {
|
||||
id: String;
|
||||
|
@ -11,4 +13,6 @@ export interface UserListingModel {
|
|||
timezone: String;
|
||||
zenodoEmail: String;
|
||||
avatarUrl: String;
|
||||
organization: OrganizationModel;
|
||||
roleOrganization: RoleOrganizationType;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import { ValidationType } from '../../common/enum/validation-type';
|
|||
import { DatasetProfileInternalDmpEntitiesType } from '../../common/enum/dataset-profile-internal-dmp-entities-type';
|
||||
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
||||
import { Role } from '@app/core/common/enum/role';
|
||||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||
|
||||
@Injectable()
|
||||
export class EnumUtils {
|
||||
|
@ -122,4 +123,23 @@ export class EnumUtils {
|
|||
case Role.Member: return this.language.instant('FACET-SEARCH.ROLE.MEMBER');
|
||||
}
|
||||
}
|
||||
|
||||
toRoleOrganizationString(status: RoleOrganizationType): string {
|
||||
switch (status) {
|
||||
case RoleOrganizationType.Faculty: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.FACULTY');
|
||||
case RoleOrganizationType.Librarian: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.LIBRARIAN');
|
||||
case RoleOrganizationType.Researcher: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.RESEARCHER');
|
||||
case RoleOrganizationType.Student: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.STUDENT');
|
||||
case RoleOrganizationType.EarlyCareerResearcher: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.EARLY-CAREER-RESEARCHER');
|
||||
case RoleOrganizationType.ResearchAdministrator: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.RESEARCH-ADMINISTRATOR');
|
||||
case RoleOrganizationType.RepositoryManager: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.REPOSITORY-MANAGER');
|
||||
case RoleOrganizationType.ResearchInfrastructure: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.RESEARCH-INFRASTRUCTURE');
|
||||
case RoleOrganizationType.ServiceProvider: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.SERVICE-PROVIDER');
|
||||
case RoleOrganizationType.Publisher: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.PUBLISHER');
|
||||
case RoleOrganizationType.ResearchFunder: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.RESEARCH-FUNDER');
|
||||
case RoleOrganizationType.Policymaker: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.POLICY-MAKER');
|
||||
case RoleOrganizationType.SMEIndustry: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.SME-INDUSTRY');
|
||||
case RoleOrganizationType.Other: return this.language.instant('USER-PROFILE.ROLE-ORGANIZATION.OTHER');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
.login-screen {
|
||||
margin-top: 70px;
|
||||
// margin-top: 70px;
|
||||
padding-top: 80px;
|
||||
min-height: calc(100vh - 10px);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||
import { OrganizationModel } from '@app/core/model/organisation/organization';
|
||||
import { UserListingModel } from '@app/core/model/user/user-listing';
|
||||
const availableLanguages: any[] = require('../../../assets/resources/language.json');
|
||||
|
||||
export class UserProfileEditorModel {
|
||||
public id: String;
|
||||
public name: String;
|
||||
public language: any;
|
||||
public culture: any;
|
||||
public timezone: String;
|
||||
public organization: OrganizationModel;
|
||||
public roleOrganization: RoleOrganizationType;
|
||||
|
||||
fromModel(item: UserListingModel): UserProfileEditorModel {
|
||||
this.id = item.id;
|
||||
this.name = item.name;
|
||||
this.language = item.language;
|
||||
this.timezone = item.timezone;
|
||||
this.culture = item.culture;
|
||||
this.organization = item.organization;
|
||||
this.roleOrganization = item.roleOrganization;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
buildForm(): FormGroup {
|
||||
const formGroup = new FormBuilder().group({
|
||||
id: new FormControl(this.id),
|
||||
name: new FormControl(this.name),
|
||||
language: new FormControl(this.language ? availableLanguages.filter(x => x.value === this.language.value).pop() : '', [Validators.required]),
|
||||
timezone: new FormControl(this.timezone, [Validators.required]),
|
||||
culture: new FormControl(this.culture, [Validators.required]),
|
||||
organization: new FormControl(this.organization),
|
||||
roleOrganization: new FormControl(this.roleOrganization),
|
||||
});
|
||||
|
||||
return formGroup;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,180 @@
|
|||
<div class="main-content">
|
||||
<div class="profile">
|
||||
<div class="container-fluid">
|
||||
<div *ngIf="user | async as userProfile; else loading" class="user-profile">
|
||||
<div class="col user-profile-title">{{'USER-DIALOG.USER-PROFILE' | translate}}</div>
|
||||
<div class="row profile-content" [formGroup]="formGroup">
|
||||
<div class="col">
|
||||
<div class="row mb-4">
|
||||
<div class="col-auto">
|
||||
<img mat-card-avatar class="avatar" [src]="userProfile.avatarUrl" (error)="applyFallbackAvatar($event)">
|
||||
<div class="row justify-content-center camera">
|
||||
<span class="material-icons-two-tone">photo_camera</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto d-flex flex-column justify-content-center main-info">
|
||||
<div class="name">{{userProfile.name}}</div>
|
||||
<div><span class="connected">{{'USER-PROFILE.SETTINGS.CONNECTED-WITH' | translate}}:</span><span class="mail"> {{userProfile.email}}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Name -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.NAME' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col name-form">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="" type="text" name="name" [formControl]="formGroup.get('name')" required>
|
||||
<!-- <mat-error *ngIf="formGroup.get('label').hasError('backendError')">{{formGroup.get('label').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Organization -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.ORGANIZATION' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col organization-form">
|
||||
<mat-form-field>
|
||||
<app-single-auto-complete placeholder="{{'DMP-EDITOR.PLACEHOLDER.ORGANIZATION' | translate}}" [configuration]="organisationsAutoCompleteConfiguration">
|
||||
</app-single-auto-complete>
|
||||
<!-- <mat-error *ngIf="formGroup.get('organisations').hasError('backendError')">{{formGroup.get('organisations').getError('backendError').message}}</mat-error>
|
||||
<mat-error *ngIf="formGroup.get('organisations').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> -->
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Role -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.ROLE' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col role-form">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="{{'USER-PROFILE.SETTINGS.SELECT-ROLE' | translate}}" [formControl]="this.formGroup.get('roleOrganization')">
|
||||
<mat-option [value]="roleOrganizationEnum.Faculty">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Faculty)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Librarian">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Librarian)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Researcher">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Researcher)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Student">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Student)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.EarlyCareerResearcher">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.EarlyCareerResearcher)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.ResearchAdministrator">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.ResearchAdministrator)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.RepositoryManager">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.RepositoryManager)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.ResearchInfrastructure">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.ResearchInfrastructure)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.ServiceProvider">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.ServiceProvider)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Publisher">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Publisher)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.ResearchFunder">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.ResearchFunder)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Policymaker">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Policymaker)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.SMEIndustry">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.SMEIndustry)}}</mat-option>
|
||||
<mat-option [value]="roleOrganizationEnum.Other">{{enumUtils.toRoleOrganizationString(roleOrganizationEnum.Other)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Timezone -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col timezone-form">
|
||||
<mat-form-field>
|
||||
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}" [formControl]="this.formGroup.get('timezone')" matInput [matAutocomplete]="timezone" required>
|
||||
<mat-autocomplete #timezone="matAutocomplete">
|
||||
<mat-option *ngFor="let timezone of timezones | async" [value]="timezone">
|
||||
{{ timezone | timezoneInfoDisplay }}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Culture -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col culture-form">
|
||||
<mat-form-field>
|
||||
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}" [formControl]="this.formGroup.get('culture')" matInput [matAutocomplete]="culture" required>
|
||||
<mat-autocomplete #culture="matAutocomplete" [displayWith]="displayFn">
|
||||
<mat-option *ngFor="let culture of cultures | async" [value]="culture">
|
||||
{{ culture.displayName }} - {{ culture.nativeName }}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Language -->
|
||||
<div class="row mb-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col language-form">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}" [formControl]="this.formGroup.get('language')" required>
|
||||
<mat-option *ngFor="let language of languages" [value]="language">
|
||||
{{ language.label | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Zenodo -->
|
||||
<div class="row mb">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto field-title">{{ 'USER-PROFILE.ZENODO.TITLE' | translate}}</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div *ngIf="hasZenodo()" class="col-auto language-form">
|
||||
<mat-form-field>
|
||||
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.ZENODO' | translate}}" value="{{zenodoEmail}}" matInput disabled>
|
||||
<mat-hint>{{'USER-PROFILE.ZENODO.DESCRIPTION' | translate}}</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="hasZenodo()" class="col-auto d-flex align-items-center">
|
||||
<div class="remove-btn"><button mat-raised-button type="button" (click)="RemoveZenodo()" class="confirm unlinkBtn">{{'USER-PROFILE.ZENODO.LOGOUT' | translate}}</button></div>
|
||||
</div>
|
||||
<div *ngIf="!hasZenodo()" class="col-md-4">
|
||||
<button mat-raised-button type="button" (click)="loginToZenodo()" class="confirm" color="primary">{{'USER-PROFILE.ZENODO.LOGIN' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row d-flex mb-5">
|
||||
<div class="col-auto ml-auto"><button mat-raised-button class="save-btn" type="button" (click)="save()">{{'USER-PROFILE.ACTIONS.SAVE' | translate}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template #loading>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div class="main-content">
|
||||
<div class="container-fluid">
|
||||
<div *ngIf="user | async as userProfile; else loading" class="row user-profile">
|
||||
<mat-card class="col-12 profile-card">
|
||||
|
@ -125,4 +301,4 @@
|
|||
<ng-template #loading>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
.clickable{
|
||||
.profile {
|
||||
height: fit-content;
|
||||
margin-top: 80px;
|
||||
min-height: 100vh;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.clickable:hover {
|
||||
|
@ -20,6 +27,66 @@
|
|||
.profile-card {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.user-profile-title {
|
||||
font-size: 1.25rem;
|
||||
color: #212121;
|
||||
padding-top: 4.1875rem;
|
||||
padding-left: 3.75rem;
|
||||
padding-bottom: 4.0625rem;
|
||||
}
|
||||
|
||||
.profile-content {
|
||||
margin-left: 9rem;
|
||||
margin-right: 11rem;
|
||||
|
||||
.avatar {
|
||||
border-radius: 50%;
|
||||
width: 122px;
|
||||
height: 122px;
|
||||
box-shadow: 0px 3px 6px #00000029;
|
||||
}
|
||||
}
|
||||
|
||||
.camera {
|
||||
position: relative;
|
||||
bottom: 17px;
|
||||
|
||||
.material-icons-two-tone {
|
||||
background-color: #00ffdc;
|
||||
font-size: 34px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
-webkit-background-clip: text;
|
||||
}
|
||||
}
|
||||
|
||||
.main-info {
|
||||
margin-bottom: 34px;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #129d99;
|
||||
font-weight: 500;
|
||||
font-size: 1.25rem;
|
||||
line-height: 3rem;
|
||||
}
|
||||
|
||||
.connected {
|
||||
color: #a8a8a8;
|
||||
}
|
||||
|
||||
.mail {
|
||||
color: #129d99;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.field-title {
|
||||
color: #212121;
|
||||
opacity: 0.81;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.settings {
|
||||
|
@ -30,7 +97,80 @@
|
|||
color: black;
|
||||
}
|
||||
|
||||
.remove-btn {
|
||||
padding-bottom: 1.34375em;
|
||||
}
|
||||
|
||||
.unlinkBtn {
|
||||
background-color: FireBrick;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
background: #129d99 0% 0% no-repeat padding-box;
|
||||
border-radius: 30px;
|
||||
opacity: 1;
|
||||
width: auto;
|
||||
min-width: 110px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
::ng-deep .name-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .name-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .organization-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .organization-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .timezone-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .timezone-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .culture-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .culture-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .language-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .language-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
||||
::ng-deep .role-form .mat-form-field-appearance-outline .mat-form-field-outline {
|
||||
background: #fafafa !important;
|
||||
}
|
||||
|
||||
::ng-deep .role-form .mat-form-field-appearance-outline .mat-form-field-infix {
|
||||
font-size: 1rem;
|
||||
padding: 0.6em 0 1em 0 !important;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ import { LanguageService } from '@app/core/services/language/language.service';
|
|||
import { isNullOrUndefined } from 'util';
|
||||
import { Oauth2DialogService } from '../misc/oauth2-dialog/service/oauth2-dialog.service';
|
||||
import { ConfigurationService } from '@app/core/services/configuration/configuration.service';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { ExternalSourceItemModel } from '@app/core/model/external-sources/external-source-item';
|
||||
import { ExternalSourcesService } from '@app/core/services/external-sources/external-sources.service';
|
||||
import { UserProfileEditorModel } from './user-profile-editor.model';
|
||||
import { RoleOrganizationType } from '@app/core/common/enum/role-organization-type';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
||||
const availableLanguages: any[] = require('../../../assets/resources/language.json');
|
||||
|
||||
|
@ -26,6 +32,7 @@ const availableLanguages: any[] = require('../../../assets/resources/language.js
|
|||
})
|
||||
export class UserProfileComponent extends BaseComponent implements OnInit, OnDestroy {
|
||||
|
||||
userProfileEditorModel: UserProfileEditorModel;
|
||||
user: Observable<UserListingModel>;
|
||||
currentUserId: string;
|
||||
cultures: Observable<CultureInfo[]>;
|
||||
|
@ -34,6 +41,15 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
languages = availableLanguages;
|
||||
zenodoToken: string;
|
||||
zenodoEmail: String;
|
||||
roleOrganizationEnum = RoleOrganizationType;
|
||||
|
||||
organisationsAutoCompleteConfiguration: MultipleAutoCompleteConfiguration = {
|
||||
filterFn: this.filterOrganisations.bind(this),
|
||||
initialItems: (excludedItems: any[]) => this.filterOrganisations('').pipe(map(result => result.filter(resultItem => (excludedItems || []).map(x => x.id).indexOf(resultItem.id) === -1))),
|
||||
displayFn: (item) => item['name'],
|
||||
titleFn: (item) => item['name'],
|
||||
subtitleFn: (item) => item['tag'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['tag'] : (item['key'] ? this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.SOURCE:') + item['key'] : this.language.instant('TYPES.EXTERNAL-DATASET-TYPE.NO-SOURCE'))
|
||||
};
|
||||
|
||||
formGroup: FormGroup;
|
||||
constructor(
|
||||
|
@ -43,10 +59,12 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
private authService: AuthService,
|
||||
private language: TranslateService,
|
||||
private cultureService: CultureService,
|
||||
private externalSourcesService: ExternalSourcesService,
|
||||
private authentication: AuthService,
|
||||
private languageService: LanguageService,
|
||||
private configurationService: ConfigurationService,
|
||||
private oauth2DialogService: Oauth2DialogService
|
||||
private oauth2DialogService: Oauth2DialogService,
|
||||
public enumUtils: EnumUtils
|
||||
) { super(); }
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -59,11 +77,15 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
//result['additionalinfo'] = JSON.parse(result['additionalinfo']);
|
||||
//this.zenodoToken = result['additionalinfo']['zenodoToken'];
|
||||
this.zenodoEmail = result['zenodoEmail'];
|
||||
this.formGroup = new FormBuilder().group({
|
||||
language: new FormControl(result['language'] ? availableLanguages.filter(x => x.value === result['language']['value']).pop() : '', [Validators.required]),
|
||||
timezone: new FormControl(result['timezone'], [Validators.required]),
|
||||
culture: new FormControl(result['culture'], [Validators.required])
|
||||
});
|
||||
|
||||
this.userProfileEditorModel = new UserProfileEditorModel().fromModel(result);
|
||||
this.formGroup = this.userProfileEditorModel.buildForm();
|
||||
// this.formGroup = new FormBuilder().group({
|
||||
// language: new FormControl(result['language'] ? availableLanguages.filter(x => x.value === result['language']['value']).pop() : '', [Validators.required]),
|
||||
// timezone: new FormControl(result['timezone'], [Validators.required]),
|
||||
// culture: new FormControl(result['culture'], [Validators.required])
|
||||
// });
|
||||
|
||||
//this.formGroup.get('language').valueChanges.pipe(takeUntil(this._destroyed)).subscribe(x => { if (x) this.translate.use(x.value) })
|
||||
this.formGroup.get('timezone').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
|
@ -71,7 +93,8 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
this.formGroup.get('culture').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => { if (x) { this.cultures = this._filterCulture(x); } });
|
||||
this.formGroup.disable();
|
||||
// this.initializeDisabledFormGroup();
|
||||
this.unlock();
|
||||
return result;
|
||||
}));
|
||||
});
|
||||
|
@ -101,6 +124,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
this.router.navigate(['/plans/edit/' + dmp.id]);
|
||||
}
|
||||
|
||||
private filterOrganisations(value: string): Observable<ExternalSourceItemModel[]> {
|
||||
return this.externalSourcesService.searchDMPOrganizations(value);
|
||||
}
|
||||
|
||||
private _filterTimezone(value: string): Observable<any[]> {
|
||||
if (value && typeof value === 'string') {
|
||||
const filterValue = value.toLowerCase();
|
||||
|
@ -124,7 +151,22 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
}
|
||||
|
||||
save() {
|
||||
|
||||
if (!this.formGroup.valid) { return; }
|
||||
this.userService.updateUserSettings(this.formGroup.value)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
x => {
|
||||
this.editMode = false;
|
||||
this.languageService.changeLanguage(this.formGroup.value.language.value);
|
||||
this.authService.current().culture = this.formGroup.value.culture.name;
|
||||
this.authService.me()
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => this.router.navigate(['/profile']));
|
||||
// .subscribe(result => window.location.reload());
|
||||
},
|
||||
error => {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
public unlock() {
|
||||
|
@ -132,6 +174,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
|||
this.formGroup.enable();
|
||||
}
|
||||
|
||||
public initializeDisabledFormGroup() {
|
||||
this.formGroup.disable();
|
||||
}
|
||||
|
||||
public lock() {
|
||||
if (!this.formGroup.valid) { return; }
|
||||
this.userService.updateUserSettings(this.formGroup.value)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { FormattingModule } from '@app/core/formatting.module';
|
||||
import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module';
|
||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||
import { UserProfileComponent } from './user-profile.component';
|
||||
|
@ -10,7 +11,8 @@ import { UserProfileRoutingModule } from './user-profile.routing';
|
|||
CommonUiModule,
|
||||
CommonFormsModule,
|
||||
FormattingModule,
|
||||
UserProfileRoutingModule
|
||||
UserProfileRoutingModule,
|
||||
AutoCompleteModule
|
||||
],
|
||||
declarations: [
|
||||
UserProfileComponent
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Einstellungen",
|
||||
"TIMEZONE": "Zeitzone",
|
||||
"CULTURE": "Kultur",
|
||||
"LANGUAGE": "Sprache"
|
||||
"LANGUAGE": "Sprache",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Rolle",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "Zugehörige DMPs",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "Remove Zenodo",
|
||||
"TITLE": "Zenodo Account",
|
||||
"DESCRIPTION": "Linked Zenodo Account:"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Settings",
|
||||
"TIMEZONE": "Time Zone",
|
||||
"CULTURE": "Culture",
|
||||
"LANGUAGE": "Language"
|
||||
"LANGUAGE": "Language",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Role",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "Associated DMPs",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "Remove Zenodo",
|
||||
"TITLE": "Zenodo Account",
|
||||
"DESCRIPTION": "Linked Zenodo Account:"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Configuración",
|
||||
"TIMEZONE": "Zona horaria",
|
||||
"CULTURE": "Cultura",
|
||||
"LANGUAGE": "Idioma"
|
||||
"LANGUAGE": "Idioma",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Role",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "PGDs asociados",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "Eliminar Zenodo",
|
||||
"TITLE": "Cuenta en Zenodo",
|
||||
"DESCRIPTION": "Enlazar una cuenta en Zenodo:"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Ρυθμίσεις",
|
||||
"TIMEZONE": "Ζώνη Ώρας",
|
||||
"CULTURE": "Κουλτούρα",
|
||||
"LANGUAGE": "Γλώσσα"
|
||||
"LANGUAGE": "Γλώσσα",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Ρόλος",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "Συσχετιζόμενα Σχέδια Διαχείρισης Δεδομένων",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "Αφαίρεση Zenodo",
|
||||
"TITLE": "Λογαριασμός Zenodo",
|
||||
"DESCRIPTION": "Συνδεδεμένος Λογαριασμός Zenodo:"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Nastavenia",
|
||||
"TIMEZONE": "Časové pásmo",
|
||||
"CULTURE": "Kultúra",
|
||||
"LANGUAGE": "Jazyk"
|
||||
"LANGUAGE": "Jazyk",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Rola",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "Pridružené DMP",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "odstrániť Zenodo",
|
||||
"TITLE": "Zenodo účet",
|
||||
"DESCRIPTION": "Prepojený Zenodo účet :"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1361,7 +1361,12 @@
|
|||
"TITLE": "Ayarlar",
|
||||
"TIMEZONE": "Zaman Dilimi",
|
||||
"CULTURE": "Kültür",
|
||||
"LANGUAGE": "Dil"
|
||||
"LANGUAGE": "Dil",
|
||||
"CONNECTED-WITH": "Connected with",
|
||||
"NAME": "Name",
|
||||
"ORGANIZATION": "Organization",
|
||||
"ROLE": "Görev",
|
||||
"SELECT-ROLE": "Select Role"
|
||||
},
|
||||
"ASSOCIATED-DMPS": "İlişkili VYP'ları",
|
||||
"DMPS": {
|
||||
|
@ -1374,6 +1379,25 @@
|
|||
"LOGOUT": "Zenodo'yu Kaldır",
|
||||
"TITLE": "Zenodo Hesabı",
|
||||
"DESCRIPTION": "Bağlantılı Zenodo Hesabı:"
|
||||
},
|
||||
"ROLE-ORGANIZATION": {
|
||||
"FACULTY": "Faculty",
|
||||
"LIBRARIAN": "Librarian",
|
||||
"RESEARCHER": "Researcher",
|
||||
"STUDENT": "Student (BA/BSc, MSc)",
|
||||
"EARLY-CAREER-RESEARCHER": "Early Career Researcher (PhD candidate, post-graduate)",
|
||||
"RESEARCH-ADMINISTRATOR": "Research Administrator",
|
||||
"REPOSITORY-MANAGER": "Repository Manager",
|
||||
"RESEARCH-INFRASTRUCTURE": "Research Infrastructure",
|
||||
"SERVICE-PROVIDER": "Service Provider",
|
||||
"PUBLISHER": "Publisher",
|
||||
"RESEARCH-FUNDER": "Research Funder",
|
||||
"POLICY-MAKER": "Policymaker",
|
||||
"SME-INDUSTRY": "SME/ Industry",
|
||||
"OTHER": "Other"
|
||||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save"
|
||||
}
|
||||
},
|
||||
"DATASET-REFERENCED-MODELS": {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
.login-screen {
|
||||
margin-top: 70px;
|
||||
padding-top: 80px;
|
||||
// margin-top: 70px;
|
||||
min-height: calc(100vh - 10px);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<script type="text/javascript" src="//platform.linkedin.com/in.js"></script>
|
||||
<!-- Fonts and icons -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet">
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,300|Material+Icons|Material+Icons+Outlined' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Roboto:400,500,700,300|Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone' rel='stylesheet' type='text/css'>
|
||||
<!-- Hammer.js -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
|
||||
.main-content {
|
||||
background-color: #f5f5f5;
|
||||
padding-top: 4.68rem;
|
||||
padding-top: 5rem;
|
||||
padding-bottom: 3rem;
|
||||
// padding-left: 3.31rem;
|
||||
padding-left: 1rem;
|
||||
|
|
Loading…
Reference in New Issue