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-error>
</mat-form-field> </mat-form-field>
<tb-entity-autocomplete <tb-entity-autocomplete
label="device-profile.default-rule-chain" labelText="device-profile.default-rule-chain"
[entityType]="entityType.RULE_CHAIN" [entityType]="entityType.RULE_CHAIN"
formControlName="defaultRuleChainId"> formControlName="defaultRuleChainId">
</tb-entity-autocomplete> </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() @Input()
excludeEntityIds: Array<string>; excludeEntityIds: Array<string>;
@Input()
labelText: string;
@Input()
requiredText: string;
private requiredValue: boolean; private requiredValue: boolean;
get required(): boolean { get required(): boolean {
return this.requiredValue; return this.requiredValue;
@ -89,21 +95,6 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
@Input() @Input()
disabled: boolean; 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; @ViewChild('entityInput', {static: true}) entityInput: ElementRef;
entityText: string; entityText: string;
@ -227,13 +218,12 @@ export class EntityAutocompleteComponent implements ControlValueAccessor, OnInit
break; break;
} }
} }
if (this.labelValue) { if (this.labelText && this.labelText.length) {
this.entityText = this.labelValue; this.entityText = this.labelText;
} }
if (this.requiredTextValue) { if (this.requiredText && this.requiredText.length) {
this.entityRequiredText = this.requiredTextValue; this.entityRequiredText = this.requiredText;
} }
const currentEntity = this.getCurrentEntity(); const currentEntity = this.getCurrentEntity();
if (currentEntity) { if (currentEntity) {
const currentEntityType = currentEntity.id.entityType; const currentEntityType = currentEntity.id.entityType;

Loading…
Cancel
Save