Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign

This commit is contained in:
apapachristou 2020-07-22 11:24:59 +03:00
commit 8d7d9c5a8b
17 changed files with 127 additions and 58 deletions

View File

@ -2,7 +2,7 @@ import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
import { UserInfoListingModel } from '../user/user-info-listing'; import { UserInfoListingModel } from '../user/user-info-listing';
export class RecentActivityModel { export class RecentActivityModel {
id: String; id: string;
title: String; title: String;
description: String; description: String;
created: Date; created: Date;

View File

@ -51,9 +51,9 @@
</div> </div>
<div class="dmp-card-actions"> <div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity) && isUserOwner" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isUserOwner"(click)="openShareDialog(activity.id, activity.title)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a> <a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div> </div>
@ -82,7 +82,7 @@
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)"> <button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} <mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item *ngIf="isDraftDmp(activity) && isUserOwner(activity)" (click)="deleteClicked()" class="menu-item"> <button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }} <mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button> </button>
</mat-menu> </mat-menu>

View File

@ -138,7 +138,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
} }
cloneClicked(dmp: DmpListingModel) { cloneClicked(dmp: DmpListingModel) {
this.router.navigate(['/plans/clone/' + dmp.id]); let url = this.router.createUrlTree(['/plans/clone/', dmp.id]);
window.open(url.toString(), '_blank');
} }
deleteClicked(dmp: DmpListingModel) { deleteClicked(dmp: DmpListingModel) {

View File

@ -46,15 +46,15 @@
</div> </div>
<div class="dataset-card-actions"> <div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.dmpId, activity.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isUserOwner(activity)" (click)="openShareDialog(activity.dmpId, activity.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a> <a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
<!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> --> <!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
</div> </div>
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openDmpSearchDialogue(activity.id)" class="menu-item"> <button mat-menu-item *ngIf="isAuthenticated()" (click)="openDmpSearchDialogue(activity.id)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}} <mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button> </button>
<button mat-menu-item (click)="openConfirm(activity.id)" class="menu-item"> <button mat-menu-item *ngIf="isUserOwner" (click)="openConfirm(activity.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }} <mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button> </button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);"> <!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -22,6 +22,7 @@ import { SnackBarNotificationLevel } from '@common/modules/notification/ui-notif
import { DatasetStatus } from '@app/core/common/enum/dataset-status'; import { DatasetStatus } from '@app/core/common/enum/dataset-status';
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component'; import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
import { Role } from '@app/core/common/enum/role';
@Component({ @Component({
selector: 'app-recent-edited-dataset-activity', selector: 'app-recent-edited-dataset-activity',
@ -117,6 +118,11 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
return !!this.authentication.current(); return !!this.authentication.current();
} }
isUserOwner(activity: DatasetListingModel): boolean {
const principal: Principal = this.authentication.current();
if (principal) return principal.id === activity.users.find(x => x.role === Role.Owner).id;
}
roleDisplay(value: any) { roleDisplay(value: any) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
let role: number; let role: number;
@ -156,8 +162,9 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)) dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
.subscribe(result => { .subscribe(result => {
if (result && result.datasetProfileExist) { if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id const newDmpId = result.formControl.value.id;
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } }); let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ])
window.open(url.toString(), '_blank')
} }
}); });
} }

View File

