Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Diamantis Tziotzios 2023-12-01 19:18:48 +02:00
commit 567b09a26b
30 changed files with 308 additions and 69 deletions

View File

@ -165,7 +165,8 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
} }
if (this.like != null && !this.like.isEmpty()) { if (this.like != null && !this.like.isEmpty()) {
predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(ReferenceEntity._label), this.like), predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(ReferenceEntity._label), this.like),
queryContext.CriteriaBuilder.like(queryContext.Root.get(ReferenceEntity._description), this.like) queryContext.CriteriaBuilder.like(queryContext.Root.get(ReferenceEntity._description), this.like),
queryContext.CriteriaBuilder.like(queryContext.Root.get(ReferenceEntity._source), this.like)
)); ));
} }
if (this.isActives != null) { if (this.isActives != null) {

View File

@ -4,13 +4,9 @@ import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.authorization.Permission; import eu.eudat.authorization.Permission;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.commons.scope.user.UserScope; import eu.eudat.commons.scope.user.UserScope;
import eu.eudat.data.DescriptionEntity; import eu.eudat.data.*;
import eu.eudat.data.DescriptionReferenceEntity;
import eu.eudat.data.UserContactInfoEntity;
import eu.eudat.data.UserEntity;
import eu.eudat.model.User; import eu.eudat.model.User;
import eu.eudat.model.PublicUser; import eu.eudat.model.PublicUser;
import eu.eudat.model.UserContactInfo;
import eu.eudat.query.utils.BuildSubQueryInput; import eu.eudat.query.utils.BuildSubQueryInput;
import eu.eudat.query.utils.QueryUtilsService; import eu.eudat.query.utils.QueryUtilsService;
import gr.cite.commons.web.authz.service.AuthorizationService; import gr.cite.commons.web.authz.service.AuthorizationService;
@ -36,6 +32,7 @@ public class UserQuery extends QueryBase<UserEntity> {
private Collection<String> emails; private Collection<String> emails;
private Collection<UUID> excludedIds; private Collection<UUID> excludedIds;
private Collection<IsActive> isActives; private Collection<IsActive> isActives;
private UserRoleQuery userRoleQuery;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None); private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -113,6 +110,11 @@ public class UserQuery extends QueryBase<UserEntity> {
return this; return this;
} }
public UserQuery userRoleSubQuery(UserRoleQuery userRoleSubQuery) {
this.userRoleQuery = userRoleSubQuery;
return this;
}
public UserQuery authorize(EnumSet<AuthorizationFlags> values) { public UserQuery authorize(EnumSet<AuthorizationFlags> values) {
this.authorize = values; this.authorize = values;
return this; return this;
@ -124,7 +126,8 @@ public class UserQuery extends QueryBase<UserEntity> {
this.isEmpty(this.ids) || this.isEmpty(this.ids) ||
this.isEmpty(this.isActives) || this.isEmpty(this.isActives) ||
this.isEmpty(this.emails) || this.isEmpty(this.emails) ||
this.isEmpty(this.excludedIds); this.isEmpty(this.excludedIds) ||
this.isFalseQuery(this.userRoleQuery);
} }
@Override @Override
@ -190,6 +193,11 @@ public class UserQuery extends QueryBase<UserEntity> {
)); ));
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userContactInfoSubquery)); predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userContactInfoSubquery));
} }
if (this.userRoleQuery != null) {
Subquery<UserRoleEntity> subQuery = queryContext.Query.subquery(this.userRoleQuery.entityClass());
this.applySubQuery(this.userRoleQuery, queryContext.CriteriaBuilder, subQuery);
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(subQuery));
}
if (!predicates.isEmpty()) { if (!predicates.isEmpty()) {

View File

@ -1,15 +1,10 @@
package eu.eudat.query.lookup; package eu.eudat.query.lookup;
import eu.eudat.commons.enums.DescriptionStatus;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.elastic.query.DescriptionElasticQuery;
import eu.eudat.elastic.query.InnerObjectDmpElasticQuery;
import eu.eudat.query.DescriptionQuery;
import eu.eudat.query.UserQuery; import eu.eudat.query.UserQuery;
import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.Lookup;
import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.data.query.QueryFactory;
import java.time.Instant;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -22,6 +17,7 @@ public class UserLookup extends Lookup {
private List<UUID> excludedIds; private List<UUID> excludedIds;
private List<IsActive> isActive; private List<IsActive> isActive;
private UserRoleLookup userRoleSubQuery;
public String getLike() { public String getLike() {
return like; return like;
@ -55,11 +51,28 @@ public class UserLookup extends Lookup {
this.isActive = isActive; this.isActive = isActive;
} }
public List<String> getEmails() {
return emails;
}
public void setEmails(List<String> emails) {
this.emails = emails;
}
public UserRoleLookup getUserRoleSubQuery() {
return userRoleSubQuery;
}
public void setUserRoleSubQuery(UserRoleLookup userRoleSubQuery) {
this.userRoleSubQuery = userRoleSubQuery;
}
public UserQuery enrich(QueryFactory queryFactory) { public UserQuery enrich(QueryFactory queryFactory) {
UserQuery query = queryFactory.query(UserQuery.class); UserQuery query = queryFactory.query(UserQuery.class);
if (this.like != null) query.like(this.like); if (this.like != null) query.like(this.like);
if (this.ids != null) query.ids(this.ids); if (this.ids != null) query.ids(this.ids);
if (this.emails != null) query.emails(this.emails); if (this.emails != null) query.emails(this.emails);
if (this.userRoleSubQuery != null) query.userRoleSubQuery(this.userRoleSubQuery.enrich(queryFactory));
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.excludedIds != null) query.excludedIds(this.excludedIds);
if (this.isActive != null) query.isActive(this.isActive); if (this.isActive != null) query.isActive(this.isActive);

View File

@ -1,12 +1,14 @@
import { Lookup } from "@common/model/lookup"; import { Lookup } from "@common/model/lookup";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { IsActive } from "../common/enum/is-active.enum"; import { IsActive } from "../common/enum/is-active.enum";
import { DescriptionTemplateTypeStatus } from "../common/enum/description-template-type-status";
export class DescriptionTemplateTypeLookup extends Lookup implements DescriptionTemplateTypeFilter { export class DescriptionTemplateTypeLookup extends Lookup implements DescriptionTemplateTypeFilter {
ids: Guid[]; ids: Guid[];
excludedIds: Guid[]; excludedIds: Guid[];
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
statuses: DescriptionTemplateTypeStatus[];
constructor() { constructor() {
super(); super();
@ -18,4 +20,5 @@ export interface DescriptionTemplateTypeFilter {
excludedIds: Guid[]; excludedIds: Guid[];
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
statuses: DescriptionTemplateTypeStatus[];
} }

View File

@ -10,7 +10,7 @@ export class ReferenceLookup extends Lookup implements ReferenceFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
sourceTypes: ReferenceSourceType[]; sourceTypes: ReferenceSourceType[];
referenceTypes: ReferenceType[]; types: ReferenceType[];
constructor() { constructor() {
super(); super();
@ -23,5 +23,5 @@ export interface ReferenceFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
sourceTypes: ReferenceSourceType[]; sourceTypes: ReferenceSourceType[];
referenceTypes: ReferenceType[]; types: ReferenceType[];
} }

View File

@ -0,0 +1,20 @@
import { Lookup } from "@common/model/lookup";
import { Guid } from "@common/types/guid";
export class UserRoleLookup extends Lookup implements UserRoleFilter {
ids: Guid[];
excludedIds: Guid[];
userIds: Guid[];
roles: string[]
constructor() {
super();
}
}
export interface UserRoleFilter {
ids: Guid[];
excludedIds: Guid[];
userIds: Guid[];
roles: string[];
}

View File

@ -1,6 +1,7 @@
import { Lookup } from '@common/model/lookup'; import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { UserRoleLookup } from './user-role.lookup';
export class UserLookup extends Lookup implements UserFilter { export class UserLookup extends Lookup implements UserFilter {
ids: Guid[]; ids: Guid[];
@ -8,6 +9,7 @@ export class UserLookup extends Lookup implements UserFilter {
like: string; like: string;
emails: string[]; emails: string[];
isActive: IsActive[]; isActive: IsActive[];
userRoleSubQuery: UserRoleLookup;
constructor() { constructor() {
super(); super();
@ -20,4 +22,5 @@ export interface UserFilter {
like: string; like: string;
emails: string[]; emails: string[];
isActive: IsActive[]; isActive: IsActive[];
userRoleSubQuery: UserRoleLookup;
} }

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type'; import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type';
import { DescriptionTemplateTypeLookup } from '@app/core/query/description-template-type.lookup'; import { DescriptionTemplateTypeLookup } from '@app/core/query/description-template-type.lookup';
import { DmpBlueprintLookup } from '@app/core/query/dmp-blueprint.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration'; import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
import { QueryResult } from '@common/model/query-result'; import { QueryResult } from '@common/model/query-result';
@ -80,8 +79,8 @@ export class DescriptionTemplateTypeService {
valueAssign: (item: DescriptionTemplateType) => item.id, valueAssign: (item: DescriptionTemplateType) => item.id,
}; };
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DmpBlueprintLookup { private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateTypeLookup {
const lookup: DmpBlueprintLookup = new DmpBlueprintLookup(); const lookup: DescriptionTemplateTypeLookup = new DescriptionTemplateTypeLookup();
lookup.page = { size: 100, offset: 0 }; lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; } if (ids && ids.length > 0) { lookup.ids = ids; }

View File

@ -72,29 +72,29 @@ export class ReferenceService {
// //
// Autocomplete Commons // Autocomplete Commons
// //
public getSingleAutocompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration { public getSingleAutocompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
return { return {
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes)).pipe(map(x => x.items)), initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery)).pipe(map(x => x.items)), filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery)).pipe(map(x => x.items)),
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])), getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])),
displayFn: (item: Reference) => item.label, displayFn: (item: Reference) => item.label,
titleFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label,
valueAssign: (item: Reference) => item.id, valueAssign: (item: Reference) => item.id,
}; };
}; };
public getMultipleAutoCompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration { public getMultipleAutoCompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
return { return {
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)), initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)), filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)), getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)),
displayFn: (item: Reference) => item.label, displayFn: (item: Reference) => item.label,
titleFn: (item: Reference) => item.label, titleFn: (item: Reference) => item.label,
valueAssign: (item: Reference) => item.id, valueAssign: (item: Reference) => item.id,
}; };
} }
private buildAutocompleteLookup(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup { private buildAutocompleteLookup(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
const lookup: ReferenceLookup = new ReferenceLookup(); const lookup: ReferenceLookup = new ReferenceLookup();
lookup.page = { size: 100, offset: 0 }; lookup.page = { size: 100, offset: 0 };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; } if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
@ -106,7 +106,7 @@ export class ReferenceService {
nameof<Reference>(x => x.label) nameof<Reference>(x => x.label)
] ]
}; };
if (referenceTypes && referenceTypes.length > 0) { lookup.referenceTypes = referenceTypes; } if (types && types.length > 0) { lookup.types = types; }
if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; } if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; }
lookup.order = { items: [nameof<Reference>(x => x.label)] }; lookup.order = { items: [nameof<Reference>(x => x.label)] };
if (like) { lookup.like = this.filterService.transformLike(like); } if (like) { lookup.like = this.filterService.transformLike(like); }

