mirror of
				https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
				synced 2025-10-31 18:27:45 +00:00 
			
		
		
		
	[WIFI-10832] Redirecting on invalid/not found serial numbers on device page
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
		
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,12 +1,12 @@ | |||||||
| { | { | ||||||
|   "name": "ucentral-client", |   "name": "ucentral-client", | ||||||
|   "version": "2.7.0(4)", |   "version": "2.7.0(5)", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 2, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "": { |     "": { | ||||||
|       "name": "ucentral-client", |       "name": "ucentral-client", | ||||||
|       "version": "2.7.0(4)", |       "version": "2.7.0(5)", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@coreui/coreui": "^3.4.0", |         "@coreui/coreui": "^3.4.0", | ||||||
|         "@coreui/icons": "^2.0.1", |         "@coreui/icons": "^2.0.1", | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "ucentral-client", |   "name": "ucentral-client", | ||||||
|   "version": "2.7.0(4)", |   "version": "2.7.0(5)", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@coreui/coreui": "^3.4.0", |     "@coreui/coreui": "^3.4.0", | ||||||
|     "@coreui/icons": "^2.0.1", |     "@coreui/icons": "^2.0.1", | ||||||
|   | |||||||
| @@ -337,6 +337,7 @@ | |||||||
| 		"error_fetching_devices": "Fehler beim Abrufen von Geräten: {{error}}", | 		"error_fetching_devices": "Fehler beim Abrufen von Geräten: {{error}}", | ||||||
| 		"firmware_count_explanation": "Dies ist die Gesamtzahl der Geräte, die diesem Firmware-Server hinzugefügt wurden, einschließlich der Geräte, die derzeit nicht auf den zugehörigen Gateway-Server verweisen.", | 		"firmware_count_explanation": "Dies ist die Gesamtzahl der Geräte, die diesem Firmware-Server hinzugefügt wurden, einschließlich der Geräte, die derzeit nicht auf den zugehörigen Gateway-Server verweisen.", | ||||||
| 		"health_explanation": "Zustand der verbundenen Geräte ((Geräte = 100 % * 100 + Geräte > 90 % * 95 + Geräte > 60 % * 75 + Geräte < 60 % * 35) / Verbundene Geräte)", | 		"health_explanation": "Zustand der verbundenen Geräte ((Geräte = 100 % * 100 + Geräte > 90 % * 95 + Geräte > 60 % * 75 + Geräte < 60 % * 35) / Verbundene Geräte)", | ||||||
|  | 		"mac_not_found": "Seriennummer nicht gefunden, Sie werden zur Seite „Geräte“ weitergeleitet", | ||||||
| 		"memory_explanation": "Anzahl verbundener Geräte mit entsprechendem belegtem Speicher %", | 		"memory_explanation": "Anzahl verbundener Geräte mit entsprechendem belegtem Speicher %", | ||||||
| 		"remove_from_blacklist": "Von der schwarzen Liste entfernen", | 		"remove_from_blacklist": "Von der schwarzen Liste entfernen", | ||||||
| 		"success_added_blacklist": "Gerät erfolgreich zur Blacklist hinzugefügt!", | 		"success_added_blacklist": "Gerät erfolgreich zur Blacklist hinzugefügt!", | ||||||
|   | |||||||
| @@ -337,6 +337,7 @@ | |||||||
| 		"error_fetching_devices": "Error while fetching devices: {{error}}", | 		"error_fetching_devices": "Error while fetching devices: {{error}}", | ||||||
| 		"firmware_count_explanation": "This is the total amount of devices that were added to this firmware server, including devices not currently pointing at the related gateway server.", | 		"firmware_count_explanation": "This is the total amount of devices that were added to this firmware server, including devices not currently pointing at the related gateway server.", | ||||||
| 		"health_explanation": "Health of connected devices ((Devices=100% * 100 + Devices>90% * 95 + Devices>60% * 75 + Devices<60% * 35) / ConnectedDevices)", | 		"health_explanation": "Health of connected devices ((Devices=100% * 100 + Devices>90% * 95 + Devices>60% * 75 + Devices<60% * 35) / ConnectedDevices)", | ||||||
|  | 		"mac_not_found": "Serial number not found, redirecting you to the Devices page", | ||||||
| 		"memory_explanation": "Amount of connected devices with corresponding memory used percentage", | 		"memory_explanation": "Amount of connected devices with corresponding memory used percentage", | ||||||
| 		"remove_from_blacklist": "Remove from blacklist", | 		"remove_from_blacklist": "Remove from blacklist", | ||||||
| 		"success_added_blacklist": "Device successfully added to blacklist!", | 		"success_added_blacklist": "Device successfully added to blacklist!", | ||||||
|   | |||||||
| @@ -337,6 +337,7 @@ | |||||||
| 		"error_fetching_devices": "Error al recuperar dispositivos: {{error}}", | 		"error_fetching_devices": "Error al recuperar dispositivos: {{error}}", | ||||||
| 		"firmware_count_explanation": "Esta es la cantidad total de dispositivos que se agregaron a este servidor de firmware, incluidos los dispositivos que actualmente no apuntan al servidor de puerta de enlace relacionado.", | 		"firmware_count_explanation": "Esta es la cantidad total de dispositivos que se agregaron a este servidor de firmware, incluidos los dispositivos que actualmente no apuntan al servidor de puerta de enlace relacionado.", | ||||||
| 		"health_explanation": "Estado de los dispositivos conectados ((Dispositivos = 100% * 100 + Dispositivos> 90% * 95 + Dispositivos> 60% * 75 + Dispositivos <60% * 35) / Dispositivos conectados)", | 		"health_explanation": "Estado de los dispositivos conectados ((Dispositivos = 100% * 100 + Dispositivos> 90% * 95 + Dispositivos> 60% * 75 + Dispositivos <60% * 35) / Dispositivos conectados)", | ||||||
|  | 		"mac_not_found": "Número de serie no encontrado, lo redirige a la página Dispositivos", | ||||||
| 		"memory_explanation": "Cantidad de dispositivos conectados con la memoria correspondiente utilizada%", | 		"memory_explanation": "Cantidad de dispositivos conectados con la memoria correspondiente utilizada%", | ||||||
| 		"remove_from_blacklist": "ELIMINAR DE LA LISTA NEGRA", | 		"remove_from_blacklist": "ELIMINAR DE LA LISTA NEGRA", | ||||||
| 		"success_added_blacklist": "¡Dispositivo agregado exitosamente a la lista negra!", | 		"success_added_blacklist": "¡Dispositivo agregado exitosamente a la lista negra!", | ||||||
|   | |||||||
| @@ -337,6 +337,7 @@ | |||||||
| 		"error_fetching_devices": "Erreur lors de la récupération des appareils : {{error}}", | 		"error_fetching_devices": "Erreur lors de la récupération des appareils : {{error}}", | ||||||
| 		"firmware_count_explanation": "Il s'agit du nombre total d'appareils qui ont été ajoutés à ce serveur de micrologiciel, y compris les appareils qui ne pointent pas actuellement vers le serveur de passerelle associé.", | 		"firmware_count_explanation": "Il s'agit du nombre total d'appareils qui ont été ajoutés à ce serveur de micrologiciel, y compris les appareils qui ne pointent pas actuellement vers le serveur de passerelle associé.", | ||||||
| 		"health_explanation": "Santé des appareils connectés ((Appareils = 100 % * 100 + Appareils> 90 % * 95 + Appareils> 60 % * 75 + Appareils < 60 % * 35) / Appareils connectés)", | 		"health_explanation": "Santé des appareils connectés ((Appareils = 100 % * 100 + Appareils> 90 % * 95 + Appareils> 60 % * 75 + Appareils < 60 % * 35) / Appareils connectés)", | ||||||
|  | 		"mac_not_found": "Numéro de série introuvable, vous redirigeant vers la page Appareils", | ||||||
| 		"memory_explanation": "Nombre d'appareils connectés avec la mémoire correspondante utilisée %", | 		"memory_explanation": "Nombre d'appareils connectés avec la mémoire correspondante utilisée %", | ||||||
| 		"remove_from_blacklist": "Supprimer de la liste noire", | 		"remove_from_blacklist": "Supprimer de la liste noire", | ||||||
| 		"success_added_blacklist": "Appareil ajouté avec succès à la liste noire !", | 		"success_added_blacklist": "Appareil ajouté avec succès à la liste noire !", | ||||||
|   | |||||||
| @@ -337,6 +337,7 @@ | |||||||
| 		"error_fetching_devices": "Erro ao buscar dispositivos: {{error}}", | 		"error_fetching_devices": "Erro ao buscar dispositivos: {{error}}", | ||||||
| 		"firmware_count_explanation": "Esta é a quantidade total de dispositivos que foram adicionados a este servidor de firmware, incluindo dispositivos que não estão apontando para o servidor de gateway relacionado.", | 		"firmware_count_explanation": "Esta é a quantidade total de dispositivos que foram adicionados a este servidor de firmware, incluindo dispositivos que não estão apontando para o servidor de gateway relacionado.", | ||||||
| 		"health_explanation": "Integridade dos dispositivos conectados ((Dispositivos = 100% * 100 + Dispositivos> 90% * 95 + Dispositivos> 60% * 75 + Dispositivos <60% * 35) / Dispositivos Conectados)", | 		"health_explanation": "Integridade dos dispositivos conectados ((Dispositivos = 100% * 100 + Dispositivos> 90% * 95 + Dispositivos> 60% * 75 + Dispositivos <60% * 35) / Dispositivos Conectados)", | ||||||
|  | 		"mac_not_found": "Número de série não encontrado, redirecionando você para a página Dispositivos", | ||||||
| 		"memory_explanation": "Quantidade de dispositivos conectados com a memória correspondente usada%", | 		"memory_explanation": "Quantidade de dispositivos conectados com a memória correspondente usada%", | ||||||
| 		"remove_from_blacklist": "Remover da lista negra", | 		"remove_from_blacklist": "Remover da lista negra", | ||||||
| 		"success_added_blacklist": "Dispositivo adicionado à lista negra com sucesso!", | 		"success_added_blacklist": "Dispositivo adicionado à lista negra com sucesso!", | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| import React, { useEffect, useState } from 'react'; | import React, { useEffect, useState } from 'react'; | ||||||
| import { useParams } from 'react-router-dom'; | import { useHistory, useParams } from 'react-router-dom'; | ||||||
| import { CRow, CCol, CCard, CCardBody, CNav, CNavLink, CTabPane, CTabContent } from '@coreui/react'; | import { CRow, CCol, CCard, CCardBody, CNav, CNavLink, CTabPane, CTabContent } from '@coreui/react'; | ||||||
| import DeviceHealth from 'components/DeviceHealth'; | import DeviceHealth from 'components/DeviceHealth'; | ||||||
| import CommandHistory from 'components/CommandHistory'; | import CommandHistory from 'components/CommandHistory'; | ||||||
| @@ -7,7 +7,7 @@ import DeviceLogs from 'components/DeviceLogs'; | |||||||
| import DeviceStatisticsCard from 'components/InterfaceStatistics'; | import DeviceStatisticsCard from 'components/InterfaceStatistics'; | ||||||
| import DeviceActionCard from 'components/DeviceActionCard'; | import DeviceActionCard from 'components/DeviceActionCard'; | ||||||
| import axiosInstance from 'utils/axiosInstance'; | import axiosInstance from 'utils/axiosInstance'; | ||||||
| import { DeviceProvider, useAuth } from 'ucentral-libs'; | import { DeviceProvider, useAuth, useToast } from 'ucentral-libs'; | ||||||
| import { useTranslation } from 'react-i18next'; | import { useTranslation } from 'react-i18next'; | ||||||
| import ConfigurationDisplay from 'components/ConfigurationDisplay'; | import ConfigurationDisplay from 'components/ConfigurationDisplay'; | ||||||
| import WifiAnalysis from 'components/WifiAnalysis'; | import WifiAnalysis from 'components/WifiAnalysis'; | ||||||
| @@ -23,7 +23,9 @@ const DevicePage = () => { | |||||||
|   const [index, setIndex] = useState(0); |   const [index, setIndex] = useState(0); | ||||||
|   const { currentToken, endpoints } = useAuth(); |   const { currentToken, endpoints } = useAuth(); | ||||||
|   const [lastStats, setLastStats] = useState(null); |   const [lastStats, setLastStats] = useState(null); | ||||||
|  |   const { addToast } = useToast(); | ||||||
|   const [status, setStatus] = useState(null); |   const [status, setStatus] = useState(null); | ||||||
|  |   const history = useHistory(); | ||||||
|   const [deviceConfig, setDeviceConfig] = useState(null); |   const [deviceConfig, setDeviceConfig] = useState(null); | ||||||
|   const [error, setError] = useState(false); |   const [error, setError] = useState(false); | ||||||
|   const [loading, setLoading] = useState(false); |   const [loading, setLoading] = useState(false); | ||||||
| @@ -64,7 +66,16 @@ const DevicePage = () => { | |||||||
|       .then((response) => { |       .then((response) => { | ||||||
|         if (response) setDeviceConfig({ ...deviceInfo, extendedInfo: response.data.extendedInfo }); |         if (response) setDeviceConfig({ ...deviceInfo, extendedInfo: response.data.extendedInfo }); | ||||||
|       }) |       }) | ||||||
|       .catch(() => { |       .catch((e) => { | ||||||
|  |         if (e.response?.status === 404 || e.response?.status === 400) { | ||||||
|  |           addToast({ | ||||||
|  |             title: t('common.error'), | ||||||
|  |             body: t('device.mac_not_found'), | ||||||
|  |             color: 'danger', | ||||||
|  |             autohide: true, | ||||||
|  |           }); | ||||||
|  |           history.push('/devices'); | ||||||
|  |         } | ||||||
|         setDeviceConfig(deviceInfo); |         setDeviceConfig(deviceInfo); | ||||||
|       }); |       }); | ||||||
|   }; |   }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Charles
					Charles