mirror of
https://github.com/henrygd/beszel.git
synced 2026-10-01 13:57:47 +02:00
feat: list pending package updates on the system page (#2427)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/henrygd/beszel/internal/common"
|
||||
"github.com/henrygd/beszel/internal/entities/monitor"
|
||||
"github.com/henrygd/beszel/internal/entities/smart"
|
||||
"github.com/henrygd/beszel/internal/entities/system"
|
||||
|
||||
"log/slog"
|
||||
)
|
||||
@@ -54,6 +55,7 @@ func NewHandlerRegistry() *HandlerRegistry {
|
||||
registry.Register(common.GetSystemdInfo, &GetSystemdInfoHandler{})
|
||||
registry.Register(common.SyncNetworkMonitors, &SyncNetworkMonitorsHandler{})
|
||||
registry.Register(common.GetZfsData, &GetZfsDataHandler{})
|
||||
registry.Register(common.GetPackageUpdates, &GetPackageUpdatesHandler{})
|
||||
|
||||
return registry
|
||||
}
|
||||
@@ -198,6 +200,20 @@ func (h *GetZfsDataHandler) Handle(hctx *HandlerContext) error {
|
||||
return hctx.SendResponse(hctx.Agent.storagePoolManager.GetDetail(req.Force), hctx.RequestID)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// GetPackageUpdatesHandler returns the pending package updates found by the
|
||||
// last background check. It never runs a check itself.
|
||||
type GetPackageUpdatesHandler struct{}
|
||||
|
||||
func (h *GetPackageUpdatesHandler) Handle(hctx *HandlerContext) error {
|
||||
if hctx.Agent.packageUpdates == nil {
|
||||
return hctx.SendResponse(system.PackageUpdates{}, hctx.RequestID)
|
||||
}
|
||||
return hctx.SendResponse(hctx.Agent.packageUpdates.list(), hctx.RequestID)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user