From 8313f4a0cc773869163937152ee00f2fe8271b02 Mon Sep 17 00:00:00 2001 From: "luca.weidmann@gmx.de" Date: Sun, 15 Sep 2024 11:39:57 +0200 Subject: [PATCH 01/13] [+] Added working Page Size Control for monitoring main --- roles/FWO.sln | 10 +- .../files/sql/idempotent/fworch-texts.sql | 4 + .../CustomComponents/PageSizeComponent.razor | 18 +++ .../FWO.UI/Pages/Monitoring/MonitorAll.razor | 3 +- .../Pages/Monitoring/MonitoringMain.razor | 106 ++++++++++-------- 5 files changed, 84 insertions(+), 57 deletions(-) create mode 100644 roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor diff --git a/roles/FWO.sln b/roles/FWO.sln index 64c522a80..d15e759a1 100644 --- a/roles/FWO.sln +++ b/roles/FWO.sln @@ -35,11 +35,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Recert", "lib\files\FWO EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{B48F8BD5-1056-4670-BEFA-F4A260293B6F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.Encryption", "lib\files\FWO.Encryption\FWO.Encryption.csproj", "{6EBEBF57-3399-4008-BA10-0D21F6827244}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Encryption", "lib\files\FWO.Encryption\FWO.Encryption.csproj", "{6EBEBF57-3399-4008-BA10-0D21F6827244}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.GlobalConstants", "lib\files\FWO.GlobalConstants\FWO.GlobalConstants.csproj", "{0CBD4CC5-3E39-4134-A0E1-4DB8999619F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.GlobalConstants", "lib\files\FWO.GlobalConstants\FWO.GlobalConstants.csproj", "{0CBD4CC5-3E39-4134-A0E1-4DB8999619F3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.Tufin.SecureChange", "lib\files\FWO.Tufin.SecureChange\FWO.Tufin.SecureChange.csproj", "{17AA0E0C-BB46-42FE-A08C-68539EA7FD53}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Tufin.SecureChange", "lib\files\FWO.Tufin.SecureChange\FWO.Tufin.SecureChange.csproj", "{17AA0E0C-BB46-42FE-A08C-68539EA7FD53}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -103,10 +103,6 @@ Global {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Debug|Any CPU.Build.0 = Debug|Any CPU {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Release|Any CPU.ActiveCfg = Release|Any CPU {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Release|Any CPU.Build.0 = Release|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Release|Any CPU.Build.0 = Release|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Debug|Any CPU.Build.0 = Debug|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/roles/database/files/sql/idempotent/fworch-texts.sql b/roles/database/files/sql/idempotent/fworch-texts.sql index 334e30475..9c950292e 100644 --- a/roles/database/files/sql/idempotent/fworch-texts.sql +++ b/roles/database/files/sql/idempotent/fworch-texts.sql @@ -6224,3 +6224,7 @@ INSERT INTO txt VALUES ('H9053', 'English', 'The assigned modeller can reject th INSERT INTO txt VALUES ('H9054', 'German', 'Nachricht die auf der Anmeldeseite angezeigt werden soll.'); INSERT INTO txt VALUES ('H9054', 'English', 'Message that is displayed on Login Page.'); +INSERT INTO txt VALUES ('PagerPagesize', 'German', 'Seitengröße'); +INSERT INTO txt VALUES ('PagerPagesize', 'English', 'Page size'); +INSERT INTO txt VALUES ('PagerSubmit', 'German', 'Speichern'); +INSERT INTO txt VALUES ('PagerSubmit', 'English', 'Save'); \ No newline at end of file diff --git a/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor b/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor new file mode 100644 index 000000000..d2bc3e4f4 --- /dev/null +++ b/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor @@ -0,0 +1,18 @@ +@inject UserConfig UserConfig + +
+ + + +
+ +@code { + [Parameter] public int PageSize { get; set; } + [Parameter] public EventCallback PageSizeCallback { get; set; } + + private async Task SubmitPageSize() + { + await PageSizeCallback.InvokeAsync(PageSize); + } + +} diff --git a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor index 55b1bd46b..66dfef8b8 100644 --- a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor +++ b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor @@ -11,7 +11,7 @@ @if(InitComplete) { -
+
@@ -48,6 +48,7 @@ else private List logEntrys = new List(); private bool InitComplete = false; + protected override async Task OnInitializedAsync() { try diff --git a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor index dd263f5f7..40233cc0f 100644 --- a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor +++ b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor @@ -22,32 +22,33 @@
@(userConfig.GetText("open_alerts"))
- @if(InitComplete) + @if (InitComplete) { - @if(alertEntrys.Count == 0) + @if (alertEntrys.Count == 0) { @(userConfig.GetText("no_open_alerts")) } else { -
-
+
+ +
- - - - - - + + + + + + - +
@@ -92,11 +93,11 @@ } - - - - - + + + + + @code { @@ -106,6 +107,8 @@ [CascadingParameter] Action DisplayMessageInUi { get; set; } = DefaultInit.DoNothing; + private int PageSize = 10; + private List alertEntrys = []; private List actActions = []; private List managements = []; @@ -125,18 +128,18 @@ private int deletedSampleTenants; private int deletedSampleGroups; private int deletedSampleOwners; - + protected override async Task OnInitializedAsync() { try { - if(authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) + if (authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Admin, Roles.FwAdmin]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementsDetails); await RefreshAlerts(); } - else if(authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) + else if (authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Auditor]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementDetailsWithoutSecrets); @@ -150,6 +153,11 @@ } } + private void UpdatePageSize(int pageSize) + { + PageSize = pageSize; + } + private async Task RefreshAlerts() { try @@ -166,8 +174,8 @@ { try { - var Variables = new - { + var Variables = new + { id = alert.Id, ackUser = userConfig.User.DbId, ackTime = DateTime.Now @@ -185,7 +193,7 @@ { try { - actActions = new List() { new ActionItem(alert) }; + actActions = new List() { new ActionItem(alert) }; AutoDiscoverMode = true; } catch (Exception exception) @@ -199,7 +207,7 @@ try { actMgmtId = alert.ManagementId ?? throw new Exception($"Missing ManagementId!"); - LastIncompleteImport = JsonSerializer.Deserialize((alert.JsonData ?? throw new Exception($"Missing Import Data!")).ToString() ?? throw new Exception($"Could not convert Import Data to string!")); + LastIncompleteImport = JsonSerializer.Deserialize(( alert.JsonData ?? throw new Exception($"Missing Import Data!") ).ToString() ?? throw new Exception($"Could not convert Import Data to string!")); RollbackMode = true; } catch (Exception exception) @@ -212,7 +220,7 @@ { try { - actStatus = JsonSerializer.Deserialize((alert.JsonData ?? throw new Exception($"Missing Import Data!")).ToString() ?? throw new Exception($"Could not convert Import Data to string!")) ?? throw new Exception($"Import Data not converted!"); + actStatus = JsonSerializer.Deserialize(( alert.JsonData ?? throw new Exception($"Missing Import Data!") ).ToString() ?? throw new Exception($"Could not convert Import Data to string!")) ?? throw new Exception($"Import Data not converted!"); DetailsMode = true; } catch (Exception exception) @@ -251,16 +259,16 @@ DisplayMessageInUi(exception, userConfig.GetText("remove_sample_data"), "", true); } } - + private async Task DeleteManagements() { // Todo: refresh necessary? - if(authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) + if (authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Admin, Roles.FwAdmin]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementsDetails); } - else if(authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) + else if (authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Auditor]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementDetailsWithoutSecrets); @@ -284,7 +292,7 @@ try { var Variables = new { id = management.Id }; - int delId = (await apiConnection.SendQueryAsync(DeviceQueries.deleteManagement, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(DeviceQueries.deleteManagement, Variables) ).DeletedId; if (delId == management.Id) { return true; @@ -318,7 +326,7 @@ try { var Variables = new { id = credential.Id }; - int delId = (await apiConnection.SendQueryAsync(DeviceQueries.deleteCredential, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(DeviceQueries.deleteCredential, Variables) ).DeletedId; if (delId == credential.Id) { return true; @@ -352,10 +360,10 @@ try { UserDeleteParameters parameters = new UserDeleteParameters - { - LdapId = user.LdapConnection.Id, - UserId = user.DbId - }; + { + LdapId = user.LdapConnection.Id, + UserId = user.DbId + }; RestResponse middlewareServerResponse = await middlewareClient.DeleteUser(parameters); if (middlewareServerResponse.StatusCode != HttpStatusCode.OK || middlewareServerResponse.Data == false) { @@ -393,7 +401,7 @@ { try { - TenantDeleteParameters deleteTenantParameters = new TenantDeleteParameters { Name = tenant.Name, Id = tenant.Id}; + TenantDeleteParameters deleteTenantParameters = new TenantDeleteParameters { Name = tenant.Name, Id = tenant.Id }; RestResponse middlewareServerResponse = await middlewareClient.DeleteTenant(deleteTenantParameters); if (middlewareServerResponse.StatusCode != HttpStatusCode.OK || middlewareServerResponse.Data == false) { @@ -419,7 +427,7 @@ { foreach (var ldapUserGroup in middlewareServerResponse.Data) { - string groupName = (new DistName(ldapUserGroup.GroupDn)).Group; + string groupName = ( new DistName(ldapUserGroup.GroupDn) ).Group; if (groupName.EndsWith("_demo")) { if (await DeleteGroup(groupName)) @@ -474,7 +482,7 @@ try { var Variables = new { id = owner.Id }; - int delId = (await apiConnection.SendQueryAsync(OwnerQueries.deleteOwner, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(OwnerQueries.deleteOwner, Variables) ).DeletedId; if (delId == owner.Id) { return true; @@ -490,32 +498,32 @@ private string ConstructMessage() { string text = ""; - if(deletedSampleManagements > 0) + if (deletedSampleManagements > 0) { text += $"{deletedSampleManagements} " + userConfig.GetText("managements"); } - if(deletedSampleCredentials > 0) + if (deletedSampleCredentials > 0) { text += $"{deletedSampleCredentials} " + userConfig.GetText("credentials"); } - if(deletedSampleUsers > 0) + if (deletedSampleUsers > 0) { text += $" {deletedSampleUsers} " + userConfig.GetText("users"); } - if(deletedSampleTenants > 0) + if (deletedSampleTenants > 0) { text += $" {deletedSampleTenants} " + userConfig.GetText("tenants"); } - if(deletedSampleGroups > 0) + if (deletedSampleGroups > 0) { text += $" {deletedSampleGroups} " + userConfig.GetText("groups"); } - if(deletedSampleOwners > 0) + if (deletedSampleOwners > 0) { text += $" {deletedSampleOwners} " + userConfig.GetText("owners"); } - if(text == "") + if (text == "") { text += userConfig.GetText("nothing"); } From dc0e214e8b9d145336929cfb355ba1997c10d834 Mon Sep 17 00:00:00 2001 From: "luca.weidmann@gmx.de" Date: Sun, 15 Sep 2024 11:39:57 +0200 Subject: [PATCH 02/13] [+] Added working Page Size Control for monitoring main #2527 --- roles/FWO.sln | 10 +- .../files/sql/idempotent/fworch-texts.sql | 4 + .../CustomComponents/PageSizeComponent.razor | 18 +++ .../FWO.UI/Pages/Monitoring/MonitorAll.razor | 3 +- .../Pages/Monitoring/MonitoringMain.razor | 106 ++++++++++-------- 5 files changed, 84 insertions(+), 57 deletions(-) create mode 100644 roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor diff --git a/roles/FWO.sln b/roles/FWO.sln index 64c522a80..d15e759a1 100644 --- a/roles/FWO.sln +++ b/roles/FWO.sln @@ -35,11 +35,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Recert", "lib\files\FWO EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{B48F8BD5-1056-4670-BEFA-F4A260293B6F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.Encryption", "lib\files\FWO.Encryption\FWO.Encryption.csproj", "{6EBEBF57-3399-4008-BA10-0D21F6827244}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Encryption", "lib\files\FWO.Encryption\FWO.Encryption.csproj", "{6EBEBF57-3399-4008-BA10-0D21F6827244}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.GlobalConstants", "lib\files\FWO.GlobalConstants\FWO.GlobalConstants.csproj", "{0CBD4CC5-3E39-4134-A0E1-4DB8999619F3}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.GlobalConstants", "lib\files\FWO.GlobalConstants\FWO.GlobalConstants.csproj", "{0CBD4CC5-3E39-4134-A0E1-4DB8999619F3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FWO.Tufin.SecureChange", "lib\files\FWO.Tufin.SecureChange\FWO.Tufin.SecureChange.csproj", "{17AA0E0C-BB46-42FE-A08C-68539EA7FD53}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FWO.Tufin.SecureChange", "lib\files\FWO.Tufin.SecureChange\FWO.Tufin.SecureChange.csproj", "{17AA0E0C-BB46-42FE-A08C-68539EA7FD53}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -103,10 +103,6 @@ Global {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Debug|Any CPU.Build.0 = Debug|Any CPU {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Release|Any CPU.ActiveCfg = Release|Any CPU {520779B1-20EB-45D9-8A02-D0C4DFEC9302}.Release|Any CPU.Build.0 = Release|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Debug|Any CPU.Build.0 = Debug|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Release|Any CPU.ActiveCfg = Release|Any CPU - {14B56819-F629-4CE9-BBC0-7579392EFC83}.Release|Any CPU.Build.0 = Release|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Debug|Any CPU.Build.0 = Debug|Any CPU {6EBEBF57-3399-4008-BA10-0D21F6827244}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/roles/database/files/sql/idempotent/fworch-texts.sql b/roles/database/files/sql/idempotent/fworch-texts.sql index 334e30475..9c950292e 100644 --- a/roles/database/files/sql/idempotent/fworch-texts.sql +++ b/roles/database/files/sql/idempotent/fworch-texts.sql @@ -6224,3 +6224,7 @@ INSERT INTO txt VALUES ('H9053', 'English', 'The assigned modeller can reject th INSERT INTO txt VALUES ('H9054', 'German', 'Nachricht die auf der Anmeldeseite angezeigt werden soll.'); INSERT INTO txt VALUES ('H9054', 'English', 'Message that is displayed on Login Page.'); +INSERT INTO txt VALUES ('PagerPagesize', 'German', 'Seitengröße'); +INSERT INTO txt VALUES ('PagerPagesize', 'English', 'Page size'); +INSERT INTO txt VALUES ('PagerSubmit', 'German', 'Speichern'); +INSERT INTO txt VALUES ('PagerSubmit', 'English', 'Save'); \ No newline at end of file diff --git a/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor b/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor new file mode 100644 index 000000000..d2bc3e4f4 --- /dev/null +++ b/roles/ui/files/FWO.UI/CustomComponents/PageSizeComponent.razor @@ -0,0 +1,18 @@ +@inject UserConfig UserConfig + +
+ + + +
+ +@code { + [Parameter] public int PageSize { get; set; } + [Parameter] public EventCallback PageSizeCallback { get; set; } + + private async Task SubmitPageSize() + { + await PageSizeCallback.InvokeAsync(PageSize); + } + +} diff --git a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor index 55b1bd46b..66dfef8b8 100644 --- a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor +++ b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitorAll.razor @@ -11,7 +11,7 @@ @if(InitComplete) { -
+
@@ -48,6 +48,7 @@ else private List logEntrys = new List(); private bool InitComplete = false; + protected override async Task OnInitializedAsync() { try diff --git a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor index dd263f5f7..40233cc0f 100644 --- a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor +++ b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor @@ -22,32 +22,33 @@
@(userConfig.GetText("open_alerts"))
- @if(InitComplete) + @if (InitComplete) { - @if(alertEntrys.Count == 0) + @if (alertEntrys.Count == 0) { @(userConfig.GetText("no_open_alerts")) } else { -
-
+
+ +
- - - - - - + + + + + + - +
@@ -92,11 +93,11 @@ } - - - - - + + + + + @code { @@ -106,6 +107,8 @@ [CascadingParameter] Action DisplayMessageInUi { get; set; } = DefaultInit.DoNothing; + private int PageSize = 10; + private List alertEntrys = []; private List actActions = []; private List managements = []; @@ -125,18 +128,18 @@ private int deletedSampleTenants; private int deletedSampleGroups; private int deletedSampleOwners; - + protected override async Task OnInitializedAsync() { try { - if(authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) + if (authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Admin, Roles.FwAdmin]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementsDetails); await RefreshAlerts(); } - else if(authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) + else if (authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Auditor]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementDetailsWithoutSecrets); @@ -150,6 +153,11 @@ } } + private void UpdatePageSize(int pageSize) + { + PageSize = pageSize; + } + private async Task RefreshAlerts() { try @@ -166,8 +174,8 @@ { try { - var Variables = new - { + var Variables = new + { id = alert.Id, ackUser = userConfig.User.DbId, ackTime = DateTime.Now @@ -185,7 +193,7 @@ { try { - actActions = new List() { new ActionItem(alert) }; + actActions = new List() { new ActionItem(alert) }; AutoDiscoverMode = true; } catch (Exception exception) @@ -199,7 +207,7 @@ try { actMgmtId = alert.ManagementId ?? throw new Exception($"Missing ManagementId!"); - LastIncompleteImport = JsonSerializer.Deserialize((alert.JsonData ?? throw new Exception($"Missing Import Data!")).ToString() ?? throw new Exception($"Could not convert Import Data to string!")); + LastIncompleteImport = JsonSerializer.Deserialize(( alert.JsonData ?? throw new Exception($"Missing Import Data!") ).ToString() ?? throw new Exception($"Could not convert Import Data to string!")); RollbackMode = true; } catch (Exception exception) @@ -212,7 +220,7 @@ { try { - actStatus = JsonSerializer.Deserialize((alert.JsonData ?? throw new Exception($"Missing Import Data!")).ToString() ?? throw new Exception($"Could not convert Import Data to string!")) ?? throw new Exception($"Import Data not converted!"); + actStatus = JsonSerializer.Deserialize(( alert.JsonData ?? throw new Exception($"Missing Import Data!") ).ToString() ?? throw new Exception($"Could not convert Import Data to string!")) ?? throw new Exception($"Import Data not converted!"); DetailsMode = true; } catch (Exception exception) @@ -251,16 +259,16 @@ DisplayMessageInUi(exception, userConfig.GetText("remove_sample_data"), "", true); } } - + private async Task DeleteManagements() { // Todo: refresh necessary? - if(authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) + if (authenticationStateTask!.Result.User.IsInRole(Roles.Admin) || authenticationStateTask!.Result.User.IsInRole(Roles.FwAdmin)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Admin, Roles.FwAdmin]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementsDetails); } - else if(authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) + else if (authenticationStateTask!.Result.User.IsInRole(Roles.Auditor)) { apiConnection.SetProperRole(authenticationStateTask!.Result.User, [Roles.Auditor]); managements = await apiConnection.SendQueryAsync>(DeviceQueries.getManagementDetailsWithoutSecrets); @@ -284,7 +292,7 @@ try { var Variables = new { id = management.Id }; - int delId = (await apiConnection.SendQueryAsync(DeviceQueries.deleteManagement, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(DeviceQueries.deleteManagement, Variables) ).DeletedId; if (delId == management.Id) { return true; @@ -318,7 +326,7 @@ try { var Variables = new { id = credential.Id }; - int delId = (await apiConnection.SendQueryAsync(DeviceQueries.deleteCredential, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(DeviceQueries.deleteCredential, Variables) ).DeletedId; if (delId == credential.Id) { return true; @@ -352,10 +360,10 @@ try { UserDeleteParameters parameters = new UserDeleteParameters - { - LdapId = user.LdapConnection.Id, - UserId = user.DbId - }; + { + LdapId = user.LdapConnection.Id, + UserId = user.DbId + }; RestResponse middlewareServerResponse = await middlewareClient.DeleteUser(parameters); if (middlewareServerResponse.StatusCode != HttpStatusCode.OK || middlewareServerResponse.Data == false) { @@ -393,7 +401,7 @@ { try { - TenantDeleteParameters deleteTenantParameters = new TenantDeleteParameters { Name = tenant.Name, Id = tenant.Id}; + TenantDeleteParameters deleteTenantParameters = new TenantDeleteParameters { Name = tenant.Name, Id = tenant.Id }; RestResponse middlewareServerResponse = await middlewareClient.DeleteTenant(deleteTenantParameters); if (middlewareServerResponse.StatusCode != HttpStatusCode.OK || middlewareServerResponse.Data == false) { @@ -419,7 +427,7 @@ { foreach (var ldapUserGroup in middlewareServerResponse.Data) { - string groupName = (new DistName(ldapUserGroup.GroupDn)).Group; + string groupName = ( new DistName(ldapUserGroup.GroupDn) ).Group; if (groupName.EndsWith("_demo")) { if (await DeleteGroup(groupName)) @@ -474,7 +482,7 @@ try { var Variables = new { id = owner.Id }; - int delId = (await apiConnection.SendQueryAsync(OwnerQueries.deleteOwner, Variables)).DeletedId; + int delId = ( await apiConnection.SendQueryAsync(OwnerQueries.deleteOwner, Variables) ).DeletedId; if (delId == owner.Id) { return true; @@ -490,32 +498,32 @@ private string ConstructMessage() { string text = ""; - if(deletedSampleManagements > 0) + if (deletedSampleManagements > 0) { text += $"{deletedSampleManagements} " + userConfig.GetText("managements"); } - if(deletedSampleCredentials > 0) + if (deletedSampleCredentials > 0) { text += $"{deletedSampleCredentials} " + userConfig.GetText("credentials"); } - if(deletedSampleUsers > 0) + if (deletedSampleUsers > 0) { text += $" {deletedSampleUsers} " + userConfig.GetText("users"); } - if(deletedSampleTenants > 0) + if (deletedSampleTenants > 0) { text += $" {deletedSampleTenants} " + userConfig.GetText("tenants"); } - if(deletedSampleGroups > 0) + if (deletedSampleGroups > 0) { text += $" {deletedSampleGroups} " + userConfig.GetText("groups"); } - if(deletedSampleOwners > 0) + if (deletedSampleOwners > 0) { text += $" {deletedSampleOwners} " + userConfig.GetText("owners"); } - if(text == "") + if (text == "") { text += userConfig.GetText("nothing"); } From 5664e503965ae805660b9cf655e941cb60c610ea Mon Sep 17 00:00:00 2001 From: "luca.weidmann@gmx.de" Date: Sun, 15 Sep 2024 12:38:46 +0200 Subject: [PATCH 03/13] [~] Moved PageSizeComponent to shared #2527 --- roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor | 3 ++- .../{CustomComponents => Shared}/PageSizeComponent.razor | 0 2 files changed, 2 insertions(+), 1 deletion(-) rename roles/ui/files/FWO.UI/{CustomComponents => Shared}/PageSizeComponent.razor (100%) diff --git a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor index 40233cc0f..516e922f7 100644 --- a/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor +++ b/roles/ui/files/FWO.UI/Pages/Monitoring/MonitoringMain.razor @@ -7,6 +7,7 @@ @using FWO.Middleware.Client @using FWO.Middleware.RequestParameters @using RestSharp +@using FWO.Ui.Shared; @page "/monitoring" @page "/monitoring/main" @@ -31,7 +32,7 @@ else {
- +