@ -50,9 +50,9 @@
</div> </div>
<div class="dmp-card-actions"> <div class="dmp-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DMP-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isDraftDmp(activity) && isUserOwner" (click)="addDataset(activity.id)"><span class="material-icons icon-align">add</span>{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isUserOwner" (click)="openShareDialog(activity.id, activity.label)"><span class="material-icons icon-align pr-2">group_add</span>{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isAuthenticated()" (click)="cloneClicked(activity)"><span class="material-icons icon-align pr-2">filter_none</span>{{'DMP-LISTING.ACTIONS.CLONE' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a> <a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
</div> </div>
@ -81,7 +81,7 @@
<button mat-menu-item (click)="viewVersions(activity.groupId, activity.label)"> <button mat-menu-item (click)="viewVersions(activity.groupId, activity.label)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} <mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item *ngIf="isDraftDmp(activity) && isUserOwner(activity)" (click)="deleteClicked()" class="menu-item"> <button mat-menu-item *ngIf="isUserOwner(activity)" (click)="deleteClicked()" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }} <mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button> </button>
</mat-menu> </mat-menu>

View File

@ -123,7 +123,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
} }
cloneClicked(dmp: DmpListingModel) { cloneClicked(dmp: DmpListingModel) {
this.router.navigate(['/plans/clone/' + dmp.id]); let url = this.router.createUrlTree(['/plans/clone/', dmp.id]);
window.open(url.toString(), '_blank');
} }
deleteClicked(dmp: DmpListingModel) { deleteClicked(dmp: DmpListingModel) {

View File

@ -24,15 +24,15 @@
</a> </a>
<div class="dataset-card-actions"> <div class="dataset-card-actions">
<a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a> <a class="col-auto border-right pointer" [matMenuTriggerFor]="exportMenu"><span class="material-icons icon-align pr-2">open_in_new</span>{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}}</a>
<a class="col-auto border-right pointer" (click)="openShareDialog(dataset.dmpId, dataset.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a> <a class="col-auto border-right pointer" *ngIf="isUserOwner" (click)="openShareDialog(dataset.dmpId, dataset.dmp)"><span class="material-icons icon-align pr-2">group_add</span>{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}}</a>
<a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a> <a class="col-auto pointer" [matMenuTriggerFor]="actionsMenu"><span class="material-icons icon-align pl-2">more_horiz</span></a>
<!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> --> <!-- <a class="col-auto" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
</div> </div>
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button mat-menu-item (click)="openDmpSearchDialogue(dataset)" class="menu-item"> <button *ngIf="isAuthenticated()" mat-menu-item (click)="openDmpSearchDialogue(dataset)" class="menu-item">
<mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}} <mat-icon>file_copy</mat-icon>{{'DATASET-WIZARD.ACTIONS.COPY-DATASET' | translate}}
</button> </button>
<button mat-menu-item (click)="openConfirm(dataset.id)" class="menu-item"> <button *ngIf="isUserOwner && !lockStatus" mat-menu-item (click)="openConfirm(dataset.id)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }} <mat-icon>delete</mat-icon>{{ 'DATASET-WIZARD.ACTIONS.DELETE' | translate }}
</button> </button>
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);"> <!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">

View File

@ -17,6 +17,8 @@ import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/serv
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model'; import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
import { Principal } from '@app/core/model/auth/principal'; import { Principal } from '@app/core/model/auth/principal';
import { AuthService } from '@app/core/services/auth/auth.service'; import { AuthService } from '@app/core/services/auth/auth.service';
import { LockService } from '@app/core/services/lock/lock.service';
import { Role } from '@app/core/common/enum/role';
@Component({ @Component({
selector: 'app-dataset-listing-item-component', selector: 'app-dataset-listing-item-component',
@ -32,6 +34,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
isDraft: boolean; isDraft: boolean;
isDeleted: boolean; isDeleted: boolean;
lockStatus: Boolean;
isUserOwner: boolean;
constructor( constructor(
private router: Router, private router: Router,
@ -40,7 +44,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
public dialog: MatDialog, public dialog: MatDialog,
private language: TranslateService, private language: TranslateService,
private authentication: AuthService, private authentication: AuthService,
private uiNotificationService: UiNotificationService private uiNotificationService: UiNotificationService,
private lockService: LockService
) { ) {
super(); super();
} }
@ -49,15 +54,35 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
if (this.dataset.status === DatasetStatus.Draft) { if (this.dataset.status === DatasetStatus.Draft) {
this.isDraft = true; this.isDraft = true;
this.isDeleted = false; this.isDeleted = false;
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
} else if (this.dataset.status === DatasetStatus.Deleted) { } else if (this.dataset.status === DatasetStatus.Deleted) {
this.isDeleted = true; this.isDeleted = true;
} }
else { else {
this.isDraft = false; this.isDraft = false;
this.isDeleted = false; this.isDeleted = false;
this.checkLockStatus(this.dataset.id);
this.setIsUserOwner();
} }
} }
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
}
setIsUserOwner() {
if (this.dataset) {
const principal: Principal = this.authentication.current();
if (principal) this.isUserOwner = principal.id === this.dataset.users.find(x => x.role === Role.Owner).id;
}
}
public isAuthenticated(): boolean {
return !(!this.authentication.current());
}
getItemLink(): string[] { getItemLink(): string[] {
return this.isPublic ? [`/datasets/publicEdit/${this.dataset.id}`] : [`/datasets/edit/${this.dataset.id}`]; return this.isPublic ? [`/datasets/publicEdit/${this.dataset.id}`] : [`/datasets/edit/${this.dataset.id}`];
} }
@ -170,18 +195,33 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
this.datasetWizardService.delete(id) this.datasetWizardService.delete(id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => this.onCallbackSuccess(), complete => this.onDeleteCallbackSuccess(),
// error => this.onCallbackError(error) error => this.onDeleteCallbackError(error)
); );
} }
}); });
} }
onCallbackSuccess(id?: String): void { reloadPage(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']); this.router.navigate(['/datasets']);
});
} }
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
}
onDeleteCallbackError(error) {
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
}
// onCallbackSuccess(id?: String): void {
// this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
// id ? this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', id]); }) : this.router.navigate(['/datasets']);
// }
roleDisplay(value: any) { roleDisplay(value: any) {
const principal: Principal = this.authentication.current(); const principal: Principal = this.authentication.current();
let role: number; let role: number;
@ -203,6 +243,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
} }
} }
// onCallbackError(error: any) { // onCallbackError(error: any) {
// this.setErrorModel(error.error); // this.setErrorModel(error.error);
// } // }

