feat: dbms新增支持工单流程审批

This commit is contained in:
meilin.huang
2024-02-29 22:12:50 +08:00
parent bf75483a3c
commit f93231da61
115 changed files with 3280 additions and 553 deletions

View File

@@ -10,6 +10,7 @@ import (
"mayfly-go/internal/machine/config"
"mayfly-go/internal/machine/domain/entity"
tagapp "mayfly-go/internal/tag/application"
tagentity "mayfly-go/internal/tag/domain/entity"
"mayfly-go/pkg/biz"
"mayfly-go/pkg/errorx"
"mayfly-go/pkg/model"
@@ -43,14 +44,20 @@ func (m *Machine) Machines(rc *req.Ctx) {
}
condition.Codes = codes
res, err := m.MachineApp.GetMachineList(condition, pageParam, new([]*vo.MachineVO))
var machinevos []*vo.MachineVO
res, err := m.MachineApp.GetMachineList(condition, pageParam, &machinevos)
biz.ErrIsNil(err)
if res.Total == 0 {
rc.ResData = res
return
}
for _, mv := range *res.List {
// 填充标签信息
m.TagApp.FillTagInfo(collx.ArrayMap(machinevos, func(mvo *vo.MachineVO) tagentity.ITagResource {
return mvo
})...)
for _, mv := range machinevos {
if machineStats, err := m.MachineApp.GetMachineStats(mv.Id); err == nil {
mv.Stat = collx.M{
"cpuIdle": machineStats.CPU.Idle,

View File

@@ -1,6 +1,7 @@
package vo
import (
tagentity "mayfly-go/internal/tag/domain/entity"
"time"
)
@@ -12,6 +13,8 @@ type AuthCertBaseVO struct {
}
type MachineVO struct {
tagentity.ResourceTags
Id uint64 `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
@@ -35,6 +38,10 @@ type MachineVO struct {
Stat map[string]any `json:"stat" gorm:"-"`
}
func (m *MachineVO) GetCode() string {
return m.Code
}
type MachineScriptVO struct {
Id *int64 `json:"id"`
Name *string `json:"name"`

View File

@@ -67,6 +67,9 @@ func checkClientAvailability(interval time.Duration) {
continue
}
cli := v.Value.(*Cli)
if cli.Info == nil {
continue
}
if _, _, err := cli.sshClient.Conn.SendRequest("ping", true, nil); err != nil {
logx.Errorf("machine[%s] cache client is not available: %s", cli.Info.Name, err.Error())
DeleteCli(cli.Info.Id)