mirror of
https://github.com/sensebox/blockly-app
synced 2025-07-01 00:00:25 +02:00
remove sensors
This commit is contained in:
parent
f86fcb92eb
commit
eb5e7106a5
3 changed files with 13 additions and 8 deletions
|
@ -100,6 +100,6 @@
|
|||
},
|
||||
"CONFIG":{
|
||||
"TITLE":"Initial configuration",
|
||||
"BUTTON":"Upload standard senseBox Sketch!"
|
||||
"BUTTON":"Upload!"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
<ion-input [(ngModel)]="senseboxid" placeholder="5c4f75e83580950019240779"></ion-input>
|
||||
</ion-item>
|
||||
</ion-row>
|
||||
<ion-row *ngFor="let sensor of sensors;let i=index;let last = last;let first=first" (click)="viewSensor(sensor)">
|
||||
<ion-row *ngFor="let sensor of sensors;let i=index;let last = last;let first=first" >
|
||||
<ion-col col-8>
|
||||
<ion-item>
|
||||
<ion-item (click)="viewSensor(sensor)">
|
||||
<ion-label>{{sensor.title}} {{sensor.id}}</ion-label>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col *ngIf="!first" col-2>
|
||||
<button ion-item (click)="removeSensor()">
|
||||
<button ion-item (click)="removeSensor(sensor)">
|
||||
<ion-icon name="remove" item-start></ion-icon>
|
||||
</button>
|
||||
</ion-col>
|
||||
|
@ -60,7 +60,7 @@
|
|||
</ion-row>
|
||||
<ion-row>
|
||||
<button ion-item (click)="uploadStandardSketch()">
|
||||
<ion-icon name="refresh" item-start></ion-icon>
|
||||
<ion-icon name="send" item-start></ion-icon>
|
||||
<ion-label>
|
||||
<h2 translate>CONFIG.BUTTON</h2>
|
||||
</ion-label>
|
||||
|
|
|
@ -52,7 +52,7 @@ export class ConfigurationPage {
|
|||
PASSWORD:this.pw,
|
||||
INGRESS_DOMAIN:"ingress.opensensemap.org",
|
||||
SENSEBOX_ID:this.senseboxid,
|
||||
NUM_SENSORS:6,
|
||||
NUM_SENSORS:this.sensors.length,
|
||||
TEMPERSENSOR_ID:this.temp,
|
||||
RELLUFSENSOR_ID:this.humi,
|
||||
BELEUCSENSOR_ID:this.lux,
|
||||
|
@ -69,8 +69,6 @@ export class ConfigurationPage {
|
|||
}
|
||||
|
||||
addSensor(){
|
||||
console.log("adding sensor");
|
||||
|
||||
let addModal = this.modalCtrl.create(AddItemPage);
|
||||
|
||||
addModal.onDidDismiss((sensor)=>{
|
||||
|
@ -85,6 +83,7 @@ export class ConfigurationPage {
|
|||
|
||||
saveSensor(sensor){
|
||||
this.sensors.push(sensor);
|
||||
// add define statements
|
||||
}
|
||||
|
||||
viewSensor(sensor){
|
||||
|
@ -93,6 +92,12 @@ export class ConfigurationPage {
|
|||
})
|
||||
}
|
||||
|
||||
removeSensor(sensor){
|
||||
this.sensors = this.sensors.filter((sensorF)=>{
|
||||
return sensor!=sensorF
|
||||
})
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
this.sensors =[
|
||||
{title:"Temperatur",type:"temp",id:"09327523"},
|
||||
|
|
Loading…
Add table
Reference in a new issue