diff --git a/frontend/public/config/settings.dev.json b/frontend/public/config/settings.dev.json
index f000526..8029fda 100644
--- a/frontend/public/config/settings.dev.json
+++ b/frontend/public/config/settings.dev.json
@@ -1,98 +1,77 @@
{
- "userConfig": {
- "city": [
- 37.38283,
- -5.97317
- ]
+ "userConfig": {
+ "city": [37.38283, -5.97317]
+ },
+ "appConfig": {
+ "endpoints": {
+ "DATA_URL": "http://localhost:8081/api/raw/v1",
+ "LOGIC_URL": "http://localhost:8082/api/v1",
+
+ "GET_GROUPS": "/groups",
+ "GET_GROUP_BY_ID": "/groups/:groupId",
+ "POST_GROUPS": "/groups",
+ "PUT_GROUP_BY_ID": "/groups/:groupId",
+
+ "GET_GROUP_DEVICES": "/groups/:groupId/devices",
+ "GET_DEVICE_BY_ID": "/groups/:groupId/devices/:deviceId",
+ "POST_DEVICES": "/groups/:groupId/devices",
+ "PUT_DEVICE_BY_ID": "/groups/:groupId/devices/:deviceId",
+
+ "GET_DEVICE_LATEST_VALUES": "/groups/:groupId/devices/:deviceId/latest-values",
+ "GET_DEVICE_POLLUTION_MAP": "/groups/:groupId/devices/:deviceId/pollution-map",
+ "GET_DEVICE_HISTORY": "/groups/:groupId/devices/:deviceId/history",
+
+ "GET_DEVICE_SENSORS": "/groups/:groupId/devices/:deviceId/sensors",
+ "GET_SENSOR_BY_ID": "/groups/:groupId/devices/:deviceId/sensors/:sensorId",
+ "POST_SENSORS": "/groups/:groupId/devices/:deviceId/sensors",
+ "PUT_SENSOR_BY_ID": "/groups/:groupId/devices/:deviceId/sensors/:sensorId",
+ "GET_SENSOR_VALUES": "/groups/:groupId/devices/:deviceId/sensors/:sensorId/values",
+
+ "GET_ACTUATORS": "/groups/:groupId/devices/:deviceId/actuators",
+ "GET_ACTUATOR_BY_ID": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id",
+ "POST_ACTUATORS": "/groups/:groupId/devices/:deviceId/actuators",
+ "PUT_ACTUATOR_BY_ID": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id",
+ "GET_ACTUATOR_STATUS": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id/status",
+
+ "VIEW_LATEST_VALUES": "/v_latest_values",
+ "VIEW_POLLUTION_MAP": "/v_pollution_map",
+ "VIEW_SENSOR_HISTORY": "/v_sensor_history_by_device",
+ "VIEW_SENSOR_VALUES": "/v_sensor_values",
+ "VIEW_CO_BY_DEVICE": "/v_co_by_device",
+ "VIEW_GPS_BY_DEVICE": "/v_gps_by_device",
+ "VIEW_WEATHER_BY_DEVICE": "/v_weather_by_device"
},
- "appConfig": {
- "endpoints": {
- "DATA_URL": "https://contaminus.miarma.net/api/raw/v1",
- "LOGIC_URL": "https://contaminus.miarma.net/api/v1",
- "GET_GROUPS": "/groups",
- "GET_GROUP_BY_ID": "/groups/{0}",
- "GET_GROUP_DEVICES": "/groups/{0}/devices",
- "POST_GROUPS": "/groups",
- "PUT_GROUP_BY_ID": "/groups/{0}",
- "GET_DEVICES": "/devices",
- "GET_DEVICE_BY_ID": "/devices/{0}",
- "GET_DEVICE_SENSORS": "/devices/{0}/sensors",
- "GET_DEVICE_LATEST_VALUES": "/devices/{0}/latest",
- "GET_DEVICE_POLLUTION_MAP": "/devices/{0}/pollution-map",
- "GET_DEVICE_HISTORY": "/devices/{0}/history",
- "POST_DEVICES": "/devices",
- "PUT_DEVICE_BY_ID": "/devices/{0}",
- "GET_SENSORS": "/sensors",
- "GET_SENSOR_BY_ID": "/sensors/{0}",
- "GET_SENSOR_VALUES": "/sensors/{0}/values",
- "POST_SENSORS": "/sensors",
- "PUT_SENSOR_BY_ID": "/sensors/{0}",
- "GET_ACTUATORS": "/actuators",
- "GET_ACTUATOR_BY_ID": "/actuators/{0}",
- "POST_ACTUATORS": "/actuators",
- "PUT_ACTUATOR_BY_ID": "/actuators/{0}",
- "GET_GPS_VALUES": "/gps-values",
- "GET_GPS_VALUE_BY_ID": "/gps-values/{0}",
- "POST_GPS_VALUES": "/gps-values",
- "GET_AIR_VALUES": "/air-values",
- "GET_AIR_VALUE_BY_ID": "/air-values/{0}",
- "POST_AIR_VALUES": "/air-values"
+ "historyChartConfig": {
+ "chartOptionsDark": {
+ "responsive": true,
+ "maintainAspectRatio": false,
+ "scales": {
+ "x": {
+ "grid": { "color": "rgba(255, 255, 255, 0.1)" },
+ "ticks": { "color": "#E0E0E0" }
+ },
+ "y": {
+ "grid": { "color": "rgba(255, 255, 255, 0.1)" },
+ "ticks": { "color": "#E0E0E0" }
+ }
},
- "historyChartConfig": {
- "chartOptionsDark": {
- "responsive": true,
- "maintainAspectRatio": false,
- "scales": {
- "x": {
- "grid": {
- "color": "rgba(255, 255, 255, 0.1)"
- },
- "ticks": {
- "color": "#E0E0E0"
- }
- },
- "y": {
- "grid": {
- "color": "rgba(255, 255, 255, 0.1)"
- },
- "ticks": {
- "color": "#E0E0E0"
- }
- }
- },
- "plugins": {
- "legend": {
- "display": false
- }
- }
- },
- "chartOptionsLight": {
- "responsive": true,
- "maintainAspectRatio": false,
- "scales": {
- "x": {
- "grid": {
- "color": "rgba(0, 0, 0, 0.1)"
- },
- "ticks": {
- "color": "#333"
- }
- },
- "y": {
- "grid": {
- "color": "rgba(0, 0, 0, 0.1)"
- },
- "ticks": {
- "color": "#333"
- }
- }
- },
- "plugins": {
- "legend": {
- "display": false
- }
- }
- }
- }
+ "plugins": { "legend": { "display": false } }
+ },
+ "chartOptionsLight": {
+ "responsive": true,
+ "maintainAspectRatio": false,
+ "scales": {
+ "x": {
+ "grid": { "color": "rgba(0, 0, 0, 0.1)" },
+ "ticks": { "color": "#333" }
+ },
+ "y": {
+ "grid": { "color": "rgba(0, 0, 0, 0.1)" },
+ "ticks": { "color": "#333" }
+ }
+ },
+ "plugins": { "legend": { "display": false } }
+ }
}
-}
\ No newline at end of file
+ }
+}
diff --git a/frontend/public/config/settings.prod.json b/frontend/public/config/settings.prod.json
index f000526..fc3c250 100644
--- a/frontend/public/config/settings.prod.json
+++ b/frontend/public/config/settings.prod.json
@@ -1,98 +1,77 @@
{
- "userConfig": {
- "city": [
- 37.38283,
- -5.97317
- ]
+ "userConfig": {
+ "city": [37.38283, -5.97317]
+ },
+ "appConfig": {
+ "endpoints": {
+ "DATA_URL": "https://contaminus.miarma.net/api/raw/v1",
+ "LOGIC_URL": "https://contaminus.miarma.net/api/v1",
+
+ "GET_GROUPS": "/groups",
+ "GET_GROUP_BY_ID": "/groups/:groupId",
+ "POST_GROUPS": "/groups",
+ "PUT_GROUP_BY_ID": "/groups/:groupId",
+
+ "GET_GROUP_DEVICES": "/groups/:groupId/devices",
+ "GET_DEVICE_BY_ID": "/groups/:groupId/devices/:deviceId",
+ "POST_DEVICES": "/groups/:groupId/devices",
+ "PUT_DEVICE_BY_ID": "/groups/:groupId/devices/:deviceId",
+
+ "GET_DEVICE_LATEST_VALUES": "/groups/:groupId/devices/:deviceId/latest-values",
+ "GET_DEVICE_POLLUTION_MAP": "/groups/:groupId/devices/:deviceId/pollution-map",
+ "GET_DEVICE_HISTORY": "/groups/:groupId/devices/:deviceId/history",
+
+ "GET_DEVICE_SENSORS": "/groups/:groupId/devices/:deviceId/sensors",
+ "GET_SENSOR_BY_ID": "/groups/:groupId/devices/:deviceId/sensors/:sensorId",
+ "POST_SENSORS": "/groups/:groupId/devices/:deviceId/sensors",
+ "PUT_SENSOR_BY_ID": "/groups/:groupId/devices/:deviceId/sensors/:sensorId",
+ "GET_SENSOR_VALUES": "/groups/:groupId/devices/:deviceId/sensors/:sensorId/values",
+
+ "GET_ACTUATORS": "/groups/:groupId/devices/:deviceId/actuators",
+ "GET_ACTUATOR_BY_ID": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id",
+ "POST_ACTUATORS": "/groups/:groupId/devices/:deviceId/actuators",
+ "PUT_ACTUATOR_BY_ID": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id",
+ "GET_ACTUATOR_STATUS": "/groups/:groupId/devices/:deviceId/actuators/:actuator_id/status",
+
+ "VIEW_LATEST_VALUES": "/v_latest_values",
+ "VIEW_POLLUTION_MAP": "/v_pollution_map",
+ "VIEW_SENSOR_HISTORY": "/v_sensor_history_by_device",
+ "VIEW_SENSOR_VALUES": "/v_sensor_values",
+ "VIEW_CO_BY_DEVICE": "/v_co_by_device",
+ "VIEW_GPS_BY_DEVICE": "/v_gps_by_device",
+ "VIEW_WEATHER_BY_DEVICE": "/v_weather_by_device"
},
- "appConfig": {
- "endpoints": {
- "DATA_URL": "https://contaminus.miarma.net/api/raw/v1",
- "LOGIC_URL": "https://contaminus.miarma.net/api/v1",
- "GET_GROUPS": "/groups",
- "GET_GROUP_BY_ID": "/groups/{0}",
- "GET_GROUP_DEVICES": "/groups/{0}/devices",
- "POST_GROUPS": "/groups",
- "PUT_GROUP_BY_ID": "/groups/{0}",
- "GET_DEVICES": "/devices",
- "GET_DEVICE_BY_ID": "/devices/{0}",
- "GET_DEVICE_SENSORS": "/devices/{0}/sensors",
- "GET_DEVICE_LATEST_VALUES": "/devices/{0}/latest",
- "GET_DEVICE_POLLUTION_MAP": "/devices/{0}/pollution-map",
- "GET_DEVICE_HISTORY": "/devices/{0}/history",
- "POST_DEVICES": "/devices",
- "PUT_DEVICE_BY_ID": "/devices/{0}",
- "GET_SENSORS": "/sensors",
- "GET_SENSOR_BY_ID": "/sensors/{0}",
- "GET_SENSOR_VALUES": "/sensors/{0}/values",
- "POST_SENSORS": "/sensors",
- "PUT_SENSOR_BY_ID": "/sensors/{0}",
- "GET_ACTUATORS": "/actuators",
- "GET_ACTUATOR_BY_ID": "/actuators/{0}",
- "POST_ACTUATORS": "/actuators",
- "PUT_ACTUATOR_BY_ID": "/actuators/{0}",
- "GET_GPS_VALUES": "/gps-values",
- "GET_GPS_VALUE_BY_ID": "/gps-values/{0}",
- "POST_GPS_VALUES": "/gps-values",
- "GET_AIR_VALUES": "/air-values",
- "GET_AIR_VALUE_BY_ID": "/air-values/{0}",
- "POST_AIR_VALUES": "/air-values"
+ "historyChartConfig": {
+ "chartOptionsDark": {
+ "responsive": true,
+ "maintainAspectRatio": false,
+ "scales": {
+ "x": {
+ "grid": { "color": "rgba(255, 255, 255, 0.1)" },
+ "ticks": { "color": "#E0E0E0" }
+ },
+ "y": {
+ "grid": { "color": "rgba(255, 255, 255, 0.1)" },
+ "ticks": { "color": "#E0E0E0" }
+ }
},
- "historyChartConfig": {
- "chartOptionsDark": {
- "responsive": true,
- "maintainAspectRatio": false,
- "scales": {
- "x": {
- "grid": {
- "color": "rgba(255, 255, 255, 0.1)"
- },
- "ticks": {
- "color": "#E0E0E0"
- }
- },
- "y": {
- "grid": {
- "color": "rgba(255, 255, 255, 0.1)"
- },
- "ticks": {
- "color": "#E0E0E0"
- }
- }
- },
- "plugins": {
- "legend": {
- "display": false
- }
- }
- },
- "chartOptionsLight": {
- "responsive": true,
- "maintainAspectRatio": false,
- "scales": {
- "x": {
- "grid": {
- "color": "rgba(0, 0, 0, 0.1)"
- },
- "ticks": {
- "color": "#333"
- }
- },
- "y": {
- "grid": {
- "color": "rgba(0, 0, 0, 0.1)"
- },
- "ticks": {
- "color": "#333"
- }
- }
- },
- "plugins": {
- "legend": {
- "display": false
- }
- }
- }
- }
+ "plugins": { "legend": { "display": false } }
+ },
+ "chartOptionsLight": {
+ "responsive": true,
+ "maintainAspectRatio": false,
+ "scales": {
+ "x": {
+ "grid": { "color": "rgba(0, 0, 0, 0.1)" },
+ "ticks": { "color": "#333" }
+ },
+ "y": {
+ "grid": { "color": "rgba(0, 0, 0, 0.1)" },
+ "ticks": { "color": "#333" }
+ }
+ },
+ "plugins": { "legend": { "display": false } }
+ }
}
-}
\ No newline at end of file
+ }
+}
diff --git a/frontend/public/images/favicon.ico b/frontend/public/images/favicon.ico
index 859b5ae..25efbeb 100644
Binary files a/frontend/public/images/favicon.ico and b/frontend/public/images/favicon.ico differ
diff --git a/frontend/public/images/logo.png b/frontend/public/images/logo.png
index b66b936..0c3ac2a 100644
Binary files a/frontend/public/images/logo.png and b/frontend/public/images/logo.png differ
diff --git a/frontend/src/components/App.jsx b/frontend/src/App.jsx
similarity index 64%
rename from frontend/src/components/App.jsx
rename to frontend/src/App.jsx
index be449d7..6534b1e 100644
--- a/frontend/src/components/App.jsx
+++ b/frontend/src/App.jsx
@@ -5,10 +5,11 @@ import 'bootstrap/dist/js/bootstrap.bundle.min.js'
import Home from '@/pages/Home.jsx'
import Dashboard from '@/pages/Dashboard.jsx'
-import MenuButton from './MenuButton.jsx'
-import SideMenu from './SideMenu.jsx'
-import ThemeButton from '@/components/ThemeButton.jsx'
-import Header from '@/components/Header.jsx'
+import MenuButton from '@/components/layout/MenuButton.jsx'
+import SideMenu from '@/components/layout/SideMenu.jsx'
+import ThemeButton from '@/components/layout/ThemeButton.jsx'
+import Header from '@/components/layout/Header.jsx'
+import GroupView from '@/pages/GroupView.jsx'
import { Routes, Route } from 'react-router-dom'
import { useState } from 'react'
@@ -30,10 +31,11 @@ const App = () => {
Cargando configuraci贸n...
; - if (configError) returnError al cargar configuraci贸n: {configError}
; - if (!config) returnConfiguraci贸n no disponible.
; +const HistoryCharts = ({ groupId, deviceId }) => { + const { config, configLoading, configError } = useConfig(); - const BASE = config.appConfig.endpoints.DATA_URL; - const ENDPOINT = config.appConfig.endpoints.GET_SENSORS; + if (configLoading) returnCargando configuraci贸n...
; + if (configError) returnError al cargar configuraci贸n: {configError}
; + if (!config) returnConfiguraci贸n no disponible.
; - const reqConfig = { - baseUrl: `${BASE}${ENDPOINT}`, - params: {} - } + const BASE = config.appConfig.endpoints.DATA_URL; + const ENDPOINT = config.appConfig.endpoints.GET_DEVICE_HISTORY; + const endp = ENDPOINT + .replace(':groupId', groupId) + .replace(':deviceId', deviceId); // si tu endpoint lo necesita - return ( -Cargando configuraci贸n...
; - if (configError) returnError al cargar configuraci贸n: {configError}
; - if (!config) returnConfiguraci贸n no disponible.
; +const PollutionMap = ({ groupId, deviceId }) => { + const { config, configLoading, configError } = useConfig(); - const BASE = config.appConfig.endpoints.LOGIC_URL; - const ENDPOINT = config.appConfig.endpoints.GET_DEVICE_POLLUTION_MAP; - let endp = ENDPOINT.replace('{0}', deviceId); + if (configLoading) returnCargando configuraci贸n...
; + if (configError) returnError al cargar configuraci贸n: {configError}
; + if (!config) returnConfiguraci贸n no disponible.
; - const reqConfig = { - baseUrl: `${BASE}${endp}`, - params: {} - } + const BASE = config.appConfig.endpoints.LOGIC_URL; + const ENDPOINT = config.appConfig.endpoints.GET_DEVICE_POLLUTION_MAP; + const endp = ENDPOINT + .replace(':groupId', groupId) + .replace(':deviceId', deviceId); - return ( -Cargando configuraci贸n...
; @@ -19,19 +19,21 @@ const SummaryCards = ({ deviceId }) => { const BASE = config.appConfig.endpoints.LOGIC_URL; const ENDPOINT = config.appConfig.endpoints.GET_DEVICE_LATEST_VALUES; - const endp = ENDPOINT.replace('{0}', deviceId); + const endp = ENDPOINT + .replace(':groupId', groupId) + .replace(':deviceId', deviceId); // solo si lo necesitas as铆 const reqConfig = { baseUrl: `${BASE}${endp}`, params: {} - } + }; return ({card.content}
+{card.content}
{props.subtitle}
+
+ {subtitle}
Configuraci贸n no disponible.
; const BASE = config.appConfig.endpoints.DATA_URL; - const ENDPOINT = config.appConfig.endpoints.GET_DEVICES; + const ENDPOINT = config.appConfig.endpoints.GET_GROUPS; const reqConfig = { baseUrl: `${BASE}${ENDPOINT}`, @@ -51,18 +53,18 @@ const SideMenuContent = ({ isOpen, onClose }) => {Error al cargar datos: {dataError}
; + + return ( +