diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..1c3c89c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,47 @@ +name: Bug Report +description: File a bug report about nezha. + +body: + - type: input + attributes: + label: Environment + description: Input your OS information and host architecture here. + placeholder: Debian GNU/Linux 12 6.1.0-22-amd64 + validations: + required: true + - type: input + attributes: + label: Agent Version + description: Input the version of your copy of nezha here. + validations: + required: true + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + value: | +
+ validations: + required: true + - type: textarea + attributes: + label: To Reproduce + description: Input your configuration and the steps to reproduce the bug here. + value: | +
+ validations: + required: true + - type: textarea + attributes: + label: Additional Context + description: Input any other relevant information that may help understand the issue. + value: | +
+ - type: checkboxes + attributes: + label: Validation + options: + - label: I confirm this is a bug about nezha (Nezha Dashboard). + required: true + - label: I have searched Issues and confirm this bug has been reported before. + required: true diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.yml b/.github/ISSUE_TEMPLATE/bug_report_zh.yml new file mode 100644 index 0000000..aeff7b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.yml @@ -0,0 +1,47 @@ +name: 问题反馈 +description: 提交 nezha 问题反馈 + +body: + - type: input + attributes: + label: 运行环境 + description: 请在这里输入你的系统信息及设备架构 + placeholder: Debian GNU/Linux 12 6.1.0-22-amd64 + validations: + required: true + - type: input + attributes: + label: Agent 版本 + description: 在这里输入你的 nezha 版本号 + validations: + required: true + - type: textarea + attributes: + label: 描述问题 + description: 一个清晰明了的问题描述 + value: | +
+ validations: + required: true + - type: textarea + attributes: + label: 复现步骤 + description: 在这里输入你的配置信息及复现问题的步骤 + value: | +
+ validations: + required: true + - type: textarea + attributes: + label: 附加信息 + description: 在这里输入其它对问题解决有帮助的信息 + value: | +
+ - type: checkboxes + attributes: + label: 验证 + options: + - label: 我确认这是一个 nezha (哪吒面板) 的问题。 + required: true + - label: 我已经搜索了 Issues,并确认该问题之前没有被反馈过。 + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1ded487 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,10 @@ +contact_links: + - name: Report nezha-agent issues / 反馈 nezha-agent 问题 + url: https://github.com/nezhahq/agent/issues + about: 请在这里创建 nezha-agent 的问题反馈。 + - name: Report admin frontend issues / 反馈管理前端问题 + url: https://github.com/nezhahq/admin-frontend/issues + about: 请在这里创建管理前端的问题反馈。 + - name: Report user frontend issues / 反馈用户前端问题 + url: https://github.com/hamster1963/nezha-dash/issues + about: 请在这里创建用户前端的问题反馈。 diff --git a/cmd/dashboard/controller/server.go b/cmd/dashboard/controller/server.go index b3026b0..48bd56e 100644 --- a/cmd/dashboard/controller/server.go +++ b/cmd/dashboard/controller/server.go @@ -5,6 +5,7 @@ import ( "github.com/gin-gonic/gin" "github.com/jinzhu/copier" + "gorm.io/gorm" "github.com/nezhahq/nezha/model" "github.com/nezhahq/nezha/pkg/utils" @@ -103,7 +104,17 @@ func batchDeleteServer(c *gin.Context) (any, error) { return nil, err } - if err := singleton.DB.Unscoped().Delete(&model.Server{}, "id in (?)", servers).Error; err != nil { + err := singleton.DB.Transaction(func(tx *gorm.DB) error { + if err := tx.Unscoped().Delete(&model.Server{}, "id in (?)", servers).Error; err != nil { + return err + } + if err := tx.Unscoped().Delete(&model.ServerGroupServer{}, "server_id in (?)", servers).Error; err != nil { + return err + } + return nil + }) + + if err != nil { return nil, newGormError("%v", err) }