fix: corrige a tela de logs que ficava vazia ao abrir a tela de configuracao depois da primeira vez
This commit is contained in:
@@ -45,6 +45,23 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
const badge = document.getElementById('app-version-badge');
|
||||
if (badge) badge.innerText = `Client v${version}`;
|
||||
}
|
||||
|
||||
if (window.api && window.api.getLogs) {
|
||||
const logs = await window.api.getLogs();
|
||||
if (logs && logs.length > 0) {
|
||||
const terminalLogs = document.getElementById('terminal-logs');
|
||||
if (terminalLogs) {
|
||||
terminalLogs.innerHTML = ''; // clear wait message
|
||||
logs.forEach(log => {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'log-line';
|
||||
div.textContent = log;
|
||||
terminalLogs.appendChild(div);
|
||||
});
|
||||
terminalLogs.scrollTop = terminalLogs.scrollHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadedConfig = await window.api.getConfig();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ let configWindow = null;
|
||||
let monitorProcess = null;
|
||||
let currentStatus = { connected: false, identified: false };
|
||||
let downloadProgress = null; // Variável para controlar o progresso de download
|
||||
const recentLogs = [];
|
||||
|
||||
// ================================================================
|
||||
// AUTO-UPDATER CONFIG
|
||||
@@ -145,6 +146,9 @@ function startMonitorProcess() {
|
||||
currentStatus.identified = message.identified;
|
||||
updateTrayMenu();
|
||||
} else if (message && message.event === 'log') {
|
||||
recentLogs.push(message.log);
|
||||
if (recentLogs.length > 100) recentLogs.shift();
|
||||
|
||||
if (configWindow && !configWindow.isDestroyed()) {
|
||||
configWindow.webContents.send('new-log', message.log);
|
||||
}
|
||||
@@ -326,6 +330,10 @@ ipcMain.handle('get-version', () => {
|
||||
return app.getVersion();
|
||||
});
|
||||
|
||||
ipcMain.handle('get-logs', () => {
|
||||
return recentLogs;
|
||||
});
|
||||
|
||||
ipcMain.handle('save-config', (event, newConfig) => {
|
||||
const success = saveConfig(newConfig);
|
||||
if (success) {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "rx.scoreodonto.com-client",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"author": "ScoreOdonto",
|
||||
"description": "Cliente Windows para envio de imagens dentais da ScoreOdonto",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -3,6 +3,7 @@ const { contextBridge, ipcRenderer } = require('electron');
|
||||
contextBridge.exposeInMainWorld('api', {
|
||||
getConfig: () => ipcRenderer.invoke('get-config'),
|
||||
getVersion: () => ipcRenderer.invoke('get-version'),
|
||||
getLogs: () => ipcRenderer.invoke('get-logs'),
|
||||
saveConfig: (config) => ipcRenderer.invoke('save-config', config),
|
||||
testServer: (url) => ipcRenderer.invoke('test-server', url),
|
||||
verifyCredentials: (url, email, password, token) => ipcRenderer.invoke('verify-credentials', url, email, password, token),
|
||||
|
||||
Reference in New Issue
Block a user