View File

@ -64,7 +64,7 @@
<div class="row "> <div class="row ">
<button class="dmp-btn" (click)="dmpClicked(dataset.dmp.id)"> <button class="dmp-btn" (click)="dmpClicked(dataset.dmp.id)">
<div class="dmp-btn-label"> <div class="dmp-btn-label">
{{ this.dataset.dmp.label }}: {{ dataset.datasetTemplate.label }} {{ this.dataset.dmp.label }}
<!-- {{ 'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate }}: {{ dataset.datasetTemplate.label }} --> <!-- {{ 'DATASET-LISTING.TOOLTIP.DMP-FOR' | translate }}: {{ dataset.datasetTemplate.label }} -->
</div> </div>
<mat-icon>launch</mat-icon> <mat-icon>launch</mat-icon>

View File

@ -138,7 +138,8 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
} }
getDatasetWizardModel(id: string) { getDatasetWizardModel(id: string) {
this.datasetWizardService.getSingle(id).pipe(takeUntil(this._destroyed)) this.datasetWizardService.getSingle(id)
.pipe(takeUntil(this._destroyed))
.subscribe(data => { .subscribe(data => {
this.datasetWizardEditorModel = new DatasetWizardEditorModel().fromModel(data); this.datasetWizardEditorModel = new DatasetWizardEditorModel().fromModel(data);
this.datasetWizardModel = data; this.datasetWizardModel = data;
@ -165,7 +166,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
} }
reloadPage(): void { reloadPage(): void {
this.router.navigateByUrl('/datasets', { skipLocationChange: true }).then(() => { this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([`/datasets/overview/${this.dataset.id}`]); this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
}); });
} }
@ -263,9 +264,11 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
editClicked(dataset: DatasetOverviewModel) { editClicked(dataset: DatasetOverviewModel) {
if (dataset.public) { if (dataset.public) {
this.router.navigate(['/datasets/publicEdit/' + dataset.id]); let url = this.router.createUrlTree(['/datasets/publicEdit/', dataset.id])
window.open(url.toString(), '_blank')
} else { } else {
this.router.navigate(['/datasets/edit/' + dataset.id]); let url = this.router.createUrlTree(['/datasets/edit/', dataset.id])
window.open(url.toString(), '_blank')
} }
} }
@ -406,7 +409,8 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
.subscribe(result => { .subscribe(result => {
if (result && result.datasetProfileExist) { if (result && result.datasetProfileExist) {
const newDmpId = result.formControl.value.id const newDmpId = result.formControl.value.id
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } }); let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ])
window.open(url.toString(), '_blank')
} }
}); });
} }

View File

