feat: complete Loki query, insights, settings and deployment workflows

Add the Loki query UI, access policies, ingress insights, alert and registry settings, and their backend APIs. Include the related Kubernetes deployment and collector updates required by the integrated application.

Validated with go test ./..., npm run build, and npm run lint.
This commit is contained in:
logan committed 2026-10-25 21:28:32 +08:00
1 parent f9c6c1d826
commit 2d73661dd1
127 files changed
+8117 -2876

No files matched your search

+39 -1
View File
@@ -2,11 +2,11 @@ package controllers
import (
"context"
"time"
"opsxloki/dto"
"opsxloki/models"
"opsxloki/services"
"opsxloki/utils"
"time"
"github.com/gin-gonic/gin"
)
@@ -31,6 +31,8 @@ func (ctrl *DeploymentController) Create(c *gin.Context) {
Mode: req.Mode,
ClusterID: req.ClusterID,
HostID: req.HostID,
ListenIP: req.ListenIP,
ListenPort: req.ListenPort,
Namespace: req.Namespace,
StorageConfigID: req.StorageConfigID,
AuthEnabled: req.AuthEnabled,
@@ -120,6 +122,42 @@ func (ctrl *DeploymentController) Update(c *gin.Context) {
utils.Success(c, gin.H{"message": "updated"})
}
// UpdateRetention 校验 YAML 片段,保存部署配置,并可立即重部署。
func (ctrl *DeploymentController) UpdateRetention(c *gin.Context) {
id, err := utils.IntParam(c, "id")
if err != nil {
utils.BadRequest(c, "ID 无效")
return
}
var req dto.UpdateRetentionRequest
if !utils.BindAndValidate(c, &req) {
return
}
days, err := ctrl.service.UpdateRetention(uint(id), req.YAML, req.Apply)
if err != nil {
utils.Error(c, 400, err.Error())
return
}
utils.Success(c, gin.H{"retentionDays": days, "applying": req.Apply})
}
// GetLiveConfig 返回运行中的完整 Loki YAML,服务层会先遮盖凭证。
func (ctrl *DeploymentController) GetLiveConfig(c *gin.Context) {
id, err := utils.IntParam(c, "id")
if err != nil {
utils.BadRequest(c, "ID 无效")
return
}
ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
defer cancel()
result, err := ctrl.service.GetLiveConfig(ctx, uint(id))
if err != nil {
utils.Error(c, 400, err.Error())
return
}
utils.Success(c, result)
}
func (ctrl *DeploymentController) Delete(c *gin.Context) {
id, err := utils.IntParam(c, "id")
if err != nil {