@@ -28,7 +28,7 @@ function InfoObject({ object,defafficherModif }) {
Status :
-
{object.status}
+
{object.status}
diff --git a/Front-end/src/components/MeteoGraph.jsx b/Front-end/src/components/MeteoGraph.jsx
index 4a891db..ee957f4 100644
--- a/Front-end/src/components/MeteoGraph.jsx
+++ b/Front-end/src/components/MeteoGraph.jsx
@@ -33,7 +33,6 @@ function MeteoGraph({ object, categorie, Logo }) {
});
return moyenne / rawData.length;
}
- console.log(getAvg());
return (
-
+
diff --git a/Front-end/src/components/MeteoInfos.jsx b/Front-end/src/components/MeteoInfos.jsx
index a2bf9d7..4946cb0 100644
--- a/Front-end/src/components/MeteoInfos.jsx
+++ b/Front-end/src/components/MeteoInfos.jsx
@@ -4,6 +4,7 @@ import React, { useEffect, useState } from "react";
import axios from "axios";
import { API_BASE_URL } from "../config";
import BoutonGraphique from "./BoutonGraphique";
+import AlertInactive from "./AlertInactive";
function MeteoInfos({
object,
@@ -15,17 +16,24 @@ function MeteoInfos({
AffHumiditeGraph,
}) {
const [rawData, setRawData] = useState([]);
+ const [AffAlert,setAffAlert] = useState(false);
const identifiant = object.id;
useEffect(() => {
axios.get(`${API_BASE_URL}/meteo?id=${identifiant}`).then((response) => {
setRawData(response.data);
+ if(rawData.length <5){
+ setAffAlert(true);
+ }
});
}, [object]);
const lastData = rawData.length > 0 ? rawData[rawData.length - 1] : null;
-
+ console.log(rawData.length);
return (
+ {(AffAlert) && (
+
+ )}
@@ -39,10 +47,10 @@ function MeteoInfos({
-
+
-
+
Température
@@ -62,10 +70,10 @@ function MeteoInfos({
-
+
-
+
Pression
@@ -85,10 +93,10 @@ function MeteoInfos({
-
+
-
+
Humidité
diff --git a/Front-end/src/components/ModifObject.jsx b/Front-end/src/components/ModifObject.jsx
index 75e252f..d627245 100644
--- a/Front-end/src/components/ModifObject.jsx
+++ b/Front-end/src/components/ModifObject.jsx
@@ -1,24 +1,25 @@
import React, { use } from "react";
-import { Info } from "lucide-react";
+import { Check, Info } from "lucide-react";
import { useState } from "react";
import axios from "axios";
import { API_BASE_URL } from "../config";
-function ModifObject({ object,defafficherModif }) {
- const [description,setDescription] = useState(object.description || "");
- const [type,setType] = useState(object.type || "");
- const [location,setLocalisation] = useState(object.location || "");
- const [status,setStatus] = useState(object.status || "");
- const [response, setResponse] = useState(null);
+function ModifObject({ object, defafficherModif }) {
+ const [description, setDescription] = useState(object.description || "");
+ const [type, setType] = useState(object.type || "");
+ const [location, setLocalisation] = useState(object.location || "");
+ const [status, setStatus] = useState(object.status || "");
+ const [Response, setResponse] = useState(null);
+ const [isActive,setActive] = useState(object.status==="active");
- function makeChange(){
+ function makeChange() {
axios
.post(`${API_BASE_URL}/modifObjet`, {
- id : object.id,
+ id: object.id,
description: description,
type: type,
location: location,
- status: status
+ status: status,
})
.then((response) => {
setResponse(response.data[0]);
@@ -26,20 +27,26 @@ function ModifObject({ object,defafficherModif }) {
defafficherModif(false);
window.location.reload();
}
- function cancelChange(){
+ function cancelChange() {
defafficherModif(false);
}
- function handleDescriptionChange(event){
+ function handleDescriptionChange(event) {
setDescription(event.target.value);
}
- function handleTypeChange(event){
+ function handleTypeChange(event) {
setType(event.target.value);
}
- function handleLocalisationChange(event){
+ function handleLocalisationChange(event) {
setLocalisation(event.target.value);
}
- function handleStatusChange(event){
- setStatus(event.target.value);
+ function handleStatusChange(event) {
+ setActive((prevIsActive) => {
+ const newIsActive = !prevIsActive;
+ const newStatus = newIsActive ? "active" : "inactive";
+ console.log(newStatus);
+ setStatus(newStatus);
+ return newIsActive;
+ });
}
return (
@@ -47,31 +54,86 @@ function ModifObject({ object,defafficherModif }) {
-
Modifier les infos
+
+ Modifier les infos
+
Status :
-
+
+
+
+
+
+
+
+
+
+
diff --git a/Front-end/src/components/WindInfo.jsx b/Front-end/src/components/WindInfo.jsx
index 8d83ddd..ac479d5 100644
--- a/Front-end/src/components/WindInfo.jsx
+++ b/Front-end/src/components/WindInfo.jsx
@@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react";
import axios from "axios";
import { API_BASE_URL } from "../config";
+import BoutonGraphique from "./BoutonGraphique";
function WindInfo({ object, defAffWindGraph, AffWindGraph }) {
const [rawData, setRawData] = useState([]);
@@ -18,52 +19,40 @@ function WindInfo({ object, defAffWindGraph, AffWindGraph }) {
return (
-
+
-
Vent actuel
+
Vent actuel
{lastData ? (
-
-
-
-

-
- {lastData.wind_direction}
-
-
-
-
+
+

+
+ {lastData.wind_direction}
+
+
+
+
-
+
+
+
+
Valeur
+
+ {lastData.wind_speed} Km/h
+
-
Valeur
-
- {lastData.wind_speed} km/h
-
+
- {!AffWindGraph ? (
-
- ) : (
-
- )}
-
Dernier enregistrement : {lastData.timestamp}
diff --git a/Front-end/src/pages/Gestion/Gestion.jsx b/Front-end/src/pages/Gestion/Gestion.jsx
index a37ad07..01a9282 100644
--- a/Front-end/src/pages/Gestion/Gestion.jsx
+++ b/Front-end/src/pages/Gestion/Gestion.jsx
@@ -22,7 +22,7 @@ function Gestion() {
Bienvenue dans le module
Gestion.
- Ce module vous permet de gérer les objets connectés de l'hôpital de manière simple et efficace.
+ Ce module vous permet de gérer les capteur et stations connectés de France de manière simple et efficace.
diff --git a/Front-end/src/pages/Gestion/ObjectManagement.jsx b/Front-end/src/pages/Gestion/ObjectManagement.jsx
index ce2c61d..d26efcf 100644
--- a/Front-end/src/pages/Gestion/ObjectManagement.jsx
+++ b/Front-end/src/pages/Gestion/ObjectManagement.jsx
@@ -14,12 +14,34 @@ import {
} from "lucide-react";
import { useEffect, useState } from "react";
import axios from "axios";
-import { useFetcher } from "react-router-dom";
function ObjectManagement() {
const [searchQuery, setSearchQuery] = useState("");
- const [activeFilter, setActiveFilter] = useState("all");
+ const [activeFilter, setActiveFilter] = useState("");
const [objects, setObjects] = useState([]);
+
+ const filteredDATA = objects.filter((node) => {
+ const matchesSearchQuery =
+ searchQuery === "" ||
+ node.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ node.description.toLowerCase().includes(searchQuery.toLowerCase());
+
+ const matchesTag =
+ activeFilter === "" ||
+ node.name.toLowerCase().includes(activeFilter.toLowerCase()) ||
+ node.description.includes(activeFilter.toLowerCase())||
+ (activeFilter=== "Active" && node.status.toLowerCase()==="active")||
+ (activeFilter=== "Inactive" && node.status.toLowerCase()==="inactive");
+ return matchesSearchQuery && matchesTag;
+
+ });
+ const handleSearchChange = (event) => {
+ setSearchQuery(event.target.value);
+ };
+
+ const handleTagFilterChange = (selectedTags) => {
+ setFilterTags(selectedTags);
+ };
useEffect(() => {
axios.get("http://localhost:8888/objets").then((response) => {
setObjects(response.data);
@@ -49,9 +71,9 @@ function ObjectManagement() {
-
+
+
- {objects.map(object =>(
-
+ {filteredDATA.length === 0 ? (
+
Aucun objet trouvé
+ ) : (
+ filteredDATA.map((object) => (
+
+ {(object.status==="active")?(
+
+
+
+
+
+
+ ):(
+
+
+
+
+
+ )}
+
-
+
-
- {object.name}
-
-
- {object.description}
-
+
{object.name}
+
{object.description}
- Plus d'infos
+ Plus d'infos
-
- ))}
+
+ ))
+ )}
diff --git a/Front-end/src/pages/Gestion/Objet.jsx b/Front-end/src/pages/Gestion/Objet.jsx
index 0040235..b357e6d 100644
--- a/Front-end/src/pages/Gestion/Objet.jsx
+++ b/Front-end/src/pages/Gestion/Objet.jsx
@@ -3,7 +3,6 @@ import { Thermometer, CircleGauge, Droplet } from "lucide-react";
import { useEffect, useState } from "react";
import axios from "axios";
-import { useFetcher } from "react-router-dom";
import InfoObjet from "../../components/InfoObject";
import ModifObject from "../../components/ModifObject";
import WindGraph from "../../components/WindGraph";
@@ -37,10 +36,9 @@ function Objet() {
- {!afficherModif && (
+ {(!afficherModif) ? (
- )}
- {afficherModif && (
+ ):(
)}