Version 1.0 working Entity creation and string generator
This commit is contained in:
73
src/app/entity/entity.component.html
Normal file
73
src/app/entity/entity.component.html
Normal file
@@ -0,0 +1,73 @@
|
||||
<main class="grid grid-cols-2 gap-4">
|
||||
<!-- Entity -->
|
||||
<div class="col-span-2 property">
|
||||
<h3>EntityTyp:</h3>
|
||||
<select [ngModel]="entity_type" (ngModelChange)="select_type($event)">
|
||||
<option *ngFor="let key of useObject.keys(entities)" value="{{key}}">{{entities[key][0]}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="property" *ngIf="generatorService.has_property('name')">
|
||||
<p>Name</p>
|
||||
<input placeholder="Name here" type="text"[ngModel]="entity_name" (ngModelChange)="entity_name = $event; updateStateTopic()"/>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('uniq_id')">
|
||||
<p>Uniqe ID</p>
|
||||
<div class="flex-row flex gap-2">
|
||||
<input type="text"[ngModel]="entity_uniq_id" (ngModelChange)="entity_uniq_id = $event; updateStateTopic()"/>
|
||||
<button (click)="entity_uniq_id = useRandomString(10); updateStateTopic()" class="randomButton" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
|
||||
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('cmd_t')">
|
||||
<p>Command Topic</p>
|
||||
<input type="text" [ngModel]="entity_cmd_t" (ngModelChange)="entity_cmd_t = $event"/>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('bri_cmd_t')">
|
||||
<p>Brightness Command Topic</p>
|
||||
<input type="text" [ngModel]="entity_bri_cmd_t" (ngModelChange)="entity_bri_cmd_t = $event"/>
|
||||
</div>
|
||||
<div class="property !flex-row" >
|
||||
<div *ngIf="generatorService.has_property('pl_off')">
|
||||
<p>Payload off</p>
|
||||
<input type="text" [ngModel]="entity_pl_off" (ngModelChange)="entity_pl_off = $event"/>
|
||||
</div>
|
||||
<div *ngIf="generatorService.has_property('pl_on')">
|
||||
<p>Payload on</p>
|
||||
<input type="text" [ngModel]="entity_pl_on" (ngModelChange)="entity_pl_on = $event"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('unit_of_meas')">
|
||||
<p>Unit of meassurement</p>
|
||||
<input type="text" [ngModel]="entity_unit_of_meas" (ngModelChange)="entity_unit_of_meas = $event"/>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('val_tpl')">
|
||||
<p>Value Template</p>
|
||||
<input type="text" [ngModel]="entity_val_tpl" (ngModelChange)="entity_val_tpl = $event"/>
|
||||
</div>
|
||||
<div class="property" *ngIf="generatorService.has_property('dev_cla')">
|
||||
<p>Device Class</p>
|
||||
<input type="text" [ngModel]="entity_dev_cla" (ngModelChange)="entity_dev_cla = $event"/>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="property" *ngIf="generatorService.has_property('stat_t')">
|
||||
<p>State Topic</p>
|
||||
<input type="text" [ngModel]="state_topic" (change)="lockStateTopic($event)"/>
|
||||
</div>
|
||||
<button class="col-span-2 py-1" (click)="create_entity()" >Create Entity</button>
|
||||
<ng-container *ngIf="showDiscovery">
|
||||
<div class="col-span-2 property" >
|
||||
<p>Discovery String</p>
|
||||
<span contenteditable>{{discoveryString}}</span>
|
||||
</div>
|
||||
<div class="col-span-2 property" >
|
||||
<p>Discovery Topic</p>
|
||||
<input type="text" readonly value="{{discoveryTopic}}">
|
||||
</div>
|
||||
</ng-container>
|
||||
</main>
|
||||
Reference in New Issue
Block a user