Browse Source
Merge pull request #10959 from rusikv/enhancement/relation-filters
Relation filter enhancement
pull/10985/head
Igor Kulikov
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
12 additions and
3 deletions
-
ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.ts
-
ui-ngx/src/app/modules/home/components/relation/relation-filters.component.html
-
ui-ngx/src/app/modules/home/components/relation/relation-filters.component.ts
|
|
|
@ -145,7 +145,7 @@ export class EntityAliasDialogComponent extends DialogComponent<EntityAliasDialo |
|
|
|
if (!isEmpty(this.alias.filter?.filters)) { |
|
|
|
this.alias.filter.filters = this.alias.filter.filters.filter((value, index, self) => |
|
|
|
self.findIndex(v => v.relationType === value.relationType && isEqual(v.entityTypes, value.entityTypes)) === index && |
|
|
|
(value.relationType || value.entityTypes.length) |
|
|
|
(value.relationType || value.entityTypes?.length) |
|
|
|
); |
|
|
|
} |
|
|
|
if (this.alias.filter.type) { |
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ |
|
|
|
<div class="tb-form-table-row align-start" |
|
|
|
*ngFor="let relationFilterControl of relationFiltersFormArray.controls; let $index = index"> |
|
|
|
<mat-chip-listbox *ngIf="enableNotOption" class="flex-18 center-stretch" [formControl]="relationFilterControl.get('negate')"> |
|
|
|
<mat-chip-option color="primary" [value]="true">{{ 'relation.not' | translate}}</mat-chip-option> |
|
|
|
<mat-chip-option color="primary" [value]="true">{{ 'relation.not' | translate }}</mat-chip-option> |
|
|
|
</mat-chip-listbox> |
|
|
|
<tb-relation-type-autocomplete subscriptSizing="dynamic" |
|
|
|
class="flex-50" showLabel="false" |
|
|
|
|
|
|
|
@ -128,7 +128,16 @@ export class RelationFiltersComponent extends PageComponent implements ControlVa |
|
|
|
entityTypes: [filter ? filter.entityTypes : []] |
|
|
|
}); |
|
|
|
if (this.enableNotOption) { |
|
|
|
formGroup.addControl('negate', this.fb.control(filter ? filter.negate : false)); |
|
|
|
formGroup.addControl('negate', this.fb.control({value: filter ? filter.negate : false, disabled: true})); |
|
|
|
formGroup.get('relationType').valueChanges.pipe( |
|
|
|
takeUntil(this.destroy$) |
|
|
|
).subscribe(value => { |
|
|
|
if (value) { |
|
|
|
formGroup.get('negate').enable({emitEvent: false}); |
|
|
|
} else { |
|
|
|
formGroup.get('negate').disable({emitEvent: false}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return formGroup; |
|
|
|
} |
|
|
|
|