From 59a17adc308fdd11ab082c3fc7ff1452b860ecb9 Mon Sep 17 00:00:00 2001 From: Thomas Clark Date: Tue, 1 Oct 2024 19:02:06 +0100 Subject: [PATCH] refactor: restyle the import/export page (#92) --- .../Components/AzureInputSelect.razor | 2 +- ...> ImportExportFileFormatInputSelect.razor} | 8 +- ...> ImportExportSourceTypeInputSelect.razor} | 8 +- .../Components/Pages/ImportExport.razor | 182 +++++++++++------- .../wwwroot/app.css | 2 +- 5 files changed, 124 insertions(+), 78 deletions(-) rename src/AzureAppConfigurationEmulator/Components/{ImportExportFileTypeInputSelect.razor => ImportExportFileFormatInputSelect.razor} (74%) rename src/AzureAppConfigurationEmulator/Components/{ImportExportSourceServiceInputSelect.razor => ImportExportSourceTypeInputSelect.razor} (70%) diff --git a/src/AzureAppConfigurationEmulator/Components/AzureInputSelect.razor b/src/AzureAppConfigurationEmulator/Components/AzureInputSelect.razor index ce609e7..04bccf2 100644 --- a/src/AzureAppConfigurationEmulator/Components/AzureInputSelect.razor +++ b/src/AzureAppConfigurationEmulator/Components/AzureInputSelect.razor @@ -1,7 +1,7 @@ @typeparam TValue @using System.Linq.Expressions - + @ChildContent diff --git a/src/AzureAppConfigurationEmulator/Components/ImportExportFileTypeInputSelect.razor b/src/AzureAppConfigurationEmulator/Components/ImportExportFileFormatInputSelect.razor similarity index 74% rename from src/AzureAppConfigurationEmulator/Components/ImportExportFileTypeInputSelect.razor rename to src/AzureAppConfigurationEmulator/Components/ImportExportFileFormatInputSelect.razor index 01c44be..5ddb159 100644 --- a/src/AzureAppConfigurationEmulator/Components/ImportExportFileTypeInputSelect.razor +++ b/src/AzureAppConfigurationEmulator/Components/ImportExportFileFormatInputSelect.razor @@ -2,9 +2,9 @@ - - - + + + @code { @@ -21,7 +21,7 @@ await ValueChanged.InvokeAsync(!string.IsNullOrEmpty(value) ? value : null); } - public static class FileType + public static class FileFormat { public const string Json = ".json"; diff --git a/src/AzureAppConfigurationEmulator/Components/ImportExportSourceServiceInputSelect.razor b/src/AzureAppConfigurationEmulator/Components/ImportExportSourceTypeInputSelect.razor similarity index 70% rename from src/AzureAppConfigurationEmulator/Components/ImportExportSourceServiceInputSelect.razor rename to src/AzureAppConfigurationEmulator/Components/ImportExportSourceTypeInputSelect.razor index c196cce..617475c 100644 --- a/src/AzureAppConfigurationEmulator/Components/ImportExportSourceServiceInputSelect.razor +++ b/src/AzureAppConfigurationEmulator/Components/ImportExportSourceTypeInputSelect.razor @@ -2,9 +2,9 @@ - - - + + + @code { @@ -21,7 +21,7 @@ await ValueChanged.InvokeAsync(!string.IsNullOrEmpty(value) ? value : null); } - public static class SourceService + public static class SourceType { public const string AzureAppConfiguration = nameof(AzureAppConfiguration); diff --git a/src/AzureAppConfigurationEmulator/Components/Pages/ImportExport.razor b/src/AzureAppConfigurationEmulator/Components/Pages/ImportExport.razor index f9cdf0d..a41abf5 100644 --- a/src/AzureAppConfigurationEmulator/Components/Pages/ImportExport.razor +++ b/src/AzureAppConfigurationEmulator/Components/Pages/ImportExport.razor @@ -17,46 +17,72 @@
- - - - @switch (Model.Operation) + + @switch (Model?.Operation) { case ImportExportOperationInputRadioGroup.Operation.Import: - - - switch (Model.SourceService) +
+ + + +
+ + switch (Model.SourceType) { - case ImportExportSourceServiceInputSelect.SourceService.AzureAppConfiguration: - + case ImportExportSourceTypeInputSelect.SourceType.AzureAppConfiguration: +
+
Select source
+ + +
if (!string.IsNullOrEmpty(Model.SourceConnectionString) && Labels is { Count: > 0 }) { - - - +
+
Select key-values
+ + + + + + +
- +
+
Apply changes to key-values
- + +
@(Model.Operation switch { ImportExportOperationInputRadioGroup.Operation.Export => "Export", ImportExportOperationInputRadioGroup.Operation.Import => "Import", _ => throw new ArgumentOutOfRangeException() }) @@ -64,41 +90,61 @@ } break; - case ImportExportSourceServiceInputSelect.SourceService.ConfigurationFile: - - - if (Model.FileType is not null) - { -