Statut de connexion au serveur
This commit is contained in:
52
renderer.js
52
renderer.js
@@ -12,6 +12,18 @@ let callStats = {
|
||||
|
||||
// === GESTION DE LA CONNEXION ===
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
// Initialiser l'indicateur SignalR
|
||||
updateSignalRStatus();
|
||||
|
||||
// Écouter les changements de statut SignalR
|
||||
ipcRenderer.on('signalr-status', (event, status) => {
|
||||
updateSignalRIndicator(status);
|
||||
});
|
||||
|
||||
// Obtenir le statut initial SignalR
|
||||
const initialStatus = await ipcRenderer.invoke('get-signalr-status');
|
||||
updateSignalRIndicator(initialStatus);
|
||||
|
||||
// Vérifier si un agent est déjà connecté
|
||||
const agentData = await ipcRenderer.invoke('get-current-agent');
|
||||
if (agentData) {
|
||||
@@ -392,4 +404,44 @@ async function saveNotes() {
|
||||
alert('Notes sauvegardées !');
|
||||
document.getElementById('quickNotes').value = '';
|
||||
}
|
||||
}
|
||||
|
||||
// === GESTION INDICATEUR SIGNALR ===
|
||||
function updateSignalRStatus() {
|
||||
// Fonction appelée au chargement pour initialiser l'interface
|
||||
}
|
||||
|
||||
function updateSignalRIndicator(status) {
|
||||
const indicator = document.getElementById('signalrIndicator');
|
||||
const text = document.getElementById('signalrText');
|
||||
|
||||
if (!indicator || !text) return;
|
||||
|
||||
// Réinitialiser les classes
|
||||
indicator.className = 'signalr-indicator';
|
||||
|
||||
switch(status) {
|
||||
case 'connected':
|
||||
indicator.classList.add('connected');
|
||||
text.textContent = 'Connecté au serveur';
|
||||
break;
|
||||
case 'connecting':
|
||||
indicator.classList.add('connecting');
|
||||
text.textContent = 'Connexion en cours...';
|
||||
break;
|
||||
case 'disconnected':
|
||||
indicator.classList.add('disconnected');
|
||||
text.textContent = 'Serveur déconnecté';
|
||||
break;
|
||||
case 'error':
|
||||
indicator.classList.add('error');
|
||||
text.textContent = 'Erreur de connexion';
|
||||
break;
|
||||
case 'disabled':
|
||||
indicator.classList.add('disabled');
|
||||
text.textContent = 'SignalR désactivé';
|
||||
break;
|
||||
default:
|
||||
text.textContent = 'État inconnu';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user