added description role filter
This commit is contained in:
parent
69f74e48fe
commit
67913b8783
|
@ -2,5 +2,5 @@ export enum DmpUserRole {
|
||||||
Owner = 0,
|
Owner = 0,
|
||||||
Viewer = 1,
|
Viewer = 1,
|
||||||
DescriptionContributor = 2,
|
DescriptionContributor = 2,
|
||||||
Reviewer= 3
|
Reviewer = 3
|
||||||
}
|
}
|
|
@ -25,8 +25,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter {
|
||||||
descriptionTagSubQuery: DescriptionTagLookup;
|
descriptionTagSubQuery: DescriptionTagLookup;
|
||||||
descriptionReferenceSubQuery: DescriptionReferenceLookup;
|
descriptionReferenceSubQuery: DescriptionReferenceLookup;
|
||||||
|
|
||||||
roleInDmp: DmpUserRole[]; //TODO
|
showAllVersions: boolean; //TODO ??
|
||||||
showAllVersions: boolean; //TODO
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -44,7 +43,6 @@ export interface DescriptionFilter {
|
||||||
isActive: IsActive[];
|
isActive: IsActive[];
|
||||||
statuses: DescriptionStatus[];
|
statuses: DescriptionStatus[];
|
||||||
showAllVersions: boolean;
|
showAllVersions: boolean;
|
||||||
roleInDmp: DmpUserRole[];
|
|
||||||
|
|
||||||
dmpSubQuery: DmpLookup;
|
dmpSubQuery: DmpLookup;
|
||||||
descriptionTemplateSubQuery: DescriptionTemplateLookup;
|
descriptionTemplateSubQuery: DescriptionTemplateLookup;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { Guid } from "@common/types/guid";
|
||||||
|
import { IsActive } from "../common/enum/is-active.enum";
|
||||||
|
import { Lookup } from "@common/model/lookup";
|
||||||
|
|
||||||
|
export class DmpUserLookup extends Lookup implements DmpUserFilter {
|
||||||
|
ids: Guid[];
|
||||||
|
isActive: IsActive[];
|
||||||
|
dmpIds: Guid[];
|
||||||
|
userIds: Guid[];
|
||||||
|
sectionIds: Guid[];
|
||||||
|
userRoles: Guid[];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DmpUserFilter {
|
||||||
|
ids: Guid[];
|
||||||
|
isActive: IsActive[];
|
||||||
|
|
||||||
|
dmpIds: Guid[];
|
||||||
|
userIds: Guid[];
|
||||||
|
sectionIds: Guid[];
|
||||||
|
userRoles: Guid[];
|
||||||
|
}
|
|
@ -5,8 +5,8 @@ import { DmpStatus } from '../common/enum/dmp-status';
|
||||||
import { DmpVersionStatus } from '../common/enum/dmp-version-status';
|
import { DmpVersionStatus } from '../common/enum/dmp-version-status';
|
||||||
import { IsActive } from '../common/enum/is-active.enum';
|
import { IsActive } from '../common/enum/is-active.enum';
|
||||||
import { DmpDescriptionTemplateLookup } from './dmp-description-template.lookup';
|
import { DmpDescriptionTemplateLookup } from './dmp-description-template.lookup';
|
||||||
import { DmpUserRole } from '../common/enum/dmp-user-role';
|
|
||||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||||
|
import { DmpUserLookup } from './dmp-user.lookup';
|
||||||
|
|
||||||
export class DmpLookup extends Lookup implements DmpFilter {
|
export class DmpLookup extends Lookup implements DmpFilter {
|
||||||
ids: Guid[];
|
ids: Guid[];
|
||||||
|
@ -20,9 +20,10 @@ export class DmpLookup extends Lookup implements DmpFilter {
|
||||||
dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup;
|
dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup;
|
||||||
groupIds: Guid[];
|
groupIds: Guid[];
|
||||||
|
|
||||||
|
dmpUserSubQuery: DmpUserLookup;
|
||||||
|
|
||||||
dmpBlueprintIds: Guid[]; //TODO
|
dmpBlueprintIds: Guid[]; //TODO
|
||||||
descriptionTemplateIds: Guid[]; //TODO
|
descriptionTemplateIds: Guid[]; //TODO
|
||||||
roleInDmp: DmpUserRole[]; //TODO
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
@ -30,7 +31,7 @@ export class DmpLookup extends Lookup implements DmpFilter {
|
||||||
|
|
||||||
from(formGroup: UntypedFormGroup): void {
|
from(formGroup: UntypedFormGroup): void {
|
||||||
this.statuses = formGroup.get('status')?.value ? [formGroup.get('status')?.value] : null;
|
this.statuses = formGroup.get('status')?.value ? [formGroup.get('status')?.value] : null;
|
||||||
this.roleInDmp = formGroup.get('role')?.value ? [formGroup.get('role')?.value] : null;
|
// this.roleInDmp = formGroup.get('role')?.value ? [formGroup.get('role')?.value] : null;
|
||||||
this.dmpBlueprintIds = formGroup.get('dmpBlueprintIds')?.value ? formGroup.get('dmpBlueprintIds')?.value : null;
|
this.dmpBlueprintIds = formGroup.get('dmpBlueprintIds')?.value ? formGroup.get('dmpBlueprintIds')?.value : null;
|
||||||
this.descriptionTemplateIds = formGroup.get('descriptionTemplateIds')?.value ? formGroup.get('descriptionTemplateIds')?.value : null;
|
this.descriptionTemplateIds = formGroup.get('descriptionTemplateIds')?.value ? formGroup.get('descriptionTemplateIds')?.value : null;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,7 @@ export class DmpLookup extends Lookup implements DmpFilter {
|
||||||
buildForm(): UntypedFormGroup {
|
buildForm(): UntypedFormGroup {
|
||||||
return (new UntypedFormBuilder()).group({
|
return (new UntypedFormBuilder()).group({
|
||||||
status: [this.statuses ? this.statuses[0] : null],
|
status: [this.statuses ? this.statuses[0] : null],
|
||||||
role: [this.roleInDmp ? this.roleInDmp[0] : null],
|
// role: [this.roleInDmp ? this.roleInDmp[0] : null],
|
||||||
dmpBlueprintIds: [this.dmpBlueprintIds],
|
dmpBlueprintIds: [this.dmpBlueprintIds],
|
||||||
descriptionTemplateIds: [this.descriptionTemplateIds],
|
descriptionTemplateIds: [this.descriptionTemplateIds],
|
||||||
});
|
});
|
||||||
|
@ -56,7 +57,8 @@ export interface DmpFilter {
|
||||||
versions: Number[];
|
versions: Number[];
|
||||||
groupIds: Guid[];
|
groupIds: Guid[];
|
||||||
|
|
||||||
|
dmpUserSubQuery: DmpUserLookup;
|
||||||
|
|
||||||
dmpBlueprintIds: Guid[]; //TODO
|
dmpBlueprintIds: Guid[]; //TODO
|
||||||
descriptionTemplateIds: Guid[]; //TODO
|
descriptionTemplateIds: Guid[]; //TODO
|
||||||
roleInDmp: DmpUserRole[]; //TODO
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="listingItems && listingItems.length > 0 || lookup.like || lookup.descriptionTemplateSubQuery || lookup.dmpSubQuery || lookup.roleInDmp || lookup.descriptionTagSubQuery || lookup.descriptionReferenceSubQuery"
|
<div *ngIf="listingItems && listingItems.length > 0 || lookup.like || lookup.descriptionTemplateSubQuery || lookup.dmpSubQuery || lookup.dmpUserRoles || lookup.descriptionTagSubQuery || lookup.descriptionReferenceSubQuery"
|
||||||
class="filter-btn" [style.right]="dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="listingItems.length > 2 ? '57px' : '37px'" (click)="openFiltersDialog()">
|
class="filter-btn" [style.right]="dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="listingItems.length > 2 ? '57px' : '37px'" (click)="openFiltersDialog()">
|
||||||
<button mat-raised-button class="p-0">
|
<button mat-raised-button class="p-0">
|
||||||
<mat-icon class="mr-4 filter-icon">filter_alt</mat-icon>
|
<mat-icon class="mr-4 filter-icon">filter_alt</mat-icon>
|
||||||
|
|
|
@ -42,6 +42,7 @@ import { Tag } from '@app/core/model/tag/tag';
|
||||||
import { D } from '@angular/cdk/keycodes';
|
import { D } from '@angular/cdk/keycodes';
|
||||||
import { DmpLookup } from '@app/core/query/dmp.lookup';
|
import { DmpLookup } from '@app/core/query/dmp.lookup';
|
||||||
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
||||||
|
import { DmpUserLookup } from '@app/core/query/dmp-user.lookup';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-description-listing-component',
|
selector: 'app-description-listing-component',
|
||||||
|
@ -233,6 +234,19 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
||||||
return lookup;
|
return lookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected initializeDmpUserLookup(): DmpUserLookup {
|
||||||
|
const lookup = new DmpUserLookup();
|
||||||
|
lookup.metadata = { countAll: true };
|
||||||
|
lookup.isActive = [IsActive.Active];
|
||||||
|
lookup.project = {
|
||||||
|
fields: [
|
||||||
|
[nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
return lookup;
|
||||||
|
}
|
||||||
|
|
||||||
protected initializeDescriptionTemplateLookup(): DescriptionTemplateLookup {
|
protected initializeDescriptionTemplateLookup(): DescriptionTemplateLookup {
|
||||||
const lookup = new DescriptionTemplateLookup();
|
const lookup = new DescriptionTemplateLookup();
|
||||||
lookup.metadata = { countAll: true };
|
lookup.metadata = { countAll: true };
|
||||||
|
@ -422,7 +436,6 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
||||||
|
|
||||||
lookup.statuses = formGroup.get("status")?.value !== null ? [formGroup.get("status")?.value] : null;
|
lookup.statuses = formGroup.get("status")?.value !== null ? [formGroup.get("status")?.value] : null;
|
||||||
lookup.showAllVersions = formGroup.get("showAllVersions")?.value ?? false;
|
lookup.showAllVersions = formGroup.get("showAllVersions")?.value ?? false;
|
||||||
lookup.roleInDmp = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null;
|
|
||||||
|
|
||||||
// Description Templates
|
// Description Templates
|
||||||
let descriptionTemplates = formGroup.get("descriptionTemplates")?.value ?? null;
|
let descriptionTemplates = formGroup.get("descriptionTemplates")?.value ?? null;
|
||||||
|
@ -432,10 +445,17 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
||||||
} else lookup.descriptionTemplateSubQuery = null;
|
} else lookup.descriptionTemplateSubQuery = null;
|
||||||
|
|
||||||
// Dmps
|
// Dmps
|
||||||
let dmps = formGroup.get("associatedDmpIds")?.value ?? null;
|
let dmps = formGroup.get("associatedDmpIds")?.value ?? null; let addDmps = dmps && dmps?.length > 0;
|
||||||
if (dmps && dmps?.length > 0) {
|
let roles = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null; let addRoles = roles && roles?.length > 0;
|
||||||
|
if (addDmps || addRoles) {
|
||||||
lookup.dmpSubQuery = this.initializeDmpLookup();
|
lookup.dmpSubQuery = this.initializeDmpLookup();
|
||||||
lookup.dmpSubQuery.ids = dmps;
|
|
||||||
|
if (addDmps) lookup.dmpSubQuery.ids = dmps?.length > 0 ? dmps : null;
|
||||||
|
|
||||||
|
if (addRoles) {
|
||||||
|
lookup.dmpSubQuery.dmpUserSubQuery = this.initializeDmpUserLookup();
|
||||||
|
lookup.dmpSubQuery.dmpUserSubQuery.userRoles = roles;
|
||||||
|
}
|
||||||
} else lookup.dmpSubQuery = null;
|
} else lookup.dmpSubQuery = null;
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
|
@ -476,7 +496,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
||||||
|
|
||||||
return (new UntypedFormBuilder()).group({
|
return (new UntypedFormBuilder()).group({
|
||||||
status: [lookup.statuses?.length > 0 ? lookup.statuses[0] : null],
|
status: [lookup.statuses?.length > 0 ? lookup.statuses[0] : null],
|
||||||
role: [lookup.roleInDmp?.length > 0 ? lookup.roleInDmp[0] : null],
|
role: lookup.dmpSubQuery?.dmpUserSubQuery?.userRoles ? lookup.dmpSubQuery?.dmpUserSubQuery?.userRoles[0] : [],
|
||||||
showAllVersions: [lookup.showAllVersions ?? false],
|
showAllVersions: [lookup.showAllVersions ?? false],
|
||||||
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ? [lookup.descriptionTemplateSubQuery?.ids] : [],
|
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ? [lookup.descriptionTemplateSubQuery?.ids] : [],
|
||||||
associatedDmpIds: lookup.dmpSubQuery?.ids ? [lookup.dmpSubQuery?.ids] : [],
|
associatedDmpIds: lookup.dmpSubQuery?.ids ? [lookup.dmpSubQuery?.ids] : [],
|
||||||
|
|
|
@ -56,11 +56,11 @@
|
||||||
<div class="col-10" *ngIf="isAuthenticated()">
|
<div class="col-10" *ngIf="isAuthenticated()">
|
||||||
<h6 class="category-title">{{'DESCRIPTION-LISTING.FILTERS.ROLE.NAME' | translate }}</h6>
|
<h6 class="category-title">{{'DESCRIPTION-LISTING.FILTERS.ROLE.NAME' | translate }}</h6>
|
||||||
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')" class="row">
|
<mat-radio-group aria-label="Select an option" [formControl]="formGroup.get('role')" class="row">
|
||||||
<mat-radio-button value="null" [checked]="formGroup.get('role').value == null" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.ANY' | translate }}</mat-radio-button>
|
<mat-radio-button [value]="null" [checked]="formGroup.get('role').value == null" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.ANY' | translate }}</mat-radio-button>
|
||||||
<mat-radio-button value="0" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.OWNER' | translate }}</mat-radio-button>
|
<mat-radio-button [value]="dmpRole.Owner" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.OWNER' | translate }}</mat-radio-button>
|
||||||
<mat-radio-button value="1" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.VIEWER' | translate }}</mat-radio-button>
|
<mat-radio-button [value]="dmpRole.Viewer" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.VIEWER' | translate }}</mat-radio-button>
|
||||||
<mat-radio-button value="2" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.DESCRIPTION-CONTRIBUTOR' | translate }}</mat-radio-button>
|
<mat-radio-button [value]="dmpRole.DescriptionContributor" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.DESCRIPTION-CONTRIBUTOR' | translate }}</mat-radio-button>
|
||||||
<mat-radio-button value="3" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.REVIEWER' | translate }}</mat-radio-button>
|
<mat-radio-button [value]="dmpRole.Reviewer" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.REVIEWER' | translate }}</mat-radio-button>
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||||
import { FormBuilder, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
import { FormBuilder, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
|
||||||
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
import { DescriptionStatus } from '@app/core/common/enum/description-status';
|
||||||
|
import { DmpUserRole } from '@app/core/common/enum/dmp-user-role';
|
||||||
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';
|
||||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
@ -34,6 +35,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements
|
||||||
public filteringTagsAsync = false;
|
public filteringTagsAsync = false;
|
||||||
|
|
||||||
statuses = DescriptionStatus;
|
statuses = DescriptionStatus;
|
||||||
|
dmpRole = DmpUserRole;
|
||||||
options: UntypedFormGroup;
|
options: UntypedFormGroup;
|
||||||
selectedReferenceTypes: Guid[];
|
selectedReferenceTypes: Guid[];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue