Skip to content

Commit

Permalink
(GH-34) Add report using DevExtreme PivotGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Aug 10, 2020
1 parent 05bf1dc commit a73f0f7
Show file tree
Hide file tree
Showing 9 changed files with 825 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public sealed class TheInternalCreateReportMethod
[InlineData(GenericIssueReportTemplate.HtmlDiagnostic)]
[InlineData(GenericIssueReportTemplate.HtmlDataTable)]
[InlineData(GenericIssueReportTemplate.HtmlDxDataGrid)]
[InlineData(GenericIssueReportTemplate.HtmlDxPivotGrid)]
public void Should_Generate_Report_From_Embedded_Template(GenericIssueReportTemplate template)
{
// Given
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Cake.Issues.Reporting.Generic.Tests
{
using Shouldly;
using Xunit;

public sealed class HtmlDxPivotGridAreaExtensionsTests
{
public sealed class TheToJavaScriptIdentifierMethod
{
[Theory]
[InlineData(HtmlDxPivotGridArea.Column)]
[InlineData(HtmlDxPivotGridArea.Row)]
[InlineData(HtmlDxPivotGridArea.Filter)]
[InlineData(HtmlDxPivotGridArea.Data)]
public void Should_Return_Identifier(HtmlDxPivotGridArea area)
{
// Given

// When
var result = area.ToJavaScriptIdentifier();

// Then
result.ShouldNotBeNullOrWhiteSpace();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<EmbeddedResource Include="Templates\DataTable.cshtml" />
<EmbeddedResource Include="Templates\Diagnostic.cshtml" />
<EmbeddedResource Include="Templates\DxDataGrid.cshtml" />
<EmbeddedResource Include="Templates\DxPivotGrid.cshtml" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ public enum GenericIssueReportTemplate
/// See <see cref="HtmlDxDataGridOption"/> for template specific options.
/// </summary>
HtmlDxDataGrid,

/// <summary>
/// Template for a HTML report containing a pivot grid showing number of errors, warnings, suggestions and hints,
/// with a detail drill down view and an overview chart.
/// </summary>
HtmlDxPivotGrid,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public static string GetTemplateResourceName(this GenericIssueReportTemplate tem
case GenericIssueReportTemplate.HtmlDxDataGrid:
return "DxDataGrid.cshtml";

case GenericIssueReportTemplate.HtmlDxPivotGrid:
return "DxPivotGrid.cshtml";

default:
throw new ArgumentOutOfRangeException(nameof(template));
}
Expand Down
28 changes: 28 additions & 0 deletions src/Cake.Issues.Reporting.Generic/HtmlDxPivotGridArea.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace Cake.Issues.Reporting.Generic
{
/// <summary>
/// Possible areas for fields.
/// </summary>
public enum HtmlDxPivotGridArea
{
/// <summary>
/// Field will be shown as row.
/// </summary>
Row,

/// <summary>
/// Field will be shown as column.
/// </summary>
Column,

/// <summary>
/// Field will be shown as data.
/// </summary>
Data,

/// <summary>
/// Field will be available to filter.
/// </summary>
Filter
}
}
32 changes: 32 additions & 0 deletions src/Cake.Issues.Reporting.Generic/HtmlDxPivotGridAreaExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Cake.Issues.Reporting.Generic
{
using System;

/// <summary>
/// Extension methods for the <see cref="HtmlDxPivotGridArea"/> enumeration.
/// </summary>
public static class HtmlDxPivotGridAreaExtensions
{
/// <summary>
/// Returns the short identifier of the pivot grid area.
/// </summary>
/// <param name="area">Area for which the identifier should be returned.</param>
/// <returns>Short identifier of the area.</returns>
public static string ToJavaScriptIdentifier(this HtmlDxPivotGridArea area)
{
switch (area)
{
case HtmlDxPivotGridArea.Row:
return "row";
case HtmlDxPivotGridArea.Column:
return "column";
case HtmlDxPivotGridArea.Data:
return "data";
case HtmlDxPivotGridArea.Filter:
return "filter";
default:
throw new ArgumentException("Unknown enumeration value", nameof(area));
}
}
}
}
Loading

0 comments on commit a73f0f7

Please sign in to comment.