Skip to content

Commit a16b441

Browse files
committed
fixes
1 parent 9714510 commit a16b441

File tree

17 files changed

+218
-77
lines changed

17 files changed

+218
-77
lines changed

docs/release_banner.png

-2.27 KB
Loading
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using System.Threading.Tasks;
4+
using Coderr.Server.Domain.Modules.Tags;
5+
using Coderr.Server.ReportAnalyzer.Abstractions.ErrorReports;
6+
using Coderr.Server.ReportAnalyzer.Abstractions.Incidents;
7+
using Coderr.Server.ReportAnalyzer.Tagging;
8+
using Coderr.Server.ReportAnalyzer.Tagging.Handlers;
9+
using DotNetCqs;
10+
using FluentAssertions;
11+
using NSubstitute;
12+
using Xunit;
13+
14+
namespace Coderr.Server.ReportAnalyzer.Tests.Tagging
15+
{
16+
public class IdentifyTagsFromIncidentTests
17+
{
18+
[Fact]
19+
public async Task should_be_able_to_identity_tags_when_only_one_is_specified()
20+
{
21+
var repos = Substitute.For<ITagsRepository>();
22+
var provider = Substitute.For<ITagIdentifierProvider>();
23+
provider.GetIdentifiers(Arg.Any<TagIdentifierContext>()).Returns(new ITagIdentifier[0]);
24+
var ctx = Substitute.For<IMessageContext>();
25+
var incident = new IncidentSummaryDTO(1, "Ada");
26+
var report = new ReportDTO
27+
{
28+
ContextCollections = new[]
29+
{new ContextCollectionDTO("Data", new Dictionary<string, string> {{"ErrTags", "MyTag"}})}
30+
};
31+
var e = new ReportAddedToIncident(incident, report, false);
32+
33+
var sut = new IdentifyTagsFromIncident(repos, provider);
34+
await sut.HandleAsync(ctx, e);
35+
36+
var arguments = repos.ReceivedCalls().First(x => x.GetMethodInfo().Name == "AddAsync")
37+
.GetArguments();
38+
var tags = (Tag[]) arguments[1];
39+
tags[0].Name.Should().Be("MyTag");
40+
}
41+
42+
[Fact]
43+
public async Task should_be_able_to_identity_tags_when_only_multiple_tags_are_specified()
44+
{
45+
var repos = Substitute.For<ITagsRepository>();
46+
var provider = Substitute.For<ITagIdentifierProvider>();
47+
provider.GetIdentifiers(Arg.Any<TagIdentifierContext>()).Returns(new ITagIdentifier[0]);
48+
var ctx = Substitute.For<IMessageContext>();
49+
var incident = new IncidentSummaryDTO(1, "Ada");
50+
var report = new ReportDTO
51+
{
52+
ContextCollections = new[]
53+
{new ContextCollectionDTO("Data", new Dictionary<string, string> {{"ErrTags", "MyTag,YourTag"}})}
54+
};
55+
var e = new ReportAddedToIncident(incident, report, false);
56+
57+
var sut = new IdentifyTagsFromIncident(repos, provider);
58+
await sut.HandleAsync(ctx, e);
59+
60+
var arguments = repos.ReceivedCalls().First(x => x.GetMethodInfo().Name == "AddAsync")
61+
.GetArguments();
62+
var tags = (Tag[]) arguments[1];
63+
tags[0].Name.Should().Be("MyTag");
64+
tags[1].Name.Should().Be("YourTag");
65+
}
66+
67+
[Fact]
68+
public async Task should_be_able_to_identity_tags_when_only_multiple_tags_are_specified_with_spaces()
69+
{
70+
var repos = Substitute.For<ITagsRepository>();
71+
var provider = Substitute.For<ITagIdentifierProvider>();
72+
provider.GetIdentifiers(Arg.Any<TagIdentifierContext>()).Returns(new ITagIdentifier[0]);
73+
var ctx = Substitute.For<IMessageContext>();
74+
var incident = new IncidentSummaryDTO(1, "Ada");
75+
var report = new ReportDTO
76+
{
77+
ContextCollections = new[]
78+
{new ContextCollectionDTO("Data", new Dictionary<string, string> {{"ErrTags[]", "MyTag"}, {"ErrTags[]", "YourTag"}})}
79+
};
80+
var e = new ReportAddedToIncident(incident, report, false);
81+
82+
var sut = new IdentifyTagsFromIncident(repos, provider);
83+
await sut.HandleAsync(ctx, e);
84+
85+
var arguments = repos.ReceivedCalls().First(x => x.GetMethodInfo().Name == "AddAsync")
86+
.GetArguments();
87+
var tags = (Tag[]) arguments[1];
88+
tags[0].Name.Should().Be("MyTag");
89+
tags[1].Name.Should().Be("YourTag");
90+
}
91+
}
92+
}

