From aa43a2db5d8db0295de7e0427a3441871ed4510e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 6 Oct 2024 11:55:19 +0700 Subject: [PATCH 1/3] Replace MudAlert and Snackbar on edit entity page SN-751 --- src/Saritasa.NetForge.Blazor/Pages/EditEntity.razor | 8 -------- .../ViewModels/EditEntity/EditEntityViewModel.cs | 13 ++++++------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/Saritasa.NetForge.Blazor/Pages/EditEntity.razor b/src/Saritasa.NetForge.Blazor/Pages/EditEntity.razor index 061bd083..b62a76c9 100644 --- a/src/Saritasa.NetForge.Blazor/Pages/EditEntity.razor +++ b/src/Saritasa.NetForge.Blazor/Pages/EditEntity.razor @@ -66,14 +66,6 @@ else if (ViewModel.IsEntityExists) - @if (ViewModel.IsUpdated) - { - - Update was completed successfully - - } - @if (ViewModel.Errors is not null && ViewModel.Errors.Count != 0) { /// Constructor. @@ -37,7 +39,8 @@ public EditEntityViewModel( string instancePrimaryKey, IEntityService entityService, IOrmDataService dataService, - IServiceProvider serviceProvider) + IServiceProvider serviceProvider, + ISnackbar snackbar) { Model = new EditEntityModel { StringId = stringId }; InstancePrimaryKey = instancePrimaryKey; @@ -45,6 +48,7 @@ public EditEntityViewModel( this.entityService = entityService; this.dataService = dataService; this.serviceProvider = serviceProvider; + this.snackbar = snackbar; } /// @@ -52,11 +56,6 @@ public EditEntityViewModel( /// public bool IsEntityExists { get; private set; } = true; - /// - /// Is entity was updated. - /// - public bool IsUpdated { get; set; } - /// /// Errors encountered while entity updating. /// @@ -165,6 +164,6 @@ public async Task UpdateEntityAsync() // We do clone because UpdateAsync method returns Model.OriginalEntityInstance // so we don't want Model.EntityInstance and Model.OriginalEntityInstance to have the same reference. Model.EntityInstance = updatedEntity.CloneJson(); - IsUpdated = true; + snackbar.Add("Update was completed successfully", Severity.Success); } } From 1ea0a4b67f1b60f3d6f4c5a5676b34bc304eeafe Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 6 Oct 2024 11:55:22 +0700 Subject: [PATCH 2/3] Add global configuration of Snackbars to allow duplicates SN-751 --- .../Infrastructure/DependencyInjection/ApplicationModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Saritasa.NetForge.Blazor/Infrastructure/DependencyInjection/ApplicationModule.cs b/src/Saritasa.NetForge.Blazor/Infrastructure/DependencyInjection/ApplicationModule.cs index 2b7da340..4f59b3e4 100644 --- a/src/Saritasa.NetForge.Blazor/Infrastructure/DependencyInjection/ApplicationModule.cs +++ b/src/Saritasa.NetForge.Blazor/Infrastructure/DependencyInjection/ApplicationModule.cs @@ -23,7 +23,10 @@ public static void Register(IServiceCollection services) services.AddRazorPages(); services.AddServerSideBlazor(); - services.AddMudServices(); + services.AddMudServices(config => + { + config.SnackbarConfiguration.PreventDuplicates = false; + }); services.AddMemoryCache(); services.AddScoped(); services.AddScoped(); From a91e6731d5649c2720f250ee0b71d2fec6a78089 Mon Sep 17 00:00:00 2001 From: Alexandr Makarov Date: Tue, 8 Oct 2024 13:34:16 +0700 Subject: [PATCH 3/3] Update changelog and version SN-751 --- CHANGELOG.txt | 5 ++++- VERSION.txt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9b5ae6a3..b4253f6b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -6,4 +6,7 @@ 0.3.0-alpha [2024-10-07] [+] Exclude all entities from admin panel. -[+} Include entity properties if NetForgeProperty attribute is set. \ No newline at end of file +[+} Include entity properties if NetForgeProperty attribute is set. + +0.3.1-alpha [2024-10-08] +[*] Replaced MudAlert with Snackbar control on edit entity page \ No newline at end of file diff --git a/VERSION.txt b/VERSION.txt index 0852d432..4e8ade61 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.3.0-alpha \ No newline at end of file +0.3.1-alpha \ No newline at end of file