mirror of
https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
synced 2025-10-29 17:32:20 +00:00
Merge pull request #105 from stephb9959/main
[WIFI-10832] Redirecting on invalid/not found serial numbers on device page
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ucentral-client",
|
||||
"version": "2.7.0(4)",
|
||||
"version": "2.7.0(5)",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ucentral-client",
|
||||
"version": "2.7.0(4)",
|
||||
"version": "2.7.0(5)",
|
||||
"dependencies": {
|
||||
"@coreui/coreui": "^3.4.0",
|
||||
"@coreui/icons": "^2.0.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ucentral-client",
|
||||
"version": "2.7.0(4)",
|
||||
"version": "2.7.0(5)",
|
||||
"dependencies": {
|
||||
"@coreui/coreui": "^3.4.0",
|
||||
"@coreui/icons": "^2.0.1",
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
"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.",
|
||||
"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 %",
|
||||
"remove_from_blacklist": "Von der schwarzen Liste entfernen",
|
||||
"success_added_blacklist": "Gerät erfolgreich zur Blacklist hinzugefügt!",
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
"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.",
|
||||
"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",
|
||||
"remove_from_blacklist": "Remove from blacklist",
|
||||
"success_added_blacklist": "Device successfully added to blacklist!",
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
"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.",
|
||||
"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%",
|
||||
"remove_from_blacklist": "ELIMINAR DE 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}}",
|
||||
"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)",
|
||||
"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 %",
|
||||
"remove_from_blacklist": "Supprimer de 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}}",
|
||||
"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)",
|
||||
"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%",
|
||||
"remove_from_blacklist": "Remover da lista negra",
|
||||
"success_added_blacklist": "Dispositivo adicionado à lista negra com sucesso!",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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 DeviceHealth from 'components/DeviceHealth';
|
||||
import CommandHistory from 'components/CommandHistory';
|
||||
@@ -7,7 +7,7 @@ import DeviceLogs from 'components/DeviceLogs';
|
||||
import DeviceStatisticsCard from 'components/InterfaceStatistics';
|
||||
import DeviceActionCard from 'components/DeviceActionCard';
|
||||
import axiosInstance from 'utils/axiosInstance';
|
||||
import { DeviceProvider, useAuth } from 'ucentral-libs';
|
||||
import { DeviceProvider, useAuth, useToast } from 'ucentral-libs';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import ConfigurationDisplay from 'components/ConfigurationDisplay';
|
||||
import WifiAnalysis from 'components/WifiAnalysis';
|
||||
@@ -23,7 +23,9 @@ const DevicePage = () => {
|
||||
const [index, setIndex] = useState(0);
|
||||
const { currentToken, endpoints } = useAuth();
|
||||
const [lastStats, setLastStats] = useState(null);
|
||||
const { addToast } = useToast();
|
||||
const [status, setStatus] = useState(null);
|
||||
const history = useHistory();
|
||||
const [deviceConfig, setDeviceConfig] = useState(null);
|
||||
const [error, setError] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -64,7 +66,16 @@ const DevicePage = () => {
|
||||
.then((response) => {
|
||||
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);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user