View File

@ -27,6 +27,7 @@ import { ImportDescriptionTemplateDialogComponent } from './import-description-t
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
@Component({ @Component({
@ -127,6 +128,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.UPDATED-AT', languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<DescriptionTemplate>(x => x.isActive),
sortable: true,
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -20,6 +20,14 @@
{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}} {{'DESCRIPTION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle> </mat-slide-toggle>
<div>
<mat-label>{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.STATUS' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.statuses">
<mat-option *ngFor="let descriptionTemplateStatus of descriptionTemplateStatusEnumValues" [value]="descriptionTemplateStatus">{{enumUtils.toDescriptionTemplateTypeStatusString(descriptionTemplateStatus)}}</mat-option>
</mat-select>
</mat-label>
</div>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem"> <div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()"> <button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.CANCEL' | translate}} {{'DESCRIPTION-TEMPLATE-LISTING.FILTER.CANCEL' | translate}}

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DescriptionTemplateFilter } from '@app/core/query/description-template.lookup'; import { DescriptionTemplateFilter } from '@app/core/query/description-template.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@ -16,6 +17,8 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
@Input() readonly filter: DescriptionTemplateFilter; @Input() readonly filter: DescriptionTemplateFilter;
@Output() filterChange = new EventEmitter<DescriptionTemplateFilter>(); @Output() filterChange = new EventEmitter<DescriptionTemplateFilter>();
descriptionTemplateStatusEnumValues = this.enumUtils.getEnumValues<DescriptionTemplateStatus>(DescriptionTemplateStatus);
// * State // * State
internalFilters: DescriptionTemplateListingFilters = this._getEmptyFilters(); internalFilters: DescriptionTemplateListingFilters = this._getEmptyFilters();
@ -46,12 +49,12 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
} }
protected applyFilters(): void { protected applyFilters(): void {
const { isActive, like, typeIds } = this.internalFilters ?? {} const { isActive, like, statuses } = this.internalFilters ?? {}
this.filterChange.emit({ this.filterChange.emit({
...this.filter, ...this.filter,
like, like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive], isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
typeIds statuses
}) })
} }
@ -61,12 +64,12 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
return this._getEmptyFilters(); return this._getEmptyFilters();
} }
let { excludedIds, ids, isActive, like, typeIds } = inputFilter; let { excludedIds, ids, isActive, like, statuses } = inputFilter;
return { return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like, like: like,
typeIds: typeIds statuses: statuses
} }
} }
@ -75,7 +78,7 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
return { return {
isActive: true, isActive: true,
like: null, like: null,
typeIds: null, statuses: null,
} }
} }
@ -95,5 +98,5 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
interface DescriptionTemplateListingFilters { interface DescriptionTemplateListingFilters {
isActive: boolean; isActive: boolean;
like: string; like: string;
typeIds: Guid[]; statuses: DescriptionTemplateStatus[];
} }

