|
|
@ -1,21 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
|
|
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
|
|
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { MatPaginator } from '@angular/material/paginator';
|
|
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
|
import { MatSort } from '@angular/material/sort';
|
|
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
|
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
|
|
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
|
|
|
|
|
|
|
import { DmpStatus } from '@app/core/common/enum/dmp-status';
|
|
|
|
|
|
|
|
import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
|
|
|
|
|
|
|
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
|
|
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
|
|
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
|
|
|
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
|
|
|
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
|
|
|
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
|
|
|
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
|
|
|
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
|
|
|
import { Description } from '@app/core/model/description/description';
|
|
|
|
import { Description } from '@app/core/model/description/description';
|
|
|
|
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
|
|
|
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
|
|
|
import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
|
|
|
|
import { BaseDmp, Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
|
|
|
|
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
|
|
|
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
|
|
|
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
|
|
|
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
|
|
|
|
import { Reference } from '@app/core/model/reference/reference';
|
|
|
|
import { Reference } from '@app/core/model/reference/reference';
|
|
|
@ -26,31 +21,37 @@ import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
|
|
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
|
|
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
|
|
|
import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants';
|
|
|
|
import { GuidedTour, Orientation } from '@app/library/guided-tour/guided-tour.constants';
|
|
|
|
import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service';
|
|
|
|
import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service';
|
|
|
|
import { BaseComponent } from '@common/base/base.component';
|
|
|
|
|
|
|
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
|
|
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
|
|
|
import { SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
|
|
|
|
import { PageLoadEvent, SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
|
|
|
|
import { Guid } from '@common/types/guid';
|
|
|
|
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
|
|
import { NgDialogAnimationService } from "ng-dialog-animation";
|
|
|
|
import { NgDialogAnimationService } from "ng-dialog-animation";
|
|
|
|
import { debounceTime, takeUntil } from 'rxjs/operators';
|
|
|
|
import { debounceTime, takeUntil, tap } from 'rxjs/operators';
|
|
|
|
import { nameof } from 'ts-simple-nameof';
|
|
|
|
import { nameof } from 'ts-simple-nameof';
|
|
|
|
import { DmpFilterDialogComponent } from './filtering/dmp-filter-dialog/dmp-filter-dialog.component';
|
|
|
|
import { DmpFilterDialogComponent } from './filtering/dmp-filter-dialog/dmp-filter-dialog.component';
|
|
|
|
|
|
|
|
import { BaseListingComponent } from '@common/base/base-listing-component';
|
|
|
|
|
|
|
|
import { QueryResult } from '@common/model/query-result';
|
|
|
|
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
|
|
|
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
|
|
|
|
|
|
|
import { QueryParamsService } from '@app/core/services/utilities/query-params.service';
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
@Component({
|
|
|
|
selector: 'app-dmp-listing-component',
|
|
|
|
selector: 'app-dmp-listing-component',
|
|
|
|
templateUrl: 'dmp-listing.component.html',
|
|
|
|
templateUrl: 'dmp-listing.component.html',
|
|
|
|
styleUrls: ['./dmp-listing.component.scss'],
|
|
|
|
styleUrls: ['./dmp-listing.component.scss'],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup> implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userSettingsKey = { key: 'DmpListingUserSettings' };
|
|
|
|
|
|
|
|
|
|
|
|
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
|
|
|
@ViewChild(MatPaginator, { static: true }) _paginator: MatPaginator;
|
|
|
|
@ViewChild(MatSort) sort: MatSort;
|
|
|
|
@ViewChild(MatSort) sort: MatSort;
|
|
|
|
lookup: DmpLookup = new DmpLookup();
|
|
|
|
lookup: DmpLookup;
|
|
|
|
groupId: string;
|
|
|
|
groupId: string;
|
|
|
|
totalCount: number;
|
|
|
|
totalCount: number;
|
|
|
|
listingItems: any[] = [];
|
|
|
|
listingItems: any[] = [];
|
|
|
|
isPublic: boolean = false;
|
|
|
|
isPublic: boolean = false;
|
|
|
|
hasListingItems = null;
|
|
|
|
hasListingItems = null;
|
|
|
|
|
|
|
|
protected ITEMS_PER_PAGE = 5;
|
|
|
|
pageSize: number = 5;
|
|
|
|
pageSize: number = 5;
|
|
|
|
public formGroup = new UntypedFormBuilder().group({
|
|
|
|
public formGroup = new UntypedFormBuilder().group({
|
|
|
|
like: new UntypedFormControl(),
|
|
|
|
like: new UntypedFormControl(),
|
|
|
@ -78,63 +79,59 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
|
|
|
|
|
protected router: Router,
|
|
|
|
|
|
|
|
protected route: ActivatedRoute,
|
|
|
|
|
|
|
|
protected uiNotificationService: UiNotificationService,
|
|
|
|
|
|
|
|
protected httpErrorHandlingService: HttpErrorHandlingService,
|
|
|
|
|
|
|
|
protected queryParamsService: QueryParamsService,
|
|
|
|
private dmpService: DmpService,
|
|
|
|
private dmpService: DmpService,
|
|
|
|
private router: Router,
|
|
|
|
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
|
|
|
|
public dialogAnimation: NgDialogAnimationService,
|
|
|
|
public dialogAnimation: NgDialogAnimationService,
|
|
|
|
public dialog: MatDialog,
|
|
|
|
public dialog: MatDialog,
|
|
|
|
public enumUtils: EnumUtils,
|
|
|
|
public enumUtils: EnumUtils,
|
|
|
|
private language: TranslateService,
|
|
|
|
private language: TranslateService,
|
|
|
|
private httpErrorHandlingService: HttpErrorHandlingService,
|
|
|
|
|
|
|
|
private authService: AuthService,
|
|
|
|
private authService: AuthService,
|
|
|
|
private guidedTourService: GuidedTourService,
|
|
|
|
private guidedTourService: GuidedTourService,
|
|
|
|
private httpClient: HttpClient,
|
|
|
|
|
|
|
|
private analyticsService: AnalyticsService,
|
|
|
|
private analyticsService: AnalyticsService,
|
|
|
|
|
|
|
|
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
super();
|
|
|
|
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
ngOnInit() {
|
|
|
|
this.analyticsService.trackPageView(AnalyticsService.DmpListing);
|
|
|
|
this.analyticsService.trackPageView(AnalyticsService.DmpListing);
|
|
|
|
|
|
|
|
|
|
|
|
this.isPublic = this.route.snapshot.data['isPublic'] ?? false;
|
|
|
|
this.isPublic = this.route.snapshot.data['isPublic'] ?? false;
|
|
|
|
if (this.isPublic) {
|
|
|
|
|
|
|
|
//TODO refactor
|
|
|
|
|
|
|
|
// this.formGroup.get('order').setValue(this.order.PUBLISHED);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.formGroup.get('order').setValue(this.order.UpdatedAt);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.isPublic && !this.authService.currentAccountIsAuthenticated()) {
|
|
|
|
if (!this.isPublic && !this.authService.currentAccountIsAuthenticated()) {
|
|
|
|
this.router.navigateByUrl("/explore-plans");
|
|
|
|
this.router.navigateByUrl("/explore-plans");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.route.params
|
|
|
|
|
|
|
|
|
|
|
|
this.route.queryParamMap
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
.subscribe(async params => {
|
|
|
|
.subscribe(async (params: Params) => {
|
|
|
|
|
|
|
|
const queryParams = this.route.snapshot.queryParams;
|
|
|
|
|
|
|
|
|
|
|
|
this.groupId = params['groupId'];
|
|
|
|
if (!this.lookup) this.lookup = queryParams['lookup'] ? this._parseLookupFromParams(queryParams) : this.initializeLookup();
|
|
|
|
|
|
|
|
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
if ((this.formGroup.get('order')?.value == null || (!this.isAscending && !this.isDescending)) && this.lookup.order.items && this.lookup.order.items.length > 0) {
|
|
|
|
this.lookup.order = { items: ['-' + nameof<Dmp>(x => x.updatedAt)] };
|
|
|
|
|
|
|
|
this.lookup.metadata = { countAll: true };
|
|
|
|
|
|
|
|
this.lookup.isActive = [IsActive.Active];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.groupId != null && Guid.isGuid(this.groupId)) {
|
|
|
|
let ordering = this.lookup.order.items[0];
|
|
|
|
this.lookup.groupIds = [Guid.parse(this.groupId)];
|
|
|
|
let sortBy = ordering.substring(1, ordering.length);
|
|
|
|
this.lookup.versionStatuses = null;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.formGroup.get('order').setValue(this._getRecentActivityOrder(sortBy));
|
|
|
|
this.lookup.versionStatuses = [DmpVersionStatus.Current, DmpVersionStatus.NotFinalized];
|
|
|
|
ordering.charAt(0) == '-' ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
this.onPageLoad({ offset: this.lookup.page.offset / this.lookup.page.size } as PageLoadEvent);
|
|
|
|
|
|
|
|
// this.groupId = params['groupId'];
|
|
|
|
|
|
|
|
// if (this.groupId != null && Guid.isGuid(this.groupId)) {
|
|
|
|
|
|
|
|
// this.lookup.groupIds = [Guid.parse(this.groupId)];
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// this.refresh(this.lookup);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.formGroup.get('like').valueChanges
|
|
|
|
this.formGroup.get('like').valueChanges
|
|
|
|
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
|
|
|
.pipe(takeUntil(this._destroyed), debounceTime(500))
|
|
|
|
.subscribe(x => this.controlModified());
|
|
|
|
.subscribe(x => this.controlModified());
|
|
|
|
this.formGroup.get('order').valueChanges
|
|
|
|
|
|
|
|
.pipe(takeUntil(this._destroyed))
|
|
|
|
|
|
|
|
.subscribe(x => this.refresh(this.lookup));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public dashboardTour: GuidedTour = {
|
|
|
|
public dashboardTour: GuidedTour = {
|
|
|
@ -165,6 +162,48 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
this.scrollbar = this.hasScrollbar();
|
|
|
|
this.scrollbar = this.hasScrollbar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected loadListing(): Observable<QueryResult<BaseDmp>> {
|
|
|
|
|
|
|
|
if (this.isPublic) {
|
|
|
|
|
|
|
|
return this.dmpService.publicQuery(this.lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
|
|
|
|
.pipe(tap(result => {
|
|
|
|
|
|
|
|
if (!result) { return []; }
|
|
|
|
|
|
|
|
this.totalCount = result.count;
|
|
|
|
|
|
|
|
if (this.lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
|
|
|
|
this.listingItems.push(...result.items);
|
|
|
|
|
|
|
|
this.hasListingItems = true;
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return this.dmpService.query(this.lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
|
|
|
|
.pipe(tap(result => {
|
|
|
|
|
|
|
|
if (!result) { return []; }
|
|
|
|
|
|
|
|
this.totalCount = result.count;
|
|
|
|
|
|
|
|
if (this.lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
|
|
|
|
this.listingItems.push(...result.items);
|
|
|
|
|
|
|
|
this.hasListingItems = true;
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected initializeLookup(): DmpLookup {
|
|
|
|
|
|
|
|
const lookup = new DmpLookup();
|
|
|
|
|
|
|
|
lookup.metadata = { countAll: true };
|
|
|
|
|
|
|
|
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
|
|
|
|
|
|
|
|
lookup.isActive = [IsActive.Active];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let recentActivityOrder = this.isPublic ? this.toAscSortField(nameof<Description>(x => x.label)) : this.toDescSortField(nameof<Description>(x => x.updatedAt));
|
|
|
|
|
|
|
|
lookup.order = { items: [recentActivityOrder] };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.updateOrderUiFields(lookup.order);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lookup.project = {
|
|
|
|
|
|
|
|
fields: this._lookupFields
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return lookup;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected setupColumns() { }
|
|
|
|
|
|
|
|
|
|
|
|
openTour() {
|
|
|
|
openTour() {
|
|
|
|
this.language.get('DMP-LISTING.TEXT-INFO').pipe(takeUntil(this._destroyed)).subscribe((x: string) => {
|
|
|
|
this.language.get('DMP-LISTING.TEXT-INFO').pipe(takeUntil(this._destroyed)).subscribe((x: string) => {
|
|
|
|
this.dashboardTour.steps[0].title = x + '\n\n' +
|
|
|
|
this.dashboardTour.steps[0].title = x + '\n\n' +
|
|
|
@ -182,7 +221,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
loadMore() {
|
|
|
|
loadMore() {
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: this.lookup.page.offset + this.pageSize };
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: this.lookup.page.offset + this.pageSize };
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
|
|
|
|
|
|
|
|
this.filterChanged(this.lookup, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
orderByChanged() {
|
|
|
|
orderByChanged() {
|
|
|
@ -193,105 +233,48 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
|
|
|
|
this.lookup.order = { items: [this.sortingDirectionPrefix + nameof<Dmp>(x => x.updatedAt)] };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
this.filterChanged(this.lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private refresh(lookup: DmpLookup) {
|
|
|
|
// private refresh(lookup: DmpLookup) {
|
|
|
|
lookup.project = {
|
|
|
|
// if (this.isPublic) {
|
|
|
|
fields: [
|
|
|
|
// this.dmpService.publicQuery(lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
nameof<Dmp>(x => x.id),
|
|
|
|
// .subscribe(result => {
|
|
|
|
nameof<Dmp>(x => x.label),
|
|
|
|
// if (!result) { return []; }
|
|
|
|
nameof<Dmp>(x => x.description),
|
|
|
|
// this.totalCount = result.count;
|
|
|
|
nameof<Dmp>(x => x.status),
|
|
|
|
// if (lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
nameof<Dmp>(x => x.accessType),
|
|
|
|
// this.listingItems.push(...result.items);
|
|
|
|
nameof<Dmp>(x => x.version),
|
|
|
|
// this.hasListingItems = true;
|
|
|
|
nameof<Dmp>(x => x.versionStatus),
|
|
|
|
// },
|
|
|
|
nameof<Dmp>(x => x.groupId),
|
|
|
|
// error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
|
|
|
nameof<Dmp>(x => x.updatedAt),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.belongsToCurrentTenant),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.finalizedAt),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.hash),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.EditDmp].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.id)].join('.'),
|
|
|
|
// } else {
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.label)].join('.'),
|
|
|
|
// this.dmpService.query(lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.status)].join('.'),
|
|
|
|
// .subscribe(result => {
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.groupId)].join('.'),
|
|
|
|
// if (!result) { return []; }
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
|
|
|
// this.totalCount = result.count;
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.isActive)].join('.'),
|
|
|
|
// if (lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
|
|
|
|
// result.items.forEach(x => {
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
|
|
|
|
// if (x.descriptions) {
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.label)].join('.'),
|
|
|
|
// if (x.status == DmpStatus.Finalized) {
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.id)].join('.'),
|
|
|
|
// x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized);
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.label)].join('.'),
|
|
|
|
// } else {
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.definition), nameof<DmpBlueprintDefinition>(x => x.sections), nameof<DmpBlueprintDefinitionSection>(x => x.hasTemplates)].join('.'),
|
|
|
|
// x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
|
|
|
|
[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('.'),
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
|
|
|
|
// x.dmpUsers = x.dmpUsers.filter(x => x.isActive === IsActive.Active);
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
|
|
|
|
// this.listingItems.push(x);
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
|
|
|
|
// })
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.dmp.id)].join('.'),
|
|
|
|
// this.hasListingItems = true;
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
|
|
|
|
// },
|
|
|
|
|
|
|
|
// error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
|
|
|
|
// }
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
|
|
|
// }
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.isPublic) {
|
|
|
|
|
|
|
|
this.dmpService.publicQuery(lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
|
|
|
|
.subscribe(result => {
|
|
|
|
|
|
|
|
if (!result) { return []; }
|
|
|
|
|
|
|
|
this.totalCount = result.count;
|
|
|
|
|
|
|
|
if (lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
|
|
|
|
this.listingItems.push(...result.items);
|
|
|
|
|
|
|
|
this.hasListingItems = true;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.dmpService.query(lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
|
|
|
|
.subscribe(result => {
|
|
|
|
|
|
|
|
if (!result) { return []; }
|
|
|
|
|
|
|
|
this.totalCount = result.count;
|
|
|
|
|
|
|
|
if (lookup?.page?.offset === 0) this.listingItems = [];
|
|
|
|
|
|
|
|
result.items.forEach(x => {
|
|
|
|
|
|
|
|
if (x.descriptions) {
|
|
|
|
|
|
|
|
if (x.status == DmpStatus.Finalized) {
|
|
|
|
|
|
|
|
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status === DescriptionStatus.Finalized);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
x.descriptions = x.descriptions.filter(x => x.isActive === IsActive.Active && x.status !== DescriptionStatus.Canceled);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
x.dmpUsers = x.dmpUsers.filter(x => x.isActive === IsActive.Active);
|
|
|
|
|
|
|
|
this.listingItems.push(x);
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
this.hasListingItems = true;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
error => this.httpErrorHandlingService.handleBackedRequestError(error));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controlModified(): void {
|
|
|
|
controlModified(): void {
|
|
|
|
this.lookup.like = this.formGroup.get("like").value;
|
|
|
|
this.lookup.like = this.formGroup.get("like").value;
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
this.filterChanged(this.lookup, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -319,9 +302,6 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
updateDataFn(filterForm: UntypedFormGroup): void {
|
|
|
|
updateDataFn(filterForm: UntypedFormGroup): void {
|
|
|
|
let testLookup = this.lookup;
|
|
|
|
let testLookup = this.lookup;
|
|
|
|
testLookup.from(filterForm);
|
|
|
|
testLookup.from(filterForm);
|
|
|
|
// console.log('testLookup: ', testLookup);
|
|
|
|
|
|
|
|
// this.lookup.from(filterForm);
|
|
|
|
|
|
|
|
// this.refresh(this.lookup);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hasScrollbar(): boolean {
|
|
|
|
hasScrollbar(): boolean {
|
|
|
@ -349,7 +329,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
this.guidedTourService.startTour(this.dashboardTour);
|
|
|
|
this.guidedTourService.startTour(this.dashboardTour);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public hasLikeCriteria(): boolean {
|
|
|
|
hasLikeFilters(): boolean {
|
|
|
|
return this.lookup.like !== undefined && this.lookup.like !== null;
|
|
|
|
return this.lookup.like !== undefined && this.lookup.like !== null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -357,4 +337,82 @@ export class DmpListingComponent extends BaseComponent implements OnInit {
|
|
|
|
this.sortDirection = this.isAscending ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
this.sortDirection = this.isAscending ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
this.orderByChanged();
|
|
|
|
this.orderByChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private _parseLookupFromParams(params: Params): DmpLookup {
|
|
|
|
|
|
|
|
let lookup: DmpLookup = JSON.parse(params['lookup']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!lookup) return this.initializeLookup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const queryOffset = 0;
|
|
|
|
|
|
|
|
const querySize = (lookup.page?.offset ?? 0) + this.pageSize;
|
|
|
|
|
|
|
|
lookup.page = { size: querySize, offset: queryOffset };
|
|
|
|
|
|
|
|
lookup.project = { fields: this._lookupFields };
|
|
|
|
|
|
|
|
lookup.metadata = { countAll: true };
|
|
|
|
|
|
|
|
return lookup;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private _getRecentActivityOrder(recentActivityOrderValue: string): RecentActivityOrder {
|
|
|
|
|
|
|
|
switch (recentActivityOrderValue) {
|
|
|
|
|
|
|
|
case nameof<Dmp>(x => x.updatedAt): return RecentActivityOrder.UpdatedAt;
|
|
|
|
|
|
|
|
case nameof<Dmp>(x => x.label): return RecentActivityOrder.Label;
|
|
|
|
|
|
|
|
case nameof<Dmp>(x => x.status): return RecentActivityOrder.Status;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private get _lookupFields(): string[] {
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.id),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.label),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.description),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.status),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.accessType),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.version),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.versionStatus),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.groupId),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.updatedAt),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.belongsToCurrentTenant),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.finalizedAt),
|
|
|
|
|
|
|
|
nameof<Dmp>(x => x.hash),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CreateNewVersionDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.DeleteDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.CloneDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.FinalizeDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.ExportDmp].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.InviteDmpUsers].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.AssignDmpUsers].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.authorizationFlags), AppPermission.EditDmp].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.label)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.status)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.descriptionTemplate), nameof<DescriptionTemplate>(x => x.groupId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.dmpDescriptionTemplate), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.descriptions), nameof<Description>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.blueprint), nameof<DmpBlueprint>(x => x.label)].join('.'),
|
|
|
|
|
|
|
|
[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.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('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.dmp.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.sectionId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
|
|
|
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].join('.'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|