Browse Source

UI: Minor changes

pull/3477/head
Igor Kulikov 6 years ago
parent
commit
3165ba0105
  1. 2
      ui-ngx/src/app/modules/home/components/profile/device-profile.component.html
  2. 30
      ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts

2
ui-ngx/src/app/modules/home/components/profile/device-profile.component.html

@ -50,7 +50,7 @@
</mat-error>
</mat-form-field>
<tb-entity-autocomplete
label="device-profile.default-rule-chain"
labelText="device-profile.default-rule-chain"
[entityType]="entityType.RULE_CHAIN"
formControlName="defaultRuleChainId">
</tb-entity-autocomplete>

30
ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts

@ -77,6 +77,12 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
@Input()
excludeEntityIds: Array<string>;
@Input()
labelText: string;
@Input()
requiredText: string;
private requiredValue: boolean;
get required(): boolean {
return this.requiredValue;
@ -89,21 +95,6 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
@Input()
disabled: boolean;
labelValue: string;
@Input()
set label(label: string) {
this.labelValue = label;
this.entityText = label;
}
requiredTextValue: string;
@Input()
set requiredText(requiredText: string) {
this.requiredTextValue = requiredText;
}
@ViewChild('entityInput', {static: true}) entityInput: ElementRef;
entityText: string;
@ -227,13 +218,12 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
break;
}
}
if (this.labelValue) {
this.entityText = this.labelValue;
if (this.labelText && this.labelText.length) {
this.entityText = this.labelText;
}
if (this.requiredTextValue) {
this.entityRequiredText = this.requiredTextValue;
if (this.requiredText && this.requiredText.length) {
this.entityRequiredText = this.requiredText;
}
const currentEntity = this.getCurrentEntity();
if (currentEntity) {
const currentEntityType = currentEntity.id.entityType;

Loading…
Cancel
Save