@ -29,7 +29,6 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
public filteredUsers: DmpInvitationUser[]; public filteredUsers: DmpInvitationUser[];
public emails: string[] = []; public emails: string[] = [];
public roles = Role; public roles = Role;
public roleNames: string[];
visible = true; visible = true;
selectable = true; selectable = true;
@ -46,7 +45,6 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
@Inject(MAT_DIALOG_DATA) public data: any @Inject(MAT_DIALOG_DATA) public data: any
) { ) {
super(); super();
this.roleNames = Object.keys(this.roles).filter(key => key.length > 1);
} }
ngOnInit(): void { ngOnInit(): void {

View File

@ -59,7 +59,8 @@
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)"> <button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)">
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}} <mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked()" class="menu-item"> <!-- <button mat-menu-item *ngIf="isDraftDmp(dmp) && isUserOwner(dmp)" (click)="deleteClicked()" class="menu-item"> -->
<button mat-menu-item *ngIf="isUserOwner(dmp) && !lockStatus" (click)="deleteClicked(dmp)" class="menu-item">
<mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }} <mat-icon>delete</mat-icon>{{ 'DMP-LISTING.ACTIONS.DELETE' | translate }}
</button> </button>
</mat-menu> </mat-menu>

View File

@ -16,6 +16,7 @@ import * as FileSaver from 'file-saver';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service'; import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
import { Role } from '@app/core/common/enum/role'; import { Role } from '@app/core/common/enum/role';
import { LockService } from '@app/core/services/lock/lock.service';
@Component({ @Component({
selector: 'app-dmp-listing-item-component', selector: 'app-dmp-listing-item-component',
@ -32,6 +33,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
isDraft: boolean; isDraft: boolean;
isFinalized: boolean; isFinalized: boolean;
isPublished: boolean; isPublished: boolean;
lockStatus: Boolean;
constructor( constructor(
private router: Router, private router: Router,
@ -40,7 +42,8 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
public enumUtils: EnumUtils, public enumUtils: EnumUtils,
private dmpService: DmpService, private dmpService: DmpService,
private language: TranslateService, private language: TranslateService,
private uiNotificationService: UiNotificationService) { private uiNotificationService: UiNotificationService,
private lockService: LockService) {
super(); super();
} }
@ -49,15 +52,22 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
this.isDraft = true; this.isDraft = true;
this.isFinalized = false; this.isFinalized = false;
this.isPublished = false; this.isPublished = false;
this.checkLockStatus(this.dmp.id);
} }
else if (this.dmp.status == DmpStatus.Finalized) { else if (this.dmp.status == DmpStatus.Finalized) {
this.isDraft = false; this.isDraft = false;
this.isFinalized = true; this.isFinalized = true;
this.isPublished = false; this.isPublished = false;
this.checkLockStatus(this.dmp.id);
if (this.dmp.public == true) { this.isPublished = true } if (this.dmp.public == true) { this.isPublished = true }
} }
} }
checkLockStatus(id: string) {
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => this.lockStatus = lockStatus);
}
openShareDialog(rowId: any, rowName: any) { openShareDialog(rowId: any, rowName: any) {
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, { const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
// height: '250px', // height: '250px',
@ -204,7 +214,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
this.dmpService.delete(dmp.id) this.dmpService.delete(dmp.id)
.pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
.subscribe( .subscribe(
complete => { this.onCallbackSuccess() }, complete => this.onDeleteCallbackSuccess(),
error => this.onDeleteCallbackError(error) error => this.onDeleteCallbackError(error)
); );
} }
@ -215,9 +225,15 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
return activity.status == DmpStatus.Draft; return activity.status == DmpStatus.Draft;
} }
onCallbackSuccess(): void { reloadPage(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success); this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate(['/plans']); this.router.navigate(['/plans']);
});
}
onDeleteCallbackSuccess(): void {
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-DATASET-PROFILE-DELETE'), SnackBarNotificationLevel.Success);
this.reloadPage();
} }
onDeleteCallbackError(error) { onDeleteCallbackError(error) {

View File

@ -27,8 +27,10 @@
{{'DMP-OVERVIEW.PRIVATE' | translate}} {{'DMP-OVERVIEW.PRIVATE' | translate}}
</div> </div>
</div> </div>
<div *ngIf="lockStatus" class="d-flex flex-row mr-4">
<mat-icon class="status-icon">lock_outline</mat-icon> <div *ngIf="lockStatus" class="d-flex flex-row mr-2">
<span>.</span>
<mat-icon class="status-icon ml-2">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}} {{'DMP-OVERVIEW.LOCKED' | translate}}
</div> </div>
<span>.</span> <span>.</span>
@ -85,24 +87,17 @@
</div> </div>
<div class="row header">{{'DMP-OVERVIEW.DATASETS-USED' | translate}}</div> <div class="row header">{{'DMP-OVERVIEW.DATASETS-USED' | translate}}</div>
<div class="d-flex flex-column"> <div class="d-flex flex-column">
<div *ngFor="let dataset of dmp.datasets; let i=index"> <div *ngFor="let dataset of dmp.datasets">
<div class="row" *ngIf="i < 3" (click)="datasetClicked(dataset.id)"> <div class="row" (click)="datasetClicked(dataset.id)">
<button mat-raised-button class="mb-2 mr-2 pl-0 pr-0"> <button mat-raised-button class="mb-2 mr-2 pl-0 pr-0">
<div matTooltip="{{ dataset.label }} : {{ dataset.datasetTemplate.label }}" <div matTooltip="{{ dataset.label }}"
class="col-auto dataset-btn"> class="col-auto dataset-btn">
<div class="dataset-btn-label">{{ dataset.label }}: <div class="dataset-btn-label">{{ dataset.label }}</div>
{{ dataset.datasetTemplate.label }}</div>
<mat-icon>launch</mat-icon> <mat-icon>launch</mat-icon>
</div> </div>
</button> </button>
</div> </div>
</div> </div>
<div class="row" *ngIf="dmp.datasets.length > 3" class="show-more-btn">
<button mat-button (click)="datasetsClicked(dmp.id)">
<mat-icon class="mr-2">expand_more</mat-icon>
{{ 'GENERAL.ACTIONS.SHOW-MORE' | translate }}
</button>
</div>
</div> </div>
<div class="row mt-2 add-dataset-txt"> <div class="row mt-2 add-dataset-txt">
<button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner" <button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner"

