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.
31 lines
770 B
Go
31 lines
770 B
Go
package controllers
|
|
|
|
import (
|
|
"opsxloki/dto"
|
|
"opsxloki/services"
|
|
"opsxloki/utils"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// ImageRegistryController 镜像源设置(国内/海外/私有仓库)
|
|
type ImageRegistryController struct{}
|
|
|
|
func NewImageRegistryController() *ImageRegistryController { return &ImageRegistryController{} }
|
|
|
|
func (ctrl *ImageRegistryController) Get(c *gin.Context) {
|
|
utils.Success(c, services.ImageRegistryPublicConfig())
|
|
}
|
|
|
|
func (ctrl *ImageRegistryController) Save(c *gin.Context) {
|
|
var req dto.ImageRegistryRequest
|
|
if !utils.BindAndValidate(c, &req) {
|
|
return
|
|
}
|
|
if err := services.SaveImageRegistry(req.Mode, req.CustomHost); err != nil {
|
|
utils.Error(c, 400, err.Error())
|
|
return
|
|
}
|
|
utils.Success(c, services.ImageRegistryPublicConfig())
|
|
}
|