diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/RecentActivityItemLookup.java b/dmp-backend/core/src/main/java/eu/eudat/model/RecentActivityItemLookup.java index ce160b3cf..2b6021737 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/RecentActivityItemLookup.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/RecentActivityItemLookup.java @@ -19,6 +19,8 @@ public class RecentActivityItemLookup{ private String like; private Boolean onlyDraft; + private Boolean onlyDmp; + private Boolean onlyDescription; private List userIds; private Paging page; private BaseFieldSet project; @@ -72,12 +74,30 @@ public class RecentActivityItemLookup{ this.orderField = orderField; } + public Boolean getOnlyDmp() { + return onlyDmp; + } + + public void setOnlyDmp(Boolean onlyDmp) { + this.onlyDmp = onlyDmp; + } + + public Boolean getOnlyDescription() { + return onlyDescription; + } + + public void setOnlyDescription(Boolean onlyDescription) { + this.onlyDescription = onlyDescription; + } public DescriptionLookup asDescriptionLookup() { + if (this.onlyDmp != null) return null; + DescriptionLookup lookup = new DescriptionLookup(); lookup.setIsActive(List.of(IsActive.Active)); if (this.like != null) lookup.setLike(this.like); if (this.onlyDraft != null) lookup.setStatuses(List.of(DescriptionStatus.Draft)); + else lookup.setStatuses(List.of(DescriptionStatus.Draft, DescriptionStatus.Finalized)); if (this.userIds != null) { DmpLookup dmpLookup = new DmpLookup(); DmpUserLookup dmpUserLookup = new DmpUserLookup(); @@ -105,6 +125,8 @@ public class RecentActivityItemLookup{ } public DmpLookup asDmpLookup() { + if (this.onlyDescription != null) return null; + DmpLookup lookup = new DmpLookup(); lookup.setIsActive(List.of(IsActive.Active)); if (this.like != null) lookup.setLike(this.like); diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/dashborad/DashboardServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/dashborad/DashboardServiceImpl.java index d4ba31741..dd699b754 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/dashborad/DashboardServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/dashborad/DashboardServiceImpl.java @@ -68,18 +68,23 @@ public class DashboardServiceImpl implements DashboardService { List recentActivityItemEntities = new ArrayList<>(); DescriptionLookup descriptionLookup = model.asDescriptionLookup(); - descriptionLookup.getPage().setOffset(0); - QueryResult descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(Description._status).ensure(Description._label)); - if (!this.conventionService.isListNullOrEmpty(descriptions.getItems())) { - for (Description description : descriptions.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Description, description.getId(), description.getUpdatedAt(), description.getLabel(), description.getStatus().getValue())); + if (descriptionLookup != null) { + descriptionLookup.getPage().setOffset(0); + QueryResult descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(Description._status).ensure(Description._label)); + if (!this.conventionService.isListNullOrEmpty(descriptions.getItems())) { + for (Description description : descriptions.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Description, description.getId(), description.getUpdatedAt(), description.getLabel(), description.getStatus().getValue())); + } } DmpLookup dmpLookup = model.asDmpLookup(); - dmpLookup.getPage().setOffset(0); - QueryResult dmps = this.elasticQueryHelperService.collect(dmpLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._updatedAt).ensure(Dmp._label).ensure(Dmp._status)); - if (!this.conventionService.isListNullOrEmpty(dmps.getItems())) { - for (Dmp dmp : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Dmp, dmp.getId(), dmp.getUpdatedAt(), dmp.getLabel(), dmp.getStatus().getValue())); + if (dmpLookup != null){ + dmpLookup.getPage().setOffset(0); + QueryResult dmps = this.elasticQueryHelperService.collect(dmpLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._updatedAt).ensure(Dmp._label).ensure(Dmp._status)); + if (!this.conventionService.isListNullOrEmpty(dmps.getItems())) { + for (Dmp dmp : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Dmp, dmp.getId(), dmp.getUpdatedAt(), dmp.getLabel(), dmp.getStatus().getValue())); + } } + Comparator comparator = Comparator.comparing(RecentActivityItemEntity::getUpdatedAt); if (model.getOrderField() != null) { @@ -139,7 +144,7 @@ public class DashboardServiceImpl implements DashboardService { dmpUserLookup.userIds(this.userScope.getUserId()); dmpUserLookup.isActives(IsActive.Active); - DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(DmpVersionStatus.Current); + DmpQuery dmpQuery = this.queryFactory.query(DmpQuery.class).isActive(IsActive.Active).dmpUserSubQuery(dmpUserLookup).versionStatuses(List.of(DmpVersionStatus.Current, DmpVersionStatus.NotFinalized)); DashboardStatistics statistics = new DashboardStatistics(); statistics.setDmpCount(dmpQuery.authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).count()); diff --git a/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts b/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts index fa6e7331f..c232fc147 100644 --- a/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts +++ b/dmp-frontend/src/app/core/query/recent-activity-item-lookup.lookup.ts @@ -4,6 +4,8 @@ import { RecentActivityOrder } from "../common/enum/recent-activity-order"; export class RecentActivityItemLookup implements RecentActivityItemFilter { like: string; onlyDraft: boolean; + onlyDmp: boolean; + onlyDescription: boolean; userIds: string; page: Lookup.Paging; project: Lookup.FieldDirectives; @@ -17,6 +19,8 @@ export class RecentActivityItemLookup implements RecentActivityItemFilter { export interface RecentActivityItemFilter { like: string; onlyDraft: boolean; + onlyDmp: boolean; + onlyDescription: boolean; userIds: string; page: Lookup.Paging; project: Lookup.FieldDirectives; diff --git a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts index f7fc5281b..3ba3583b3 100644 --- a/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/dashboard.component.ts @@ -137,7 +137,6 @@ export class DashboardComponent extends BaseComponent implements OnInit { addNewDescription() { const formGroup = this.fb.group({ dmpId: this.fb.control(null, Validators.required), - sectionId: this.fb.control(null, Validators.required), }) const dialogRef = this.dialog.open(StartNewDescriptionDialogComponent, { @@ -153,7 +152,7 @@ export class DashboardComponent extends BaseComponent implements OnInit { if (result.startNewDmp) { this.openNewDmpDialog(); } else { - this.router.navigate(['/descriptions', 'edit', result.formGroup.get('dmpId').value, result.formGroup.get('sectionId').value]); + this.router.navigate(['/plans', 'edit', result.formGroup.get('dmpId').value]); } } }); diff --git a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html index f32e9a655..c80edb200 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.html @@ -20,17 +20,17 @@ -
- +
+
-
+
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | 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 9c20001a1..fad3eda39 100644 --- a/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts +++ b/dmp-frontend/src/app/ui/dashboard/drafts/drafts.component.ts @@ -33,6 +33,7 @@ export class DraftsComponent extends BaseComponent implements OnInit { lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; + pageLessSize= this.pageSize; listingItems: RecentActivityItem[] = []; public formGroup = new UntypedFormBuilder().group({ @@ -173,6 +174,31 @@ export class DraftsComponent extends BaseComponent implements OnInit { ] }; + this.getItems(); + + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => this.refresh()); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + } + + loadMore() { + this.pageSize = this.pageSize + this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + loadLess() { + this.pageSize = this.pageSize - this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + private getItems(){ + this.listingItems = []; + this.dashboardService .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) @@ -193,32 +219,6 @@ export class DraftsComponent extends BaseComponent implements OnInit { if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item); } }) - //this.totalCount = response.totalCount; - - - //this.totalCountDmps.emit(this.dmpActivities.length); - // if (this.totalCount > 0 && this.totalCount <= (this.page - 1) * this.pageSize && this.page > 1) { - // let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; - // if (this.formGroup.get("like").value) { - // queryParams['keyword'] = this.formGroup.get("like").value; - // } - // this.router.navigate(["/home"], { queryParams: queryParams }) - // } - // this.totalCount < this.pageSize ? this.totalCountDmps.emit(response.totalCount) : this.totalCountDmps.emit(this.pageSize); - // this.totalCountDmps.emit(this.totalCount); - // this.dmpActivities.forEach(dmpActivity => { - // const recentActivity: RecentActivity = { - // activityData: dmpActivity, - // activityType: RecentActivityType.Dmp - // }; - // this.allRecentActivities.push(recentActivity) - // }) }); - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } } 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 3be5c8104..a2d00d6f9 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 @@ -22,17 +22,17 @@
-
- +
+
-
+
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
-
- +
+
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 e3b2e06c3..a669539d9 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 @@ -33,6 +33,7 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; + pageLessSize= this.pageSize; listingItems: RecentActivityItem[]= []; public formGroup = new UntypedFormBuilder().group({ @@ -171,47 +172,8 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn ] }; - this.dashboardService - .getMyRecentActivityItems(this.lookup) - .pipe(takeUntil(this._destroyed)) - .subscribe(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; + this.getItems(); - - //this.totalCountDmps.emit(this.dmpActivities.length); - // if (this.totalCount > 0 && this.totalCount <= (this.page - 1) * this.pageSize && this.page > 1) { - // let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; - // if (this.formGroup.get("like").value) { - // queryParams['keyword'] = this.formGroup.get("like").value; - // } - // this.router.navigate(["/home"], { queryParams: queryParams }) - // } - // this.totalCount < this.pageSize ? this.totalCountDmps.emit(response.totalCount) : this.totalCountDmps.emit(this.pageSize); - // this.totalCountDmps.emit(this.totalCount); - // this.dmpActivities.forEach(dmpActivity => { - // const recentActivity: RecentActivity = { - // activityData: dmpActivity, - // activityType: RecentActivityType.Dmp - // }; - // this.allRecentActivities.push(recentActivity) - // }) - }); this.formGroup.get('like').valueChanges .pipe(takeUntil(this._destroyed), debounceTime(500)) .subscribe(x => this.refresh()); @@ -219,4 +181,42 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn .pipe(takeUntil(this._destroyed)) .subscribe(x => this.refresh()); } + + loadMore() { + this.pageSize = this.pageSize + this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + loadLess() { + this.pageSize = this.pageSize - this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + private getItems(){ + this.listingItems = []; + + this.dashboardService + .getMyRecentActivityItems(this.lookup) + .pipe(takeUntil(this._destroyed)) + .subscribe(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); + } + }) + }); + } } diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html index 2d76656ed..27d97e860 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-description-activity/recent-edited-description-activity.component.html @@ -20,16 +20,16 @@
-
- +
+
-
+
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
-
- +
+
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 4c3b60f81..2899bda5d 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 @@ -29,6 +29,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; + pageLessSize= this.pageSize; listingItems: Description[] = []; @@ -118,6 +119,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl this.formGroup.get('order').setValue(this.order.UpdatedAt); } this.lookup.page = { size: this.pageSize, offset: 0 }; + this.lookup.onlyDescription = true; this.lookup.orderField = this.formGroup.get('order').value; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -145,6 +147,31 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl ] }; + this.getItems(); + + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => this.refresh()); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + } + + loadMore() { + this.pageSize = this.pageSize + this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + loadLess() { + this.pageSize = this.pageSize - this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + getItems(){ + this.listingItems = []; + this.dashboardService .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) @@ -154,32 +181,6 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl if (item.description.status != DescriptionStatus.Canceled) this.listingItems.push(item.description); } }) - // this.totalCount = response.count; - - - //this.totalCountDmps.emit(this.dmpActivities.length); - // if (this.totalCount > 0 && this.totalCount <= (this.page - 1) * this.pageSize && this.page > 1) { - // let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; - // if (this.formGroup.get("like").value) { - // queryParams['keyword'] = this.formGroup.get("like").value; - // } - // this.router.navigate(["/home"], { queryParams: queryParams }) - // } - // this.totalCount < this.pageSize ? this.totalCountDmps.emit(response.totalCount) : this.totalCountDmps.emit(this.pageSize); - // this.totalCountDmps.emit(this.totalCount); - // this.dmpActivities.forEach(dmpActivity => { - // const recentActivity: RecentActivity = { - // activityData: dmpActivity, - // activityType: RecentActivityType.Dmp - // }; - // this.allRecentActivities.push(recentActivity) - // }) }); - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); } } diff --git a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html index ab8396521..1690310d3 100644 --- a/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html +++ b/dmp-frontend/src/app/ui/dashboard/recent-edited-dmp-activity/recent-edited-dmp-activity.component.html @@ -20,8 +20,8 @@
-
- +
+
@@ -98,10 +98,10 @@
--> -
+
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
-
- +
+
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 5f01d4ea7..f48a3c8ac 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 @@ -31,6 +31,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O lookup: RecentActivityItemLookup = new RecentActivityItemLookup(); pageSize: number = 5; + pageLessSize= this.pageSize; @Output() totalCountDmps: EventEmitter = new EventEmitter(); @@ -126,6 +127,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O this.formGroup.get('order').setValue(this.order.UpdatedAt); } this.lookup.page = { size: this.pageSize, offset: 0 }; + this.lookup.onlyDmp = true; this.lookup.orderField = this.formGroup.get('order').value; this.lookup.like = this.formGroup.get('like').value; this.lookup.project = { @@ -153,6 +155,31 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O ] }; + this.getItems(); + + this.formGroup.get('like').valueChanges + .pipe(takeUntil(this._destroyed), debounceTime(500)) + .subscribe(x => this.refresh()); + this.formGroup.get('order').valueChanges + .pipe(takeUntil(this._destroyed)) + .subscribe(x => this.refresh()); + } + + loadMore() { + this.pageSize = this.pageSize + this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + loadLess() { + this.pageSize = this.pageSize - this.pageLessSize; + this.lookup.page = { size: this.pageSize, offset: 0 }; + this.getItems(); + } + + private getItems(){ + this.listingItems = []; + this.dashboardService .getMyRecentActivityItems(this.lookup) .pipe(takeUntil(this._destroyed)) @@ -171,47 +198,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O } }) - //this.totalCount = response.totalCount; - - //this.totalCountDmps.emit(this.dmpActivities.length); - // if (this.totalCount > 0 && this.totalCount <= (this.page - 1) * this.pageSize && this.page > 1) { - // let queryParams = { type: "dmps", page: 1, order: this.formGroup.get("order").value }; - // if (this.formGroup.get("like").value) { - // queryParams['keyword'] = this.formGroup.get("like").value; - // } - // this.router.navigate(["/home"], { queryParams: queryParams }) - // } - // this.totalCount < this.pageSize ? this.totalCountDmps.emit(response.totalCount) : this.totalCountDmps.emit(this.pageSize); - // this.totalCountDmps.emit(this.totalCount); - // this.dmpActivities.forEach(dmpActivity => { - // const recentActivity: RecentActivity = { - // activityData: dmpActivity, - // activityType: RecentActivityType.Dmp - // }; - // this.allRecentActivities.push(recentActivity) - // }) }); - this.formGroup.get('like').valueChanges - .pipe(takeUntil(this._destroyed), debounceTime(500)) - .subscribe(x => this.refresh()); - this.formGroup.get('order').valueChanges - .pipe(takeUntil(this._destroyed)) - .subscribe(x => this.refresh()); - // const datasetDataTableRequest: DataTableRequest = new DataTableRequest(0, 5, { fields: fields }); - // datasetDataTableRequest.criteria = new DatasetCriteria(); - // datasetDataTableRequest.criteria.like = ""; - // this.datasetService - // .getPaged(datasetDataTableRequest) - // .subscribe(response => { - // this.datasetActivities = response.data; - // this.datasetActivities.forEach(datasetActivity => { - // const recentActivity: RecentActivity = { - // activityData: datasetActivity, - // activityType: RecentActivityType.Dataset - // }; - // this.allRecentActivities.push(recentActivity) - // }) - // }); } } diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts index 4b3abd396..272d0ad8e 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.ts @@ -359,7 +359,6 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit addNewDescription() { const formGroup = this.fb.group({ dmpId: this.fb.control(null, Validators.required), - sectionId: this.fb.control(null, Validators.required), }) const dialogRef = this.dialog.open(StartNewDescriptionDialogComponent, { @@ -375,7 +374,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit if (result.startNewDmp) { this.openNewDmpDialog(); } else { - this.router.navigate(['/descriptions', 'edit', result.formGroup.get('dmpId').value, result.formGroup.get('sectionId').value]); + this.router.navigate(['/plans', 'edit', result.formGroup.get('dmpId').value]); } } }); diff --git a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html index 4849b6993..aa54cbf4f 100644 --- a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html +++ b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.html @@ -13,14 +13,6 @@
-
- - {{'START-NEW-DESCRIPTION-DIALOG.DMP-SECTION' | translate}} - - {{section.label}} - - -
diff --git a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts index c96045d26..20664f317 100644 --- a/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts +++ b/dmp-frontend/src/app/ui/description/start-new-description-dialog/start-new-description-dialog.component.ts @@ -33,7 +33,7 @@ export class StartNewDescriptionDialogComponent extends BaseComponent { getSelectedItem: (selectedItem: any) => this.dmpService.query(this.buildAutocompleteLookup(null, null, [selectedItem])).pipe(map(x => x.items[0])), displayFn: (item: Dmp) => item.label, titleFn: (item: Dmp) => item.label, - valueAssign: (item: Dmp) => this.findSection(item), + valueAssign: (item: Dmp) => item.id, }; private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[], statuses?: DmpStatus[], dmpDescriptionTemplateSubQuery?: DmpDescriptionTemplateLookup): DmpLookup { @@ -48,11 +48,6 @@ export class StartNewDescriptionDialogComponent extends BaseComponent { nameof(x => x.id), nameof(x => x.label), nameof(x => x.createdAt), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.ordinal)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.hasTemplates)].join('.'), - [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.descriptionTemplates), nameof(x => x.descriptionTemplateGroupId)].join('.'), ] }; if (dmpDescriptionTemplateSubQuery != null) lookup.dmpDescriptionTemplateSubQuery = dmpDescriptionTemplateSubQuery; @@ -94,17 +89,6 @@ export class StartNewDescriptionDialogComponent extends BaseComponent { this.dialogRef.close(this.data); } - findSection(dmp: Dmp){ - this.sections = dmp.blueprint.definition.sections.filter(x => x.hasTemplates == true); - if(this.sections.length == 1){ - this.formGroup.get('sectionId').setValue(this.sections[0].id); - }else { - this.formGroup.get('sectionId').setValue(null); - } - - return dmp.id - } - getDatasetDisplay(item: any): string { // if (!this.isPublic) { // return (item['status'] ? this.language.instant('TYPES.DATASET-STATUS.FINALISED').toUpperCase() : this.language.instant('TYPES.DATASET-STATUS.DRAFT').toUpperCase()) + ': ' + item['label'];