|
|
@ -1,16 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, Params, Router } from '@angular/router';
|
|
|
|
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 { 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 { BaseDmp, Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
|
|
|
|
import { 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';
|
|
|
@ -21,37 +26,31 @@ 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 { PageLoadEvent, SortDirection } from '@common/modules/hybrid-listing/hybrid-listing.component';
|
|
|
|
import { 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, tap } from 'rxjs/operators';
|
|
|
|
import { debounceTime, takeUntil } 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 BaseListingComponent<BaseDmp, DmpLookup> implements OnInit {
|
|
|
|
export class DmpListingComponent extends BaseComponent 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;
|
|
|
|
lookup: DmpLookup = new 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(),
|
|
|
@ -79,59 +78,63 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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: Params) => {
|
|
|
|
.subscribe(async params => {
|
|
|
|
const queryParams = this.route.snapshot.queryParams;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.lookup) this.lookup = queryParams['lookup'] ? this._parseLookupFromParams(queryParams) : this.initializeLookup();
|
|
|
|
this.groupId = params['groupId'];
|
|
|
|
|
|
|
|
|
|
|
|
if ((this.formGroup.get('order')?.value == null || (!this.isAscending && !this.isDescending)) && this.lookup.order.items && this.lookup.order.items.length > 0) {
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
|
|
|
|
this.lookup.order = { items: ['-' + nameof<Dmp>(x => x.updatedAt)] };
|
|
|
|
|
|
|
|
this.lookup.metadata = { countAll: true };
|
|
|
|
|
|
|
|
this.lookup.isActive = [IsActive.Active];
|
|
|
|
|
|
|
|
|
|
|
|
let ordering = this.lookup.order.items[0];
|
|
|
|
if (this.groupId != null && Guid.isGuid(this.groupId)) {
|
|
|
|
let sortBy = ordering.substring(1, ordering.length);
|
|
|
|
this.lookup.groupIds = [Guid.parse(this.groupId)];
|
|
|
|
|
|
|
|
this.lookup.versionStatuses = null;
|
|
|
|
this.formGroup.get('order').setValue(this._getRecentActivityOrder(sortBy));
|
|
|
|
} else {
|
|
|
|
ordering.charAt(0) == '-' ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
this.lookup.versionStatuses = [DmpVersionStatus.Current, DmpVersionStatus.NotFinalized];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.onPageLoad({ offset: this.lookup.page.offset / this.lookup.page.size } as PageLoadEvent);
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
// 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 = {
|
|
|
@ -162,48 +165,6 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
|
|
|
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' +
|
|
|
@ -221,8 +182,7 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
|
|
|
|
|
|
|
|
|
|
|
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() {
|
|
|
@ -233,135 +193,12 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
|
|
|
} 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.filterChanged(this.lookup);
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// private refresh(lookup: DmpLookup) {
|
|
|
|
private refresh(lookup: DmpLookup) {
|
|
|
|
// if (this.isPublic) {
|
|
|
|
lookup.project = {
|
|
|
|
// this.dmpService.publicQuery(lookup).pipe(takeUntil(this._destroyed))
|
|
|
|
fields: [
|
|
|
|
// .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 {
|
|
|
|
|
|
|
|
this.lookup.like = this.formGroup.get("like").value;
|
|
|
|
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
|
|
|
|
this.filterChanged(this.lookup, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openShareDialog(rowId: any, rowName: any) {
|
|
|
|
|
|
|
|
//TODO: add this
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openFiltersDialog(): void {
|
|
|
|
|
|
|
|
//TODO: Add filters dialog
|
|
|
|
|
|
|
|
let dialogRef = this.dialog.open(DmpFilterDialogComponent, {
|
|
|
|
|
|
|
|
width: '456px',
|
|
|
|
|
|
|
|
height: '100%',
|
|
|
|
|
|
|
|
id: 'filters',
|
|
|
|
|
|
|
|
restoreFocus: false,
|
|
|
|
|
|
|
|
position: { right: '0px;' },
|
|
|
|
|
|
|
|
panelClass: 'dialog-side-panel',
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
isPublic: this.isPublic ?? true,
|
|
|
|
|
|
|
|
filterForm: this.lookup.buildForm(),
|
|
|
|
|
|
|
|
updateDataFn: this.updateDataFn.bind(this)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateDataFn(filterForm: UntypedFormGroup): void {
|
|
|
|
|
|
|
|
let testLookup = this.lookup;
|
|
|
|
|
|
|
|
testLookup.from(filterForm);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hasScrollbar(): boolean {
|
|
|
|
|
|
|
|
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public setDashboardTourDmpText(): void {
|
|
|
|
|
|
|
|
const dmpText = this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.GET-IDEA');
|
|
|
|
|
|
|
|
this.dashboardTour.steps[0].title = dmpText;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public setDashboardTourDescriptionText(): void {
|
|
|
|
|
|
|
|
const descriptionText = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' +
|
|
|
|
|
|
|
|
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
|
|
|
|
|
|
|
|
this.dashboardTour.steps[1].title = descriptionText;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public restartTour(): void {
|
|
|
|
|
|
|
|
this.setDashboardTourDmpText();
|
|
|
|
|
|
|
|
this.setDashboardTourDescriptionText();
|
|
|
|
|
|
|
|
this.guidedTourService.startTour(this.dashboardTour);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hasLikeFilters(): boolean {
|
|
|
|
|
|
|
|
return this.lookup.like !== undefined && this.lookup.like !== null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toggleSortDirection(): void {
|
|
|
|
|
|
|
|
this.sortDirection = this.isAscending ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
|
|
|
|
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.id),
|
|
|
|
nameof<Dmp>(x => x.label),
|
|
|
|
nameof<Dmp>(x => x.label),
|
|
|
|
nameof<Dmp>(x => x.description),
|
|
|
|
nameof<Dmp>(x => x.description),
|
|
|
@ -413,6 +250,111 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.descriptionTemplateGroupId)].join('.'),
|
|
|
|
[nameof<Dmp>(x => x.dmpDescriptionTemplates), nameof<DmpDescriptionTemplate>(x => x.isActive)].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 {
|
|
|
|
|
|
|
|
this.lookup.like = this.formGroup.get("like").value;
|
|
|
|
|
|
|
|
this.lookup.page = { size: this.pageSize, offset: 0 };
|
|
|
|
|
|
|
|
this.refresh(this.lookup);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openShareDialog(rowId: any, rowName: any) {
|
|
|
|
|
|
|
|
//TODO: add this
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openFiltersDialog(): void {
|
|
|
|
|
|
|
|
//TODO: Add filters dialog
|
|
|
|
|
|
|
|
let dialogRef = this.dialog.open(DmpFilterDialogComponent, {
|
|
|
|
|
|
|
|
width: '456px',
|
|
|
|
|
|
|
|
height: '100%',
|
|
|
|
|
|
|
|
id: 'filters',
|
|
|
|
|
|
|
|
restoreFocus: false,
|
|
|
|
|
|
|
|
position: { right: '0px;' },
|
|
|
|
|
|
|
|
panelClass: 'dialog-side-panel',
|
|
|
|
|
|
|
|
data: {
|
|
|
|
|
|
|
|
isPublic: this.isPublic ?? true,
|
|
|
|
|
|
|
|
filterForm: this.lookup.buildForm(),
|
|
|
|
|
|
|
|
updateDataFn: this.updateDataFn.bind(this)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateDataFn(filterForm: UntypedFormGroup): void {
|
|
|
|
|
|
|
|
let testLookup = this.lookup;
|
|
|
|
|
|
|
|
testLookup.from(filterForm);
|
|
|
|
|
|
|
|
// console.log('testLookup: ', testLookup);
|
|
|
|
|
|
|
|
// this.lookup.from(filterForm);
|
|
|
|
|
|
|
|
// this.refresh(this.lookup);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hasScrollbar(): boolean {
|
|
|
|
|
|
|
|
return document.getElementById("main-page").scrollHeight > document.documentElement.clientHeight
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public setDashboardTourDmpText(): void {
|
|
|
|
|
|
|
|
const dmpText = this.language.instant('DMP-LISTING.TEXT-INFO') + '\n\n' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.LINK-ZENODO') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DMP-LISTING.GET-IDEA');
|
|
|
|
|
|
|
|
this.dashboardTour.steps[0].title = dmpText;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public setDashboardTourDescriptionText(): void {
|
|
|
|
|
|
|
|
const descriptionText = this.language.instant('DESCRIPTION-LISTING.TEXT-INFO') + '\n\n' +
|
|
|
|
|
|
|
|
this.language.instant('DESCRIPTION-LISTING.TEXT-INFO-QUESTION') + ' ' +
|
|
|
|
|
|
|
|
this.language.instant('DESCRIPTION-LISTING.GET-IDEA');
|
|
|
|
|
|
|
|
this.dashboardTour.steps[1].title = descriptionText;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public restartTour(): void {
|
|
|
|
|
|
|
|
this.setDashboardTourDmpText();
|
|
|
|
|
|
|
|
this.setDashboardTourDescriptionText();
|
|
|
|
|
|
|
|
this.guidedTourService.startTour(this.dashboardTour);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public hasLikeCriteria(): boolean {
|
|
|
|
|
|
|
|
return this.lookup.like !== undefined && this.lookup.like !== null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
toggleSortDirection(): void {
|
|
|
|
|
|
|
|
this.sortDirection = this.isAscending ? this.sortDirection = SortDirection.Descending : this.sortDirection = SortDirection.Ascending;
|
|
|
|
|
|
|
|
this.orderByChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|