feat: nettoyage menu + suppression modules inexistants + log viewer

- Sidebar : retrait des liens files, logs, services (non implémentés)
- Migration 001 : suppression des inserts files/logs/services
- Migration 002 : DELETE des modules inexistants en DB existante
- logbuffer : ring buffer mémoire branché sur log.SetOutput
- GET /api/settings/logs : retourne les 300 dernières lignes de log
- Settings : onglet Logs avec auto-refresh (5s/10s/30s/60s/désactivé, défaut 10s)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-20 23:57:07 +01:00
parent 07af66ad81
commit 88831e3967
9 changed files with 200 additions and 27 deletions

View file

@ -3,9 +3,11 @@ package api
import (
"net/http"
"strconv"
"git.geronzi.fr/proxmoxPanel/core/backend/internal/audit"
"git.geronzi.fr/proxmoxPanel/core/backend/internal/db"
"git.geronzi.fr/proxmoxPanel/core/backend/internal/logbuffer"
"github.com/go-chi/chi/v5"
)
@ -168,6 +170,22 @@ func (h *SettingsHandler) DisableModule(w http.ResponseWriter, r *http.Request)
JSONResponse(w, http.StatusOK, map[string]string{"message": "Module désactivé"})
}
// GetLogs retourne les dernières lignes du log applicatif (tampon mémoire).
// GET /api/settings/logs?lines=200
func (h *SettingsHandler) GetLogs(w http.ResponseWriter, r *http.Request) {
n := 200
if s := r.URL.Query().Get("lines"); s != "" {
if v, err := strconv.Atoi(s); err == nil && v > 0 {
n = v
}
}
lines := logbuffer.Global.Lines(n)
if lines == nil {
lines = []string{}
}
JSONResponse(w, http.StatusOK, lines)
}
// GetAuditLog retourne le journal d'audit paginé.
// GET /api/settings/audit
func (h *SettingsHandler) GetAuditLog(w http.ResponseWriter, r *http.Request) {