View File

@ -57,7 +57,8 @@
.add-dataset-btn { .add-dataset-btn {
border: none; border: none;
font: Bold 0.875em Open Sans; font: Bold 0.875em Roboto;
// font: Bold 0.875em Open Sans;
color: #444444; color: #444444;
background-color: transparent; background-color: transparent;
} }
@ -215,6 +216,7 @@
box-shadow: 0px 1px 5px #00000026; box-shadow: 0px 1px 5px #00000026;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
min-width: 18.5em;
} }
.frame-txt { .frame-txt {
@ -302,7 +304,6 @@
::ng-deep .versions-select .mat-form-field-wrapper .mat-form-field-flex { ::ng-deep .versions-select .mat-form-field-wrapper .mat-form-field-flex {
padding: 0 0.5rem 0 0.625rem; padding: 0 0.5rem 0 0.625rem;
margin-bottom: 0.2rem; margin-bottom: 0.2rem;
font-weight: 500;
} }
::ng-deep mat-select .mat-select-arrow-wrapper { ::ng-deep mat-select .mat-select-arrow-wrapper {

View File

@ -161,11 +161,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
editClicked(dmp: DmpOverviewModel) { editClicked(dmp: DmpOverviewModel) {
this.router.navigate(['/plans/edit/' + dmp.id]); let url = this.router.createUrlTree(['/plans/edit/', dmp.id]);
window.open(url.toString(), '_blank');
} }
cloneClicked(dmp: DmpOverviewModel) { cloneClicked(dmp: DmpOverviewModel) {
this.router.navigate(['/plans/clone/' + dmp.id]); let url = this.router.createUrlTree(['/plans/clone/', dmp.id]);
window.open(url.toString(), '_blank');
} }
grantClicked(grantId: String) { grantClicked(grantId: String) {
@ -534,7 +536,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
newVersion(id: String, label: String) { newVersion(id: String, label: String) {
this.router.navigate(['/plans/new_version/' + id, { dmpLabel: label }]); let url = this.router.createUrlTree(['/plans/new_version/', id, { dmpLabel: label }])
window.open(url.toString(), '_blank')
} }
viewVersions(rowId: String, rowLabel: String) { viewVersions(rowId: String, rowLabel: String) {
@ -604,7 +607,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
} }
reloadPage(): void { reloadPage(): void {
this.router.navigateByUrl('/plans', { skipLocationChange: true }).then(() => { this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
this.router.navigate([`/plans/overview/${this.dmp.id}`]); this.router.navigate([`/plans/overview/${this.dmp.id}`]);
}); });
} }