Compare commits

..

2 Commits

8 changed files with 68 additions and 20 deletions

View File

@ -2,5 +2,5 @@ export enum DmpUserRole {
Owner = 0,
Viewer = 1,
DescriptionContributor = 2,
Reviewer= 3
Reviewer = 3
}

View File

@ -25,8 +25,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter {
descriptionTagSubQuery: DescriptionTagLookup;
descriptionReferenceSubQuery: DescriptionReferenceLookup;
roleInDmp: DmpUserRole[]; //TODO
showAllVersions: boolean; //TODO
showAllVersions: boolean; //TODO ??
constructor() {
super();
@ -44,7 +43,6 @@ export interface DescriptionFilter {
isActive: IsActive[];
statuses: DescriptionStatus[];
showAllVersions: boolean;
roleInDmp: DmpUserRole[];
dmpSubQuery: DmpLookup;
descriptionTemplateSubQuery: DescriptionTemplateLookup;

View File

@ -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[];
}

View File

@ -5,8 +5,8 @@ import { DmpStatus } from '../common/enum/dmp-status';
import { DmpVersionStatus } from '../common/enum/dmp-version-status';
import { IsActive } from '../common/enum/is-active.enum';
import { DmpDescriptionTemplateLookup } from './dmp-description-template.lookup';
import { DmpUserRole } from '../common/enum/dmp-user-role';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { DmpUserLookup } from './dmp-user.lookup';
export class DmpLookup extends Lookup implements DmpFilter {
ids: Guid[];
@ -20,9 +20,10 @@ export class DmpLookup extends Lookup implements DmpFilter {
dmpDescriptionTemplateSubQuery: DmpDescriptionTemplateLookup;
groupIds: Guid[];
dmpUserSubQuery: DmpUserLookup;
dmpBlueprintIds: Guid[]; //TODO
descriptionTemplateIds: Guid[]; //TODO
roleInDmp: DmpUserRole[]; //TODO
constructor() {
super();
@ -30,7 +31,7 @@ export class DmpLookup extends Lookup implements DmpFilter {
from(formGroup: UntypedFormGroup): void {
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.descriptionTemplateIds = formGroup.get('descriptionTemplateIds')?.value ? formGroup.get('descriptionTemplateIds')?.value : null;
}
@ -38,7 +39,7 @@ export class DmpLookup extends Lookup implements DmpFilter {
buildForm(): UntypedFormGroup {
return (new UntypedFormBuilder()).group({
status: [this.statuses ? this.statuses[0] : null],
role: [this.roleInDmp ? this.roleInDmp[0] : null],
// role: [this.roleInDmp ? this.roleInDmp[0] : null],
dmpBlueprintIds: [this.dmpBlueprintIds],
descriptionTemplateIds: [this.descriptionTemplateIds],
});
@ -56,7 +57,8 @@ export interface DmpFilter {
versions: Number[];
groupIds: Guid[];
dmpUserSubQuery: DmpUserLookup;
dmpBlueprintIds: Guid[]; //TODO
descriptionTemplateIds: Guid[]; //TODO
roleInDmp: DmpUserRole[]; //TODO
}

View File

@ -29,7 +29,7 @@
</button>
</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()">
<button mat-raised-button class="p-0">
<mat-icon class="mr-4 filter-icon">filter_alt</mat-icon>

View File

@ -42,6 +42,7 @@ import { Tag } from '@app/core/model/tag/tag';
import { D } from '@angular/cdk/keycodes';
import { DmpLookup } from '@app/core/query/dmp.lookup';
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
import { DmpUserLookup } from '@app/core/query/dmp-user.lookup';
@Component({
selector: 'app-description-listing-component',
@ -233,6 +234,19 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
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 {
const lookup = new DescriptionTemplateLookup();
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.showAllVersions = formGroup.get("showAllVersions")?.value ?? false;
lookup.roleInDmp = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null;
// Description Templates
let descriptionTemplates = formGroup.get("descriptionTemplates")?.value ?? null;
@ -432,10 +445,17 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
} else lookup.descriptionTemplateSubQuery = null;
// Dmps
let dmps = formGroup.get("associatedDmpIds")?.value ?? null;
if (dmps && dmps?.length > 0) {
let dmps = formGroup.get("associatedDmpIds")?.value ?? null; let addDmps = 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.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;
// Tags
@ -476,7 +496,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
return (new UntypedFormBuilder()).group({
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],
descriptionTemplates: lookup.descriptionTemplateSubQuery?.ids ? [lookup.descriptionTemplateSubQuery?.ids] : [],
associatedDmpIds: lookup.dmpSubQuery?.ids ? [lookup.dmpSubQuery?.ids] : [],

View File

@ -56,11 +56,11 @@
<div class="col-10" *ngIf="isAuthenticated()">
<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-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="1" 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="3" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.REVIEWER' | 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]="dmpRole.Owner" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.OWNER' | 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]="dmpRole.DescriptionContributor" class="col-12">{{ 'DESCRIPTION-LISTING.FILTERS.ROLE.TYPES.DESCRIPTION-CONTRIBUTOR' | 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>
<hr>
</div>

View File

@ -2,6 +2,7 @@
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import { FormBuilder, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
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 { Reference } from '@app/core/model/reference/reference';
import { AuthService } from '@app/core/services/auth/auth.service';
@ -34,6 +35,7 @@ export class DescriptionFilterComponent extends BaseCriteriaComponent implements
public filteringTagsAsync = false;
statuses = DescriptionStatus;
dmpRole = DmpUserRole;
options: UntypedFormGroup;
selectedReferenceTypes: Guid[];