feat: add summary dashboard history charts
This commit is contained in:
@@ -168,6 +168,17 @@ class APIv2_12: BaseAPIClient, ServerAPIProtocol {
|
||||
return try await performRequest(request, responseType: UtilizationType.self)
|
||||
}
|
||||
|
||||
func fetchCPUUtilizationPercent(apiKey: String) async throws -> Double {
|
||||
let url = Endpoint.utilization.url(baseURL: baseURL)
|
||||
var request = URLRequest(url: url)
|
||||
request.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
request.setValue(apiKey, forHTTPHeaderField: "X-API-KEY")
|
||||
request.timeoutInterval = 30
|
||||
|
||||
let utilization = try await performRequest(request, responseType: UtilizationType.self)
|
||||
return utilization.cpu.overall
|
||||
}
|
||||
|
||||
func fetchServerSummary(apiKey: String) async throws -> ServerInfo {
|
||||
let summaryURL = baseURL.appendingPathComponent("api/v2/server")
|
||||
var request = URLRequest(url: summaryURL)
|
||||
@@ -397,6 +408,7 @@ private extension APIv2_12 {
|
||||
total: disk.total,
|
||||
percent: disk.percent
|
||||
),
|
||||
cpuUtilizationPercent: nil,
|
||||
panelVersion: meta.panelVersion,
|
||||
panelBuild: String(meta.panelBuild),
|
||||
apiVersion: meta.apiVersion,
|
||||
|
||||
Reference in New Issue
Block a user