-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
648 additions
and
484 deletions.
There are no files selected for viewing
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
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
28 changes: 0 additions & 28 deletions
28
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/ConfirmDialog.razor
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/EventDialog.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,59 @@ | ||
@using Amazon.Lambda.TestTool.Models | ||
|
||
<div class="modal fade" id="eventModal" tabindex="-1" aria-hidden="true"> | ||
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<div class="d-flex align-items-center gap-2"> | ||
<div><b>Request ID:</b> @_eventContainer?.AwsRequestId</div> | ||
<span class="badge @GetStatusBadgeStyle(_eventContainer?.EventStatus)">@_eventContainer?.EventStatus</span> | ||
</div> | ||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> | ||
</div> | ||
<div class="modal-body"> | ||
<nav class="navbar navbar-expand-md bd-navbar pt-0"> | ||
<ul class="navbar-nav nav-underline nav-fill flex-row" id="eventsModalTab" role="tablist"> | ||
<li class="nav-item" role="presentation"> | ||
<button class="nav-link active" id="active-tab" data-bs-toggle="tab" data-bs-target="#request-tab-pane" type="button" role="tab" aria-controls="request-tab-pane" aria-selected="true" @onclick="ShowRequestTab"> | ||
<i class="bi bi-file-earmark"></i> | ||
Request | ||
</button> | ||
</li> | ||
<li class="nav-item" role="presentation"> | ||
<button class="nav-link" id="queued-tab" data-bs-toggle="tab" data-bs-target="#response-tab-pane" type="button" role="tab" aria-controls="response-tab-pane" aria-selected="false" @onclick="ShowResponseTab"> | ||
<i class="bi bi-file-earmark-fill"></i> | ||
Response | ||
</button> | ||
</li> | ||
</ul> | ||
</nav> | ||
<div class="tab-content d-flex flex-column flex-grow-1 flex-fill" id="eventsModalTabContent"> | ||
<div class="tab-pane fade flex-fill active show" id="request-tab-pane" role="tabpanel" aria-labelledby="request-tab" tabindex="0"> | ||
<StandaloneCodeEditor Id="request-body" @ref="_requestEditor" ConstructionOptions="EditorConstructionOptions" CssClass="monaco-modal-editor rounded-4 overflow-hidden border"/> | ||
</div> | ||
<div class="tab-pane fade flex-fill flex-column gap-2" id="response-tab-pane" role="tabpanel" aria-labelledby="response-tab" tabindex="1"> | ||
<div class="flex-grow-1"> | ||
<div class="d-flex bg-body-tertiary p-2 align-items-start gap-2 rounded-4 rounded-bottom-0 border border-bottom-0"> | ||
<div class="d-flex flex-column gap-2"> | ||
<div><b>Last Updated:</b> @_eventContainer?.LastUpdated</div> | ||
@if (_eventContainer?.EventStatus == EventContainer.Status.Failure) | ||
{ | ||
<div><b>Error Type:</b> @_eventContainer?.ErrorType</div> | ||
} | ||
</div> | ||
</div> | ||
@if (_eventContainer?.EventStatus == EventContainer.Status.Failure) | ||
{ | ||
<StandaloneCodeEditor Id="response-error-body" @ref="_responseErrorEditor" ConstructionOptions="EditorConstructionOptions" CssClass="monaco-editor-container monaco-modal-editor rounded-4 rounded-top-0 border border-top-0 overflow-hidden"/> | ||
} | ||
else | ||
{ | ||
<StandaloneCodeEditor Id="response-body" @ref="_responseEditor" ConstructionOptions="EditorConstructionOptions" CssClass="monaco-editor-container monaco-modal-editor rounded-4 rounded-top-0 border border-top-0 overflow-hidden"/> | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
66 changes: 66 additions & 0 deletions
66
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/EventDialog.razor.cs
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,66 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
using Amazon.Lambda.TestTool.Models; | ||
using Amazon.Lambda.TestTool.Services; | ||
using BlazorMonaco.Editor; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace Amazon.Lambda.TestTool.Components.Pages; | ||
|
||
public partial class EventDialog : ComponentBase | ||
{ | ||
[Inject] public required IThemeService ThemeService { get; set; } | ||
|
||
private EventContainer? _eventContainer; | ||
private StandaloneCodeEditor? _requestEditor; | ||
private StandaloneCodeEditor? _responseErrorEditor; | ||
private StandaloneCodeEditor? _responseEditor; | ||
|
||
public void ShowDialog(EventContainer eventContainer) | ||
{ | ||
_eventContainer = eventContainer; | ||
_requestEditor?.SetValue(_eventContainer.EventJson); | ||
_responseErrorEditor?.SetValue(_eventContainer.ErrorResponse); | ||
_responseEditor?.SetValue(_eventContainer.Response); | ||
StateHasChanged(); | ||
} | ||
|
||
private void ShowRequestTab() | ||
{ | ||
_requestEditor?.SetValue(_eventContainer?.EventJson); | ||
StateHasChanged(); | ||
} | ||
|
||
private void ShowResponseTab() | ||
{ | ||
_responseErrorEditor?.SetValue(_eventContainer?.ErrorResponse); | ||
_responseEditor?.SetValue(_eventContainer?.Response); | ||
StateHasChanged(); | ||
} | ||
|
||
private string GetStatusBadgeStyle(EventContainer.Status? status) => status switch | ||
{ | ||
EventContainer.Status.Success => "text-bg-success", | ||
EventContainer.Status.Failure => "text-bg-danger", | ||
_ => "text-bg-secondary" | ||
}; | ||
|
||
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor) | ||
{ | ||
return new StandaloneEditorConstructionOptions | ||
{ | ||
Language = "json", | ||
GlyphMargin = false, | ||
Theme = ThemeService.CurrentTheme.Equals("dark") ? "vs-dark" : "vs", | ||
FontSize = 12, | ||
AutomaticLayout = true, | ||
ScrollBeyondLastLine = false, | ||
ReadOnly = true, | ||
Minimap = new EditorMinimapOptions | ||
{ | ||
Enabled = false | ||
} | ||
}; | ||
} | ||
} |
Oops, something went wrong.