feat: implement IPC handlers for Nginx configuration management and service lifecycle control

This commit is contained in:
Ümit Tunç
2026-04-02 15:05:57 +03:00
parent a3d662423f
commit baf1739f6d
5 changed files with 207 additions and 3 deletions
+19
View File
@@ -1182,4 +1182,23 @@ export function registerIpcHandlers(): void {
rootPass: rootPass || ''
}, dbName, savePath, compress, (msg) => log(msg))
})
ipcMain.handle('services:get-events', async () => {
try {
return serviceEventLogger.getEvents()
} catch (error: any) {
console.error('Failed to get events:', error)
return []
}
})
ipcMain.handle('services:clear-events', async () => {
try {
serviceEventLogger.clear()
return { success: true }
} catch (error: any) {
console.error('Failed to clear events:', error)
return { success: false, message: error.message }
}
})
}
+10 -1
View File
@@ -79,7 +79,8 @@ import {
Handyman as ToolsIcon,
Restore as ResetIcon,
Search as SearchIcon,
Tune as TuningIcon
Tune as TuningIcon,
History as HistoryIcon
} from '@mui/icons-material'
import Swal from 'sweetalert2'
import { useTranslation } from 'react-i18next'
@@ -91,6 +92,7 @@ import NginxCodeEditor from './components/NginxCodeEditor'
import ApacheCodeEditor from './components/ApacheCodeEditor'
import PhpExtensionManager from './components/PhpExtensionManager'
import ServerTuning from './components/ServerTuning'
import ServiceEventMonitor from './components/ServiceEventMonitor'
declare global {
interface Window {
@@ -1141,6 +1143,12 @@ function App(): JSX.Element {
<ListItemText primary={t('settings.general')} />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton selected={activeTab === 'event_monitor'} onClick={() => setActiveTab('event_monitor')}>
<ListItemIcon><HistoryIcon color={activeTab === 'event_monitor' ? 'primary' : 'inherit'} /></ListItemIcon>
<ListItemText primary={t('service_monitor.title')} />
</ListItemButton>
</ListItem>
</List>
</Box>
</Drawer>
@@ -1150,6 +1158,7 @@ function App(): JSX.Element {
<Container maxWidth={false} sx={{ py: 2 }}>
{activeTab === 'tuning' && <ServerTuning />}
{activeTab === 'db_manager' && <MariaDbDatabaseManager versions={mariaDbVersions} />}
{activeTab === 'event_monitor' && <ServiceEventMonitor />}
{activeTab === 'settings' && (
<Box>
+1 -1
View File
@@ -309,7 +309,7 @@
}
},
"service_monitor": {
"title": "Service Monitor",
"title": "Service Logs",
"desc": "Track the start, stop, and error history of services.",
"event_log": "Event Log",
"clear_confirm": "Are you sure you want to clear the entire event history?",
+1 -1
View File
@@ -304,7 +304,7 @@
}
},
"service_monitor": {
"title": "Servis İzleyici",
"title": "Servis Logları",
"desc": "Servislerin başlama, durma ve hata geçmişini takip edin.",
"event_log": "Olay Günlüğü",
"clear_confirm": "Tüm olay geçmişini silmek istediğinize emin misiniz?",