snapshot: AnsibleManager拆分前快照

This commit is contained in:
attacker committed 2026-06-15 10:01:24 +08:00
1 parent 16205fdb2b
commit e6d9f364e5
13 files changed
+660 -103

No files matched your search

+18
View File
@@ -115,6 +115,24 @@ func (h *AnsibleHandler) DeletePlaybook(c *gin.Context) {
c.JSON(http.StatusOK, models.Response{Code: 200, Message: "已删除"})
}
// BatchDeletePlaybooks 批量删除 Playbook // Logan.Li
func (h *AnsibleHandler) BatchDeletePlaybooks(c *gin.Context) {
var req models.IDsRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusBadRequest, models.Response{Code: 400, Message: "请求参数错误"})
return
}
if len(req.IDs) == 0 {
c.JSON(http.StatusBadRequest, models.Response{Code: 400, Message: "ids 不能为空"})
return
}
if err := h.db.Delete(&models.AnsiblePlaybook{}, req.IDs).Error; err != nil {
c.JSON(http.StatusInternalServerError, models.Response{Code: 500, Message: "删除失败"})
return
}
c.JSON(http.StatusOK, models.Response{Code: 200, Message: "已删除"})
}
// ==================== Job ====================
func (h *AnsibleHandler) ListJobs(c *gin.Context) {