This commit is contained in:
Logan committed 2026-07-09 14:16:56 +08:00
1 parent 0690285147
commit 5618cd2738
154 files changed
+5021 -3161

No files matched your search

+11 -11
View File
@@ -25,7 +25,7 @@ func NewAgentTaskHandler(db *gorm.DB) *AgentTaskHandler {
func (h *AgentTaskHandler) CreateTask(c *gin.Context) {
var req struct {
Hostname string `json:"hostname"`
Type string `json:"type"` // command / script
Type string `json:"type"` // command / script
Command string `json:"command"`
Timeout int `json:"timeout"`
}
@@ -47,12 +47,12 @@ func (h *AgentTaskHandler) CreateTask(c *gin.Context) {
username, _ := c.Get("username")
task := model.AgentTask{
TaskID: uuid.New().String(),
Hostname: req.Hostname,
Type: req.Type,
Command: req.Command,
Timeout: req.Timeout,
Status: "pending",
TaskID: uuid.New().String(),
Hostname: req.Hostname,
Type: req.Type,
Command: req.Command,
Timeout: req.Timeout,
Status: "pending",
CreatedBy: fmt.Sprintf("%v", username),
}
@@ -180,11 +180,11 @@ func (h *AgentTaskHandler) QuickSetupRules(c *gin.Context) {
}
type ruleDef struct {
Name string
Metric string
Operator string
Name string
Metric string
Operator string
Threshold float64
Duration int
Duration int
}
defaultRules := []ruleDef{