Paint cells with errors differently
This commit is contained in:
@ -25,9 +25,10 @@
|
|||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
<RadzenRow>
|
<RadzenRow>
|
||||||
<RadzenColumn SizeMD="12">
|
<RadzenColumn SizeMD="12">
|
||||||
<RadzenDataGrid @ref="@campaignsDataGrid" TItem="Campaign" Data="@campaigns" RowExpand="@RowExpandAsync" RowCollapse="@RowCollapse" IsLoading="@(state != PageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true" ExpandMode="DataGridExpandMode.Single">
|
<div>
|
||||||
|
<RadzenDataGrid @ref="@campaignsDataGrid" TItem="Campaign" Data="@campaigns" RowExpand="@RowExpandAsync" RowCollapse="@RowCollapse" IsLoading="@(state != PageState.Idle)" CellRender="@OnCellRender" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true" ExpandMode="DataGridExpandMode.Single">
|
||||||
<Template Context="campaign">
|
<Template Context="campaign">
|
||||||
<RadzenDataGrid @ref="@operationsDataGrid" Data="@campaign.Operations" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
|
<RadzenDataGrid @ref="@operationsDataGrid" Data="@campaign.Operations" CellRender="@OnCellRender" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn Property="@nameof(Operation.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
|
<RadzenDataGridColumn Property="@nameof(Operation.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
|
||||||
<RadzenDataGridColumn Property="@nameof(Operation.Type)" Title="Тип операции" />
|
<RadzenDataGridColumn Property="@nameof(Operation.Type)" Title="Тип операции" />
|
||||||
@ -53,6 +54,7 @@
|
|||||||
<RadzenDataGridColumn TItem="Campaign" Property="@nameof(Campaign.FailureReason)" Title="Причина ошибки" />
|
<RadzenDataGridColumn TItem="Campaign" Property="@nameof(Campaign.FailureReason)" Title="Причина ошибки" />
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
@ -113,6 +115,24 @@
|
|||||||
campaign.Operations = null;
|
campaign.Operations = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnCellRender(DataGridCellRenderEventArgs<Campaign> args)
|
||||||
|
{
|
||||||
|
if (args.Column.Property == nameof(Campaign.FailureReason))
|
||||||
|
{
|
||||||
|
args.Attributes.Add("class", "white-text");
|
||||||
|
args.Attributes.Add("style", $"background-color: {(!string.IsNullOrEmpty(args.Data.FailureReason) ? "var(--rz-danger)" : "var(--rz-base-background-color)")};");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCellRender(DataGridCellRenderEventArgs<Operation> args)
|
||||||
|
{
|
||||||
|
if (args.Column.Property == nameof(Operation.FailureReason))
|
||||||
|
{
|
||||||
|
args.Attributes.Add("class", "white-text");
|
||||||
|
args.Attributes.Add("style", $"background-color: {(!string.IsNullOrEmpty(args.Data.FailureReason) ? "var(--rz-danger)" : "var(--rz-base-background-color)")};");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ChangeState(PageState state)
|
void ChangeState(PageState state)
|
||||||
{
|
{
|
||||||
if (this.state == state) return;
|
if (this.state == state) return;
|
||||||
|
|||||||
3
Hcs.WebApp/Components/Pages/Campaigns.razor.css
Normal file
3
Hcs.WebApp/Components/Pages/Campaigns.razor.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
::deep td.white-text span {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
@ -24,7 +24,8 @@
|
|||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
<RadzenRow>
|
<RadzenRow>
|
||||||
<RadzenColumn SizeMD="12">
|
<RadzenColumn SizeMD="12">
|
||||||
<RadzenDataGrid @ref="@dataGrid" TItem="Operation" Data="@operations" IsLoading="@(state != PageState.Idle)" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
|
<div>
|
||||||
|
<RadzenDataGrid @ref="@dataGrid" TItem="Operation" Data="@operations" IsLoading="@(state != PageState.Idle)" CellRender="@OnCellRender" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true" AllowColumnResize="true">
|
||||||
<Columns>
|
<Columns>
|
||||||
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
|
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.Id)" Title="ID" SortOrder="SortOrder.Descending" Resizable="false" Width="100px" MaxWidth="100px" />
|
||||||
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.CampaignId)" Title="ID кампании" Resizable="false" Width="100px" MaxWidth="100px" />
|
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.CampaignId)" Title="ID кампании" Resizable="false" Width="100px" MaxWidth="100px" />
|
||||||
@ -36,6 +37,7 @@
|
|||||||
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.FailureReason)" Title="Причина ошибки" />
|
<RadzenDataGridColumn TItem="Operation" Property="@nameof(Operation.FailureReason)" Title="Причина ошибки" />
|
||||||
</Columns>
|
</Columns>
|
||||||
</RadzenDataGrid>
|
</RadzenDataGrid>
|
||||||
|
</div>
|
||||||
</RadzenColumn>
|
</RadzenColumn>
|
||||||
</RadzenRow>
|
</RadzenRow>
|
||||||
</RadzenStack>
|
</RadzenStack>
|
||||||
@ -70,6 +72,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnCellRender(DataGridCellRenderEventArgs<Operation> args)
|
||||||
|
{
|
||||||
|
if (args.Column.Property == nameof(Operation.FailureReason))
|
||||||
|
{
|
||||||
|
args.Attributes.Add("class", "white-text");
|
||||||
|
args.Attributes.Add("style", $"background-color: {(!string.IsNullOrEmpty(args.Data.FailureReason) ? "var(--rz-danger)" : "var(--rz-base-background-color)")};");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ChangeState(PageState state)
|
void ChangeState(PageState state)
|
||||||
{
|
{
|
||||||
if (this.state == state) return;
|
if (this.state == state) return;
|
||||||
|
|||||||
3
Hcs.WebApp/Components/Pages/Operations.razor.css
Normal file
3
Hcs.WebApp/Components/Pages/Operations.razor.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
::deep td.white-text span {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user