Skip to content

Commit 3c6dea7

Browse files
Merge branch 'CactuseSecurity#2609--App-modelling--answering-interface-forgets-former-edits' of https://github.com/CactuseSecurity/firewall-orchestrator into CactuseSecurity#2692--Modelling---short-duplication-of-objects-when-saving
2 parents 4b0bba4 + 9143d7b commit 3c6dea7

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

roles/lib/files/FWO.Services/ModellingConnectionHandler.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class ModellingConnectionHandler : ModellingHandlerBase
8383
public ModellingAppRole DummyAppRole = new();
8484
public int LastWidth = GlobalConst.kGlobLibraryWidth;
8585
public bool LastCollapsed = false;
86+
public bool ActConnNeedsRefresh = true;
8687

8788
private bool SrcFix = false;
8889
private bool DstFix = false;
@@ -156,7 +157,12 @@ public async Task ReInit()
156157
{
157158
try
158159
{
159-
await RefreshActConn();
160+
// exclude the cases where ActConn has to be held (e.g. if there is an ui binding)
161+
if(ActConnNeedsRefresh)
162+
{
163+
await RefreshActConn();
164+
}
165+
160166
await RefreshObjects();
161167
await RefreshParent();
162168
}

roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnLeftSide.razor

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,13 @@
206206
}
207207
</div>
208208
</Sidebar>
209-
<EditAppRole @bind-Display="ConnHandler.EditAppRoleMode" @bind-AppRoleHandler="ConnHandler.AppRoleHandler" RefreshParent="async () => await WrapAsync(ConnHandler.ReInit)"/>
209+
<EditAppRole @bind-Display="ConnHandler.EditAppRoleMode" @bind-AppRoleHandler="ConnHandler.AppRoleHandler" RefreshParent="RefreshParentWithoutRefreshingActConn"/>
210210
<ConfirmDelete @bind-Display="ConnHandler.DeleteAppRoleMode" PerformAction="async () => await WrapAsync(ConnHandler.DeleteAppRole)"
211211
Title="@userConfig.GetText("delete_app_role")" DeleteMessage="@ConnHandler.Message" AllowedRoles="@Roles.Modeller" DeleteAllowed="ConnHandler.DeleteAllowed" Enabled="ConnHandler.IsOwner"/>
212212
<EditServiceGroup @bind-Display="ConnHandler.EditSvcGrpMode" @bind-SvcGroupHandler="ConnHandler.SvcGrpHandler"/>
213213
<ConfirmDelete @bind-Display="ConnHandler.DeleteSvcGrpMode" PerformAction="async () => await WrapAsync(ConnHandler.DeleteServiceGroup)"
214214
Title="@userConfig.GetText("delete_service_group")" DeleteMessage="@ConnHandler.Message" AllowedRoles="@Roles.Modeller" DeleteAllowed="ConnHandler.DeleteAllowed" Enabled="ConnHandler.IsOwner"/>
215-
<EditService @bind-Display="ConnHandler.EditServiceMode" ServiceHandler="ConnHandler.ServiceHandler" RefreshParent="async () => await WrapAsync(ConnHandler.ReInit)"/>
215+
<EditService @bind-Display="ConnHandler.EditServiceMode" ServiceHandler="ConnHandler.ServiceHandler" RefreshParent="RefreshParentWithoutRefreshingActConn"/>
216216
<ConfirmDelete @bind-Display="ConnHandler.DeleteServiceMode" PerformAction="async () => await WrapAsync(ConnHandler.DeleteService)"
217217
Title="@userConfig.GetText("delete_service")" DeleteMessage="@ConnHandler.Message" AllowedRoles="@Roles.Modeller" DeleteAllowed="ConnHandler.DeleteAllowed" Enabled="ConnHandler.IsOwner"/>
218218
<SearchInterface @bind-Display="SearchInterfaceMode" @bind-PreselectedInterfaces="ConnHandler.PreselectedInterfaces" Application="ConnHandler.Application"/>
@@ -648,6 +648,16 @@
648648
await ConnHandlerChanged.InvokeAsync(ConnHandler);
649649
}
650650

651+
/// <summary>
652+
/// Executes ReInit without dropping ActConn
653+
/// </summary>
654+
private async Task RefreshParentWithoutRefreshingActConn()
655+
{
656+
ConnHandler.ActConnNeedsRefresh = false;
657+
await WrapAsync(ConnHandler.ReInit);
658+
ConnHandler.ActConnNeedsRefresh = true;
659+
}
660+
651661
private string ColWidthClass()
652662
{
653663
return OverviewMode ? "col-sm-12" : "col-sm-10";

0 commit comments

Comments
 (0)