功能:完善通用云管工作台、审计与诊断能力
This commit is contained in:
1 parent
5ac692724d
commit
9f05aa20ea
225 files changed
+14266
-141
No files matched your search
@@ -73,7 +73,7 @@ func (s *Server) deviceAuth(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
defer tx.Rollback()
|
||||
if strings.HasSuffix(c.FullPath(), "/connect-ticket") || strings.HasSuffix(c.FullPath(), "/connect-ticket/consume") {
|
||||
if strings.HasSuffix(c.FullPath(), "/connect-ticket") || strings.HasSuffix(c.FullPath(), "/connect-ticket/consume") || strings.HasSuffix(c.FullPath(), "/desktop-prepare") {
|
||||
if !s.lockAuthorization(c, tx) {
|
||||
return
|
||||
}
|
||||
@@ -174,7 +174,15 @@ func (s *Server) deviceDesktops(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
if s.commitDevice(c) {
|
||||
list(c, items)
|
||||
type item struct {
|
||||
model.Desktop
|
||||
PowerOnConnect bool `json:"powerOnConnect"`
|
||||
}
|
||||
result := make([]item, 0, len(items))
|
||||
for _, d := range items {
|
||||
result = append(result, item{d, s.exclusiveGPU(d) && !d.SetupRequired && d.Endpoint != ""})
|
||||
}
|
||||
list(c, result)
|
||||
}
|
||||
}
|
||||
func (s *Server) deviceCommands(c *gin.Context) {
|
||||
@@ -258,7 +266,10 @@ func (s *Server) createTicket(c *gin.Context) {
|
||||
if !s.hardwareAllowsConnection(c, d.ID) {
|
||||
return
|
||||
}
|
||||
if d.SetupRequired || d.PowerState != "running" || d.Endpoint == "" {
|
||||
if !s.gpuAllowsConnection(c, d) {
|
||||
return
|
||||
}
|
||||
if d.SetupRequired || (d.PowerState != "running" && !s.exclusiveGPU(d)) || d.Endpoint == "" {
|
||||
s.fail(c, 409, "desktop_not_ready", "桌面未开机或尚未配置连接地址")
|
||||
return
|
||||
}
|
||||
@@ -309,7 +320,10 @@ func (s *Server) consumeTicket(c *gin.Context) {
|
||||
if !s.hardwareAllowsConnection(c, d.ID) {
|
||||
return
|
||||
}
|
||||
if d.SetupRequired || d.PowerState != "running" || d.Endpoint == "" {
|
||||
if !s.gpuAllowsConnection(c, d) {
|
||||
return
|
||||
}
|
||||
if d.SetupRequired || (d.PowerState != "running" && !s.exclusiveGPU(d)) || d.Endpoint == "" {
|
||||
s.fail(c, 409, "desktop_not_ready", "桌面当前不可连接")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user