From ca73457e765bdcf4d42ddb75985cfe08699070ff Mon Sep 17 00:00:00 2001 From: abarz722 Date: Tue, 19 Mar 2024 15:31:47 +0100 Subject: [PATCH] display interfaces --- .../files/sql/idempotent/fworch-texts.sql | 2 + .../Pages/NetworkModelling/EditConn.razor | 21 ++++++++-- .../NetworkModelling/EditConnLeftSide.razor | 7 +++- .../NetworkModelling/EditConnPopup.razor | 39 +++++++++++++++++++ .../Services/ModellingConnectionHandler.cs | 11 ++++++ .../FWO.UI/Services/ModellingHandlerBase.cs | 20 ++++++++++ 6 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnPopup.razor diff --git a/roles/database/files/sql/idempotent/fworch-texts.sql b/roles/database/files/sql/idempotent/fworch-texts.sql index 0cf4363fd..1f42083af 100644 --- a/roles/database/files/sql/idempotent/fworch-texts.sql +++ b/roles/database/files/sql/idempotent/fworch-texts.sql @@ -1092,6 +1092,8 @@ INSERT INTO txt VALUES ('provided_interfaces', 'German', 'Bereitgestellte Schni INSERT INTO txt VALUES ('provided_interfaces', 'English', 'Provided Interfaces'); INSERT INTO txt VALUES ('remove_interface', 'German', 'Schnittstelle entfernen'); INSERT INTO txt VALUES ('remove_interface', 'English', 'Remove Interface'); +INSERT INTO txt VALUES ('display_interface', 'German', 'Schnittstelle darstellen'); +INSERT INTO txt VALUES ('display_interface', 'English', 'Display Interface'); INSERT INTO txt VALUES ('use', 'German', 'Benutzen'); INSERT INTO txt VALUES ('use', 'English', 'Use'); INSERT INTO txt VALUES ('services_group', 'German', 'Dienstgruppe'); diff --git a/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConn.razor b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConn.razor index fb9734ea2..16caa417f 100644 --- a/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConn.razor +++ b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConn.razor @@ -12,9 +12,18 @@ }

@(ConnHandler.ActConn.IsInterface ? userConfig.GetText("interface") : (ConnHandler.ActConn.IsCommonService ? userConfig.GetText("common_service") : userConfig.GetText("connection")))

- @if(ConnHandler.ActConn.UsedInterfaceId != null) + @if(ConnHandler.ActConn.UsedInterfaceId != null && !PopupMode) { - +
+
+ +
@ConnHandler.InterfaceName
+ +
+
}
@@ -235,7 +244,9 @@ }
- @if(ConnHandler.ReadOnly) + @if(PopupMode) + {} + else if(ConnHandler.ReadOnly) { } @@ -260,6 +271,7 @@ + } @code @@ -282,6 +294,9 @@ [Parameter] public Func ClosingAction { get; set; } = DefaultInit.DoNothingSync; + [Parameter] + public bool PopupMode { get; set; } = false; + private ModellingDnDContainer Container { get; set; } = new(); private int sidebarInitWidth = GlobalConst.kSidebarLeftWidth + 300; diff --git a/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnLeftSide.razor b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnLeftSide.razor index 29bdf499e..8240e5062 100644 --- a/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnLeftSide.razor +++ b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnLeftSide.razor @@ -70,7 +70,6 @@ @(ConnHandler.DisplayButton("remove", Icons.Delete)) } } - }


@@ -166,6 +165,10 @@ {ConnHandler.RequestRemovePreselectedInterface(selectedInterfaces[0]); selectedInterfaces = new(); ConnHandlerChanged.InvokeAsync(ConnHandler);}"> @(ConnHandler.DisplayButton("remove", Icons.Delete)) + }

@@ -189,6 +192,8 @@ Application="ConnHandler.Application" Refresh="ConnHandler.RefreshSelectedNwObjects"/> + + @code { diff --git a/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnPopup.razor b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnPopup.razor new file mode 100644 index 000000000..f31e43fb3 --- /dev/null +++ b/roles/ui/files/FWO.UI/Pages/NetworkModelling/EditConnPopup.razor @@ -0,0 +1,39 @@ +@using FWO.Config.Api + +@inject ApiConnection apiConnection +@inject UserConfig userConfig + + + + + @if (Display) + { + + } + +
+ +
+
+ + +@code +{ + [CascadingParameter] + Action DisplayMessageInUi { get; set; } = DefaultInit.DoNothing; + + [Parameter] + public bool Display { get; set; } = false; + + [Parameter] + public EventCallback DisplayChanged { get; set; } + + [Parameter] + public ModellingConnectionHandler ConnHandler { get; set; } + + private void Close() + { + Display = false; + DisplayChanged.InvokeAsync(Display); + } +} diff --git a/roles/ui/files/FWO.UI/Services/ModellingConnectionHandler.cs b/roles/ui/files/FWO.UI/Services/ModellingConnectionHandler.cs index 97e8de48c..bd8a9e390 100644 --- a/roles/ui/files/FWO.UI/Services/ModellingConnectionHandler.cs +++ b/roles/ui/files/FWO.UI/Services/ModellingConnectionHandler.cs @@ -31,6 +31,8 @@ public class ModellingConnectionHandler : ModellingHandlerBase public bool SearchNWObjectMode = false; public bool RemoveNwObjectMode = false; public bool RemovePreselectedInterfaceMode = false; + public bool DisplaySelectedInterfaceMode = false; + public ModellingConnectionHandler? IntConnHandler; public List SrcAppServerToAdd { get; set; } = new(); public List SrcAppServerToDelete { get; set; } = new(); @@ -271,6 +273,14 @@ public async Task RemovePreselectedInterface() } } + public async Task DisplaySelectedInterface(ModellingConnection interf) + { + FwoOwner? app = allApps.FirstOrDefault(x => x.Id == interf.AppId); + IntConnHandler = new ModellingConnectionHandler(apiConnection, userConfig, app ?? new(), Connections, interf, false, true, DisplayMessageInUi, false); + await IntConnHandler.Init(); + DisplaySelectedInterfaceMode = true; + } + public void AppServerToSource(List srcAppServers) { if(!SrcDropForbidden()) @@ -1095,6 +1105,7 @@ public void Close() SearchNWObjectMode = false; RemoveNwObjectMode = false; RemovePreselectedInterfaceMode = false; + DisplaySelectedInterfaceMode = false; AddAppRoleMode = false; EditAppRoleMode = false; DeleteAppRoleMode = false; diff --git a/roles/ui/files/FWO.UI/Services/ModellingHandlerBase.cs b/roles/ui/files/FWO.UI/Services/ModellingHandlerBase.cs index 0f7850f61..f1eafe883 100644 --- a/roles/ui/files/FWO.UI/Services/ModellingHandlerBase.cs +++ b/roles/ui/files/FWO.UI/Services/ModellingHandlerBase.cs @@ -179,6 +179,26 @@ public async Task ExtractUsedInterface(ModellingConnection conn) return interfaceName; } + public async Task GetUsedInterface(ModellingConnection conn) + { + try + { + if(conn.UsedInterfaceId != null) + { + List interf = await apiConnection.SendQueryAsync>(ModellingQueries.getInterfaceById, new {intId = conn.UsedInterfaceId}); + if(interf.Count > 0) + { + return interf[0]; + } + } + } + catch (Exception exception) + { + DisplayMessageInUi(exception, userConfig.GetText("fetch_data"), "", true); + } + return null; + } + protected async Task CheckAppServerInUse(ModellingAppServer appServer) { try