fix server deletion api, add issue templates (#526)

* add issue templates

* fix: server deletion api
This commit is contained in:
UUBulb 2024-12-01 23:45:26 +08:00 committed by GitHub
parent 7f33f8239e
commit b128a0a5ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 116 additions and 1 deletions

47
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -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: |
<details></details>
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Input your configuration and the steps to reproduce the bug here.
value: |
<details></details>
validations:
required: true
- type: textarea
attributes:
label: Additional Context
description: Input any other relevant information that may help understand the issue.
value: |
<details></details>
- 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

View File

@ -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: |
<details></details>
validations:
required: true
- type: textarea
attributes:
label: 复现步骤
description: 在这里输入你的配置信息及复现问题的步骤
value: |
<details></details>
validations:
required: true
- type: textarea
attributes:
label: 附加信息
description: 在这里输入其它对问题解决有帮助的信息
value: |
<details></details>
- type: checkboxes
attributes:
label: 验证
options:
- label: 我确认这是一个 nezha (哪吒面板) 的问题。
required: true
- label: 我已经搜索了 Issues并确认该问题之前没有被反馈过。
required: true

10
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -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: 请在这里创建用户前端的问题反馈。

View File

@ -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)
}