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