Skip to content

Commit

Permalink
Show error as dialog: #329
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jan 24, 2025
1 parent 316fb26 commit ce2e5b5
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src-admin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 27 additions & 2 deletions src-admin/src/Tabs/Controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import {
Typography,
} from '@mui/material';

import { type AdminConnection, type IobTheme, type ThemeName, type ThemeType, I18n } from '@iobroker/adapter-react-v5';
import {
type AdminConnection,
type IobTheme,
type ThemeName,
type ThemeType,
I18n,
DialogMessage,
} from '@iobroker/adapter-react-v5';
import DeviceManager from '@iobroker/dm-gui-components';

import type { CommissionableDevice, GUIMessage, MatterConfig } from '../types';
Expand Down Expand Up @@ -114,6 +121,7 @@ interface ComponentState {
/* increase this number to reload the devices */
triggerControllerLoad: number;
discoveryRunning: boolean;
errorText: string;
}

class Controller extends Component<ComponentProps, ComponentState> {
Expand All @@ -134,6 +142,7 @@ class Controller extends Component<ComponentProps, ComponentState> {
bleDialogOpen: false,
triggerControllerLoad: 0,
discoveryRunning: false,
errorText: '',
};
}

Expand Down Expand Up @@ -536,7 +545,9 @@ class Controller extends Component<ComponentProps, ComponentState> {
this.setState({ backendProcessingActive: false });

if (result.error || !result.result) {
window.alert(`Cannot pair device: ${result.error || 'Unknown error'}`);
this.setState({
errorText: `${I18n.t('Cannot pair device')}: ${result.error || I18n.t('Unknown error')}`,
});
} else {
window.alert(I18n.t('Connected'));
this.refDeviceManager.current?.loadData();
Expand Down Expand Up @@ -609,6 +620,19 @@ class Controller extends Component<ComponentProps, ComponentState> {
);
}

renderShowErrorDialog() {

Check failure on line 623 in src-admin/src/Tabs/Controller.tsx

View workflow job for this annotation

GitHub Actions / check-and-lint

Missing return type on function

Check failure on line 623 in src-admin/src/Tabs/Controller.tsx

View workflow job for this annotation

GitHub Actions / check-and-lint

Missing return type on function

Check failure on line 623 in src-admin/src/Tabs/Controller.tsx

View workflow job for this annotation

GitHub Actions / check-and-lint

Missing return type on function

Check failure on line 623 in src-admin/src/Tabs/Controller.tsx

View workflow job for this annotation

GitHub Actions / check-and-lint

Missing return type on function
if (!this.state.errorText) {
return null;
}
return (
<DialogMessage
text={this.state.errorText}
title={I18n.t('Error')}
onClose={() => this.setState({ errorText: '' })}
/>
);
}

render(): React.JSX.Element {
if (!this.props.alive && this.state.showDiscoveryDialog) {
setTimeout(() => this.setState({ showDiscoveryDialog: false }), 100);
Expand All @@ -628,6 +652,7 @@ class Controller extends Component<ComponentProps, ComponentState> {
{this.renderShowDiscoveredDevices()}
{this.renderQrCodeDialog()}
{this.renderBleDialog()}
{this.renderShowErrorDialog()}
<div>
{I18n.t('Off')}
<Switch
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Helligkeit durch EIN",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "Lokales QR-Code-Scannen ist nicht möglich, da ioBroker Admin ohne HTTPS verwendet wird.\nBitte verwenden Sie den ioBroker Cloud QR-Code-Scanner über die Schaltfläche unten oder aktivieren Sie HTTPS für den ioBroker Admin.",
"Cancel": "Abbrechen",
"Cannot pair device": "Gerät kann nicht gekoppelt werden",
"Close": "Schließen",
"Cloud Account": "Cloud-Konto",
"Code must start with \"MT:\"": "Der Code muss mit „MT:“ beginnen.",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Gerät aktivieren",
"Enable enhanced debug logging for the Matter protocol": "Erweitertes Debug-Logging für das Matter-Protokoll aktivieren (nur sichtbar mit der Protokollebene „Debug“)",
"Enable/disable bridge": "Bridge aktivieren/deaktivieren",
"Error": "Fehler",
"Expand all": "Alle erweitern",
"Expose ioBroker devices as Matter bridge": "ioBroker-Geräte als Matter-Bridge verfügbar machen",
"Following object IDs was not added because already exists": "Folgende Objekt-IDs wurden nicht hinzugefügt, da sie bereits vorhanden sind",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Um Matter-Geräte mit ioBroker-Controller in Betrieb zu nehmen/zu verbinden, verwenden Sie besser die ioBroker.visu-App:",
"To make all this work, the following requirements should be considered": "Damit das alles funktioniert, sollten die folgenden Anforderungen beachtet werden",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Um eine Matter-Bridge oder Geräteoptionen mit mehr als 5 Geräten zu verwenden, geben Sie bitte gültige ioBroker.pro-Cloud-Anmeldeinformationen mit mindestens einer aktiven Assistant-Lizenz ein.",
"Unknown error": "Unbekannter Fehler",
"Unselect all rooms": "Alle Räume abwählen",
"Use last value for ON": "Bei ON den letzten Wert verwenden",
"Value": "Wert",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Brightness by ON",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "Local QR code scanning is not possible because ioBroker Admin is used without HTTPS.\nPlease use the ioBroker Cloud QR code scanner using the button below or activate HTTPS for the ioBroker Admin.",
"Cancel": "Cancel",
"Cannot pair device": "Cannot pair device",
"Close": "Close",
"Cloud Account": "Cloud Account",
"Code must start with \"MT:\"": "Code must start with \"MT:\"",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Enable device",
"Enable enhanced debug logging for the Matter protocol": "Enable enhanced debug logging for the Matter protocol (only visible with \"debug\" log level)",
"Enable/disable bridge": "Enable/disable bridge",
"Error": "Error",
"Expand all": "Expand all",
"Expose ioBroker devices as Matter bridge": "Expose ioBroker devices as Matter bridge",
"Following object IDs was not added because already exists": "Following object IDs was not added because already exists",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:",
"To make all this work, the following requirements should be considered": "To make all this work, the following requirements should be considered",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.",
"Unknown error": "Unknown error",
"Unselect all rooms": "Unselect all rooms",
"Use last value for ON": "Use the last value by ON",
"Value": "Value",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Brillo por ON",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "No es posible escanear códigos QR locales porque ioBroker Admin se utiliza sin HTTPS.\nUtilice el escáner de códigos QR de ioBroker Cloud mediante el botón que aparece a continuación o active HTTPS para ioBroker Admin.",
"Cancel": "Cancelar",
"Cannot pair device": "No se puede emparejar el dispositivo",
"Close": "Cerca",
"Cloud Account": "Cuenta en la nube",
"Code must start with \"MT:\"": "El código debe comenzar con \"MT:\"",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Habilitar dispositivo",
"Enable enhanced debug logging for the Matter protocol": "Habilitar el registro de depuración mejorado para el protocolo Matter (solo visible con el nivel de registro \"depuración\")",
"Enable/disable bridge": "Activar/desactivar puente",
"Error": "Error",
"Expand all": "Expandir todo",
"Expose ioBroker devices as Matter bridge": "Exponer dispositivos ioBroker como puente Matter",
"Following object IDs was not added because already exists": "Los siguientes ID de objeto no se agregaron porque ya existían",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Para poner en funcionamiento o conectar dispositivos con el controlador ioBroker, utilice la mejor aplicación ioBroker.visu:",
"To make all this work, the following requirements should be considered": "Para que todo esto funcione se deben tener en cuenta los siguientes requisitos",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Para utilizar un puente Matter u opciones de dispositivo con más de 5 dispositivos, ingrese credenciales válidas de ioBroker.pro Cloud con al menos una licencia de Asistente activa.",
"Unknown error": "Error desconocido",
"Unselect all rooms": "Deseleccionar todas las habitaciones",
"Use last value for ON": "Utilice el último valor de ON",
"Value": "Valor",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Luminosité par ON",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "La numérisation locale du code QR n'est pas possible car ioBroker Admin est utilisé sans HTTPS.\nVeuillez utiliser le scanner de code QR ioBroker Cloud à l'aide du bouton ci-dessous ou activer HTTPS pour ioBroker Admin.",
"Cancel": "Annuler",
"Cannot pair device": "Impossible de coupler l'appareil",
"Close": "Fermer",
"Cloud Account": "Compte Cloud",
"Code must start with \"MT:\"": "Le code doit commencer par « MT : »",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Activer l'appareil",
"Enable enhanced debug logging for the Matter protocol": "Activer la journalisation de débogage améliorée pour le protocole Matter (visible uniquement avec le niveau de journalisation « debug »)",
"Enable/disable bridge": "Activer/désactiver le pont",
"Error": "Erreur",
"Expand all": "Développer tout",
"Expose ioBroker devices as Matter bridge": "Exposez les appareils ioBroker en tant que pont Matter",
"Following object IDs was not added because already exists": "Les identifiants d'objet suivants n'ont pas été ajoutés car ils existent déjà",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Pour mettre en service/connecter des appareils Matter avec le contrôleur ioBroker, utilisez la meilleure application ioBroker.visu :",
"To make all this work, the following requirements should be considered": "Pour que tout cela fonctionne, les exigences suivantes doivent être prises en compte",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Pour utiliser un pont Matter ou des options d'appareil avec plus de 5 appareils, veuillez saisir des informations d'identification ioBroker.pro Cloud valides avec au moins une licence Assistant active.",
"Unknown error": "Erreur inconnue",
"Unselect all rooms": "Désélectionner toutes les pièces",
"Use last value for ON": "Utiliser la dernière valeur par ON",
"Value": "Valeur",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Luminosità attivata",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "La scansione del codice QR locale non è possibile perché ioBroker Admin viene utilizzato senza HTTPS. Utilizza lo scanner del codice QR Cloud di ioBroker tramite il pulsante qui sotto o attiva HTTPS per ioBroker Admin.",
"Cancel": "Annulla",
"Cannot pair device": "Impossibile associare il dispositivo",
"Close": "Vicino",
"Cloud Account": "Conto cloud",
"Code must start with \"MT:\"": "Il codice deve iniziare con \"MT:\"",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Abilita dispositivo",
"Enable enhanced debug logging for the Matter protocol": "Abilita la registrazione di debug avanzata per il protocollo Matter (visibile solo con livello di registro \"debug\")",
"Enable/disable bridge": "Abilita/disabilita il bridge",
"Error": "Errore",
"Expand all": "Espandi tutto",
"Expose ioBroker devices as Matter bridge": "Esporre i dispositivi ioBroker come Matter Bridge",
"Following object IDs was not added because already exists": "I seguenti ID oggetto non sono stati aggiunti perché già esistenti",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Per mettere in funzione/collegare i dispositivi Matter con il controller ioBroker, utilizzare la migliore app ioBroker.visu:",
"To make all this work, the following requirements should be considered": "Per far funzionare tutto questo, è necessario considerare i seguenti requisiti",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Per utilizzare un bridge Matter o opzioni dispositivo con più di 5 dispositivi, inserisci credenziali ioBroker.pro Cloud valide con almeno una licenza Assistant attiva.",
"Unknown error": "Errore sconosciuto",
"Unselect all rooms": "Deseleziona tutte le stanze",
"Use last value for ON": "Utilizzare l'ultimo valore per ON",
"Value": "Valore",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Helderheid door AAN",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "Lokale QR-codescanning is niet mogelijk omdat ioBroker Admin zonder HTTPS wordt gebruikt.\nGebruik de ioBroker Cloud QR-codescanner met behulp van de onderstaande knop of activeer HTTPS voor de ioBroker Admin.",
"Cancel": "Annuleren",
"Cannot pair device": "Kan apparaat niet koppelen",
"Close": "Dichtbij",
"Cloud Account": "Cloud-account",
"Code must start with \"MT:\"": "Code moet beginnen met \"MT:\"",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Schakel apparaat in",
"Enable enhanced debug logging for the Matter protocol": "Verbeterde debug-logging inschakelen voor het Matter-protocol (alleen zichtbaar met logniveau 'debug')",
"Enable/disable bridge": "Brug in-/uitschakelen",
"Error": "Fout",
"Expand all": "Alles uitvouwen",
"Expose ioBroker devices as Matter bridge": "IoBroker-apparaten blootstellen als Matter-brug",
"Following object IDs was not added because already exists": "De volgende object-ID's zijn niet toegevoegd omdat ze al bestaan",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Voor het in bedrijf stellen/verbinden van materieapparaten met de ioBroker-controller kunt u het beste de ioBroker.visu-app gebruiken:",
"To make all this work, the following requirements should be considered": "Om dit allemaal te laten werken, moeten de volgende vereisten in overweging worden genomen",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Om een Matter-bridge of apparaatopties met meer dan 5 apparaten te gebruiken, voert u geldige ioBroker.pro Cloud-inloggegevens in met minimaal een actieve Assistent-licentie.",
"Unknown error": "Onbekende fout",
"Unselect all rooms": "Deselecteer alle kamers",
"Use last value for ON": "Gebruik de laatste waarde bij AAN",
"Value": "Waarde",
Expand Down
3 changes: 3 additions & 0 deletions src-admin/src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"Brightness by ON": "Jasność po włączeniu",
"Camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.": "Skanowanie lokalnego kodu QR nie jest możliwe, ponieważ ioBroker Admin jest używany bez HTTPS.\nProszę użyć skanera kodów QR ioBroker Cloud za pomocą poniższego przycisku lub aktywować HTTPS dla ioBroker Admin.",
"Cancel": "Anulować",
"Cannot pair device": "Nie można sparować urządzenia",
"Close": "Zamknąć",
"Cloud Account": "Konto w chmurze",
"Code must start with \"MT:\"": "Kod musi zaczynać się od „MT:”",
Expand Down Expand Up @@ -77,6 +78,7 @@
"Enable device": "Włącz urządzenie",
"Enable enhanced debug logging for the Matter protocol": "Włącz rozszerzone rejestrowanie debugowania dla protokołu Matter (widoczne tylko na poziomie rejestrowania „debugowanie”)",
"Enable/disable bridge": "Włącz/wyłącz most",
"Error": "Błąd",
"Expand all": "Rozwiń wszystkie",
"Expose ioBroker devices as Matter bridge": "Udostępnij urządzenia ioBroker jako most Matter",
"Following object IDs was not added because already exists": "Następujące identyfikatory obiektów nie zostały dodane, ponieważ już istnieją",
Expand Down Expand Up @@ -170,6 +172,7 @@
"To commission/connect matter devices with ioBroker controller use better ioBroker.visu app:": "Aby uruchomić/połączyć urządzenia Matter ze sterownikiem ioBroker, należy użyć lepszej aplikacji ioBroker.visu:",
"To make all this work, the following requirements should be considered": "Aby to wszystko zadziałało, należy wziąć pod uwagę następujące wymagania",
"To use a Matter bridge or device options with more than 5 devices please enter valid ioBroker.pro Cloud credentials with at least an active Assistant license.": "Aby korzystać z mostu Matter lub opcji urządzenia z więcej niż 5 urządzeniami, wprowadź prawidłowe dane uwierzytelniające ioBroker.pro Cloud z co najmniej aktywną licencją Asystenta.",
"Unknown error": "Nieznany błąd",
"Unselect all rooms": "Odznacz wszystkie pokoje",
"Use last value for ON": "Użyj ostatniej wartości poprzez ON",
"Value": "Wartość",
Expand Down
Loading

0 comments on commit ce2e5b5

Please sign in to comment.