View File

@ -13,6 +13,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
import { BaseListingComponent } from '@common/base/base-listing-component'; import { BaseListingComponent } from '@common/base/base-listing-component';
import { PipeService } from '@common/formatting/pipe.service'; import { PipeService } from '@common/formatting/pipe.service';
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { QueryResult } from '@common/model/query-result'; import { QueryResult } from '@common/model/query-result';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.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';
@ -110,6 +111,12 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.UPDATED-AT', languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<DescriptionTemplateType>(x => x.isActive),
sortable: true,
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -20,6 +20,14 @@
{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.IS-ACTIVE' | translate}} {{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle> </mat-slide-toggle>
<div>
<mat-label>{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.STATUS' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.statuses">
<mat-option *ngFor="let descriptionTemplateTypeStatus of descriptionTemplateTypeStatusEnumValues" [value]="descriptionTemplateTypeStatus">{{enumUtils.toDescriptionTemplateTypeStatusString(descriptionTemplateTypeStatus)}}</mat-option>
</mat-select>
</mat-label>
</div>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem"> <div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()"> <button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.CANCEL' | translate}} {{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.CANCEL' | translate}}

View File

@ -1,4 +1,5 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DescriptionTemplateTypeFilter } from '@app/core/query/description-template-type.lookup'; import { DescriptionTemplateTypeFilter } from '@app/core/query/description-template-type.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@ -15,6 +16,8 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
@Input() readonly filter: DescriptionTemplateTypeFilter; @Input() readonly filter: DescriptionTemplateTypeFilter;
@Output() filterChange = new EventEmitter<DescriptionTemplateTypeFilter>(); @Output() filterChange = new EventEmitter<DescriptionTemplateTypeFilter>();
descriptionTemplateTypeStatusEnumValues = this.enumUtils.getEnumValues<DescriptionTemplateTypeStatus>(DescriptionTemplateTypeStatus);
// * State // * State
internalFilters: DescriptionTemplateTypeListingFilters = this._getEmptyFilters(); internalFilters: DescriptionTemplateTypeListingFilters = this._getEmptyFilters();
@ -45,11 +48,12 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
} }
protected applyFilters(): void { protected applyFilters(): void {
const { isActive, like } = this.internalFilters ?? {} const { isActive, like, statuses } = this.internalFilters ?? {}
this.filterChange.emit({ this.filterChange.emit({
...this.filter, ...this.filter,
like, like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive] isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
statuses
}) })
} }
@ -59,11 +63,12 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
return this._getEmptyFilters(); return this._getEmptyFilters();
} }
let { excludedIds, ids, isActive, like } = inputFilter; let { excludedIds, ids, isActive, like, statuses } = inputFilter;
return { return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like like: like,
statuses: statuses
} }
} }
@ -72,6 +77,7 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
return { return {
isActive: true, isActive: true,
like: null, like: null,
statuses: null,
} }
} }
@ -91,4 +97,5 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
interface DescriptionTemplateTypeListingFilters { interface DescriptionTemplateTypeListingFilters {
isActive: boolean; isActive: boolean;
like: string; like: string;
statuses: DescriptionTemplateTypeStatus[];
} }