src/Server/Coderr.Server.ReportAnalyzer/Tagging/Handlers/IdentifyTagsFromIncident.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e)
4949

5050
ExtractTagsFromCollections(e, ctx);
5151

52-
_logger.DebugFormat("Done, identified {0} new tags", ctx.NewTags);
52+
_logger.DebugFormat("Done, identified {0} new tags", string.Join(", ", ctx.NewTags));
5353

5454
if (ctx.NewTags.Count == 0)
5555
return;
@@ -70,7 +70,7 @@ private void ExtractTagsFromCollections(ReportAddedToIncident e, TagIdentifierCo
7070
var tags = tagsStr.Split(',');
7171
foreach (var tag in tags)
7272
{
73-
ctx.AddTag(tag, 1);
73+
ctx.AddTag(tag.Trim(), 1);
7474
}
7575
}
7676
catch (Exception ex)
@@ -85,7 +85,7 @@ private void ExtractTagsFromCollections(ReportAddedToIncident e, TagIdentifierCo
8585
foreach (var property in collection.Properties)
8686
{
8787
if (property.Key.StartsWith("ErrTags["))
88-
ctx.AddTag(property.Value, 1);
88+
ctx.AddTag(property.Value.Trim(), 1);
8989
}
9090
}
9191
}
Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
1-
@using Coderr.Server.Web.Areas.Installation.Models
2-
@model Coderr.Server.Web.Areas.Installation.Models.ErrorTrackingViewModel
3-
@{
4-
ViewBag.Title = "Installation - Error tracking";
5-
}
6-
<div class="container">
7-
<div class="col-lg-12">
8-
9-
<h2>Error tracking</h2>
1+
@using Coderr.Server.Web.Areas.Installation.Models
2+
@model Coderr.Server.Web.Areas.Installation.Models.ErrorTrackingViewModel
3+
@{
4+
ViewBag.Title = "Installation - Error tracking";
5+
}
6+
<div class="container">
7+
<div class="col-lg-12">
8+
9+
<h2>Error tracking</h2>
1010
<p>
11-
We have activated Coderr in the Community Server to send us bugs as they occur. It is our own way to practice what we preach about error handling and helps us to correct our code faster
12-
</p>
13-
<p>
14-
You can optionally enter your email address to get notifications when the errors in your
15-
installation have been corrected and released.
16-
</p>
17-
<p>
18-
<em>(We might also contact you if we need more information about the error)</em>
19-
</p>
20-
<form method="post" action="@Url.Action("Errors")">
21-
@Html.ValidationSummary(false)
22-
<div class="form-group">
23-
<label asp-for="ContactEmail"></label>
24-
<input asp-for="ContactEmail" type="email" class="form-control" placeholder="Your email address"/>
25-
</div>
26-
<br/>
27-
@Html.Raw(ViewBag.PrevLink)
28-
<input type="submit" class="btn btn-primary" value="Save"/>
29-
@Html.Raw(ViewBag.NextLink)
30-
</form>
31-
</div>
32-
</div>
33-
@section scripts
34-
{
35-
<script>
36-
$('#ActivateTracking')
37-
.click(function() {
38-
if ($('.suboption').is('.disabled')) {
39-
$('.suboption').removeClass('disabled');
40-
$('.suboption input').prop('disabled', false);
41-
$('.suboption label').prop('disabled', false);
42-
} else {
43-
$('.suboption').addClass('disabled');
44-
$('.suboption input').prop('disabled', true);
45-
$('.suboption label').prop('disabled', true);
46-
}
47-
48-
});
49-
if ($('#ActivateTracking').is(':checked')) {
50-
$('.suboption').removeClass('disabled');
51-
$('.suboption input').prop('disabled', false);
52-
$('.suboption label').prop('disabled', false);
53-
}
54-
</script>
11+
We have activated Coderr in the Community Server to send us bugs as they occur. It is our own way to practice what we preach about error handling and helps us to correct our code faster. Further, with rich context information provided by Coderr, it enables us understand the error better.
12+
</p>
13+
<p>
14+
If you want to receive notification when the errors in your installation have been corrected, please provide an email address.
15+
</p>
16+
<form method="post" action="@Url.Action("Errors")">
17+
@Html.ValidationSummary(false)
18+
<div class="form-group">
19+
<label asp-for="ContactEmail"></label>
20+
<input asp-for="ContactEmail" type="email" class="form-control" placeholder="Your email address"/>
21+
</div>
22+
<br/>
23+
@Html.Raw(ViewBag.PrevLink)
24+
<input type="submit" class="btn btn-primary" value="Save"/>
25+
@Html.Raw(ViewBag.NextLink)
26+
</form>
27+
</div>
28+
</div>
29+
@section scripts
30+
{
31+
<script>
32+
$('#ActivateTracking')
33+
.click(function() {
34+
if ($('.suboption').is('.disabled')) {
35+
$('.suboption').removeClass('disabled');
36+
$('.suboption input').prop('disabled', false);
37+
$('.suboption label').prop('disabled', false);
38+
} else {
39+
$('.suboption').addClass('disabled');
40+
$('.suboption input').prop('disabled', true);
41+
$('.suboption label').prop('disabled', true);
42+
}
43+
44+
});
45+
if ($('#ActivateTracking').is(':checked')) {
46+
$('.suboption').removeClass('disabled');
47+
$('.suboption input').prop('disabled', false);
48+
$('.suboption label').prop('disabled', false);
49+
}
50+
</script>
5551
}
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
@{
2-
ViewBag.Title = "Installation - Usage statistics";
3-
}
4-
<div class="container">
5-
<div class="col-lg-12">
6-
7-
<h2>Usage statistics</h2>
8-
<p>
9-
By continuing with the setup, you allow us to collect anonymous usage statistics. The data is specified below.
10-
</p>
1+
@{
2+
ViewBag.Title = "Installation - Usage statistics";
3+
}
4+
<div class="container">
5+
<div class="col-lg-12">
6+
7+
<h2>Usage statistics</h2>
8+
<p>
9+
We need to collect anonymous usage statistics to understand how Coderr is used and how we can make it better.
10+
The data we collect are specified below and by continuing with the setup you agree for us to collect it.
11+
This data is anonymous and confidential and never shared outside our company.
12+
</p>
1113
<pre style="background: #444444; color: #cccccc;"><code>{
1214
Guid InstallationId; // Cannot be used to identify you, your company or your servers.
1315
YearMonth DateTime; // year+month for the usage
@@ -17,9 +19,9 @@
1719
IncidentCount: int; // Number of new incidents created the given month
1820
ReportCount: int; // Number of error reports received the given month
1921
}
20-
}</code></pre>
21-
@Html.Raw(ViewBag.PrevLink)
22-
@Html.Raw(ViewBag.NextLink)
23-
<br />
24-
</div>
22+
}</code></pre>
23+
@Html.Raw(ViewBag.PrevLink)
24+
@Html.Raw(ViewBag.NextLink)
25+
<br />
26+
</div>
2527
</div>

