Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

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 Mar 24, 2019
1 parent 59eb1be commit 69a7381
Show file tree
Hide file tree
Showing 10 changed files with 830 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="HtmlDxPivotGridAreaExtensionsTests.cs" />
<Compile Include="ColumnSortOrderExtensionsTests.cs" />
<Compile Include="DevExtremeThemeExtensionsTests.cs" />
<Compile Include="ExceptionAssertExtensions.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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 @@ -68,11 +68,14 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ColumnSortOrder.cs" />
<Compile Include="HtmlDxPivotGridAreaExtensions.cs" />
<Compile Include="ColumnSortOrderExtensions.cs" />
<Compile Include="DevExtremeTheme.cs" />
<Compile Include="DevExtremeThemeExtensions.cs" />
<Compile Include="FileLinkSettings.cs" />
<Compile Include="HtmlDxDataGridColumnDescription.cs" />
<Compile Include="HtmlDxPivotGridArea.cs" />
<Compile Include="HtmlDxPivotGridOption.cs" />
<Compile Include="HtmlDxDataGridOption.cs" />
<Compile Include="GenericIssueReportFormatAliases.cs" />
<Compile Include="GenericIssueReportFormatSettingsExtensions.cs" />
Expand All @@ -97,6 +100,7 @@
</None>
<EmbeddedResource Include="Templates\DataTable.cshtml" />
<EmbeddedResource Include="Templates\DxDataGrid.cshtml" />
<EmbeddedResource Include="Templates\DxPivotGrid.cshtml" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.6.3\analyzers\dotnet\cs\Humanizer.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public enum GenericIssueReportTemplate
/// Template for a HTML report containing a rich data grid with sorting, filtering, grouping and search capabilities.
/// See <see cref="HtmlDxDataGridOption"/> for template specific options.
/// </summary>
HtmlDxDataGrid
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 69a7381

Please sign in to comment.