diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj index 4b26ad9fd..22d271178 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj @@ -19,6 +19,7 @@ + diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/App.razor b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/App.razor index 13b0170ff..c3c01639c 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/App.razor +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/App.razor @@ -16,6 +16,9 @@ + + + diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/Home.razor b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/Home.razor index 35d773c4b..c12c34409 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/Home.razor +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/Pages/Home.razor @@ -23,36 +23,40 @@
-
-

Queue Event:

- - + + @if (@SampleRequests.ContainsKey(SampleRequestManager.SavedRequestGroup)) { - - @foreach (var request in SampleRequests[group]) + + @foreach (var request in SampleRequests[SampleRequestManager.SavedRequestGroup]) { } } - } - - - -
+ @foreach (var group in SampleRequests.Keys) + { + @if (!string.Equals(group, SampleRequestManager.SavedRequestGroup)) + { + + @foreach (var request in SampleRequests[group]) + { + + } + + } + } + + +
+
+ + +
+
@@ -66,7 +70,7 @@ {
- @((MarkupString)REBOOT_ICON) + @((MarkupString)RebootIcon)

Request ID: @RuntimeApiModel.ActiveEvent.AwsRequestId

Status: @RuntimeApiModel.ActiveEvent.EventStatus

@@ -106,7 +110,7 @@
Last Updated:
@evnt.LastUpdated
- @((MarkupString)CLOSE_ICON) + @((MarkupString)CloseIcon)
@@ -124,7 +128,7 @@
- @((MarkupString)REBOOT_ICON) + @((MarkupString)RebootIcon)
Request ID:
@evnt.AwsRequestId
@@ -132,7 +136,7 @@
Last Updated:
@evnt.LastUpdated
- @((MarkupString)CLOSE_ICON) + @((MarkupString)CloseIcon)
@@ -163,13 +167,15 @@ @code { - private const string REBOOT_ICON = @" + private StandaloneCodeEditor _editor = null!; + + private const string RebootIcon = @" "; - private const string CLOSE_ICON = @" + private const string CloseIcon = @" @@ -177,7 +183,7 @@ [CascadingParameter] public IModalService Modal { get; set; } = default!; - private const string NO_SAMPLE_SELECTED_ID = "void-select-request"; + private const string NoSampleSelectedId = "void-select-request"; private string FunctionInput { get; set; } = ""; @@ -186,22 +192,25 @@ string? _selectedSampleRequestName; string? SelectedSampleRequestName { - get => this._selectedSampleRequestName; + get => _selectedSampleRequestName; set { if (SampleRequestManager == null) return; - this._selectedSampleRequestName = value; - if (string.IsNullOrEmpty(this._selectedSampleRequestName)) + _selectedSampleRequestName = value; + if (string.IsNullOrEmpty(_selectedSampleRequestName) || + string.Equals(value, NoSampleSelectedId)) { - this.FunctionInput = string.Empty; + FunctionInput = string.Empty; } - else if (!string.Equals(value, NO_SAMPLE_SELECTED_ID)) + else { - this.FunctionInput = SampleRequestManager.GetRequest(this._selectedSampleRequestName); + FunctionInput = SampleRequestManager.GetRequest(_selectedSampleRequestName); } - this.StateHasChanged(); + + _editor.SetValue(FunctionInput); + StateHasChanged(); } } @@ -210,58 +219,58 @@ protected override void OnInitialized() { RuntimeApiModel.StateChange += RuntimeApiModelOnStateChange; - this.SampleRequestManager = new SampleRequestManager(DirectoryManager.GetCurrentDirectory()); - this.SampleRequests = SampleRequestManager.GetSampleRequests(); + SampleRequestManager = new SampleRequestManager(DirectoryManager.GetCurrentDirectory()); + SampleRequests = SampleRequestManager.GetSampleRequests(); } private void RuntimeApiModelOnStateChange(object? sender, EventArgs e) { - this.InvokeAsync(this.StateHasChanged); + InvokeAsync(this.StateHasChanged); } void OnAddEventClick() { - RuntimeApiModel.QueueEvent(this.FunctionInput); - this.FunctionInput = ""; - this.SelectedSampleRequestName = NO_SAMPLE_SELECTED_ID; - this.StateHasChanged(); + RuntimeApiModel.QueueEvent(FunctionInput); + FunctionInput = ""; + SelectedSampleRequestName = NoSampleSelectedId; + StateHasChanged(); } void OnClearQueued() { - this.RuntimeApiModel.ClearQueued(); - this.StateHasChanged(); + RuntimeApiModel.ClearQueued(); + StateHasChanged(); } void OnClearExecuted() { - this.RuntimeApiModel.ClearExecuted(); - this.StateHasChanged(); + RuntimeApiModel.ClearExecuted(); + StateHasChanged(); } void OnRequeue(string awsRequestId) { EventContainer? evnt = null; - if (string.Equals(this.RuntimeApiModel.ActiveEvent?.AwsRequestId, awsRequestId)) + if (string.Equals(RuntimeApiModel.ActiveEvent?.AwsRequestId, awsRequestId)) { - evnt = this.RuntimeApiModel.ActiveEvent; + evnt = RuntimeApiModel.ActiveEvent; } else { - evnt = this.RuntimeApiModel.ExecutedEvents.FirstOrDefault(x => string.Equals(x.AwsRequestId, awsRequestId)); + evnt = RuntimeApiModel.ExecutedEvents.FirstOrDefault(x => string.Equals(x.AwsRequestId, awsRequestId)); } if (evnt == null) return; - this.RuntimeApiModel.QueueEvent(evnt.EventJson); - this.StateHasChanged(); + RuntimeApiModel.QueueEvent(evnt.EventJson); + StateHasChanged(); } void OnDeleteEvent(string awsRequestId) { - this.RuntimeApiModel.DeleteEvent(awsRequestId); - this.StateHasChanged(); + RuntimeApiModel.DeleteEvent(awsRequestId); + StateHasChanged(); } string GetStatusStyle(EventContainer.Status status) => status switch @@ -308,4 +317,14 @@ parameters.Add(ExpandedTextDialog.PARAMETER_NAME_FULL_TEXT, text); Modal.Show(title, parameters); } + + private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor) + { + return new StandaloneEditorConstructionOptions + { + Language = "json", + GlyphMargin = true, + Theme = "vs-dark" + }; + } } diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/_Imports.razor b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/_Imports.razor index 2d88f6819..d47a57025 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/_Imports.razor +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Components/_Imports.razor @@ -10,4 +10,8 @@ @using Amazon.Lambda.TestTool.Components @using Blazored.Modal -@using Blazored.Modal.Services \ No newline at end of file +@using Blazored.Modal.Services + +@using BlazorMonaco +@using BlazorMonaco.Editor +@using BlazorMonaco.Languages diff --git a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/wwwroot/app.css b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/wwwroot/app.css index 7ac30e2a8..c1dfb18cd 100644 --- a/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/wwwroot/app.css +++ b/Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/wwwroot/app.css @@ -49,3 +49,7 @@ h1:focus { .darker-border-checkbox.form-check-input { border-color: #929292; } + +.monaco-editor-container { + height: 500px; +}