From 350779f573c0490d333341fdcac2058d107f8e51 Mon Sep 17 00:00:00 2001 From: Etienne Rossignon Date: Fri, 18 Aug 2023 22:42:34 +0200 Subject: [PATCH] OpcUaEndpoint2 adjust UI --- .vscode/settings.json | 3 ++- .../OpcUa-Endpoint2/OpcUa-Endpoint2.html/editor.html | 6 +++--- .../nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/index.ts | 8 ++++++-- source/nodes/tools/connection_tools.ts | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index baaa261..07d49d6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ - "oneditprepare" + "oneditprepare", + "oneditsave" ] } \ No newline at end of file diff --git a/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/editor.html b/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/editor.html index 19db4a0..9d11c17 100644 --- a/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/editor.html +++ b/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/editor.html @@ -5,7 +5,7 @@
- +
@@ -57,8 +57,8 @@
- - + +
diff --git a/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/index.ts b/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/index.ts index dd100e4..135b425 100644 --- a/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/index.ts +++ b/source/nodes/OpcUa-Endpoint2/OpcUa-Endpoint2.html/index.ts @@ -23,6 +23,9 @@ function isValidOPC_UA_URI(str: string) { RED.nodes.registerType("OpcUa-Endpoint2", { category: "config", defaults: { + + name: { value: "" }, + endpoint: { value: "", required: true, @@ -71,6 +74,7 @@ RED.nodes.registerType("OpcUa-Endpoint2", { _securityMode.text("None"); } }, + oneditprepare() { const node = this; // ----------------------------------------------------------------------- @@ -110,7 +114,7 @@ RED.nodes.registerType("OpcUa-Endpoint2", { const updateIdentityControls = function (userIdentityType: string) { switch (userIdentityType) { case "Anonymous": - $("#node-input-user").val(""); + $("#node-input-userName").val(""); $("#node-input-password").val(""); authRow.hide(); certRow.hide(); @@ -120,7 +124,7 @@ RED.nodes.registerType("OpcUa-Endpoint2", { certRow.hide(); break; case "Certificate": - $("#node-input-user").val(""); + $("#node-input-userName").val(""); $("#node-input-password").val(""); certRow.show(); authRow.hide(); diff --git a/source/nodes/tools/connection_tools.ts b/source/nodes/tools/connection_tools.ts index 6b2c677..07fe9e9 100644 --- a/source/nodes/tools/connection_tools.ts +++ b/source/nodes/tools/connection_tools.ts @@ -94,7 +94,8 @@ export async function get_opcua_endpoint(endpointNode: OpcUaEndpoint2Node, reque pendingConnection.set(endpointId, []); const securityMode = MessageSecurityMode[(endpointNode.securityMode as any) || "None"] || MessageSecurityMode.None; - const securityPolicy = coerceSecurityPolicy(endpointNode.securityPolicy); + const securityPolicy = + securityMode === MessageSecurityMode.None ? SecurityPolicy.None : coerceSecurityPolicy(endpointNode.securityPolicy); nodeToNotify.warn("securityMode = " + securityMode); nodeToNotify.warn("securityPolicy = " + securityPolicy);