From 17e5b3254dcd11ab3687ceb97c6fce116e9439ef Mon Sep 17 00:00:00 2001 From: Blacky <106263486+Black-Fox-2022@users.noreply.github.com> Date: Wed, 29 May 2024 10:26:29 +0200 Subject: [PATCH 1/4] Load Data on Change of TimeInterval --- Cluster/QueryRunner.swift | 30 ++ Services/QueryService.swift | 84 ----- Shared/Insight and Groups/QueryView.swift | 349 ------------------ Telemetry Viewer.xcodeproj/project.pbxproj | 6 - .../xcshareddata/swiftpm/Package.resolved | 132 ------- 5 files changed, 30 insertions(+), 571 deletions(-) delete mode 100644 Shared/Insight and Groups/QueryView.swift delete mode 100644 Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/Cluster/QueryRunner.swift b/Cluster/QueryRunner.swift index 9fcbbd2..f478e26 100644 --- a/Cluster/QueryRunner.swift +++ b/Cluster/QueryRunner.swift @@ -50,6 +50,33 @@ struct QueryRunner: View { } } } + .onChange(of: queryService.isTestingMode) { + Task { + do { + try await getQueryResult() + } catch { + print(error) + } + } + } + .onChange(of: queryService.timeWindowBeginning) { + Task { + do { + try await getQueryResult() + } catch { + print(error) + } + } + } + .onChange(of: queryService.timeWindowEnd) { + Task { + do { + try await getQueryResult() + } catch { + print(error) + } + } + } } private func getQueryResult() async throws { @@ -84,6 +111,9 @@ extension QueryRunner { queryCopy.relativeIntervals = [RelativeTimeInterval(beginningDate: queryService.timeWindowBeginning.toRelativeDate(), endDate: queryService.timeWindowEnd.toRelativeDate())] } } + if queryCopy.testMode == nil { + queryCopy.testMode = queryService.isTestingMode + } let response: [String: String] = try await api.post(data: queryCopy, url: queryBeginURL) guard let taskID = response["queryTaskID"] else { diff --git a/Services/QueryService.swift b/Services/QueryService.swift index e842e39..72c5cd3 100644 --- a/Services/QueryService.swift +++ b/Services/QueryService.swift @@ -72,88 +72,4 @@ class QueryService: ObservableObject { } } - func getInsightQuery(ofInsightWithID insightID: DTOv2.Insight.ID) async throws -> CustomQuery { - return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in - let url = api.urlForPath(apiVersion: .v3, "insights", insightID.uuidString, "query") - - struct ProduceQueryBody: Codable { - /// Is Test Mode enabled? (nil means false) - public var testMode: Bool? - /// Which time intervals are we looking at? - public var relativeInterval: RelativeTimeInterval? - public var interval: QueryTimeInterval? - } - - let produceQueryBody = ProduceQueryBody(testMode: isTestingMode, interval: .init(beginningDate: timeWindowBeginningDate, endDate: timeWindowEndDate)) - - api.post(produceQueryBody, to: url) { (result: Result) in - switch result { - case .success(let query): - continuation.resume(returning: query) - - case .failure(let error): - self.errorService.handle(transferError: error) - continuation.resume(throwing: error) - } - } - } - } - - func createTask(forQuery query: CustomQuery) async throws -> [String: String] { - return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<[String: String], Error>) in - - // If the query has no specified interval, give it the default interval - var query = query - if query.relativeIntervals == nil && query.intervals == nil { - query.intervals = [.init(beginningDate: timeWindowBeginningDate, endDate: timeWindowEndDate)] - } - - let url = api.urlForPath(apiVersion: .v3, "query", "calculate-async") - api.post(query, to: url) { (result: Result<[String: String], TransferError>) in - switch result { - case .success(let taskID): - - continuation.resume(returning: taskID) - - case .failure(let error): - self.errorService.handle(transferError: error) - continuation.resume(throwing: error) - } - } - } - } - - func getTaskResult(forTaskID taskID: String) async throws -> QueryResultWrapper { - return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in - let url = api.urlForPath(apiVersion: .v3, "task", taskID, "lastSuccessfulValue") - api.get(url) { (result: Result) in - switch result { - case .success(let queryResult): - - continuation.resume(returning: queryResult) - - case .failure(let error): - self.errorService.handle(transferError: error) - continuation.resume(throwing: error) - } - } - } - } - - func getTaskStatus(forTaskID taskID: String) async throws -> QueryTaskStatus { - return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in - let url = api.urlForPath(apiVersion: .v3, "task", taskID, "status") - api.get(url) { (result: Result) in - switch result { - case .success(let queryStatusStruct): - let queryStatus = queryStatusStruct.status - continuation.resume(returning: queryStatus) - - case .failure(let error): - self.errorService.handle(transferError: error) - continuation.resume(throwing: error) - } - } - } - } } diff --git a/Shared/Insight and Groups/QueryView.swift b/Shared/Insight and Groups/QueryView.swift deleted file mode 100644 index d6e7102..0000000 --- a/Shared/Insight and Groups/QueryView.swift +++ /dev/null @@ -1,349 +0,0 @@ -// -// QueryView.swift -// Telemetry Viewer -// -// Created by Charlotte Böhm on 22.02.22. -// - -import DataTransferObjects -import SwiftUI -import Charts - -// @State var customQuery: CustomQuery - -@MainActor -class QueryViewModel: ObservableObject { - let queryService: QueryService - let customQuery: CustomQuery - let displayMode: InsightDisplayMode - let isSelected: Bool - - public let runningTimer = Timer.publish( - every: 0.5, // seconds - on: .main, - in: .common - ).autoconnect() - - public let successTimer = Timer.publish( - every: 60, // seconds - on: .main, - in: .common - ).autoconnect() - - init(queryService: QueryService, customQuery: CustomQuery, displayMode: InsightDisplayMode, isSelected: Bool) { - self.queryService = queryService - self.customQuery = customQuery - self.displayMode = displayMode - self.isSelected = isSelected - } - - @Published var loadingState: LoadingState = .loading - @Published var queryTaskStatus: QueryTaskStatus = .running - - var taskID: [String: String] = ["queryTaskID": ""] - @Published var queryResult: QueryResultWrapper? - @Published var chartDataSet: ChartDataSet? - - // func that posts the query on load and loads the last result - - func retrieveResults() async { - loadingState = .loading - - do { - taskID = try await queryService.createTask(forQuery: customQuery) - let queryTaskID = taskID["queryTaskID"] - let result = try await queryService.getTaskResult(forTaskID: queryTaskID!) - if result.result != nil { - let chartDataSet = try ChartDataSet(fromQueryResultWrapper: result) - DispatchQueue.main.async { - self.queryResult = result - self.chartDataSet = chartDataSet - self.loadingState = .finished(Date()) - } - } - - } catch { - print(error.localizedDescription) - - DispatchQueue.main.async { - if let transferError = error as? TransferError { - switch transferError { - case .transferFailed, .decodeFailed: - self.loadingState = .error(transferError.localizedDescription, Date()) - case .serverError(let message): - if message == "Not Found" { - self.loadingState = .loading - } else { - self.loadingState = .error(transferError.localizedDescription, Date()) - } - } - } else if let chartDataSetError = error as? ChartDataSetError { - self.loadingState = .error(chartDataSetError.localizedDescription, Date()) - } else { - self.loadingState = .error(error.localizedDescription, Date()) - } - } - } - } - - /// Asks for the status every 0.5 seconds if current status is running and loads the result if status is successful - @MainActor - func checkIfStillRunning() async { - switch loadingState { - case .idle, .loading, .finished: - break - case .error: - return - } - - if queryTaskStatus == .running { - loadingState = .loading - - do { - let queryTaskID = taskID["queryTaskID"] - let taskStatus = try await queryService.getTaskStatus(forTaskID: queryTaskID!) - - switch taskStatus { - case .successful: - DispatchQueue.main.async { - self.queryTaskStatus = taskStatus - } - let queryTaskID = taskID["queryTaskID"] - let result = try await queryService.getTaskResult(forTaskID: queryTaskID!) - let chartDataSet = try ChartDataSet(fromQueryResultWrapper: result) - DispatchQueue.main.async { - self.queryResult = result - self.chartDataSet = chartDataSet - self.loadingState = .finished(Date()) - } - case .error: - DispatchQueue.main.async { - self.loadingState = .error("string", Date()) - self.queryTaskStatus = taskStatus - } - - case .running: - DispatchQueue.main.async { - self.loadingState = .finished(Date()) - self.queryTaskStatus = taskStatus - } - } - } catch { - print(error.localizedDescription) - DispatchQueue.main.async { - if let transferError = error as? TransferError { - switch transferError { - case .transferFailed, .decodeFailed: - self.loadingState = .error(transferError.localizedDescription, Date()) - case .serverError(let message): - if message == "Not Found" { - self.loadingState = .loading - } else { - self.loadingState = .error(transferError.localizedDescription, Date()) - } - } - } else if let chartDataSetError = error as? ChartDataSetError { - self.loadingState = .error(chartDataSetError.localizedDescription, Date()) - } else { - self.loadingState = .error(error.localizedDescription, Date()) - } - } - } - } - } - - /// Ask for the status every 10 seconds - func checkStatus() async { - switch loadingState { - case .idle, .loading, .finished: - break - case .error: - return - } - - if queryTaskStatus == .successful { - loadingState = .loading - do { - let queryTaskID = taskID["queryTaskID"] - let taskStatus = try await queryService.getTaskStatus(forTaskID: queryTaskID!) - switch taskStatus { - case .successful: - DispatchQueue.main.async { - self.loadingState = .finished(Date()) - self.queryTaskStatus = taskStatus - } - case .error: - DispatchQueue.main.async { - self.loadingState = .error("string", Date()) - self.queryTaskStatus = taskStatus - } - - case .running: - DispatchQueue.main.async { - self.loadingState = .finished(Date()) - self.queryTaskStatus = taskStatus - } - } - } catch { - print(error.localizedDescription) - - DispatchQueue.main.async { - if let transferError = error as? TransferError { - switch transferError { - case .transferFailed, .decodeFailed: - self.loadingState = .error(transferError.localizedDescription, Date()) - case .serverError(let message): - if message == "Not Found" { - self.loadingState = .loading - } else { - self.loadingState = .error(transferError.localizedDescription, Date()) - } - } - } else if let chartDataSetError = error as? ChartDataSetError { - self.loadingState = .error(chartDataSetError.localizedDescription, Date()) - } else { - self.loadingState = .error(error.localizedDescription, Date()) - } - } - } - } - } -} - -struct QueryView: View { - @StateObject var viewModel: QueryViewModel - - var body: some View { - VStack { -// Text("asdf") -// viewModel.chartDataSet.map { -// LineChart(chartDataSet: $0, isSelected: false) -// } - if let chartDataSet = viewModel.chartDataSet { - switch viewModel.displayMode { - case .raw: - RawChartView(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - case .pieChart: - DonutChartView(chartDataset: chartDataSet, isSelected: viewModel.isSelected) - .padding(.bottom) - .padding(.horizontal) - case .lineChart: - LineChart(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - case .barChart: - BarChartView(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - default: - Text("\(viewModel.displayMode.rawValue.capitalized) is not supported in this version.") - .font(.footnote) - .foregroundColor(.grayColor) - .padding(.vertical) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - } - } else { - SondrineLoadingStateIndicator(loadingState: viewModel.loadingState) - .onTapGesture { - Task { - await viewModel.retrieveResults() - } - } - } - } - .task { - await viewModel.retrieveResults() - } - .onReceive(viewModel.runningTimer) { _ in - Task { - await viewModel.checkIfStillRunning() - } - } - .onReceive(viewModel.successTimer) { _ in - Task { - await viewModel.checkStatus() - } - } - } -} - -struct QueryViewV2: View { - @StateObject var viewModel: QueryViewModel - - //let displayMode: String - - var body: some View { - VStack { - if let queryResult = viewModel.queryResult?.result, let chartDataSet = viewModel.chartDataSet{ - switch viewModel.displayMode { - case .raw: - RawChartView(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - case .pieChart: - DonutChartView(chartDataset: chartDataSet, isSelected: viewModel.isSelected) - .padding(.bottom) - .padding(.horizontal) - case .lineChart: - ClusterLineChart(query: viewModel.customQuery, result: queryResult) - case .barChart: - ClusterBarChart(query: viewModel.customQuery, result: queryResult) - default: - Text("\(viewModel.displayMode.rawValue.capitalized) is not supported in this version.") - .font(.footnote) - .foregroundColor(.grayColor) - .padding(.vertical) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - } - } else { - SondrineLoadingStateIndicator(loadingState: viewModel.loadingState) - .onTapGesture { - Task { - await viewModel.retrieveResults() - } - } - } - - /*if let chartDataSet = viewModel.chartDataSet { - switch viewModel.displayMode { - case .raw: - RawChartView(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - case .pieChart: - DonutChartView(chartDataset: chartDataSet, isSelected: viewModel.isSelected) - .padding(.bottom) - .padding(.horizontal) - case .lineChart: - LineChart(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - case .barChart: - BarChartView(chartDataSet: chartDataSet, isSelected: viewModel.isSelected) - default: - Text("\(viewModel.displayMode.rawValue.capitalized) is not supported in this version.") - .font(.footnote) - .foregroundColor(.grayColor) - .padding(.vertical) - .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) - } - } else { - SondrineLoadingStateIndicator(loadingState: viewModel.loadingState) - .onTapGesture { - Task { - await viewModel.retrieveResults() - } - } - }*/ - } - .task { - await viewModel.retrieveResults() - } - .onReceive(viewModel.runningTimer) { _ in - Task { - await viewModel.checkIfStillRunning() - } - } - .onReceive(viewModel.successTimer) { _ in - Task { - await viewModel.checkStatus() - } - } - } -} - -// struct QueryView_Previews: PreviewProvider { -// static var previews: some View { -// QueryView() -// } -// } diff --git a/Telemetry Viewer.xcodeproj/project.pbxproj b/Telemetry Viewer.xcodeproj/project.pbxproj index 3eaa9f7..94cebcf 100644 --- a/Telemetry Viewer.xcodeproj/project.pbxproj +++ b/Telemetry Viewer.xcodeproj/project.pbxproj @@ -231,8 +231,6 @@ C5551E5327C3CBEB005847B6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5551E5127C3CBEB005847B6 /* Assets.xcassets */; }; C5551E5427C3CBEB005847B6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5551E5127C3CBEB005847B6 /* Assets.xcassets */; }; C5551E5527C3CBEB005847B6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5551E5127C3CBEB005847B6 /* Assets.xcassets */; }; - C56B91F927C536D60085839A /* QueryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C56B91F827C536D60085839A /* QueryView.swift */; }; - C56B91FA27C536D60085839A /* QueryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C56B91F827C536D60085839A /* QueryView.swift */; }; C581F4E0271B22FD0031E99C /* Color+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B00509027035C85009C609C /* Color+Hex.swift */; }; C581F4E5271B29470031E99C /* InsightService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B1D46A026CC52DD008814A9 /* InsightService.swift */; }; C581F4E6271B29780031E99C /* ErrorService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B1D469726CC4C5D008814A9 /* ErrorService.swift */; }; @@ -533,7 +531,6 @@ C5551E5727C3CC78005847B6 /* ThreeCirclesInATrenchcode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeCirclesInATrenchcode.swift; sourceTree = ""; }; C5551E5827C3CC78005847B6 /* SondrineAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SondrineAnimation.swift; sourceTree = ""; }; C5551E5927C3CC78005847B6 /* AnimatedCircle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimatedCircle.swift; sourceTree = ""; }; - C56B91F827C536D60085839A /* QueryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryView.swift; sourceTree = ""; }; C598487627CFBB7A00026772 /* QueryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryService.swift; sourceTree = ""; }; C5A8D863270C5D7A0032560A /* TelemetryDeckWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = TelemetryDeckWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; C5A8D867270C5D7B0032560A /* TelemetryDeckWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TelemetryDeckWidget.swift; sourceTree = ""; }; @@ -1012,7 +1009,6 @@ 2B21FCD626FDC38500A8A55B /* NewInsightMenu.swift */, 2B21FCDE26FDCAE200A8A55B /* InsightsList.swift */, 6351A788277C9ED8003AF559 /* InsightDisplayMode+Extensions.swift */, - C56B91F827C536D60085839A /* QueryView.swift */, ); path = "Insight and Groups"; sourceTree = ""; @@ -1738,7 +1734,6 @@ 2B3CC0DC264D4AFE0038B528 /* LexiconService.swift in Sources */, 80AD3EA52BFF33FF00BBD7EB /* LineChartTimeSeries.swift in Sources */, 2B1D469E26CC51A8008814A9 /* GroupService.swift in Sources */, - C56B91F927C536D60085839A /* QueryView.swift in Sources */, 2B1D468926CC4423008814A9 /* OrgService.swift in Sources */, 2B21FCDF26FDCAE200A8A55B /* InsightsList.swift in Sources */, 2BBFCA11267D05E40013DC74 /* DetailSidebar.swift in Sources */, @@ -1823,7 +1818,6 @@ C5F4D32B28ACF48000EBB667 /* ChartHoverLabel.swift in Sources */, C51CB73627565EB5005A3FB9 /* TelemetryDeckWidget.intentdefinition in Sources */, 2BC522EB2625FCEF00E643AC /* HelpAndFeedbackView.swift in Sources */, - C56B91FA27C536D60085839A /* QueryView.swift in Sources */, DC5F3A8A25A364C00057AA59 /* EmptyInsightGroupView.swift in Sources */, 2B46280C2728699E00515530 /* StatusMessageContainer.swift in Sources */, 2BBFCA1E267D05E40013DC74 /* URL+Open.swift in Sources */, diff --git a/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 8ff7842..0000000 --- a/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,132 +0,0 @@ -{ - "originHash" : "c77feac7351e9360f94da77ea6664ee97c0a4c27540c7ad522fe8a1013e98df7", - "pins" : [ - { - "identity" : "collectionconcurrencykit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git", - "state" : { - "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95", - "version" : "0.2.0" - } - }, - { - "identity" : "cryptoswift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", - "state" : { - "revision" : "c9c3df6ab812de32bae61fc0cd1bf6d45170ebf0", - "version" : "1.8.2" - } - }, - { - "identity" : "models", - "kind" : "remoteSourceControl", - "location" : "https://github.com/TelemetryDeck/models", - "state" : { - "revision" : "0cff1fb5eccb202d790c944993f023e8176b97f1", - "version" : "1.11.0" - } - }, - { - "identity" : "sourcekitten", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/SourceKitten.git", - "state" : { - "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", - "version" : "0.35.0" - } - }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b", - "version" : "1.4.0" - } - }, - { - "identity" : "swift-crypto", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-crypto.git", - "state" : { - "revision" : "60f13f60c4d093691934dc6cfdf5f508ada1f894", - "version" : "2.6.0" - } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", - "version" : "510.0.2" - } - }, - { - "identity" : "swiftclient", - "kind" : "remoteSourceControl", - "location" : "https://github.com/AppTelemetry/SwiftClient", - "state" : { - "branch" : "feature/metricKit", - "revision" : "d6f99f022477f544c363a4bd7a097970a3bdbd7f" - } - }, - { - "identity" : "swiftdateoperations", - "kind" : "remoteSourceControl", - "location" : "https://github.com/TelemetryDeck/SwiftDateOperations.git", - "state" : { - "revision" : "9baf08c95057688deffe1f14dfcc871ba2ef38d2", - "version" : "1.0.3" - } - }, - { - "identity" : "swiftlint", - "kind" : "remoteSourceControl", - "location" : "https://github.com/realm/SwiftLint", - "state" : { - "revision" : "b515723b16eba33f15c4677ee65f3fef2ce8c255", - "version" : "0.55.1" - } - }, - { - "identity" : "swiftui-shimmer", - "kind" : "remoteSourceControl", - "location" : "https://github.com/markiv/SwiftUI-Shimmer", - "state" : { - "revision" : "5659a623567cefe258d1e3e67cb65585fbb6ecb6", - "version" : "1.4.2" - } - }, - { - "identity" : "swiftytexttable", - "kind" : "remoteSourceControl", - "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git", - "state" : { - "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3", - "version" : "0.9.0" - } - }, - { - "identity" : "swxmlhash", - "kind" : "remoteSourceControl", - "location" : "https://github.com/drmohundro/SWXMLHash.git", - "state" : { - "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f", - "version" : "7.0.2" - } - }, - { - "identity" : "yams", - "kind" : "remoteSourceControl", - "location" : "https://github.com/jpsim/Yams.git", - "state" : { - "revision" : "9234124cff5e22e178988c18d8b95a8ae8007f76", - "version" : "5.1.2" - } - } - ], - "version" : 3 -} From 82c7637fe157cb60166ff1373b571d37c7e395db Mon Sep 17 00:00:00 2001 From: Blacky <106263486+Black-Fox-2022@users.noreply.github.com> Date: Wed, 29 May 2024 10:29:50 +0200 Subject: [PATCH 2/4] Fix Packages --- Telemetry Viewer.xcodeproj/project.pbxproj | 8 +- .../xcshareddata/swiftpm/Package.resolved | 132 ++++++++++++++++++ 2 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/Telemetry Viewer.xcodeproj/project.pbxproj b/Telemetry Viewer.xcodeproj/project.pbxproj index 94cebcf..0a4ec1a 100644 --- a/Telemetry Viewer.xcodeproj/project.pbxproj +++ b/Telemetry Viewer.xcodeproj/project.pbxproj @@ -2323,7 +2323,7 @@ DEVELOPMENT_TEAM = FL4V655A94; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2349,7 +2349,7 @@ DEVELOPMENT_TEAM = FL4V655A94; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 16.0; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2517,8 +2517,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/AppTelemetry/SwiftClient"; requirement = { - branch = feature/metricKit; - kind = branch; + kind = upToNextMajorVersion; + minimumVersion = 2.0.0; }; }; /* End XCRemoteSwiftPackageReference section */ diff --git a/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..9fdc9be --- /dev/null +++ b/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,132 @@ +{ + "originHash" : "f8e3bc17593c91188fe60d4ec5bfc7210d4af2746c843213d20918d38b8a21ca", + "pins" : [ + { + "identity" : "collectionconcurrencykit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git", + "state" : { + "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95", + "version" : "0.2.0" + } + }, + { + "identity" : "cryptoswift", + "kind" : "remoteSourceControl", + "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", + "state" : { + "revision" : "c9c3df6ab812de32bae61fc0cd1bf6d45170ebf0", + "version" : "1.8.2" + } + }, + { + "identity" : "models", + "kind" : "remoteSourceControl", + "location" : "https://github.com/TelemetryDeck/models", + "state" : { + "revision" : "0cff1fb5eccb202d790c944993f023e8176b97f1", + "version" : "1.11.0" + } + }, + { + "identity" : "sourcekitten", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/SourceKitten.git", + "state" : { + "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", + "version" : "0.35.0" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser.git", + "state" : { + "revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b", + "version" : "1.4.0" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "60f13f60c4d093691934dc6cfdf5f508ada1f894", + "version" : "2.6.0" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax.git", + "state" : { + "revision" : "303e5c5c36d6a558407d364878df131c3546fad8", + "version" : "510.0.2" + } + }, + { + "identity" : "swiftclient", + "kind" : "remoteSourceControl", + "location" : "https://github.com/AppTelemetry/SwiftClient", + "state" : { + "revision" : "d20ccc4b8266cf739eede58cdfc7e9c6ffb41cda", + "version" : "1.5.1" + } + }, + { + "identity" : "swiftdateoperations", + "kind" : "remoteSourceControl", + "location" : "https://github.com/TelemetryDeck/SwiftDateOperations.git", + "state" : { + "revision" : "9baf08c95057688deffe1f14dfcc871ba2ef38d2", + "version" : "1.0.3" + } + }, + { + "identity" : "swiftlint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/realm/SwiftLint", + "state" : { + "revision" : "b515723b16eba33f15c4677ee65f3fef2ce8c255", + "version" : "0.55.1" + } + }, + { + "identity" : "swiftui-shimmer", + "kind" : "remoteSourceControl", + "location" : "https://github.com/markiv/SwiftUI-Shimmer", + "state" : { + "revision" : "e3aa4226b0fafe345ca1c920f516b6a2f3e0aacc", + "version" : "1.5.0" + } + }, + { + "identity" : "swiftytexttable", + "kind" : "remoteSourceControl", + "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git", + "state" : { + "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3", + "version" : "0.9.0" + } + }, + { + "identity" : "swxmlhash", + "kind" : "remoteSourceControl", + "location" : "https://github.com/drmohundro/SWXMLHash.git", + "state" : { + "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f", + "version" : "7.0.2" + } + }, + { + "identity" : "yams", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/Yams.git", + "state" : { + "revision" : "9234124cff5e22e178988c18d8b95a8ae8007f76", + "version" : "5.1.2" + } + } + ], + "version" : 3 +} From ed20c0ee7bce2d85dea951555c81d139e48f2f5c Mon Sep 17 00:00:00 2001 From: Blacky <106263486+Black-Fox-2022@users.noreply.github.com> Date: Wed, 29 May 2024 10:34:45 +0200 Subject: [PATCH 3/4] Update Packages --- .../project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9fdc9be..04cd91a 100644 --- a/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Telemetry Viewer.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -69,8 +69,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/AppTelemetry/SwiftClient", "state" : { - "revision" : "d20ccc4b8266cf739eede58cdfc7e9c6ffb41cda", - "version" : "1.5.1" + "revision" : "0c5dcdd868dc92a4c528c0e7a42d33f8c5b32506", + "version" : "2.0.0" } }, { From adbbd484c0df9a497e3303e6015094971637c18f Mon Sep 17 00:00:00 2001 From: Blacky <106263486+Black-Fox-2022@users.noreply.github.com> Date: Wed, 29 May 2024 11:29:13 +0200 Subject: [PATCH 4/4] Loading Animation for Chart --- Cluster/QueryRunner.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Cluster/QueryRunner.swift b/Cluster/QueryRunner.swift index f478e26..4962b2f 100644 --- a/Cluster/QueryRunner.swift +++ b/Cluster/QueryRunner.swift @@ -17,15 +17,28 @@ struct QueryRunner: View { @State var queryResultWrapper: QueryResultWrapper? @State var isLoading: Bool = false + @State var taskID: String = "" var body: some View { VStack(spacing: 10){ if let queryResult = queryResultWrapper?.result { ClusterChart(query: query, result: queryResult, type: type) + .frame(height: 135) + .id(queryResultWrapper) .padding(.horizontal) + } else { + SondrineAnimation() + .frame(width: 100, height: 100) + .opacity(0.5) + .padding() } HStack(spacing: 3){ + if isLoading { + ProgressView() + .scaleEffect(0.75) + .frame(height: 5) + } Spacer() if let queryResultWrapper = queryResultWrapper { Text("Updated") @@ -85,7 +98,7 @@ struct QueryRunner: View { isLoading = false } - let taskID = try await beginAsyncCalcV2() + taskID = try await beginAsyncCalcV2() try await getLastSuccessfulValue(taskID)