From 9494e5b61891df06a76fa1060cf3d137a2f4de30 Mon Sep 17 00:00:00 2001 From: gpapavgeri Date: Wed, 22 Jul 2020 11:23:20 +0300 Subject: [PATCH] Home-myDmps-myDatasetDescriptions buttons updated according to dmp&dataset overview --- .../recent-activity/recent-activity.model.ts | 2 +- .../recent-edited-activity.component.html | 8 +-- .../recent-edited-activity.component.ts | 3 +- ...ent-edited-dataset-activity.component.html | 6 +-- ...ecent-edited-dataset-activity.component.ts | 11 +++- .../recent-edited-dmp-activity.component.html | 8 +-- .../recent-edited-dmp-activity.component.ts | 3 +- .../dataset-listing-item.component.html | 6 +-- .../dataset-listing-item.component.ts | 54 ++++++++++++++++--- .../dmp-invitation-dialog.component.ts | 2 - .../dmp-listing-item.component.html | 3 +- .../dmp-listing-item.component.ts | 26 +++++++-- 12 files changed, 99 insertions(+), 33 deletions(-) diff --git a/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts b/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts index 7bf5eecdb..871211661 100644 --- a/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts +++ b/dmp-frontend/src/app/core/model/recent-activity/recent-activity.model.ts @@ -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; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html index 2245e95ac..0d6b6c1a0 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.html @@ -51,9 +51,9 @@
open_in_new{{'DMP-LISTING.ACTIONS.EXPORT' | translate}} - add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} - group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} - filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} + add{{'DMP-LISTING.ACTIONS.ADD-DATASET-SHORT' | translate}} + group_add{{'DMP-LISTING.ACTIONS.INVITE-SHORT' | translate}} + filter_none{{'DMP-LISTING.ACTIONS.CLONE' | translate}} more_horiz
@@ -82,7 +82,7 @@ - diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts index 0a0b78a12..56ac02dd2 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-activity/recent-edited-activity.component.ts @@ -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) { diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html index 0e9e23882..820227c41 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dataset-activity/recent-edited-dataset-activity.component.html @@ -46,15 +46,15 @@
open_in_new{{'DATASET-LISTING.ACTIONS.EXPORT' | translate}} - group_add{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}} + group_add{{'DATASET-LISTING.ACTIONS.INVITE-COLLABORATORS' | translate}} more_horiz
- - - - + diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts index 940dc2ff5..bca7cedb5 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts @@ -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) {