View File

@ -20,9 +20,13 @@
{{'DMP-BLUEPRINT-LISTING.FILTER.IS-ACTIVE' | translate}} {{'DMP-BLUEPRINT-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle> </mat-slide-toggle>
<div>
<mat-label>{{'DMP-BLUEPRINT-LISTING.FILTER.STATUS' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.statuses"> <mat-select multiple [(ngModel)]="internalFilters.statuses">
<mat-option *ngFor="let blueprintStatus of dmpBlueprintStatusEnumValues" [value]="blueprintStatus">{{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}}</mat-option> <mat-option *ngFor="let blueprintStatus of dmpBlueprintStatusEnumValues" [value]="blueprintStatus">{{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}}</mat-option>
</mat-select> </mat-select>
</mat-label>
</div>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem"> <div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()"> <button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">

View File

@ -12,6 +12,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
import { BaseListingComponent } from '@common/base/base-listing-component'; import { BaseListingComponent } from '@common/base/base-listing-component';
import { PipeService } from '@common/formatting/pipe.service'; import { PipeService } from '@common/formatting/pipe.service';
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { QueryResult } from '@common/model/query-result'; import { QueryResult } from '@common/model/query-result';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.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';
@ -102,6 +103,12 @@ export class LanguageListingComponent extends BaseListingComponent<Language, Lan
languageName: 'LANGUAGE-LISTING.FIELDS.UPDATED-AT', languageName: 'LANGUAGE-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<Language>(x => x.isActive),
sortable: true,
languageName: 'LANGUAGE-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -21,6 +21,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
@Component({ @Component({
templateUrl: './reference-type-listing.component.html', templateUrl: './reference-type-listing.component.html',
@ -95,7 +96,6 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
prop: nameof<ReferenceType>(x => x.code), prop: nameof<ReferenceType>(x => x.code),
sortable: true, sortable: true,
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.CODE', languageName: 'REFERENCE-TYPE-LISTING.FIELDS.CODE',
//cellTemplate: this.ReferenceTypeStatus
}, },
{ {
prop: nameof<ReferenceType>(x => x.createdAt), prop: nameof<ReferenceType>(x => x.createdAt),
@ -109,6 +109,12 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.UPDATED-AT', languageName: 'REFERENCE-TYPE-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<ReferenceType>(x => x.isActive),
sortable: true,
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -20,6 +20,22 @@
{{'REFERENCE-LISTING.FILTER.IS-ACTIVE' | translate}} {{'REFERENCE-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle> </mat-slide-toggle>
<div>
<mat-label>{{'REFERENCE-LISTING.FILTER.TYPE' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.types">
<mat-option *ngFor="let referenceType of referenceTypeEnumValues" [value]="referenceType">{{enumUtils.toReferenceTypeString(referenceType)}}</mat-option>
</mat-select>
</mat-label>
</div>
<div>
<mat-label>{{'REFERENCE-LISTING.FILTER.SOURCE-TYPE' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.sourceTypes">
<mat-option *ngFor="let referenceSourceType of referenceSourceTypeEnumValues" [value]="referenceSourceType">{{enumUtils.toReferenceSourceTypeString(referenceSourceType)}}</mat-option>
</mat-select>
</mat-label>
</div>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem"> <div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()"> <button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
{{'REFERENCE-LISTING.FILTER.CANCEL' | translate}} {{'REFERENCE-LISTING.FILTER.CANCEL' | translate}}

View File

@ -1,6 +1,8 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { TenantFilter } from '@app/core/query/tenant.lookup'; import { ReferenceSourceType } from '@app/core/common/enum/reference-source-type';
import { ReferenceType } from '@app/core/common/enum/reference-type';
import { ReferenceFilter } from '@app/core/query/reference.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component'; import { BaseComponent } from '@common/base/base.component';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
@ -12,8 +14,11 @@ import { nameof } from 'ts-simple-nameof';
}) })
export class ReferenceListingFiltersComponent extends BaseComponent implements OnInit, OnChanges { export class ReferenceListingFiltersComponent extends BaseComponent implements OnInit, OnChanges {
@Input() readonly filter: TenantFilter; @Input() readonly filter: ReferenceFilter;
@Output() filterChange = new EventEmitter<TenantFilter>(); @Output() filterChange = new EventEmitter<ReferenceFilter>();
referenceSourceTypeEnumValues = this.enumUtils.getEnumValues<ReferenceSourceType>(ReferenceSourceType)
referenceTypeEnumValues = this.enumUtils.getEnumValues<ReferenceType>(ReferenceType);
// * State // * State
internalFilters: ReferenceListingFilters = this._getEmptyFilters(); internalFilters: ReferenceListingFilters = this._getEmptyFilters();
@ -27,7 +32,7 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
const filterChange = changes[nameof<ReferenceListingFiltersComponent>(x => x.filter)]?.currentValue as TenantFilter; const filterChange = changes[nameof<ReferenceListingFiltersComponent>(x => x.filter)]?.currentValue as ReferenceFilter;
if (filterChange) { if (filterChange) {
this.updateFilters() this.updateFilters()
} }
@ -45,25 +50,29 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
} }
protected applyFilters(): void { protected applyFilters(): void {
const { isActive, like } = this.internalFilters ?? {} const { isActive, like, types, sourceTypes } = this.internalFilters ?? {}
this.filterChange.emit({ this.filterChange.emit({
...this.filter, ...this.filter,
like, like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive] isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
types,
sourceTypes
}) })
} }
private _parseToInternalFilters(inputFilter: TenantFilter): ReferenceListingFilters { private _parseToInternalFilters(inputFilter: ReferenceFilter): ReferenceListingFilters {
if (!inputFilter) { if (!inputFilter) {
return this._getEmptyFilters(); return this._getEmptyFilters();
} }
let { excludedIds, ids, isActive, like } = inputFilter; let { excludedIds, ids, isActive, like, types, sourceTypes } = inputFilter;
return { return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like like: like,
types: types,
sourceTypes: sourceTypes
} }
} }
@ -72,6 +81,8 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
return { return {
isActive: true, isActive: true,
like: null, like: null,
types: null,
sourceTypes: null
} }
} }
@ -91,4 +102,6 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
interface ReferenceListingFilters { interface ReferenceListingFilters {
isActive: boolean; isActive: boolean;
like: string; like: string;
types: ReferenceType[];
sourceTypes: ReferenceSourceType[];
} }

View File

@ -21,6 +21,9 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { ReferenceTypePipe } from '@common/formatting/pipes/reference-type.pipe';
import { ReferenceSourceTypePipe } from '@common/formatting/pipes/reference-source-type.pipe';
@Component({ @Component({
templateUrl: './REFERENCE-LISTING.component.html', templateUrl: './REFERENCE-LISTING.component.html',
@ -38,6 +41,7 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
nameof<Reference>(x => x.id), nameof<Reference>(x => x.id),
nameof<Reference>(x => x.label), nameof<Reference>(x => x.label),
nameof<Reference>(x => x.source), nameof<Reference>(x => x.source),
nameof<Reference>(x => x.sourceType),
nameof<Reference>(x => x.type), nameof<Reference>(x => x.type),
nameof<Reference>(x => x.updatedAt), nameof<Reference>(x => x.updatedAt),
nameof<Reference>(x => x.createdAt), nameof<Reference>(x => x.createdAt),
@ -96,10 +100,17 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
sortable: true, sortable: true,
languageName: 'REFERENCE-LISTING.FIELDS.SOURCE', languageName: 'REFERENCE-LISTING.FIELDS.SOURCE',
}, },
{
prop: nameof<Reference>(x => x.sourceType),
sortable: true,
languageName: 'REFERENCE-LISTING.FIELDS.SOURCE-TYPE',
pipe: this.pipeService.getPipe<ReferenceSourceTypePipe>(ReferenceSourceTypePipe)
},
{ {
prop: nameof<Reference>(x => x.type), prop: nameof<Reference>(x => x.type),
sortable: true, sortable: true,
languageName: 'REFERENCE-LISTING.FIELDS.TYPE', languageName: 'REFERENCE-LISTING.FIELDS.TYPE',
pipe: this.pipeService.getPipe<ReferenceTypePipe>(ReferenceTypePipe)
}, },
{ {
prop: nameof<Reference>(x => x.createdAt), prop: nameof<Reference>(x => x.createdAt),
@ -113,6 +124,12 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
languageName: 'REFERENCE-LISTING.FIELDS.UPDATED-AT', languageName: 'REFERENCE-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<Reference>(x => x.isActive),
sortable: true,
languageName: 'REFERENCE-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -21,6 +21,7 @@ import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
@Component({ @Component({
templateUrl: './tenant-listing.component.html', templateUrl: './tenant-listing.component.html',
@ -94,7 +95,6 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
prop: nameof<Tenant>(x => x.code), prop: nameof<Tenant>(x => x.code),
sortable: true, sortable: true,
languageName: 'TENANT-LISTING.FIELDS.CODE', languageName: 'TENANT-LISTING.FIELDS.CODE',
//cellTemplate: this.TenantStatus
}, },
{ {
prop: nameof<Tenant>(x => x.createdAt), prop: nameof<Tenant>(x => x.createdAt),
@ -108,6 +108,12 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
languageName: 'TENANT-LISTING.FIELDS.UPDATED-AT', languageName: 'TENANT-LISTING.FIELDS.UPDATED-AT',
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short') pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
}, },
{
prop: nameof<Tenant>(x => x.isActive),
sortable: true,
languageName: 'TENANT-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
{ {
alwaysShown: true, alwaysShown: true,
cellTemplate: this.actions, cellTemplate: this.actions,

View File

@ -20,6 +20,14 @@
{{'USER-LISTING.FILTER.IS-ACTIVE' | translate}} {{'USER-LISTING.FILTER.IS-ACTIVE' | translate}}
</mat-slide-toggle> </mat-slide-toggle>
<div>
<mat-label>{{'USER-LISTING.FILTER.ROLES' | translate}}
<mat-select multiple [(ngModel)]="internalFilters.userRoleSubQuery.roles">
<mat-option *ngFor="let appRole of appRoleEnumValues" [value]="appRole">{{enumUtils.toAppRoleString(appRole)}}</mat-option>
</mat-select>
</mat-label>
</div>
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem"> <div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()"> <button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
{{'USER-LISTING.FILTER.CANCEL' | translate}} {{'USER-LISTING.FILTER.CANCEL' | translate}}

View File

@ -1,5 +1,7 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { AppRole } from '@app/core/common/enum/app-role';
import { IsActive } from '@app/core/common/enum/is-active.enum'; import { IsActive } from '@app/core/common/enum/is-active.enum';
import { UserRoleLookup } from '@app/core/query/user-role.lookup';
import { UserFilter } from '@app/core/query/user.lookup'; import { UserFilter } from '@app/core/query/user.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service'; import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component'; import { BaseComponent } from '@common/base/base.component';
@ -15,6 +17,9 @@ export class UserListingFiltersComponent extends BaseComponent implements OnInit
@Input() readonly filter: UserFilter; @Input() readonly filter: UserFilter;
@Output() filterChange = new EventEmitter<UserFilter>(); @Output() filterChange = new EventEmitter<UserFilter>();
roles: string[] = []
appRoleEnumValues = this.enumUtils.getEnumValues<AppRole>(AppRole);
// * State // * State
internalFilters: UserListingFilters = this._getEmptyFilters(); internalFilters: UserListingFilters = this._getEmptyFilters();
@ -45,11 +50,12 @@ export class UserListingFiltersComponent extends BaseComponent implements OnInit
} }
protected applyFilters(): void { protected applyFilters(): void {
const { isActive, like } = this.internalFilters ?? {} const { isActive, like, userRoleSubQuery } = this.internalFilters ?? {}
this.filterChange.emit({ this.filterChange.emit({
...this.filter, ...this.filter,
like, like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive] isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
userRoleSubQuery
}) })
} }
@ -59,11 +65,12 @@ export class UserListingFiltersComponent extends BaseComponent implements OnInit
return this._getEmptyFilters(); return this._getEmptyFilters();
} }
let { excludedIds, ids, isActive, like } = inputFilter; let { excludedIds, ids, isActive, like, userRoleSubQuery } = inputFilter;
return { return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length, isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like like: like,
userRoleSubQuery: userRoleSubQuery ?? new UserRoleLookup()
} }
} }
@ -72,6 +79,7 @@ export class UserListingFiltersComponent extends BaseComponent implements OnInit
return { return {
isActive: true, isActive: true,
like: null, like: null,
userRoleSubQuery: new UserRoleLookup()
} }
} }
@ -91,4 +99,5 @@ export class UserListingFiltersComponent extends BaseComponent implements OnInit
interface UserListingFilters { interface UserListingFilters {
isActive: boolean; isActive: boolean;
like: string; like: string;
userRoleSubQuery: UserRoleLookup;
} }

View File

@ -13,6 +13,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
import { BaseListingComponent } from '@common/base/base-listing-component'; import { BaseListingComponent } from '@common/base/base-listing-component';
import { PipeService } from '@common/formatting/pipe.service'; import { PipeService } from '@common/formatting/pipe.service';
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { QueryResult } from '@common/model/query-result'; import { QueryResult } from '@common/model/query-result';
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.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';
@ -124,7 +125,13 @@ export class UserListingComponent extends BaseListingComponent<User, UserLookup>
alwaysShown: true, alwaysShown: true,
maxWidth: 300, maxWidth: 300,
cellTemplate: this.roleCellTemplate cellTemplate: this.roleCellTemplate
} },
{
prop: nameof<User>(x => x.isActive),
sortable: true,
languageName: 'USER-LISTING.FIELDS.IS-ACTIVE',
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
},
]); ]);
this.propertiesAvailableForOrder = this.gridColumns.filter(x => x.sortable); this.propertiesAvailableForOrder = this.gridColumns.filter(x => x.sortable);
} }

