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:
fastium
2025-05-14 23:30:25 +02:00
parent 2a85ed3e87
commit 70039dfe0e
4 changed files with 125 additions and 24 deletions

View File

@@ -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(