Skip to content

Commit

Permalink
support queue length in system status
Browse files Browse the repository at this point in the history
  • Loading branch information
nedley committed Mar 8, 2021
1 parent fa74f26 commit 37560a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions appdb/Models/ServiceStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ struct ServiceStatus: Mappable {

var name: String = ""
var isOnline: Bool = false
var data: Int?

mutating func mapping(map: Map) {
name <- map["name"]
isOnline <- map["is_online"]
data <- map["data"]
}
}
8 changes: 7 additions & 1 deletion appdb/Tabs/Settings/System Status/SystemStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ class SystemStatus: LoadingTableView {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "service", for: indexPath) as? SimpleStaticCell {
cell.textLabel?.text = services[indexPath.row].name
cell.accessoryView = UIImageView(image: services[indexPath.row].isOnline ? #imageLiteral(resourceName: "online") : #imageLiteral(resourceName: "offline"))
if let data = services[indexPath.row].data {
cell.detailTextLabel?.text = String(data)
cell.accessoryView = nil
} else {
cell.detailTextLabel?.text = ""
cell.accessoryView = UIImageView(image: services[indexPath.row].isOnline ? #imageLiteral(resourceName: "online") : #imageLiteral(resourceName: "offline"))
}
cell.accessoryView?.frame.size.width = 24
cell.accessoryView?.frame.size.height = 24
cell.selectionStyle = .none
Expand Down

0 comments on commit 37560a9

Please sign in to comment.