remove section selection from add description pop up and fix dashboard home page sizes

This commit is contained in:
amentis 2024-03-22 09:41:35 +02:00
parent 76e251c14d
commit 4e61353f77
15 changed files with 183 additions and 190 deletions

View File

@ -19,6 +19,8 @@ public class RecentActivityItemLookup{
private String like;
private Boolean onlyDraft;
private Boolean onlyDmp;
private Boolean onlyDescription;
private List<UUID> 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);

View File

@ -68,18 +68,23 @@ public class DashboardServiceImpl implements DashboardService {
List<RecentActivityItemEntity> recentActivityItemEntities = new ArrayList<>();
DescriptionLookup descriptionLookup = model.asDescriptionLookup();
if (descriptionLookup != null) {
descriptionLookup.getPage().setOffset(0);
QueryResult<Description> 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();
if (dmpLookup != null){
dmpLookup.getPage().setOffset(0);
QueryResult<Dmp> 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<RecentActivityItemEntity> 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());

View File

@ -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;

View File

@ -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]);
}
}
});

View File

@ -20,17 +20,17 @@
</mat-form-field>
<!-- End of Search Filter -->
</div>
<div *ngIf="listingItems && listingItems.length > 0 && page > 1" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && pageSize > pageLessSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadLess()">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-dmp-listing-item-component *ngIf="item.dmp" [showDivider]="i != (listingItems.length - 1)" [dmp]="item.dmp" [isPublic]="isPublic"></app-dmp-listing-item-component>
<app-description-listing-item-component *ngIf="item.description" [showDivider]="i != (listingItems.length - 1)" [description]="item.description" [isPublic]="isPublic" ></app-description-listing-item-component>
</div>
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="!hasMoreActivity && listingItems && listingItems.length > 0">
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="listingItems && listingItems.length > 0 && listingItems.length < pageSize">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
</div>
<div *ngIf="listingItems && listingItems.length > 0 && (listingItems.length >= startIndex + pageSize) && hasMoreActivity" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && (listingItems.length >= startIndex + pageSize)" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>

View File

@ -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());
}
}

View File

@ -22,17 +22,17 @@
</mat-form-field>
<!-- End of Search Filter -->
</div>
<div *ngIf="allRecentActivities && allRecentActivities.length > 0 && page > 1" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && pageSize > pageLessSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadLess()">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-dmp-listing-item-component *ngIf="item.dmp" [showDivider]="i != (listingItems.length - 1)" [dmp]="item.dmp" [isPublic]="isPublic"></app-dmp-listing-item-component>
<app-description-listing-item-component *ngIf="item.description" [showDivider]="i != (listingItems.length - 1)" [description]="item.description" [isPublic]="isPublic" ></app-description-listing-item-component>
</div>
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="!hasMoreActivity && allRecentActivities && allRecentActivities.length > 0">
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="listingItems && listingItems.length > 0 && listingItems.length < pageSize">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
</div>
<div *ngIf="allRecentActivities && allRecentActivities.length > 0 && (allRecentActivities.length >= startIndex + pageSize) && hasMoreActivity" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= startIndex + pageSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>

View File

@ -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,6 +172,31 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
]
};
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))
@ -191,32 +217,6 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
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());
}
}

View File

@ -20,16 +20,16 @@
</mat-form-field>
<!-- End of Search Filter -->
</div>
<div *ngIf="listingItems && listingItems.length > 0 && page > 1" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && pageSize > pageLessSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadLess()">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-description-listing-item-component *ngIf="item" [showDivider]="i != (listingItems.length - 1)" [description]="item" [isPublic]="isPublic" ></app-description-listing-item-component>
</div>
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="!hasMoreResults && listingItems && listingItems.length > 0">
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="listingItems && listingItems.length > 0 && listingItems.length < pageSize">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
</div>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= pageSize && hasMoreResults" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= pageSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>

View File

@ -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());
}
}

View File

@ -20,8 +20,8 @@
</mat-form-field>
<!-- End of Search Filter -->
</div>
<div *ngIf="listingItems && listingItems.length > 0 && page > 1" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && pageSize > pageLessSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadLess()">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button> <button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-dmp-listing-item-component *ngIf="item" [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
@ -98,10 +98,10 @@
</mat-menu>
</div>
</div> -->
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="!hasMoreResults && listingItems && listingItems.length > 0">
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="listingItems && listingItems.length > 0 && listingItems.length < pageSize">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}
</div>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= pageSize && hasMoreResults" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
<div *ngIf="listingItems && listingItems.length > 0 && listingItems.length >= pageSize" class="d-flex justify-content-center">
<button type="button" class="btn-load-more" (click)="loadMore()">{{'GENERAL.ACTIONS.LOAD-MORE' | translate}}</button>
</div>
</div>

View File

@ -31,6 +31,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
lookup: RecentActivityItemLookup = new RecentActivityItemLookup();
pageSize: number = 5;
pageLessSize= this.pageSize;
@Output() totalCountDmps: EventEmitter<any> = 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<DatasetCriteria> = 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)
// })
// });
}
}

View File

@ -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]);
}
}
});

View File

@ -13,14 +13,6 @@
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmpId')" placeholder="{{'START-NEW-DESCRIPTION-DIALOG.SELECT-DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"></app-single-auto-complete>
</mat-form-field>
</div>
<div *ngIf="this.sections.length > 1">
<mat-form-field>
<mat-label>{{'START-NEW-DESCRIPTION-DIALOG.DMP-SECTION' | translate}}</mat-label>
<mat-select [formControl]="formGroup.get('sectionId')">
<mat-option *ngFor="let section of sections" [value]="section.id">{{section.label}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div class="row mt-2">
<div class="col-auto pb-4">

View File

@ -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<Dmp>(x => x.id),
nameof<Dmp>(x => x.label),
nameof<Dmp>(x => x.createdAt),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.ordinal)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.descriptionTemplates), nameof<DescriptionTemplatesInSection>(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'];