Merge branch 'ui-redesign' of gitlab.eudat.eu:dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-redesign
This commit is contained in:
commit
8d7d9c5a8b
|
@ -2,7 +2,7 @@ import { RecentActivityType } from '@app/core/common/enum/recent-activity-type';
|
|||
import { UserInfoListingModel } from '../user/user-info-listing';
|
||||
|
||||
export class RecentActivityModel {
|
||||
id: String;
|
||||
id: string;
|
||||
title: String;
|
||||
description: String;
|
||||
created: Date;
|
||||
|
|
|
@ -51,9 +51,9 @@
|
|||
</div>
|
||||
<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" (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" (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="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" *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" *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>
|
||||
</div>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
<button mat-menu-item (click)="viewVersions(getGroupId(activity), activity.title)">
|
||||
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
|
||||
</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 }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
|
|
@ -138,7 +138,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -46,15 +46,15 @@
|
|||
</div>
|
||||
<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" (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" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
|
||||
</div>
|
||||
<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}}
|
||||
</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 }}
|
||||
</button>
|
||||
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">
|
||||
|
|
|
@ -22,6 +22,7 @@ import { SnackBarNotificationLevel } from '@common/modules/notification/ui-notif
|
|||
import { DatasetStatus } from '@app/core/common/enum/dataset-status';
|
||||
import { DmpInvitationDialogComponent } from '@app/ui/dmp/invitation/dmp-invitation-dialog.component';
|
||||
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
||||
import { Role } from '@app/core/common/enum/role';
|
||||
|
||||
@Component({
|
||||
selector: 'app-recent-edited-dataset-activity',
|
||||
|
@ -117,6 +118,11 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
|||
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) {
|
||||
const principal: Principal = this.authentication.current();
|
||||
let role: number;
|
||||
|
@ -156,8 +162,9 @@ export class RecentEditedDatasetActivityComponent extends BaseComponent implemen
|
|||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed))
|
||||
.subscribe(result => {
|
||||
if (result && result.datasetProfileExist) {
|
||||
const newDmpId = result.formControl.value.id
|
||||
this.router.navigate(['/datasets/copy/' + result.datasetId], { queryParams: { newDmpId: newDmpId } });
|
||||
const newDmpId = result.formControl.value.id;
|
||||
let url = this.router.createUrlTree(['/datasets/copy/', result.datasetId, { newDmpId: newDmpId } ])
|
||||
window.open(url.toString(), '_blank')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
</div>
|
||||
<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" (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" (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="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" *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" *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>
|
||||
</div>
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
|||
<button mat-menu-item (click)="viewVersions(activity.groupId, activity.label)">
|
||||
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
|
||||
</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 }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
|
|
@ -123,7 +123,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
</a>
|
||||
<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" (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" [matMenuTriggerFor]="actionsMenu" *ngIf="!publicMode"><span class="material-icons icon-align pl-2">more_horiz</span></a> -->
|
||||
</div>
|
||||
<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}}
|
||||
</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 }}
|
||||
</button>
|
||||
<!-- <button mat-menu-item *ngIf="needsUpdate(activity)" class="menu-item" (click)="openUpdateDatasetProfileDialogue(activity.id);">
|
||||
|
|
|
@ -17,6 +17,8 @@ import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/serv
|
|||
import { ValidationErrorModel } from '@common/forms/validation/error-model/validation-error-model';
|
||||
import { Principal } from '@app/core/model/auth/principal';
|
||||
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({
|
||||
selector: 'app-dataset-listing-item-component',
|
||||
|
@ -32,6 +34,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
|
|||
|
||||
isDraft: boolean;
|
||||
isDeleted: boolean;
|
||||
lockStatus: Boolean;
|
||||
isUserOwner: boolean;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -40,7 +44,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
|
|||
public dialog: MatDialog,
|
||||
private language: TranslateService,
|
||||
private authentication: AuthService,
|
||||
private uiNotificationService: UiNotificationService
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private lockService: LockService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -49,15 +54,35 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
|
|||
if (this.dataset.status === DatasetStatus.Draft) {
|
||||
this.isDraft = true;
|
||||
this.isDeleted = false;
|
||||
this.checkLockStatus(this.dataset.id);
|
||||
this.setIsUserOwner();
|
||||
} else if (this.dataset.status === DatasetStatus.Deleted) {
|
||||
this.isDeleted = true;
|
||||
}
|
||||
else {
|
||||
this.isDraft = 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[] {
|
||||
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)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => this.onCallbackSuccess(),
|
||||
// error => this.onCallbackError(error)
|
||||
complete => this.onDeleteCallbackSuccess(),
|
||||
error => this.onDeleteCallbackError(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']);
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
|
||||
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) {
|
||||
const principal: Principal = this.authentication.current();
|
||||
let role: number;
|
||||
|
@ -203,6 +243,8 @@ export class DatasetListingItemComponent extends BaseComponent implements OnInit
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// onCallbackError(error: any) {
|
||||
// this.setErrorModel(error.error);
|
||||
// }
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<div class="row ">
|
||||
<button class="dmp-btn" (click)="dmpClicked(dataset.dmp.id)">
|
||||
<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 }} -->
|
||||
</div>
|
||||
<mat-icon>launch</mat-icon>
|
||||
|
|
|
@ -138,7 +138,8 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
getDatasetWizardModel(id: string) {
|
||||
this.datasetWizardService.getSingle(id).pipe(takeUntil(this._destroyed))
|
||||
this.datasetWizardService.getSingle(id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.datasetWizardEditorModel = new DatasetWizardEditorModel().fromModel(data);
|
||||
this.datasetWizardModel = data;
|
||||
|
@ -165,7 +166,7 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/datasets', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigate([`/datasets/overview/${this.dataset.id}`]);
|
||||
});
|
||||
}
|
||||
|
@ -263,9 +264,11 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit {
|
|||
|
||||
editClicked(dataset: DatasetOverviewModel) {
|
||||
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 {
|
||||
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 => {
|
||||
if (result && result.datasetProfileExist) {
|
||||
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')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
|
|||
public filteredUsers: DmpInvitationUser[];
|
||||
public emails: string[] = [];
|
||||
public roles = Role;
|
||||
public roleNames: string[];
|
||||
|
||||
visible = true;
|
||||
selectable = true;
|
||||
|
@ -46,7 +45,6 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni
|
|||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
super();
|
||||
this.roleNames = Object.keys(this.roles).filter(key => key.length > 1);
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
<button mat-menu-item (click)="viewVersions(dmp.groupId, dmp.label)">
|
||||
<mat-icon>library_books</mat-icon>{{'DMP-LISTING.ACTIONS.VIEW-VERSION' | translate}}
|
||||
</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 }}
|
||||
</button>
|
||||
</mat-menu>
|
||||
|
|
|
@ -16,6 +16,7 @@ import * as FileSaver from 'file-saver';
|
|||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { UiNotificationService, SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||
import { Role } from '@app/core/common/enum/role';
|
||||
import { LockService } from '@app/core/services/lock/lock.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-listing-item-component',
|
||||
|
@ -32,6 +33,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
isDraft: boolean;
|
||||
isFinalized: boolean;
|
||||
isPublished: boolean;
|
||||
lockStatus: Boolean;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -40,7 +42,8 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
public enumUtils: EnumUtils,
|
||||
private dmpService: DmpService,
|
||||
private language: TranslateService,
|
||||
private uiNotificationService: UiNotificationService) {
|
||||
private uiNotificationService: UiNotificationService,
|
||||
private lockService: LockService) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@ -49,15 +52,22 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
this.isDraft = true;
|
||||
this.isFinalized = false;
|
||||
this.isPublished = false;
|
||||
this.checkLockStatus(this.dmp.id);
|
||||
}
|
||||
else if (this.dmp.status == DmpStatus.Finalized) {
|
||||
this.isDraft = false;
|
||||
this.isFinalized = true;
|
||||
this.isPublished = false;
|
||||
this.checkLockStatus(this.dmp.id);
|
||||
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) {
|
||||
const dialogRef = this.dialog.open(DmpInvitationDialogComponent, {
|
||||
// height: '250px',
|
||||
|
@ -204,7 +214,7 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
this.dmpService.delete(dmp.id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => { this.onCallbackSuccess() },
|
||||
complete => this.onDeleteCallbackSuccess(),
|
||||
error => this.onDeleteCallbackError(error)
|
||||
);
|
||||
}
|
||||
|
@ -215,9 +225,15 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit {
|
|||
return activity.status == DmpStatus.Draft;
|
||||
}
|
||||
|
||||
onCallbackSuccess(): void {
|
||||
this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.SUCCESSFUL-UPDATE'), SnackBarNotificationLevel.Success);
|
||||
this.router.navigate(['/plans']);
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
|
||||
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) {
|
||||
|
|
|
@ -27,8 +27,10 @@
|
|||
{{'DMP-OVERVIEW.PRIVATE' | translate}}
|
||||
</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}}
|
||||
</div>
|
||||
<span>.</span>
|
||||
|
@ -85,24 +87,17 @@
|
|||
</div>
|
||||
<div class="row header">{{'DMP-OVERVIEW.DATASETS-USED' | translate}}</div>
|
||||
<div class="d-flex flex-column">
|
||||
<div *ngFor="let dataset of dmp.datasets; let i=index">
|
||||
<div class="row" *ngIf="i < 3" (click)="datasetClicked(dataset.id)">
|
||||
<div *ngFor="let dataset of dmp.datasets">
|
||||
<div class="row" (click)="datasetClicked(dataset.id)">
|
||||
<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">
|
||||
<div class="dataset-btn-label">{{ dataset.label }}:
|
||||
{{ dataset.datasetTemplate.label }}</div>
|
||||
<div class="dataset-btn-label">{{ dataset.label }}</div>
|
||||
<mat-icon>launch</mat-icon>
|
||||
</div>
|
||||
</button>
|
||||
</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 class="row mt-2 add-dataset-txt">
|
||||
<button class="add-dataset-btn" *ngIf="isDraftDmp(dmp) && isUserOwner"
|
||||
|
|
|
@ -57,7 +57,8 @@
|
|||
|
||||
.add-dataset-btn {
|
||||
border: none;
|
||||
font: Bold 0.875em Open Sans;
|
||||
font: Bold 0.875em Roboto;
|
||||
// font: Bold 0.875em Open Sans;
|
||||
color: #444444;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
@ -215,6 +216,7 @@
|
|||
box-shadow: 0px 1px 5px #00000026;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
min-width: 18.5em;
|
||||
}
|
||||
|
||||
.frame-txt {
|
||||
|
@ -302,7 +304,6 @@
|
|||
::ng-deep .versions-select .mat-form-field-wrapper .mat-form-field-flex {
|
||||
padding: 0 0.5rem 0 0.625rem;
|
||||
margin-bottom: 0.2rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
::ng-deep mat-select .mat-select-arrow-wrapper {
|
||||
|
|
|
@ -161,11 +161,13 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
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) {
|
||||
this.router.navigate(['/plans/clone/' + dmp.id]);
|
||||
let url = this.router.createUrlTree(['/plans/clone/', dmp.id]);
|
||||
window.open(url.toString(), '_blank');
|
||||
}
|
||||
|
||||
grantClicked(grantId: String) {
|
||||
|
@ -534,7 +536,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -604,7 +607,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
reloadPage(): void {
|
||||
this.router.navigateByUrl('/plans', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigateByUrl('/reload', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigate([`/plans/overview/${this.dmp.id}`]);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue