Skip to content

Commit

Permalink
fix server deletion api, add issue templates (#526)
Browse files Browse the repository at this point in the history
* add issue templates

* fix: server deletion api
  • Loading branch information
uubulb authored Dec 1, 2024
1 parent 7f33f82 commit b128a0a
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 1 deletion.
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_zh.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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: 请在这里创建用户前端的问题反馈。
13 changes: 12 additions & 1 deletion cmd/dashboard/controller/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit b128a0a

Please sign in to comment.