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
+176
View File
@@ -1,4 +1,180 @@
[
{
"service": "php:5.6.40",
"action": "start",
"status": "success",
"id": "ip2wf8j95",
"timestamp": 1775131231041
},
{
"service": "php:7.4.33",
"action": "start",
"status": "success",
"id": "brta3j7bf",
"timestamp": 1775131231014
},
{
"service": "php:8.2.30",
"action": "start",
"status": "success",
"id": "3i8vcjvbv",
"timestamp": 1775131230996
},
{
"service": "php:8.5.4",
"action": "start",
"status": "success",
"id": "ppygpqvhx",
"timestamp": 1775131230979
},
{
"service": "mariadb:10.11.8",
"action": "start",
"status": "success",
"id": "n0g8i2avo",
"timestamp": 1775131230537
},
{
"service": "mariadb:11.4.2",
"action": "start",
"status": "success",
"id": "02we1vlvr",
"timestamp": 1775131230516
},
{
"service": "apache",
"action": "start",
"status": "success",
"id": "1jpcki5fc",
"timestamp": 1775131229986
},
{
"service": "nginx",
"action": "start",
"status": "success",
"id": "3rigad9dj",
"timestamp": 1775131229925
},
{
"service": "mariadb:10.11.8",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "nn66e97ys",
"timestamp": 1775131224313
},
{
"service": "mariadb:11.4.2",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "pbmy1sua2",
"timestamp": 1775131224306
},
{
"service": "php:5.6.40",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "21csoq0zp",
"timestamp": 1775131224296
},
{
"service": "php:7.4.33",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "tfq0icf4v",
"timestamp": 1775131224289
},
{
"service": "php:8.2.30",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "keraic95e",
"timestamp": 1775131224281
},
{
"service": "php:8.5.4",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "5yfeqf3ni",
"timestamp": 1775131224274
},
{
"service": "apache",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "sybx4mc6m",
"timestamp": 1775131224235
},
{
"service": "nginx",
"action": "exit",
"status": "failure",
"details": "Exit code: null",
"id": "lpmb34l47",
"timestamp": 1775131224222
},
{
"service": "mariadb:10.11.8",
"action": "stop",
"status": "info",
"id": "sgmy1tqyr",
"timestamp": 1775131224213
},
{
"service": "mariadb:11.4.2",
"action": "stop",
"status": "info",
"id": "jkh1z3y1a",
"timestamp": 1775131224196
},
{
"service": "php:5.6.40",
"action": "stop",
"status": "info",
"id": "sjoit37nw",
"timestamp": 1775131224184
},
{
"service": "php:7.4.33",
"action": "stop",
"status": "info",
"id": "dl2pmnf64",
"timestamp": 1775131224171
},
{
"service": "php:8.2.30",
"action": "stop",
"status": "info",
"id": "qi4jcjjis",
"timestamp": 1775131224159
},
{
"service": "php:8.5.4",
"action": "stop",
"status": "info",
"id": "gu69r9z5l",
"timestamp": 1775131224145
},
{
"service": "apache",
"action": "stop",
"status": "info",
"id": "o4py4bflp",
"timestamp": 1775131224131
},
{
"service": "nginx",
"action": "stop",
"status": "info",
"id": "ne32x4sul",
"timestamp": 1775131224124
},
{
"service": "php:5.6.40",
"action": "start",
+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?",