Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 59 additions & 30 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,34 +1,63 @@
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

*.jpg binary
*.png binary
*.gif binary
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

*.cs text=auto diff=csharp eol=crlf
*.vb text=auto eol=crlf
*.resx text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.sql text=auto eol=crlf
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

*.csproj text=auto eol=crlf
*.vbproj text=auto eol=crlf
*.fsproj text=auto eol=crlf
*.dbproj text=auto eol=crlf
*.sln text=auto eol=crlf
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

*.sh eol=lf
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ _ReSharper*/
src/Tools/MarkdownToNamespaceDoc/packages/*/
src/Tools/TsGenerator/.vs/*
src/Help/*
**/.vs/*
src/Server/Coderr.Server.Web.Tests/applicationhost.config
/src/Server/Coderr.Server.Web/node_modules/*
/src/Server/Coderr.Server.Web/wwwroot/dist**
/src/Server/Coderr.Server.Web/wwwroot/dist/**
/src/Server/Coderr.Server.Web/npm-shrinkwrap.json
/src/Server/node_modules/**
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Coderr.Server.Abstractions.Boot
{
/// <summary>
/// Abstraction for the .NET Core configuration files.
/// </summary>
public interface IConfigurationSection
{
string this[string name] { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
</ItemGroup>


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using Coderr.Server.Api.Core.Incidents.Queries;

namespace Coderr.Server.Abstractions.Incidents
{
public class HighlightedContextDataProviderContext
{
private readonly IList<HighlightedContextData> _items;

public HighlightedContextDataProviderContext(IList<HighlightedContextData> items)
{
_items = items ?? throw new ArgumentNullException(nameof(items));
Tags = new string[0];
}

public int ApplicationId { get; set; }
public string Description { get; set; }

/// <summary>
/// Namespace + name of exception
/// </summary>
public string FullName { get; set; }

public int IncidentId { get; set; }

public IEnumerable<HighlightedContextData> Items => _items;

public string StackTrace { get; set; }
public string[] Tags { get; set; }

public void AddValue(HighlightedContextData contextData)
{
if (contextData == null) throw new ArgumentNullException(nameof(contextData));
_items.Add(contextData);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ namespace Coderr.Server.Abstractions.Incidents
{
public interface IHighlightedContextDataProvider
{
Task CollectAsync(int incidentId, ICollection<HighlightedContextData> data);
Task CollectAsync(HighlightedContextDataProviderContext context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

namespace Coderr.Server.Abstractions.Incidents
{
/// <summary>
/// Checks if there is a solution available for the current incident.
/// </summary>
public interface ISolutionProvider
{
Task SuggestSolutionAsync(int incidentId, ICollection<SuggestedIncidentSolution> suggestedSolutions);
Task SuggestSolutionAsync(SolutionProviderContext context);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using Coderr.Server.Api.Core.Incidents.Queries;

namespace Coderr.Server.Abstractions.Incidents
{
public class SolutionProviderContext
{
private readonly List<SuggestedIncidentSolution> _possibleSolutions;

public SolutionProviderContext(List<SuggestedIncidentSolution> possibleSolutions)
{
_possibleSolutions = possibleSolutions;
}

public int ApplicationId { get; set; }
public string Description { get; set; }

/// <summary>
/// Namespace + name of exception
/// </summary>
public string FullName { get; set; }

public int IncidentId { get; set; }

public string StackTrace { get; set; }
public string[] Tags { get; set; }

public void AddSuggestion(string suggestion, string motivation)
{
if (suggestion == null) throw new ArgumentNullException(nameof(suggestion));
if (motivation == null) throw new ArgumentNullException(nameof(motivation));
_possibleSolutions.Add(new SuggestedIncidentSolution {Reason = motivation, SuggestedSolution = suggestion});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static string ToFriendlyString(this IPrincipal principal)
return "Anonymous";
}

string str = cc.Identity.Name + " [";
string str = cc.Identity.Name + " Claims[";
foreach (var claim in cc.Claims)
{
var pos = claim.Type.LastIndexOf('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace Coderr.Server.Abstractions.Security
{
public class CoderrClaims
{
public const string Application = "http://coderrapp.com/claims/application";
public const string ApplicationAdmin = "http://coderrapp.com/claims/application/admin";
public const string Application = "http://coderr/claims/application";
public const string ApplicationAdmin = "http://coderr/claims/application/admin";

public static readonly ClaimsPrincipal SystemPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
<AssemblyName>Coderr.Server.Api.Client.Tests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="FluentAssertions" Version="5.2.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="NSubstitute" Version="4.2.0" />

</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetCqs" Version="2.0.10" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Coderr.Server.Api\Coderr.Server.Api.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Server/Coderr.Server.Api/Coderr.Server.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Coderr.Server.Api.Core.Accounts.Queries
{
[Message]
public class ListAccounts : Query<ListAccountsResult>
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace Coderr.Server.Api.Core.Incidents.Queries
/// </summary>
public class FindIncidentsResultItem
{
private string _name;

/// <summary>
/// Creates new instance of <see cref="FindIncidentsResultItem" />.
Expand Down Expand Up @@ -68,16 +67,7 @@ protected FindIncidentsResultItem()
/// <summary>
/// Incident name
/// </summary>
public string Name
{
set
{
if (value.Length > 40)
value = value.Substring(0, 35) + "[...]";
_name = value;
}
get => _name;
}
public string Name { get; set; }

/// <summary>
/// Total number of received reports (increased even if the number of stored reports are at the limit)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using DotNetCqs;

namespace Coderr.Server.Api.Core.Incidents.Queries
{
/// <summary>
/// Fetch a specific collection from all reports, sorted in descending order.
/// </summary>
public class GetCollection : Query<GetCollectionResult>
{
public GetCollection(int incidentId, string collectionName)
{
if (incidentId <= 0) throw new ArgumentOutOfRangeException(nameof(incidentId));
IncidentId = incidentId;
CollectionName = collectionName ?? throw new ArgumentNullException(nameof(collectionName));
}

protected GetCollection()
{
}

/// <summary>
/// Collection name like "ErrorProperties" or "HttpRequest".
/// </summary>
public string CollectionName { get; }

/// <summary>
/// Incident that the collection belongs to.
/// </summary>
public int IncidentId { get; }

/// <summary>
/// Collection limit.
/// </summary>
public int MaxNumberOfCollections { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Coderr.Server.Api.Core.Incidents.Queries
{
/// <summary>
/// Result for <see cref="GetCollection"/>.
/// </summary>
public class GetCollectionResult
{
/// <summary>
/// Fetched collections.
/// </summary>
public GetCollectionResultItem[] Items { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;

namespace Coderr.Server.Api.Core.Incidents.Queries
{
/// <summary>
/// A collection
/// </summary>
public class GetCollectionResultItem
{
/// <summary>
/// Properties in the collection (for instance "Url" if this is the HTTP request).
/// </summary>
public Dictionary<string, string> Properties { get; set; }

/// <summary>
/// Date for the report that this collection is for.
/// </summary>
public DateTime ReportDate { get; set; }

/// <summary>
/// Id of the report that this collection was received in.
/// </summary>
public int ReportId { get; set; }
}
}
Loading