-
-
Notifications
You must be signed in to change notification settings - Fork 508
Expand file tree
/
Copy pathSavedView.cs
More file actions
86 lines (68 loc) · 3.26 KB
/
SavedView.cs
File metadata and controls
86 lines (68 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System.ComponentModel.DataAnnotations;
using Exceptionless.Core.Attributes;
using Foundatio.Repositories.Models;
namespace Exceptionless.Core.Models;
/// <summary>
/// A saved view captures filter, time range, and display settings for a dashboard page.
/// Org-scoped; optionally user-private when UserId is set.
/// </summary>
public record SavedView : IOwnedByOrganizationWithIdentity, IHaveDates
{
/// <summary>The set of valid dashboard view identifiers.</summary>
public static readonly string[] ValidViews = ["events", "issues", "stream"];
/// <summary>Valid column IDs per view, matching the TanStack Table column definitions.</summary>
public static readonly IReadOnlyDictionary<string, IReadOnlySet<string>> ValidColumnIds =
new Dictionary<string, IReadOnlySet<string>>
{
["events"] = new HashSet<string> { "user", "date" },
["issues"] = new HashSet<string> { "status", "users", "events", "first", "last" },
["stream"] = new HashSet<string> { "user", "date" }
};
/// <summary>Union of all valid column IDs across all views.</summary>
public static readonly IReadOnlySet<string> AllValidColumnIds =
new HashSet<string>(ValidColumnIds.Values.SelectMany(ids => ids));
// Identity
[ObjectId]
public string Id { get; set; } = null!;
[ObjectId]
[Required]
public string OrganizationId { get; set; } = null!;
// User associations
/// <summary>When set, this view is private to the specified user. Null means org-wide.</summary>
[ObjectId]
public string? UserId { get; set; }
/// <summary>The user who originally created this view.</summary>
[ObjectId]
[Required]
public string CreatedByUserId { get; set; } = null!;
/// <summary>The user who last modified this view.</summary>
[ObjectId]
public string? UpdatedByUserId { get; set; }
// View configuration
/// <summary>Raw Lucene filter query string, e.g. "(status:open OR status:regressed)". Null means no filter (show all).</summary>
[MaxLength(2000)]
public string? Filter { get; set; }
/// <summary>JSON array of structured filter objects for UI chip hydration.</summary>
[MaxLength(10000)]
public string? FilterDefinitions { get; set; }
/// <summary>Column visibility state per dashboard table, keyed by column id.</summary>
public Dictionary<string, bool>? Columns { get; set; }
/// <summary>Whether this view loads automatically when navigating to the page.</summary>
public bool IsDefault { get; set; }
/// <summary>Display name shown in the sidebar and picker.</summary>
[Required]
[MaxLength(100)]
public string Name { get; set; } = null!;
/// <summary>Date-math time range, e.g. "[now-7d TO now]". Null if no time constraint.</summary>
[MaxLength(100)]
public string? Time { get; set; }
/// <summary>Schema version for future filter definition migrations.</summary>
public int Version { get; set; } = 1;
/// <summary>Dashboard page identifier: "events", "issues", or "stream".</summary>
[Required]
[RegularExpression("^(events|issues|stream)$")]
public string View { get; set; } = null!;
// Timestamps
public DateTime CreatedUtc { get; set; }
public DateTime UpdatedUtc { get; set; }
}