diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html index ff6346b73..e982c10a9 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.html +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.html @@ -148,10 +148,10 @@
{{'DASHBOARD.PUBLIC-USAGE' | translate}}
{{dashboardStatistics?.dmpCount}}
- {{'DASHBOARD.PUBLIC-DMPS' | translate}} + {{'DASHBOARD.PUBLIC-DMPS' | translate}}
{{dashboardStatistics?.descriptionCount}}
- {{'DASHBOARD.PUBLIC-DESCRIPTIONS' | translate}} + {{'DASHBOARD.PUBLIC-DESCRIPTIONS' | translate}}
{{grantCount}}
{{'DASHBOARD.GRANTS' | translate}} diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts index 2921e7676..9c20001a1 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -20,6 +20,9 @@ import { debounceTime, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { AuthService } from '../../../core/services/auth/auth.service'; import { ReferenceType } from '@app/core/model/reference-type/reference-type'; +import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { DescriptionStatus } from '@app/core/common/enum/description-status'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; @Component({ selector: 'app-drafts', @@ -30,7 +33,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; - listingItems: RecentActivityItem[]; + listingItems: RecentActivityItem[] = []; public formGroup = new UntypedFormBuilder().group({ like: new UntypedFormControl(), @@ -131,8 +134,11 @@ export class DraftsComponent extends BaseComponent implements OnInit { [nameof(x => x.dmp), nameof(x => x.version)].join('.'), [nameof(x => x.dmp), nameof(x => x.groupId)].join('.'), [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), + [nameof(x => x.dmp), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), @@ -147,6 +153,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { [nameof(x => x.description), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.status)].join('.'), [nameof(x => x.description), nameof(x => x.updatedAt)].join('.'), + [nameof(x => x.description), nameof(x => x.isActive)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), @@ -170,7 +177,22 @@ export class DraftsComponent extends BaseComponent implements OnInit { .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) .subscribe(response => { - this.listingItems = response; + response.forEach(item => { + if (item.dmp){ + if (item.dmp.descriptions) { + if (item.dmp.status == DmpStatus.Finalized) { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); + } else { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); + } + } + item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x=> x.isActive === IsActive.Active); + this.listingItems.push(item); + } + if (item.description){ + if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); + } + }) //this.totalCount = response.totalCount; 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 4ff40a54d..e3b2e06c3 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 @@ -2,6 +2,9 @@ import { Location } from '@angular/common'; import { Component, Input, OnInit } from '@angular/core'; import { UntypedFormBuilder, UntypedFormControl } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; +import { DescriptionStatus } from '@app/core/common/enum/description-status'; +import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; import { DescriptionTemplate } from '@app/core/model/description-template/description-template'; @@ -30,7 +33,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; - listingItems: RecentActivityItem[]; + listingItems: RecentActivityItem[]= []; public formGroup = new UntypedFormBuilder().group({ like: new UntypedFormControl(), @@ -130,8 +133,11 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn [nameof(x => x.dmp), nameof(x => x.version)].join('.'), [nameof(x => x.dmp), nameof(x => x.groupId)].join('.'), [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), + [nameof(x => x.dmp), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), @@ -146,6 +152,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn [nameof(x => x.description), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.status)].join('.'), [nameof(x => x.description), nameof(x => x.updatedAt)].join('.'), + [nameof(x => x.description), nameof(x => x.isActive)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.id)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), [nameof(x => x.description), nameof(x => x.descriptionTemplate), nameof(x => x.groupId)].join('.'), @@ -168,7 +175,22 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) .subscribe(response => { - this.listingItems = response; + response.forEach(item => { + if (item.dmp){ + if (item.dmp.descriptions) { + if (item.dmp.status == DmpStatus.Finalized) { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); + } else { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); + } + } + item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x=> x.isActive === IsActive.Active); + this.listingItems.push(item); + } + if (item.description){ + if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); + } + }) //this.totalCount = response.totalCount; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts index 6f416d7a2..4c3b60f81 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.ts @@ -18,6 +18,7 @@ import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { BaseComponent } from '@common/base/base.component'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; +import { DescriptionStatus } from '@app/core/common/enum/description-status'; @Component({ selector: 'app-recent-edited-description-activity', @@ -28,7 +29,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; - listingItems: Description[]; + listingItems: Description[] = []; public formGroup = new UntypedFormBuilder().group({ @@ -148,7 +149,11 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) .subscribe(response => { - this.listingItems = response.map(x => x.description); + response.forEach(item => { + if (item.description){ + if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item.description); + } + }) // this.totalCount = response.count; diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts index 7d597f836..5f01d4ea7 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.ts @@ -2,6 +2,9 @@ import { Location } from '@angular/common'; import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; +import { DescriptionStatus } from '@app/core/common/enum/description-status'; +import { DmpStatus } from '@app/core/common/enum/dmp-status'; +import { IsActive } from '@app/core/common/enum/is-active.enum'; import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order'; import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item'; import { Description } from '@app/core/model/description/description'; @@ -33,13 +36,12 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O @ViewChild("dmps") resultsContainer; - listingItems: Dmp[]; + listingItems: Dmp[]= []; isDraft: boolean; totalCount: number; startIndex: number = 0; offsetLess: number = 0; - hasMoreResults: boolean = true; dmpFormGroup: UntypedFormGroup; public formGroup = new UntypedFormBuilder().group({ like: new UntypedFormControl(), @@ -137,6 +139,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O [nameof(x => x.dmp), nameof(x => x.updatedAt)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.label)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.status)].join('.'), + [nameof(x => x.dmp), nameof(x => x.descriptions), nameof(x => x.isActive)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.user.id)].join('.'), [nameof(x => x.dmp), nameof(x => x.dmpUsers), nameof(x => x.role)].join('.'), @@ -153,7 +157,20 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) .subscribe(response => { - this.listingItems = response.map(x => x.dmp); + response.forEach(item => { + if (item.dmp){ + item.dmp.dmpUsers = item.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); + if (item.dmp.descriptions) { + if (item.dmp.status == DmpStatus.Finalized) { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized); + } else { + item.dmp.descriptions = item.dmp.descriptions.filter(x => x.isActive === IsActive.Active && x.status != DescriptionStatus.Canceled); + } + } + this.listingItems.push(item.dmp); + } + + }) //this.totalCount = response.totalCount;