-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dashboard): added workflow instance details view (wip)
Signed-off-by: Jean-Baptiste Bianchi <[email protected]>
- Loading branch information
Showing
103 changed files
with
24,408 additions
and
1,847 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/dashboard/Synapse.Dashboard/Components/CorrelationContextDetails.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@* | ||
Copyright © 2024-Present The Synapse Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*@ | ||
|
||
@namespace Synapse.Dashboard.Components | ||
@inject IJsonSerializer JsonSerializer | ||
|
||
@if (CorrelationContext != null) | ||
{ | ||
<pre> | ||
@JsonSerializer.SerializeToText(CorrelationContext); | ||
</pre> | ||
} | ||
|
||
@code { | ||
[Parameter] public CorrelationContext? CorrelationContext { get; set; } | ||
} |
147 changes: 147 additions & 0 deletions
147
src/dashboard/Synapse.Dashboard/Components/DocumentDetails/DocumentDetails.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
@* | ||
Copyright © 2024-Present The Synapse Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*@ | ||
|
||
@namespace Synapse.Dashboard.Components | ||
@using Synapse.Dashboard.Components.DocumentDetailsStateManagement | ||
@inherits StatefulComponent<DocumentDetails, DocumentDetailsStore, DocumentDetailsState> | ||
|
||
<div class="d-flex justify-content-between"> | ||
@if (LabelTemplate != null) { | ||
@LabelTemplate | ||
} | ||
else { | ||
<span class="label">@Label</span> | ||
} | ||
@if (collapse != null) | ||
{ | ||
<Icon Name="@(isOpen ? IconName.CaretUp : IconName.CaretDown)" @onclick="async (_) => await ToggleAsync()" /> | ||
} | ||
</div> | ||
|
||
<Collapse @ref="collapse" OnShowing="Store.LoadReferencedDocumentAsync"> | ||
@if (reference == null && Document == null) | ||
{ | ||
<p>No document</p> | ||
} | ||
else | ||
{ | ||
@if (!loaded) | ||
{ | ||
<Spinner Class="me-3" Color="SpinnerColor.Primary" Size="SpinnerSize.Small" /> | ||
} | ||
else | ||
{ | ||
<PreferredLanguageSelector PreferedLanguageChange="Store.ToggleTextBasedEditorLanguageAsync" /> | ||
<StandaloneCodeEditor @ref="Store.TextEditor" | ||
ConstructionOptions="Store.StandaloneEditorConstructionOptions" | ||
OnDidInit="Store.OnTextBasedEditorInitAsync" | ||
CssClass="h-100-px" /> | ||
} | ||
@if (problemDetails != null) | ||
{ | ||
<div class="problems"> | ||
<Callout Type="CalloutType.Danger" Heading="@problemDetails.Title"> | ||
@problemDetails.Detail | ||
</Callout> | ||
@if (problemDetails.Errors != null && problemDetails.Errors.Any()) | ||
{ | ||
foreach (KeyValuePair<string, string[]> errorContainer in problemDetails.Errors) | ||
{ | ||
<Callout Type="CalloutType.Danger" Heading="@errorContainer.Key"> | ||
<ul> | ||
@foreach (string error in errorContainer.Value) | ||
{ | ||
<li>@error</li> | ||
} | ||
</ul> | ||
</Callout> | ||
} | ||
} | ||
</div> | ||
} | ||
} | ||
</Collapse> | ||
|
||
@code { | ||
/// <summary> | ||
/// The label to display | ||
/// </summary> | ||
[Parameter] public string? Label { get; set; } | ||
/// <summary> | ||
/// The label to display | ||
/// </summary> | ||
[Parameter] public RenderFragment? LabelTemplate { get; set; } | ||
/// <summary> | ||
/// The reference of the document to load | ||
/// </summary> | ||
[Parameter] public string? Reference { get; set; } | ||
/// <summary> | ||
/// The reference of the document to display | ||
/// </summary> | ||
[Parameter] public object? Document { get; set; } | ||
|
||
/// <summary> | ||
/// The <see cref="Collapse" /> reference | ||
/// </summary> | ||
private Collapse collapse = default!; | ||
/// <summary> | ||
/// The state of the <see cref="Collapse" /> | ||
/// </summary> | ||
private bool isOpen = false; | ||
/// <summary> | ||
/// The internal reference | ||
/// </summary> | ||
private string? reference; | ||
/// <summary> | ||
/// The internal boolean indicating if the resource already loaded | ||
/// </summary> | ||
private bool loaded = false; | ||
/// <summary> | ||
/// The <see cref="ProblemDetails"/> that occurred when trying to save the resource, if any | ||
/// </summary> | ||
private ProblemDetails? problemDetails = null; | ||
|
||
/// <inheritdoc/> | ||
protected override async Task OnInitializedAsync() | ||
{ | ||
await base.OnInitializedAsync().ConfigureAwait(false); | ||
Store.Reference.Subscribe(newReference => OnStateChanged(cmp => cmp.reference = newReference), token: CancellationTokenSource.Token); | ||
Store.Loaded.Subscribe(newLoading => OnStateChanged(cmp => cmp.loaded = newLoading), token: CancellationTokenSource.Token); | ||
Store.ProblemDetails.Subscribe(newProblemDetails => OnStateChanged(cmp => cmp.problemDetails = newProblemDetails), token: CancellationTokenSource.Token); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override async Task OnParametersSetAsync() | ||
{ | ||
await base.OnParametersSetAsync(); | ||
Store.SetDocument(Document); | ||
if (reference != Reference) | ||
{ | ||
Store.SetReference(Reference); | ||
} | ||
if (collapse != null) | ||
{ | ||
isOpen = false; | ||
await collapse.HideAsync(); | ||
} | ||
} | ||
|
||
async Task ToggleAsync() | ||
{ | ||
isOpen = !isOpen; | ||
await (isOpen ? collapse.ShowAsync() : collapse.HideAsync()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.