Skip to content

Commit 89dea86

Browse files
committed
aight, good to go
1 parent 688bcb6 commit 89dea86

File tree

85 files changed

+2992
-691
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2992
-691
lines changed

rubberduckvba.Server/Api/Admin/AdminController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ public async ValueTask<IActionResult> UpdateTagMetadata()
4343
return await ValueTask.FromResult(Ok(jobId));
4444
}
4545

46+
#if DEBUG
4647
[HttpGet("admin/config/current")]
4748
public async ValueTask<IActionResult> Config()
4849
{
4950
return await ValueTask.FromResult(Ok(options));
5051
}
52+
#endif
5153
}
5254

5355
public record class ConfigurationOptions(

rubberduckvba.Server/Api/Features/FeatureEditViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public Feature ToFeature()
2929
return new Feature
3030
{
3131
Id = Id ?? default,
32-
ParentId = ParentId,
32+
FeatureId = ParentId,
3333
RepositoryId = RepositoryId,
3434
Name = Name,
3535
Title = Title,
@@ -43,7 +43,7 @@ public Feature ToFeature()
4343
public FeatureEditViewModel(Feature model, FeatureOptionViewModel[] features, RepositoryOptionViewModel[] repositories)
4444
{
4545
Id = model.Id;
46-
ParentId = model.ParentId;
46+
ParentId = model.FeatureId;
4747
RepositoryId = model.RepositoryId;
4848

4949
Name = model.Name;
Lines changed: 213 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
using rubberduckvba.Server.Model;
2+
using rubberduckvba.Server.Model.Entity;
23

34
namespace rubberduckvba.Server.Api.Features;
45

56
public class FeatureViewModel
67
{
7-
public FeatureViewModel(Feature model)
8+
public FeatureViewModel(Feature model, bool summaryOnly = false)
89
{
910
Id = model.Id;
1011
DateInserted = model.DateTimeInserted;
1112
DateUpdated = model.DateTimeUpdated;
1213

14+
FeatureId = model.FeatureId;
15+
FeatureName = model.FeatureName;
16+
1317
Name = model.Name;
14-
Title = model.Title;
18+
Title = string.IsNullOrWhiteSpace(model.Title) ? model.Name : model.Title;
19+
1520
ShortDescription = model.ShortDescription;
16-
Description = model.Description;
21+
Description = summaryOnly ? string.Empty : model.Description;
22+
1723
IsNew = model.IsNew;
24+
IsDiscontinued = model.IsDiscontinued;
1825
IsHidden = model.IsHidden;
26+
1927
HasImage = model.HasImage;
28+
Links = model.Links.ToArray();
2029

21-
if (model is FeatureGraph graph)
30+
if (!summaryOnly && model is FeatureGraph graph)
2231
{
23-
Features = graph.Features.Select(e => new FeatureViewModel(e) { FeatureId = e.ParentId, FeatureName = graph.Name, FeatureTitle = graph.Title }).ToArray();
32+
Features = graph.Features.Select(e => new FeatureViewModel(e) { FeatureId = graph.Id, FeatureName = graph.Name }).ToArray();
2433
}
2534
}
2635

@@ -30,48 +39,234 @@ public FeatureViewModel(Feature model)
3039

3140
public int? FeatureId { get; init; }
3241
public string? FeatureName { get; init; }
33-
public string? FeatureTitle { get; init; }
3442

3543
public string Name { get; init; }
3644
public string Title { get; init; }
3745
public string ShortDescription { get; init; }
3846
public string Description { get; init; }
3947
public bool IsNew { get; init; }
48+
public bool IsDiscontinued { get; init; }
4049
public bool IsHidden { get; init; }
4150
public bool HasImage { get; init; }
4251

4352
public FeatureViewModel[] Features { get; init; } = [];
53+
public BlogLink[] Links { get; init; } = [];
54+
}
55+
56+
public class InspectionViewModel
57+
{
58+
public InspectionViewModel(Inspection model, IDictionary<int, Tag> tagsByAssetId)
59+
{
60+
Id = model.Id;
61+
DateTimeInserted = model.DateTimeInserted;
62+
DateTimeUpdated = model.DateTimeUpdated;
63+
64+
FeatureId = model.FeatureId;
65+
FeatureName = model.FeatureName;
66+
67+
SourceUrl = model.SourceUrl;
68+
TagAssetId = model.TagAssetId;
69+
TagName = tagsByAssetId[model.TagAssetId].Name;
70+
71+
IsHidden = model.IsHidden;
72+
IsNew = model.IsNew;
73+
IsDiscontinued = model.IsDiscontinued;
74+
75+
Name = model.Name;
76+
Summary = model.Summary;
77+
Remarks = model.Remarks;
78+
79+
InspectionType = model.InspectionType;
80+
DefaultSeverity = model.DefaultSeverity;
81+
QuickFixes = model.QuickFixes;
82+
83+
Reasoning = model.Reasoning;
84+
HostApp = model.HostApp;
85+
References = model.References;
86+
87+
Examples = model.Examples;
88+
}
89+
90+
public int Id { get; init; }
91+
public DateTime DateTimeInserted { get; init; }
92+
public DateTime? DateTimeUpdated { get; init; }
93+
public int TagAssetId { get; init; }
94+
public string SourceUrl { get; init; } = string.Empty;
95+
96+
public int FeatureId { get; init; }
97+
public string FeatureName { get; init; }
98+
99+
public string TagName { get; init; }
100+
101+
public bool IsNew { get; init; }
102+
public bool IsDiscontinued { get; init; }
103+
public bool IsHidden { get; init; }
104+
105+
public string Name { get; init; } = string.Empty;
106+
public string InspectionType { get; init; } = string.Empty;
107+
public string DefaultSeverity { get; init; } = string.Empty;
108+
public string Summary { get; init; } = string.Empty;
109+
public string Reasoning { get; init; } = string.Empty;
110+
public string? Remarks { get; init; }
111+
public string? HostApp { get; init; }
112+
public string[] References { get; init; } = [];
113+
public string[] QuickFixes { get; init; } = [];
114+
public InspectionExample[] Examples { get; init; } = [];
115+
}
116+
117+
public class AnnotationViewModel
118+
{
119+
public AnnotationViewModel(Annotation model, IDictionary<int, Tag> tagsByAssetId)
120+
{
121+
Id = model.Id;
122+
DateTimeInserted = model.DateTimeInserted;
123+
DateTimeUpdated = model.DateTimeUpdated;
124+
FeatureId = model.FeatureId;
125+
126+
SourceUrl = model.SourceUrl;
127+
TagAssetId = model.TagAssetId;
128+
TagName = tagsByAssetId[model.TagAssetId].Name;
129+
130+
IsHidden = model.IsHidden;
131+
IsNew = model.IsNew;
132+
IsDiscontinued = model.IsDiscontinued;
133+
134+
Name = model.Name;
135+
Summary = model.Summary;
136+
Remarks = model.Remarks;
137+
138+
Parameters = model.Parameters;
139+
Examples = model.Examples;
140+
}
141+
142+
public int Id { get; init; }
143+
public DateTime DateTimeInserted { get; init; }
144+
public DateTime? DateTimeUpdated { get; init; }
145+
public int FeatureId { get; init; }
146+
public int TagAssetId { get; init; }
147+
public string SourceUrl { get; init; } = string.Empty;
148+
149+
public string TagName { get; init; }
150+
151+
public bool IsNew { get; init; }
152+
public bool IsDiscontinued { get; init; }
153+
public bool IsHidden { get; init; }
154+
155+
public string Name { get; init; } = string.Empty;
156+
157+
public string Summary { get; init; } = string.Empty;
158+
public string? Remarks { get; init; }
159+
160+
public AnnotationParameter[] Parameters { get; init; } = [];
161+
public AnnotationExample[] Examples { get; init; } = [];
162+
}
163+
164+
public class QuickFixViewModel
165+
{
166+
public QuickFixViewModel(QuickFix model, IDictionary<int, Tag> tagsByAssetId, IDictionary<string, Inspection> inspectionsByName)
167+
{
168+
Id = model.Id;
169+
DateTimeInserted = model.DateTimeInserted;
170+
DateTimeUpdated = model.DateTimeUpdated;
171+
FeatureId = model.FeatureId;
172+
173+
SourceUrl = model.SourceUrl;
174+
TagAssetId = model.TagAssetId;
175+
TagName = tagsByAssetId[model.TagAssetId].Name;
176+
177+
IsHidden = model.IsHidden;
178+
IsNew = model.IsNew;
179+
IsDiscontinued = model.IsDiscontinued;
180+
181+
Name = model.Name;
182+
Summary = model.Summary;
183+
Remarks = model.Remarks;
184+
185+
CanFixAll = model.CanFixAll;
186+
CanFixMultiple = model.CanFixMultiple;
187+
CanFixProcedure = model.CanFixProcedure;
188+
CanFixModule = model.CanFixModule;
189+
CanFixProject = model.CanFixProject;
190+
191+
Inspections = (from name in model.Inspections
192+
let inspection = inspectionsByName[name]
193+
select new QuickFixInspectionLinkViewModel
194+
{
195+
Name = inspection.Name,
196+
Summary = inspection.Summary,
197+
InspectionType = inspection.InspectionType,
198+
DefaultSeverity = inspection.DefaultSeverity
199+
}).ToArray();
200+
201+
Examples = model.Examples;
202+
}
203+
204+
public int Id { get; init; }
205+
public DateTime DateTimeInserted { get; init; }
206+
public DateTime? DateTimeUpdated { get; init; }
207+
public int FeatureId { get; init; }
208+
public int TagAssetId { get; init; }
209+
public string SourceUrl { get; init; } = string.Empty;
210+
211+
public string TagName { get; init; }
212+
213+
public bool IsNew { get; init; }
214+
public bool IsDiscontinued { get; init; }
215+
public bool IsHidden { get; init; }
216+
217+
public string Name { get; init; } = string.Empty;
218+
219+
public string Summary { get; init; } = string.Empty;
220+
public string? Remarks { get; init; }
221+
222+
public bool CanFixProcedure { get; init; }
223+
public bool CanFixModule { get; init; }
224+
public bool CanFixProject { get; init; }
225+
public bool CanFixAll { get; init; }
226+
public bool CanFixMultiple { get; init; }
227+
228+
public QuickFixInspectionLinkViewModel[] Inspections { get; init; } = [];
229+
public QuickFixExample[] Examples { get; init; } = [];
230+
}
231+
232+
public record class QuickFixInspectionLinkViewModel
233+
{
234+
public string Name { get; init; }
235+
public string Summary { get; init; }
236+
public string InspectionType { get; init; }
237+
public string DefaultSeverity { get; init; }
44238
}
45239

46240
public class InspectionsFeatureViewModel : FeatureViewModel
47241
{
48-
public InspectionsFeatureViewModel(FeatureGraph model)
49-
: base(model)
242+
public InspectionsFeatureViewModel(FeatureGraph model, IDictionary<int, Tag> tagsByAssetId, bool summaryOnly = false)
243+
: base(model, summaryOnly)
50244
{
51-
Inspections = model.Inspections.ToArray();
245+
246+
Inspections = model.Inspections.OrderBy(e => e.Name).Select(e => new InspectionViewModel(e, tagsByAssetId)).ToArray();
52247
}
53248

54-
public Inspection[] Inspections { get; init; } = [];
249+
public InspectionViewModel[] Inspections { get; init; } = [];
55250
}
56251

57252
public class QuickFixesFeatureViewModel : FeatureViewModel
58253
{
59-
public QuickFixesFeatureViewModel(FeatureGraph model)
60-
: base(model)
254+
public QuickFixesFeatureViewModel(FeatureGraph model, IDictionary<int, Tag> tagsByAssetId, IDictionary<string, Inspection> inspectionsByName, bool summaryOnly = false)
255+
: base(model, summaryOnly)
61256
{
62-
QuickFixes = model.QuickFixes.ToArray();
257+
QuickFixes = model.QuickFixes.OrderBy(e => e.Name).Select(e => new QuickFixViewModel(e, tagsByAssetId, inspectionsByName)).ToArray();
63258
}
64259

65-
public QuickFix[] QuickFixes { get; init; } = [];
260+
public QuickFixViewModel[] QuickFixes { get; init; } = [];
66261
}
67262

68263
public class AnnotationsFeatureViewModel : FeatureViewModel
69264
{
70-
public AnnotationsFeatureViewModel(FeatureGraph model)
71-
: base(model)
265+
public AnnotationsFeatureViewModel(FeatureGraph model, IDictionary<int, Tag> tagsByAssetId, bool summaryOnly = false)
266+
: base(model, summaryOnly)
72267
{
73-
Annotations = model.Annotations.ToArray();
268+
Annotations = model.Annotations.OrderBy(e => e.Name).Select(e => new AnnotationViewModel(e, tagsByAssetId)).ToArray();
74269
}
75270

76-
public Annotation[] Annotations { get; init; } = [];
271+
public AnnotationViewModel[] Annotations { get; init; } = [];
77272
}

rubberduckvba.Server/Api/Features/FeatureViewModelFactory.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)