Browse Source

Merge branch 'AD/bug-fix/delete-recipient' of github.com:ArtemDzhereleiko/thingsboard into AD/bug-fix/delete-recipient

pull/11337/head
Vladyslav_Prykhodko 2 years ago
parent
commit
521c2ec484
  1. 1
      ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html
  2. 9
      ui-ngx/src/app/shared/components/entity/entity-list.component.ts

1
ui-ngx/src/app/modules/home/pages/notification/sent/sent-notification-dialog.component.html

@ -104,6 +104,7 @@
</ng-template>
<ng-template #recipientsList>
<tb-entity-list
syncedIdListPropagator
required
formControlName="targets"
labelText="{{ 'notification.recipients' | translate }}"

9
ui-ngx/src/app/shared/components/entity/entity-list.component.ts

@ -45,6 +45,7 @@ import { MatAutocomplete } from '@angular/material/autocomplete';
import { MatChipGrid } from '@angular/material/chips';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { SubscriptSizing } from '@angular/material/form-field';
import { coerceBoolean } from '@shared/decorators/coercion';
@Component({
selector: 'tb-entity-list',
@ -106,6 +107,10 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
@Input()
hint: string;
@Input()
@coerceBoolean()
syncedIdListPropagator = false;
@ViewChild('entityInput') entityInput: ElementRef<HTMLInputElement>;
@ViewChild('entityAutocomplete') matAutocomplete: MatAutocomplete;
@ViewChild('chipList', {static: true}) chipList: MatChipGrid;
@ -189,6 +194,10 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
(entities) => {
this.entities = entities;
this.entityListFormGroup.get('entities').setValue(this.entities);
if (this.syncedIdListPropagator && this.modelValue.length !== entities.length) {
this.modelValue = entities.map(entity => entity.id.id);
this.propagateChange(this.modelValue);
}
}
);
} else {

Loading…
Cancel
Save