From 0b6fcf36a9bbd8576028fe4f33fc8dd74bb084f4 Mon Sep 17 00:00:00 2001 From: Arjun Komath Date: Thu, 27 Oct 2022 19:20:07 +1100 Subject: [PATCH] Fix #31 Handle missing enabled key --- .../xcshareddata/swiftpm/Package.resolved | 24 +++++++++---------- .../xcschemes/xcschememanagement.plist | 4 ++-- netdata/Models/ServerCharts.swift | 3 +-- .../Components/ChartListRow.swift | 1 - .../Components/CustomChartDetailView.swift | 1 + .../ServerDetail/ServerDetailViewModel.swift | 2 -- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/netdata.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/netdata.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 1857fa3..dbf19d1 100644 --- a/netdata.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/netdata.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,16 +1,14 @@ { - "object": { - "pins": [ - { - "package": "Bugsnag", - "repositoryURL": "https://github.com/bugsnag/bugsnag-cocoa", - "state": { - "branch": null, - "revision": "3850d4cd88f3eeabc8fff271a1b08a6a6d4e381a", - "version": "6.10.2" - } + "pins" : [ + { + "identity" : "bugsnag-cocoa", + "kind" : "remoteSourceControl", + "location" : "https://github.com/bugsnag/bugsnag-cocoa", + "state" : { + "revision" : "3850d4cd88f3eeabc8fff271a1b08a6a6d4e381a", + "version" : "6.10.2" } - ] - }, - "version": 1 + } + ], + "version" : 2 } diff --git a/netdata.xcodeproj/xcuserdata/arjunkomath.xcuserdatad/xcschemes/xcschememanagement.plist b/netdata.xcodeproj/xcuserdata/arjunkomath.xcuserdatad/xcschemes/xcschememanagement.plist index 5bf7361..ea2e0a0 100644 --- a/netdata.xcodeproj/xcuserdata/arjunkomath.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/netdata.xcodeproj/xcuserdata/arjunkomath.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ AlarmWidgetExtension.xcscheme_^#shared#^_ orderHint - 1 + 0 Playground (Playground) 1.xcscheme @@ -38,7 +38,7 @@ netdata.xcscheme_^#shared#^_ orderHint - 0 + 1 SuppressBuildableAutocreation diff --git a/netdata/Models/ServerCharts.swift b/netdata/Models/ServerCharts.swift index 0656b72..aa1313d 100644 --- a/netdata/Models/ServerCharts.swift +++ b/netdata/Models/ServerCharts.swift @@ -14,7 +14,6 @@ public struct ServerChart: Encodable, Decodable, Identifiable { var family: String; var context: String; var title: String; - var enabled: Bool; var units: String; } @@ -26,7 +25,7 @@ public struct ServerCharts: Encodable, Decodable { public var activeCharts: [ServerChart] { return charts.keys.sorted() .filter { - charts[$0] != nil && charts[$0]!.enabled + charts[$0] != nil } .map { charts[$0]! diff --git a/netdata/Modules/ServerDetail/Components/ChartListRow.swift b/netdata/Modules/ServerDetail/Components/ChartListRow.swift index 033383d..206896e 100644 --- a/netdata/Modules/ServerDetail/Components/ChartListRow.swift +++ b/netdata/Modules/ServerDetail/Components/ChartListRow.swift @@ -38,7 +38,6 @@ struct ChartListRow_Previews: PreviewProvider { family: "fragments", context: "ipv4.sockstat_frag_mem", title: "IPv4 FRAG Sockets Memory (ipv4.sockstat_frag_mem)", - enabled: true, units: "GiB"), serverUrl: "", basicAuthBase64: "") diff --git a/netdata/Modules/ServerDetail/Components/CustomChartDetailView.swift b/netdata/Modules/ServerDetail/Components/CustomChartDetailView.swift index df811f9..5c8484b 100644 --- a/netdata/Modules/ServerDetail/Components/CustomChartDetailView.swift +++ b/netdata/Modules/ServerDetail/Components/CustomChartDetailView.swift @@ -42,6 +42,7 @@ struct CustomChartDetailView: View { } else { Button(action: { withAnimation { + // Fix warning https://developer.apple.com/forums/thread/711899 userSettings.bookmarks.insert(serverChart.id, at: 0) } }, label: { diff --git a/netdata/Modules/ServerDetail/ServerDetailViewModel.swift b/netdata/Modules/ServerDetail/ServerDetailViewModel.swift index bb7ab5f..41ac603 100644 --- a/netdata/Modules/ServerDetail/ServerDetailViewModel.swift +++ b/netdata/Modules/ServerDetail/ServerDetailViewModel.swift @@ -147,8 +147,6 @@ enum DataMode { self.bookmarks = bookmarks .compactMap { chart in charts.charts[chart] - }.filter { chart in - chart.enabled } self.bookmarkedChartData = Array(repeating: ServerData(labels: [], data: []), count: self.bookmarks.count)