feat(web-app): selected user/room/device
This part allow to select from where the data from with some option - user - room - device
This commit is contained in:
@@ -2,10 +2,61 @@ import { Prop } from "vue";
|
||||
import { Serie } from "./Serie";
|
||||
import { HttpClient } from "../Services/HttpClient";
|
||||
import { TEMPERATURE, HUMIDITY, TYPE, VALUE } from "../const";
|
||||
import { ref } from "vue";
|
||||
|
||||
export class TimeSeriesManager {
|
||||
private client: HttpClient;
|
||||
|
||||
selected_user = {
|
||||
user: "Rémi",
|
||||
tag: "remi",
|
||||
};
|
||||
selected_room = {
|
||||
room: "Bedroom",
|
||||
tag: "Bedroom",
|
||||
};
|
||||
selected_device = {
|
||||
device: "Door sensor",
|
||||
tag: "DoorSensor",
|
||||
};
|
||||
|
||||
user_options = [
|
||||
{
|
||||
user: "Rémi",
|
||||
tag: "remi",
|
||||
},
|
||||
{
|
||||
user: "Sylvan",
|
||||
tag: "sylvan",
|
||||
},
|
||||
];
|
||||
|
||||
room_options = [
|
||||
{
|
||||
room: "23N309",
|
||||
tag: "23N309",
|
||||
},
|
||||
{
|
||||
room: "Bedroom",
|
||||
tag: "Bedroom",
|
||||
},
|
||||
{
|
||||
room: "Terrasse",
|
||||
tag: "Terrasse",
|
||||
},
|
||||
];
|
||||
|
||||
device_options = [
|
||||
{
|
||||
device: "Door sensor",
|
||||
tag: "DoorSensor",
|
||||
},
|
||||
{
|
||||
device: "Shed",
|
||||
tag: "Shed",
|
||||
},
|
||||
];
|
||||
|
||||
constructor(client: HttpClient) {
|
||||
this.client = client;
|
||||
}
|
||||
@@ -16,7 +67,11 @@ export class TimeSeriesManager {
|
||||
device: string
|
||||
): Promise<Serie[]> {
|
||||
return this.client
|
||||
.getValues(user, room, device)
|
||||
.getValues(
|
||||
this.selected_user.tag,
|
||||
this.selected_room.tag,
|
||||
this.selected_device.tag
|
||||
)
|
||||
.then((response) => {
|
||||
// Filter temperature records
|
||||
let temperatureRecords = response.data.filter(
|
||||
|
||||
Reference in New Issue
Block a user