mirror of
https://github.com/sensebox/blockly-app
synced 2025-07-04 13:00:21 +02:00
updated sensor detail and removed startup errors
This commit is contained in:
parent
40718824b3
commit
8c00e7eeec
9 changed files with 44 additions and 37 deletions
|
@ -40,11 +40,6 @@ export class openSenseApp {
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
component: 'SettingsPage'
|
component: 'SettingsPage'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'MENU.CONFIGURATION',
|
|
||||||
icon: 'settings',
|
|
||||||
component: 'ConfigurationPage'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'MENU.MYSENSEBOX',
|
title: 'MENU.MYSENSEBOX',
|
||||||
icon: "settings",
|
icon: "settings",
|
||||||
|
|
|
@ -57,8 +57,6 @@ export function createTranslateLoader(http: HttpClient) {
|
||||||
MySenseBoxPage,
|
MySenseBoxPage,
|
||||||
SensorsPage,
|
SensorsPage,
|
||||||
ConfigurationPage
|
ConfigurationPage
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
StatusBar,
|
StatusBar,
|
||||||
|
|
|
@ -17,7 +17,10 @@ import { LoginProvider } from "../../providers/LoginProvider/LoginProvider"
|
||||||
selector: 'page-configuration',
|
selector: 'page-configuration',
|
||||||
templateUrl: 'configuration.html',
|
templateUrl: 'configuration.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
export class ConfigurationPage {
|
export class ConfigurationPage {
|
||||||
|
|
||||||
public sensors = [];
|
public sensors = [];
|
||||||
ssid:string;
|
ssid:string;
|
||||||
pw:string;
|
pw:string;
|
||||||
|
@ -44,7 +47,7 @@ export class ConfigurationPage {
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
async uploadStandardSketch() {
|
async uploadStandardSketch() {
|
||||||
const sketch = await this.loginProvider.getUserSketch(this.token,this.box._id,this.ssid,this.pw)
|
const sketch = await this.loginProvider.getUserSketch(this.token,this.box['_id'],this.ssid,this.pw)
|
||||||
this.navCtrl.push(OtaWizardPage,{sketch})
|
this.navCtrl.push(OtaWizardPage,{sketch})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@
|
||||||
<ion-input name="password" type="password" placeholder="Password" ngModel required></ion-input>
|
<ion-input name="password" type="password" placeholder="Password" ngModel required></ion-input>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
|
<ion-row class="errorMessage" *ngIf="errorInput">
|
||||||
|
{{'LOGIN.ERRORINPUT' | translate}}
|
||||||
|
</ion-row>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<ion-col col-8>
|
<ion-col col-8>
|
||||||
</ion-col>
|
</ion-col>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { IonicPageModule } from 'ionic-angular';
|
import { IonicPageModule } from 'ionic-angular';
|
||||||
import { LoginPage } from './login';
|
import { LoginPage } from './login';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
|
@ -8,6 +9,7 @@ import { LoginPage } from './login';
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
IonicPageModule.forChild(LoginPage),
|
IonicPageModule.forChild(LoginPage),
|
||||||
|
TranslateModule
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class LoginPageModule {}
|
export class LoginPageModule {}
|
||||||
|
|
|
@ -20,6 +20,8 @@ export class LoginPage {
|
||||||
private token: string
|
private token: string
|
||||||
private boxes: Object;
|
private boxes: Object;
|
||||||
public loading = false;
|
public loading = false;
|
||||||
|
public errorInput = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public navCtrl: NavController,
|
public navCtrl: NavController,
|
||||||
public navParams: NavParams,
|
public navParams: NavParams,
|
||||||
|
@ -28,6 +30,7 @@ export class LoginPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async submitLogin(form) {
|
private async submitLogin(form) {
|
||||||
|
if (form.value.email && form.value.password) {
|
||||||
try {
|
try {
|
||||||
this.token = await this.loginProvider.login(form.value.email, form.value.password)
|
this.token = await this.loginProvider.login(form.value.email, form.value.password)
|
||||||
this.boxes = await this.loginProvider.getUserBoxes(this.token);
|
this.boxes = await this.loginProvider.getUserBoxes(this.token);
|
||||||
|
@ -37,9 +40,14 @@ export class LoginPage {
|
||||||
}
|
}
|
||||||
this.navCtrl.push(MySenseBoxPage, [this.boxes, this.token]);
|
this.navCtrl.push(MySenseBoxPage, [this.boxes, this.token]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.errorInput = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ionViewDidLoad() {
|
ionViewDidLoad() {
|
||||||
console.log('ionViewDidLoad LoginPage');
|
console.log('ionViewDidLoad LoginPage');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-navbar color="secondary">
|
<ion-navbar color="secondary">
|
||||||
<ion-title>
|
<ion-title>
|
||||||
{{title}}
|
{{sensor.title}}
|
||||||
</ion-title>
|
</ion-title>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
@ -9,8 +9,16 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-card>
|
<ion-card>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
Type: {{type}}<br>
|
<ul>
|
||||||
ID: {{id}}
|
<li>{{sensor.title}}</li>
|
||||||
|
<li>{{sensor.unit}}</li>
|
||||||
|
<li>{{sensor.sensorType}}</li>
|
||||||
|
<li>{{sensor.icon}}</li>
|
||||||
|
<li>{{sensor._id}}</li>
|
||||||
|
<li>{{sensor.lastMeasurement.value}}</li>
|
||||||
|
<li>{{sensor.lastMeasurement.createdAt}}</li>
|
||||||
|
</ul>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
|
|
||||||
</ion-card>
|
</ion-card>
|
||||||
</ion-content>
|
</ion-content>
|
|
@ -15,18 +15,13 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
|
||||||
})
|
})
|
||||||
export class SensorDetailPage {
|
export class SensorDetailPage {
|
||||||
|
|
||||||
title;
|
public sensor:Object=this.navParams.data.sensor
|
||||||
type;
|
|
||||||
id;
|
|
||||||
|
|
||||||
constructor(public navParams: NavParams) {
|
constructor(public navParams: NavParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewDidLoad() {
|
ionViewDidLoad() {
|
||||||
console.log('ionViewDidLoad SensorDetailPage');
|
console.log('ionViewDidLoad SensorDetailPage');
|
||||||
this.title=this.navParams.get('sensor').title;
|
console.log(this.navParams.data.sensor)
|
||||||
this.type = this.navParams.get('sensor').type;
|
|
||||||
this.id = this.navParams.get('sensor').id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,12 +60,7 @@ export class LoginProvider {
|
||||||
let URL_sketch_final = URL_sketch+id+"/script";
|
let URL_sketch_final = URL_sketch+id+"/script";
|
||||||
const headers = new HttpHeaders({'Authorization':"Bearer "+token})
|
const headers = new HttpHeaders({'Authorization':"Bearer "+token})
|
||||||
const params = new HttpParams({fromObject:{ssid,password}})
|
const params = new HttpParams({fromObject:{ssid,password}})
|
||||||
const options = {
|
return this.http.get(URL_sketch_final,{headers,params,responseType:'text'})
|
||||||
headers,
|
|
||||||
params,
|
|
||||||
'responseType':'text'
|
|
||||||
}
|
|
||||||
return this.http.get(URL_sketch_final,options)
|
|
||||||
.pipe(timeout(30000))
|
.pipe(timeout(30000))
|
||||||
.toPromise()
|
.toPromise()
|
||||||
.catch(err=>{
|
.catch(err=>{
|
||||||
|
|
Loading…
Add table
Reference in a new issue