src/Server/Coderr.Server.Web/Areas/Installation/Views/Setup/Support.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
}
66
<div class="container">
77
<div class="col-lg-12">
8-
<h2>Getting started help</h2>
9-
<p>Do you want to get FREE help during the first month? We can answer questions regarding your configuration or help you get the most out of Coderr.</p>
8+
<h2>Getting started assistance</h2>
9+
<p>We offer free assistance during the first month of usage. We want to make sure there is nothing on our end or from Coderr that stops you from getting to know Coderr. Sign up to our free service by entering your contact email which will only be used to assist you with Coderr.</p>
1010
<form method="post" action="@Url.Action("Support")" style="width: 100%" class="form">
1111
@Html.ValidationSummary(false)
1212
<div>

src/Server/Coderr.Server.Web/Views/Shared/_Layout.cshtml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
<link rel="stylesheet" href="~/css/bootstrap.min.css" asp-append-version="true" />
1111
<link href="~/css/fontawesome-all.min.css" rel="stylesheet">
1212
<link href="~/css/toastr.min.css" rel="stylesheet">
13+
<link rel="apple-touch-icon" sizes="180x180" href="~/apple-touch-icon.png">
1314
<link rel="icon" type="image/png" sizes="32x32" href="~/favicon-32x32.png">
14-
<link rel="icon" type="image/png" sizes="96x96" href="~/favicon-96x96.png">
1515
<link rel="icon" type="image/png" sizes="16x16" href="~/favicon-16x16.png">
16-
<meta name="msapplication-TileColor" content="#59C1D5">
17-
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
18-
</head>
16+
<link rel="manifest" href="~/site.webmanifest">
17+
<link rel="mask-icon" href="~/safari-pinned-tab.svg" color="#59c1d5">
18+
<meta name="msapplication-TileColor" content="#ffffff">
19+
<meta name="theme-color" content="#ffffff"></head>
1920
<body>
2021
@RenderBody()
2122

10.1 KB
Loading
28.1 KB
Loading
5.46 KB
Loading

0 commit comments

Comments
 (0)