CHANGE: entity_type in select
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<div class="property">
|
||||
<p>Bereich</p>
|
||||
<input type="text" [ngModel]="generatorService.upperTopic"
|
||||
(ngModelChange)="generatorService.upperTopic = $event; generatorService.update()" />
|
||||
(ngModelChange)="generatorService.upperTopic = $event" />
|
||||
</div>
|
||||
<div class="property">
|
||||
<p>Automatische Topics</p>
|
||||
@@ -20,9 +20,16 @@
|
||||
<label class="customCheckbox" for="auto_topic_2">Aus</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-2 property">
|
||||
<h3>EntityTyp:</h3>
|
||||
<select [ngModel]="entity_type" (ngModelChange)="select_type($event)">
|
||||
<option *ngFor="let key of useObject.keys(generatorService.entity_types)" value="{{key}}">{{generatorService.entity_types[key][0]}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<app-entity class="genContainer" ></app-entity>
|
||||
<app-entity-data class="genContainer" [basemodel]="generatorService.selected_entity" *ngIf="generatorService.selected_entity != null" ></app-entity-data>
|
||||
<!-- <app-entity class="genContainer" ></app-entity> -->
|
||||
</div>
|
||||
@@ -1,21 +1,17 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { MqttLight } from '../_models/mqtt-light';
|
||||
import { MqttSwitch } from '../_models/mqtt-switch';
|
||||
import { MqttSensor } from '../_models/mqtt-sensor';
|
||||
import { MqttBinary } from '../_models/mqtt-binary';
|
||||
import { GeneratorService, entity_types, randomString } from '../_services/generator.service';
|
||||
import { MQTTEntity } from '../_models/mqtt_base';
|
||||
import { Component } from '@angular/core';
|
||||
import { EntityService } from '../_services/entity.service';
|
||||
import { GeneratorService, randomString } from '../_services/generator.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
templateUrl: './generator.component.html',
|
||||
styleUrl: './generator.component.css'
|
||||
styleUrl: './generator.component.css',
|
||||
})
|
||||
|
||||
export class GeneratorComponent {
|
||||
constructor(public generatorService: GeneratorService) {
|
||||
}
|
||||
|
||||
constructor(
|
||||
public generatorService: GeneratorService,
|
||||
private entityService: EntityService
|
||||
) {}
|
||||
|
||||
readonly useObject = Object;
|
||||
readonly useRandomString = randomString;
|
||||
@@ -29,16 +25,23 @@ export class GeneratorComponent {
|
||||
return String(this.generatorService.auto_topic);
|
||||
}
|
||||
|
||||
log(event:any){
|
||||
console.log(Number(event));
|
||||
entity_type: number = 0;
|
||||
|
||||
select_type(etype: number) {
|
||||
let ent_type =
|
||||
this.generatorService.entity_types[
|
||||
etype as keyof typeof this.generatorService.entity_types
|
||||
];
|
||||
let ent_class = ent_type[1];
|
||||
if (typeof ent_class === 'function' && etype != 0) {
|
||||
let entity_model = new ent_class();
|
||||
this.generatorService.selected_entity = entity_model;
|
||||
} else this.generatorService.selected_entity = null;
|
||||
this.entity_type = etype;
|
||||
console.log(this.generatorService.selected_entity);
|
||||
}
|
||||
|
||||
|
||||
log(event: any) {
|
||||
console.log(Number(event));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user