CHANGE: entity_type in select
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<div class="property">
|
<div class="property">
|
||||||
<p>Bereich</p>
|
<p>Bereich</p>
|
||||||
<input type="text" [ngModel]="generatorService.upperTopic"
|
<input type="text" [ngModel]="generatorService.upperTopic"
|
||||||
(ngModelChange)="generatorService.upperTopic = $event; generatorService.update()" />
|
(ngModelChange)="generatorService.upperTopic = $event" />
|
||||||
</div>
|
</div>
|
||||||
<div class="property">
|
<div class="property">
|
||||||
<p>Automatische Topics</p>
|
<p>Automatische Topics</p>
|
||||||
@@ -20,9 +20,16 @@
|
|||||||
<label class="customCheckbox" for="auto_topic_2">Aus</label>
|
<label class="customCheckbox" for="auto_topic_2">Aus</label>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</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>
|
</div>
|
||||||
@@ -1,21 +1,17 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { MqttLight } from '../_models/mqtt-light';
|
import { EntityService } from '../_services/entity.service';
|
||||||
import { MqttSwitch } from '../_models/mqtt-switch';
|
import { GeneratorService, randomString } from '../_services/generator.service';
|
||||||
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';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
templateUrl: './generator.component.html',
|
templateUrl: './generator.component.html',
|
||||||
styleUrl: './generator.component.css'
|
styleUrl: './generator.component.css',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class GeneratorComponent {
|
export class GeneratorComponent {
|
||||||
constructor(public generatorService: GeneratorService) {
|
constructor(
|
||||||
}
|
public generatorService: GeneratorService,
|
||||||
|
private entityService: EntityService
|
||||||
|
) {}
|
||||||
|
|
||||||
readonly useObject = Object;
|
readonly useObject = Object;
|
||||||
readonly useRandomString = randomString;
|
readonly useRandomString = randomString;
|
||||||
@@ -29,16 +25,23 @@ export class GeneratorComponent {
|
|||||||
return String(this.generatorService.auto_topic);
|
return String(this.generatorService.auto_topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
log(event:any){
|
entity_type: number = 0;
|
||||||
console.log(Number(event));
|
|
||||||
|
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