filter out inactive descriptions from dmp listing
This commit is contained in:
parent
c6a6f26275
commit
827c543e44
|
@ -5,7 +5,7 @@ import { DmpVersionStatus } from '@app/core/common/enum/dmp-version-status';
|
||||||
import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model';
|
import { BaseEntity, BaseEntityPersist } from '@common/base/base-entity.model';
|
||||||
import { Guid } from '@common/types/guid';
|
import { Guid } from '@common/types/guid';
|
||||||
import { DescriptionTemplate } from '../description-template/description-template';
|
import { DescriptionTemplate } from '../description-template/description-template';
|
||||||
import { Description, PublicDescription } from '../description/description';
|
import { BaseDescription, Description, PublicDescription } from '../description/description';
|
||||||
import { DmpBlueprint } from '../dmp-blueprint/dmp-blueprint';
|
import { DmpBlueprint } from '../dmp-blueprint/dmp-blueprint';
|
||||||
import { EntityDoi } from '../entity-doi/entity-doi';
|
import { EntityDoi } from '../entity-doi/entity-doi';
|
||||||
import { ReferencePersist } from '../reference/reference';
|
import { ReferencePersist } from '../reference/reference';
|
||||||
|
@ -221,4 +221,5 @@ export interface PublicEntityDoi {
|
||||||
|
|
||||||
export interface BaseDmp extends BaseEntity {
|
export interface BaseDmp extends BaseEntity {
|
||||||
status?: DmpStatus;
|
status?: DmpStatus;
|
||||||
|
descriptions?: BaseDescription[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,8 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
||||||
if (!result) { return []; }
|
if (!result) { return []; }
|
||||||
this.totalCount = result.count;
|
this.totalCount = result.count;
|
||||||
if (this.lookup?.page?.offset === 0) this.listingItems = [];
|
if (this.lookup?.page?.offset === 0) this.listingItems = [];
|
||||||
this.listingItems.push(...result.items);
|
const dmps = this._filterDmp([...result.items]);
|
||||||
|
this.listingItems.push(...dmps);
|
||||||
this.hasLoadedListingItems = true;
|
this.hasLoadedListingItems = true;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -415,6 +416,13 @@ export class DmpListingComponent extends BaseListingComponent<BaseDmp, DmpLookup
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _filterDmp(dmps: BaseDmp[]): BaseDmp[] {
|
||||||
|
dmps.forEach((dmp: BaseDmp) => {
|
||||||
|
dmp.descriptions = dmp.descriptions.filter(d => d.isActive == IsActive.Active);
|
||||||
|
})
|
||||||
|
return dmps;
|
||||||
|
}
|
||||||
|
|
||||||
private get _lookupFields(): string[] {
|
private get _lookupFields(): string[] {
|
||||||
return [
|
return [
|
||||||
nameof<Dmp>(x => x.id),
|
nameof<Dmp>(x => x.id),
|
||||||
|
|
Loading…
Reference in New Issue