-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use AppInfo Struct instead of App DTO
- Loading branch information
1 parent
9899a9a
commit 29b8d0e
Showing
8 changed files
with
170 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// AppInfo.swift | ||
// Telemetry Viewer (iOS) | ||
// | ||
// Created by Lukas on 21.05.24. | ||
// | ||
|
||
import Foundation | ||
import DataTransferObjects | ||
import SwiftUI | ||
|
||
public struct AppInfo: Codable, Hashable, Identifiable { | ||
public var id: UUID | ||
public var name: String | ||
public var organizationID: UUID | ||
public var insightGroups: [InsightGroupInfo] | ||
public var settings: DTOv2.AppSettings | ||
public var insightGroupIDs: [UUID] { | ||
insightGroups.map { group in | ||
group.id | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// InsightGroupInfo.swift | ||
// Telemetry Viewer (iOS) | ||
// | ||
// Created by Lukas on 21.05.24. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct InsightGroupInfo: Codable, Hashable, Identifiable { | ||
public init(id: UUID, title: String, order: Double? = nil, appID: UUID, insights: [InsightInfo]) { | ||
self.id = id | ||
self.title = title | ||
self.order = order | ||
self.appID = appID | ||
self.insights = insights | ||
} | ||
|
||
public var id: UUID | ||
public var title: String | ||
public var order: Double? | ||
public var appID: UUID | ||
public var insights: [InsightInfo] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// | ||
// InsightInfo.swift | ||
// Telemetry Viewer (iOS) | ||
// | ||
// Created by Lukas on 21.05.24. | ||
// | ||
|
||
import Foundation | ||
import DataTransferObjects | ||
|
||
public struct InsightInfo: Codable, Hashable, Identifiable { | ||
public enum InsightType: String, Codable, Hashable { | ||
case timeseries | ||
case topN | ||
case customQuery | ||
case funnel | ||
case experiment | ||
} | ||
|
||
public var id: UUID | ||
public var groupID: UUID | ||
|
||
/// order in which insights appear in the apps (if not expanded) | ||
public var order: Double? | ||
public var title: String | ||
|
||
/// What kind of insight is this? | ||
public var type: InsightType | ||
|
||
/// If set, display the chart with this accent color, otherwise fall back to default color | ||
public var accentColor: String? | ||
|
||
/// If set, use the custom query in this property instead of constructing a query out of the options below | ||
public var customQuery: CustomQuery? | ||
|
||
/// Which signal types are we interested in? If nil, do not filter by signal type | ||
public var signalType: String? | ||
|
||
/// If true, only include at the newest signal from each user | ||
public var uniqueUser: Bool | ||
|
||
/// Only include signals that match all of these key-values in the payload | ||
public var filters: [String: String] | ||
|
||
/// If set, break down the values in this key | ||
public var breakdownKey: String? | ||
|
||
/// If set, group and count found signals by this time interval. Incompatible with breakdownKey | ||
public var groupBy: QueryGranularity? | ||
|
||
/// How should this insight's data be displayed? | ||
public var displayMode: InsightDisplayMode | ||
|
||
/// If true, the insight will be displayed bigger | ||
public var isExpanded: Bool | ||
|
||
/// The amount of time (in seconds) this query took to calculate last time | ||
public var lastRunTime: TimeInterval? | ||
|
||
/// The date this query was last run | ||
public var lastRunAt: Date? | ||
|
||
public init( | ||
id: UUID, | ||
groupID: UUID, | ||
order: Double?, | ||
title: String, | ||
type: InsightType, | ||
accentColor: String? = nil, | ||
widgetable _: Bool? = false, | ||
customQuery: CustomQuery? = nil, | ||
signalType: String?, | ||
uniqueUser: Bool, | ||
filters: [String: String], | ||
breakdownKey: String?, | ||
groupBy: QueryGranularity?, | ||
displayMode: InsightDisplayMode, | ||
isExpanded: Bool, | ||
lastRunTime: TimeInterval?, | ||
lastRunAt: Date? | ||
) { | ||
self.id = id | ||
self.groupID = groupID | ||
self.order = order | ||
self.title = title | ||
self.type = type | ||
self.accentColor = accentColor | ||
self.customQuery = customQuery | ||
self.signalType = signalType | ||
self.uniqueUser = uniqueUser | ||
self.filters = filters | ||
self.breakdownKey = breakdownKey | ||
self.groupBy = groupBy | ||
self.displayMode = displayMode | ||
self.isExpanded = isExpanded | ||
self.lastRunTime = lastRunTime | ||
self.lastRunAt = lastRunAt | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters