Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-475) Add report using DevExtreme PivotGrid #478

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
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
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 @@ -19,6 +19,7 @@ public static string GetTemplateResourceName(this GenericIssueReportTemplate tem
GenericIssueReportTemplate.HtmlDiagnostic => "Diagnostic.cshtml",
GenericIssueReportTemplate.HtmlDataTable => "DataTable.cshtml",
GenericIssueReportTemplate.HtmlDxDataGrid => "DxDataGrid.cshtml",
GenericIssueReportTemplate.HtmlDxPivotGrid => "DxPivotGrid.cshtml",
_ => 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
}
}
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
Loading