feat: migrate Flutter to Cupertino with daily logs and computer groups
This commit is contained in:
1 parent
c568749d23
commit
87e1fff59b
22 files changed
+808
-55
No files matched your search
+24
-3
@@ -188,14 +188,35 @@ func (b *broker) agentEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
func (b *broker) devicesEndpoint(w http.ResponseWriter, r *http.Request) {
|
||||
type device struct {
|
||||
ID string `json:"id"`
|
||||
Busy bool `json:"busy"`
|
||||
ID string `json:"id"`
|
||||
Busy bool `json:"busy"`
|
||||
AgentID string `json:"agent_id,omitempty"`
|
||||
ComputerName string `json:"computer_name,omitempty"`
|
||||
}
|
||||
devices := []device{}
|
||||
b.mu.Lock()
|
||||
for id, a := range b.agents {
|
||||
if a.ws != nil {
|
||||
devices = append(devices, device{id, b.leases[id] != nil})
|
||||
item := device{ID: id, Busy: b.leases[id] != nil}
|
||||
for agentID, m := range b.managers {
|
||||
if m.ws == nil {
|
||||
continue
|
||||
}
|
||||
for _, phone := range m.status.Devices {
|
||||
if phone.ID == id {
|
||||
item.AgentID = agentID
|
||||
item.ComputerName = m.status.Name
|
||||
if item.ComputerName == "" {
|
||||
item.ComputerName = m.status.Hostname
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
if item.AgentID != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
devices = append(devices, item)
|
||||
}
|
||||
}
|
||||
b.mu.Unlock()
|
||||
|
||||
Reference in new issue
Block a user