View File

@ -1009,11 +1009,13 @@
"STATUS": "Status", "STATUS": "Status",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created", "CREATED-AT": "Created",
"PUBLISHED-AT": "Published" "PUBLISHED-AT": "Published",
"IS-ACTIVE":"Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
"IS-ACTIVE": "Is Active", "IS-ACTIVE": "Is Active",
"STATUS": "Status",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"APPLY-FILTERS": "Apply filters" "APPLY-FILTERS": "Apply filters"
}, },
@ -1049,11 +1051,13 @@
"NAME": "Name", "NAME": "Name",
"STATUS": "Status", "STATUS": "Status",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
"IS-ACTIVE": "Is Active", "IS-ACTIVE": "Is Active",
"STATUS": "Status",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"APPLY-FILTERS": "Apply filters" "APPLY-FILTERS": "Apply filters"
}, },
@ -1076,7 +1080,8 @@
"NAME": "Name", "NAME": "Name",
"CODE": "Code", "CODE": "Code",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
@ -1103,7 +1108,8 @@
"NAME": "Name", "NAME": "Name",
"CODE": "Code", "CODE": "Code",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
@ -1129,13 +1135,17 @@
"FIELDS": { "FIELDS": {
"LABEL": "Label", "LABEL": "Label",
"SOURCE": "Source", "SOURCE": "Source",
"TYPE": "Type", "SOURCE-TYPE": "Source Type",
"TYPE": "Reference Type",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
"IS-ACTIVE": "Is Active", "IS-ACTIVE": "Is Active",
"TYPE": "Type",
"SOURCE-TYPE": "Source Type",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"APPLY-FILTERS": "Apply filters" "APPLY-FILTERS": "Apply filters"
}, },
@ -1157,7 +1167,8 @@
"FIELDS": { "FIELDS": {
"CODE": "Code", "CODE": "Code",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
@ -1590,11 +1601,13 @@
"STATUS": "Status", "STATUS": "Status",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created", "CREATED-AT": "Created",
"PUBLISHED-AT": "Published" "PUBLISHED-AT": "Published",
"IS-ACTIVE":"Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
"IS-ACTIVE": "Is Active", "IS-ACTIVE": "Is Active",
"STATUS": "Status",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"APPLY-FILTERS": "Apply filters" "APPLY-FILTERS": "Apply filters"
}, },
@ -1800,11 +1813,13 @@
"ROLES": "Roles", "ROLES": "Roles",
"NAME": "Name", "NAME": "Name",
"UPDATED-AT": "Updated", "UPDATED-AT": "Updated",
"CREATED-AT": "Created" "CREATED-AT": "Created",
"IS-ACTIVE": "Is Active"
}, },
"FILTER": { "FILTER": {
"TITLE": "Filters", "TITLE": "Filters",
"IS-ACTIVE": "Is Active", "IS-ACTIVE": "Is Active",
"ROLES": "Roles",
"CANCEL": "Cancel", "CANCEL": "Cancel",
"APPLY-FILTERS": "Apply filters" "APPLY-FILTERS": "Apply filters"
}, },
@ -1821,6 +1836,10 @@
"MANAGER": "Manager", "MANAGER": "Manager",
"DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor" "DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor"
}, },
"IS-ACTIVE":{
"ACTIVE":"Active",
"INACTIVE":"Inactive"
},
"DMP-PROFILE-FIELD": { "DMP-PROFILE-FIELD": {
"DATA-TYPE": { "DATA-TYPE": {
"DATE": "Date", "DATE": "Date",

View File

@ -5,6 +5,8 @@ import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pi
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe'; import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe'; import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
import { IsActiveTypePipe } from './pipes/is-active-type.pipe'; import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
import { ReferenceTypePipe } from './pipes/reference-type.pipe';
import { ReferenceSourceTypePipe } from './pipes/reference-source-type.pipe';
// //
// //
@ -21,8 +23,9 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
ArrayToStringPipe, ArrayToStringPipe,
DateOnlyPipe, DateOnlyPipe,
DataTableDateOnlyFormatPipe, DataTableDateOnlyFormatPipe,
IsActiveTypePipe IsActiveTypePipe,
ReferenceTypePipe,
ReferenceSourceTypePipe
], ],
exports: [ exports: [
DateFormatPipe, DateFormatPipe,
@ -33,7 +36,9 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
ArrayToStringPipe, ArrayToStringPipe,
DateOnlyPipe, DateOnlyPipe,
DataTableDateOnlyFormatPipe, DataTableDateOnlyFormatPipe,
IsActiveTypePipe IsActiveTypePipe,
ReferenceTypePipe,
ReferenceSourceTypePipe
], ],
providers: [ providers: [
DateFormatPipe, DateFormatPipe,
@ -44,7 +49,9 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
ArrayToStringPipe, ArrayToStringPipe,
DateOnlyPipe, DateOnlyPipe,
DataTableDateOnlyFormatPipe, DataTableDateOnlyFormatPipe,
IsActiveTypePipe IsActiveTypePipe,
ReferenceTypePipe,
ReferenceSourceTypePipe
] ]
}) })
export class CommonFormattingModule { } export class CommonFormattingModule { }

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@Pipe({ name: 'AppRoleTypeFormat' })
export class AppRoleTypePipe implements PipeTransform {
constructor(private enumUtils: EnumUtils) { }
public transform(value): any {
return this.enumUtils.toAppRoleString(value);
}
}

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@Pipe({ name: 'ReferenceSourceTypeFormat' })
export class ReferenceSourceTypePipe implements PipeTransform {
constructor(private enumUtils: EnumUtils) { }
public transform(value): any {
return this.enumUtils.toReferenceSourceTypeString(value);
}
}

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
@Pipe({ name: 'ReferenceTypeFormat' })
export class ReferenceTypePipe implements PipeTransform {
constructor(private enumUtils: EnumUtils) { }
public transform(value): any {
return this.enumUtils.toReferenceTypeString(value);
}
}