From 37560a9449d21335d948583918e6aa234eb9db80 Mon Sep 17 00:00:00 2001 From: ned Date: Mon, 8 Mar 2021 14:27:27 +0100 Subject: [PATCH] support queue length in system status --- appdb/Models/ServiceStatus.swift | 2 ++ appdb/Tabs/Settings/System Status/SystemStatus.swift | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/appdb/Models/ServiceStatus.swift b/appdb/Models/ServiceStatus.swift index d49d3921..30d8cd6a 100644 --- a/appdb/Models/ServiceStatus.swift +++ b/appdb/Models/ServiceStatus.swift @@ -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"] } } diff --git a/appdb/Tabs/Settings/System Status/SystemStatus.swift b/appdb/Tabs/Settings/System Status/SystemStatus.swift index 5984035d..42e423ac 100644 --- a/appdb/Tabs/Settings/System Status/SystemStatus.swift +++ b/appdb/Tabs/Settings/System Status/SystemStatus.swift @@ -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