Merge branch 'Development'
This commit is contained in:
commit
3ada5a0d3d
|
@ -90,7 +90,12 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
|
|||
this.status = entity.getStatus();
|
||||
this.created = entity.getCreated();
|
||||
this.modified = entity.getModified();
|
||||
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||
if (source.equals("dmp")) {
|
||||
this.source = "Internal";
|
||||
} else {
|
||||
this.source = source;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -100,7 +105,15 @@ public class Funder implements DataModel<eu.eudat.data.entities.Funder, Funder>
|
|||
entity.setId(this.id);
|
||||
entity.setLabel(this.label);
|
||||
entity.setType(this.type);
|
||||
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
|
||||
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
|
||||
if (this.reference != null && !this.reference.trim().isEmpty()
|
||||
&& this.source != null && !this.source.trim().isEmpty()) {
|
||||
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
|
||||
entity.setReference(this.reference);
|
||||
} else {
|
||||
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
|
||||
}
|
||||
}
|
||||
entity.setDefinition(this.definition);
|
||||
entity.setCreated(this.created == null ? new Date() : this.created);
|
||||
entity.setStatus(this.status != null ? this.getStatus() : eu.eudat.data.entities.Grant.Status.ACTIVE.getValue());
|
||||
|
|
|
@ -177,7 +177,12 @@ public class Grant implements DataModel<eu.eudat.data.entities.Grant, Grant> {
|
|||
this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null));
|
||||
if (entity.getFunder() != null)
|
||||
this.funderId = entity.getFunder().getId();
|
||||
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||
if (source.equals("dmp")) {
|
||||
this.source = "Internal";
|
||||
} else {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -189,7 +194,15 @@ public class Grant implements DataModel<eu.eudat.data.entities.Grant, Grant> {
|
|||
entity.setAbbreviation(this.abbreviation);
|
||||
entity.setLabel(this.label);
|
||||
entity.setType(this.type);
|
||||
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
|
||||
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
|
||||
if (this.reference != null && !this.reference.trim().isEmpty()
|
||||
&& this.source != null && !this.source.trim().isEmpty()) {
|
||||
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
|
||||
entity.setReference(this.reference);
|
||||
} else {
|
||||
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
|
||||
}
|
||||
}
|
||||
entity.setUri(this.uri);
|
||||
entity.setDefinition(this.definition);
|
||||
entity.setStartdate(this.startDate);
|
||||
|
|
|
@ -165,7 +165,12 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
|
|||
this.modified = entity.getModified();
|
||||
this.description = entity.getDescription();
|
||||
this.files = entity.getContent() != null ? Arrays.asList(new ContentFile(entity.getContent().getLabel(), UUID.fromString(entity.getContent().getUri().split(":")[1]), "final", entity.getContent().getExtension())) : Arrays.asList(new ContentFile("default.png", null, null, null));
|
||||
String source = entity.getReference().substring(0, entity.getReference().indexOf(":"));
|
||||
if (source.equals("dmp")) {
|
||||
this.source = "Internal";
|
||||
} else {
|
||||
this.source = source;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -176,7 +181,15 @@ public class Project implements DataModel<eu.eudat.data.entities.Project, Projec
|
|||
entity.setAbbreviation(this.abbreviation);
|
||||
entity.setLabel(this.label);
|
||||
entity.setType(this.type);
|
||||
entity.setReference(this.reference == null ? "dmp:" + this.label : this.source.toLowerCase() + ":" + this.reference);
|
||||
if (this.source != null && this.source.equals("Internal")) this.source = "dmp";
|
||||
if (this.reference != null && !this.reference.trim().isEmpty()
|
||||
&& this.source != null && !this.source.trim().isEmpty()) {
|
||||
if (this.source.equals(this.reference.substring(0, this.source.length()))) {
|
||||
entity.setReference(this.reference);
|
||||
} else {
|
||||
entity.setReference(this.source.toLowerCase() + ":" + this.reference);
|
||||
}
|
||||
}
|
||||
entity.setUri(this.uri);
|
||||
entity.setDefinition(this.definition);
|
||||
entity.setStartdate(this.startDate);
|
||||
|
|
|
@ -70,12 +70,17 @@
|
|||
<!-- SAVE BUTTON -->
|
||||
<div class="col-6 d-flex" *ngIf="!viewOnly">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='onSubmit()' [disabled]="!form.valid">Save</button>
|
||||
<button mat-raised-button class="col-auto" color="primary" type="button col-auto" (click)='finalize()' [disabled]="!form.valid">Finalize</button>
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='onSubmit()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.SAVE' | translate}}</button>
|
||||
<button mat-raised-button class="col-auto" color="primary" type="button col-auto" (click)='finalize()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.FINALIZE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- SAVE BUTTON WHEN FINALIZED-->
|
||||
<div class="col-6 d-flex" *ngIf="showUpdateButton()">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button class="col-auto mr-2" color="primary" type="button col-auto" (click)='updateFinalized()' [disabled]="!form.valid">{{'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE' | translate}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- DELETE BUTTON -->
|
||||
<div class="col-6" *ngIf="viewOnly"></div>
|
||||
<div class="col-6 d-flex justify-content-end" *ngIf="!isNew">
|
||||
<div class="row mt-4">
|
||||
<button mat-raised-button color="primary" (click)="delete()">
|
||||
|
|
|
@ -222,6 +222,18 @@ export class DatasetProfileEditorComponent extends BaseComponent implements OnIn
|
|||
this.onSubmit();
|
||||
}
|
||||
|
||||
updateFinalized() {
|
||||
this.datasetProfileService.updateForm(this.datasetProfileId, this.form.getRawValue())
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/dataset-profiles']);
|
||||
});
|
||||
}
|
||||
|
||||
showUpdateButton() {
|
||||
return !this.isNew && this.dataModel.status === DatasetProfileEnum.FINALIZED;
|
||||
}
|
||||
|
||||
isStepActive(step: number) {
|
||||
return this.stepper && this.stepper.selectedIndex === step;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
// this.availableProfiles = this.datasetWizardModel.dmp.profiles;
|
||||
},
|
||||
error => {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATAESET-NOT-FOUND'), SnackBarNotificationLevel.Error);
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-WIZARD.MESSAGES.DATASET-NOT-FOUND'), SnackBarNotificationLevel.Error);
|
||||
this.router.navigate(['/datasets/edit/' + this.itemId]);
|
||||
return observableOf(null);
|
||||
});
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
<div *ngIf="isAuthenticated();else loginoption" class="col-auto">
|
||||
<img mat-card-avatar *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()">
|
||||
</div>
|
||||
|
||||
<ng-template #loginoption>
|
||||
|
|
|
@ -92,13 +92,17 @@ export class NavigationComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
openProfile() {
|
||||
const dialogRef = this.dialog.open(UserDialogComponent, {
|
||||
hasBackdrop: true,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<div mat-dialog-title>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()">
|
||||
</div>
|
||||
<span class="user-label col">{{this.getPrincipalName()}}</span>
|
||||
</div>
|
||||
|
|
|
@ -36,13 +36,17 @@ export class UserDialogComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current() && this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public navigateToProfile() {
|
||||
this.dialogRef.close();
|
||||
this.router.navigate(['/profile']);
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
|
||||
<!-- Login -->
|
||||
<li class="nav-item" *ngIf="isAuthenticated();else loginoption">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()" (click)="openProfile()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()" (click)="openProfile()">
|
||||
</li>
|
||||
<ng-template #loginoption>
|
||||
<button mat-button [routerLink]=" ['/login'] ">
|
||||
|
|
|
@ -152,13 +152,17 @@ export class NavbarComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public isAdmin(): boolean {
|
||||
if (!this.authentication.current()) { return false; }
|
||||
const principalRoles = this.authentication.current().authorities;
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" *ngIf="isAuthenticated();else loginoption">
|
||||
<p style="display: flex; align-items: center;" [routerLink]=" ['/profile']">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
|
||||
[src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
|
||||
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="!this.principalHasAvatar()" [src]="this.getDefaultAvatar()">
|
||||
<span class="d-lg-none d-md-block">{{ 'SIDE-BAR.ACCOUNT' | translate }}</span>
|
||||
</p>
|
||||
</a>
|
||||
|
|
|
@ -146,13 +146,17 @@ export class SidebarComponent implements OnInit {
|
|||
}
|
||||
|
||||
public principalHasAvatar(): boolean {
|
||||
return this.authentication.current().avatarUrl != null;
|
||||
return this.authentication.current().avatarUrl != null && this.authentication.current().avatarUrl.length > 0;
|
||||
}
|
||||
|
||||
public getPrincipalAvatar(): string {
|
||||
return this.authentication.current().avatarUrl;
|
||||
}
|
||||
|
||||
public getDefaultAvatar(): string {
|
||||
return 'assets/images/profile-placeholder.png';
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
const myBollean = this.isAdmin();
|
||||
return !(!this.authentication.current());
|
||||
|
|
|
@ -330,6 +330,8 @@
|
|||
},
|
||||
"ACTIONS": {
|
||||
"SAVE": "Save",
|
||||
"FINALIZE": "Finalize",
|
||||
"UPDATE": "Update",
|
||||
"CANCEL": "Cancel",
|
||||
"DELETE": "Delete",
|
||||
"ADD-PAGE": "Add Page +",
|
||||
|
@ -453,7 +455,7 @@
|
|||
"UPDATE-DATASET-PROFILE": "Update Template"
|
||||
},
|
||||
"MESSAGES": {
|
||||
"DATAESET-NOT-FOUND": "Dataset Description does not exist",
|
||||
"DATASET-NOT-FOUND": "Dataset Description does not exist",
|
||||
"SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Description Template updated successfully"
|
||||
},
|
||||
"UPLOAD": {
|
||||
|
|
Loading…
Reference in New Issue