Skip to content

Commit

Permalink
Merge pull request #449 from serverlessworkflow/fix-dashboard-light-t…
Browse files Browse the repository at this point in the history
…heme

Light theme improvements and close button for editor errors in the Dashboard
  • Loading branch information
cdavernas authored Oct 30, 2024
2 parents b71dfe7 + 251c2af commit bb98d91
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
}
@if (problemDetails != null)
{
<div class="problems p-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
<div class="problems px-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
<p>@problemDetails.Detail</p>

@if (problemDetails.Errors != null && problemDetails.Errors.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,5 @@ public record DocumentDetailsState
/// <summary>
/// Gets/sets the list of <see cref="ProblemDetails"/> errors that occurred when trying to save the resource, if any
/// </summary>
public EquatableDictionary<string, string[]> ProblemErrors { get; set; } = new EquatableDictionary<string, string[]>();
public IDictionary<string, string[]> ProblemErrors { get; set; } = new EquatableDictionary<string, string[]>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

using Synapse.Api.Client.Services;
using Synapse.Dashboard.Components.WorkflowInstanceLogsStateManagement;
using Synapse.Dashboard.Pages.Functions.Create;

namespace Synapse.Dashboard.Components.DocumentDetailsStateManagement;

Expand Down Expand Up @@ -380,6 +381,22 @@ public async Task OnCopyToClipboard()
this.Logger.LogError("Unable to copy to clipboard: {exception}", ex.ToString());
}
}

/// <summary>
/// Sets the state's <see cref="CreateFunctionViewState" /> <see cref="ProblemDetails"/>'s related data
/// </summary>
/// <param name="problem">The <see cref="ProblemDetails"/> to populate the data with</param>
public void SetProblemDetails(ProblemDetails? problem)
{
this.Reduce(state => state with
{
ProblemType = problem?.Type,
ProblemTitle = problem?.Title ?? string.Empty,
ProblemStatus = problem?.Status ?? 0,
ProblemDetail = problem?.Detail ?? string.Empty,
ProblemErrors = problem?.Errors?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value) ?? []
});
}
#endregion

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
OnDidChangeModelContent="OnTextBasedValueChanged" />
@if (problemDetails != null)
{
<div class="problems p-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
<div class="problems px-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
<p>@problemDetails.Detail</p>

@if (problemDetails.Errors != null && problemDetails.Errors.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ else
CssClass="h-100" />
@if (problemDetails != null)
{
<div class="problems p-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
<div class="problems px-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
<p>@problemDetails.Detail</p>

@if (problemDetails.Errors != null && problemDetails.Errors.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ else
CssClass="h-100" />
@if (problemDetails != null)
{
<div class="problems p-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title">
<div class="problems px-3">
<Callout Color="CalloutColor.Danger" Heading="@problemDetails.Title" Class="position-relative">
<Icon Name="IconName.X" Class="position-absolute" @onclick="() => Store.SetProblemDetails(null)" />
<p>@problemDetails.Detail</p>

@if (problemDetails.Errors != null && problemDetails.Errors.Any())
Expand Down
34 changes: 26 additions & 8 deletions src/dashboard/Synapse.Dashboard/wwwroot/css/app.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/dashboard/Synapse.Dashboard/wwwroot/css/app.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/dashboard/Synapse.Dashboard/wwwroot/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,15 @@ input[type="search"]::-webkit-search-cancel-button {
max-height: 300px;
overflow: scroll;
width: 100%;

.bb-callout {
margin-top: 0;
margin-bottom: 0;

.bi.bi-x.position-absolute {
cursor: pointer;
top: $spacer;
right: $spacer;
}
}
}
13 changes: 9 additions & 4 deletions src/dashboard/Synapse.Dashboard/wwwroot/css/graph.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,20 @@ $viridisScale: // generated with 13 steps, using 12 to exclude the last yellow
cursor: grabbing;
}
}

:root {
--graph-symbol-color: #{$body-color-dark};
}
[data-bs-theme="dark"] {
--graph-symbol-color: #{$body-color-dark};
.graph-container, .graph-canvas {
--stroke-color: #{$mute};
--fill-color: #{$dark-bg-subtle-dark};
}
}

.graph-container, .graph-canvas {
--stroke-color: #{$mute};
--fill-color: #{$body-bg};
--stroke-color: #{$dark};
--fill-color: #{$gray-700};
display: flex;
flex-direction: column;

Expand Down Expand Up @@ -124,6 +128,7 @@ $viridisScale: // generated with 13 steps, using 12 to exclude the last yellow
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
color: #{$body-color-dark};

h3 {
margin-bottom: calc($spacer / 4);
Expand Down Expand Up @@ -208,7 +213,7 @@ $viridisScale: // generated with 13 steps, using 12 to exclude the last yellow
}

.symbol {
fill: var(--bs-body-color);
fill: var(--graph-symbol-color);
}

.start-node circle {
Expand Down
3 changes: 2 additions & 1 deletion src/dashboard/Synapse.Dashboard/wwwroot/css/theme/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ header.header.navbar {
$value: map-get($theme-colors,"light");
@include button-variant(
transparent,
$value,
transparent,
$color: $body-color,
$hover-background: shade-color($value, $btn-hover-bg-shade-amount),
$hover-border: shade-color($value, $btn-hover-border-shade-amount),
$active-background: shade-color($value, $btn-active-bg-shade-amount),
Expand Down

0 comments on commit bb98d91

Please sign in to comment.