Skip to content

Commit 251c2af

Browse files
committed
fix(Dashboard): added icon to close editor errors
Closes #447 Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
1 parent 6ba3e73 commit 251c2af

File tree

9 files changed

+52
-11
lines changed

9 files changed

+52
-11
lines changed

src/dashboard/Synapse.Dashboard/Components/DocumentDetails/DocumentDetails.razor

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@
5858
}
5959
@if (problemDetails != null)
6060
{
61-
<div class="problems p-3">
62-
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
61+
<div class="problems px-3">
62+
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
63+
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
6364
<p>@problemDetails.Detail</p>
6465

6566
@if (problemDetails.Errors != null && problemDetails.Errors.Any())

src/dashboard/Synapse.Dashboard/Components/DocumentDetails/State.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ public record DocumentDetailsState
6767
/// <summary>
6868
/// Gets/sets the list of <see cref="ProblemDetails"/> errors that occurred when trying to save the resource, if any
6969
/// </summary>
70-
public EquatableDictionary<string, string[]> ProblemErrors { get; set; } = new EquatableDictionary<string, string[]>();
70+
public IDictionary<string, string[]> ProblemErrors { get; set; } = new EquatableDictionary<string, string[]>();
7171
}

src/dashboard/Synapse.Dashboard/Components/DocumentDetails/Store.cs

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
using Synapse.Api.Client.Services;
1515
using Synapse.Dashboard.Components.WorkflowInstanceLogsStateManagement;
16+
using Synapse.Dashboard.Pages.Functions.Create;
1617

1718
namespace Synapse.Dashboard.Components.DocumentDetailsStateManagement;
1819

@@ -380,6 +381,22 @@ public async Task OnCopyToClipboard()
380381
this.Logger.LogError("Unable to copy to clipboard: {exception}", ex.ToString());
381382
}
382383
}
384+
385+
/// <summary>
386+
/// Sets the state's <see cref="CreateFunctionViewState" /> <see cref="ProblemDetails"/>'s related data
387+
/// </summary>
388+
/// <param name="problem">The <see cref="ProblemDetails"/> to populate the data with</param>
389+
public void SetProblemDetails(ProblemDetails? problem)
390+
{
391+
this.Reduce(state => state with
392+
{
393+
ProblemType = problem?.Type,
394+
ProblemTitle = problem?.Title ?? string.Empty,
395+
ProblemStatus = problem?.Status ?? 0,
396+
ProblemDetail = problem?.Detail ?? string.Empty,
397+
ProblemErrors = problem?.Errors?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) ?? []
398+
});
399+
}
383400
#endregion
384401

385402
/// <inheritdoc/>

src/dashboard/Synapse.Dashboard/Components/ResourceEditor/ResourceEditor.razor

+3-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
OnDidChangeModelContent="OnTextBasedValueChanged" />
3939
@if (problemDetails != null)
4040
{
41-
<div class="problems p-3">
42-
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
41+
<div class="problems px-3">
42+
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
43+
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
4344
<p>@problemDetails.Detail</p>
4445

4546
@if (problemDetails.Errors != null && problemDetails.Errors.Any())

src/dashboard/Synapse.Dashboard/Pages/Functions/Create/View.razor

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ else
5353
CssClass="h-100" />
5454
@if (problemDetails != null)
5555
{
56-
<div class="problems p-3">
57-
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
56+
<div class="problems px-3">
57+
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
58+
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
5859
<p>@problemDetails.Detail</p>
5960

6061
@if (problemDetails.Errors != null && problemDetails.Errors.Any())

src/dashboard/Synapse.Dashboard/Pages/Workflows/Create/View.razor

+3-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ else
4343
CssClass="h-100" />
4444
@if (problemDetails != null)
4545
{
46-
<div class="problems p-3">
47-
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
46+
<div class="problems px-3">
47+
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
48+
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
4849
<p>@problemDetails.Detail</p>
4950

5051
@if (problemDetails.Errors != null && problemDetails.Errors.Any())

src/dashboard/Synapse.Dashboard/wwwroot/css/app.css

+10-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dashboard/Synapse.Dashboard/wwwroot/css/app.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dashboard/Synapse.Dashboard/wwwroot/css/app.scss

+11
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,15 @@ input[type="search"]::-webkit-search-cancel-button {
179179
max-height: 300px;
180180
overflow: scroll;
181181
width: 100%;
182+
183+
.bb-callout {
184+
margin-top: 0;
185+
margin-bottom: 0;
186+
187+
.bi.bi-x.position-absolute {
188+
cursor: pointer;
189+
top: $spacer;
190+
right: $spacer;
191+
}
192+
}
182193
}

0 commit comments

Comments
 (0)