You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/04/26 21:07:32 UTC
(streampipes) branch dev updated: feat: Improve OPC-UA adapter tree and error handling (#4417)
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 3a0212bcf4 feat: Improve OPC-UA adapter tree and error handling (#4417)
3a0212bcf4 is described below
commit 3a0212bcf405a51897ca2c33aa790eab82027b01
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Apr 26 23:07:28 2026 +0200
feat: Improve OPC-UA adapter tree and error handling (#4417)
---
.../connectors/opcua/adapter/OpcUaAdapter.java | 30 ++-
.../connectors/opcua/adapter/OpcUaNodeBrowser.java | 44 +++--
.../opcua/adapter/OpcUaNodeMetadataExtractor.java | 148 +++++++++++++-
.../AdapterStateChangeOperationHandler.java | 3 +-
.../opcua/opcAdapterConfiguration.smoke.spec.ts | 2 +-
...ic-runtime-resolvable-tree-input.component.html | 157 +++++++++++----
...ic-runtime-resolvable-tree-input.component.scss | 215 ++++++++++++++++++++-
...atic-runtime-resolvable-tree-input.component.ts | 160 ++++++++++++++-
.../static-tree-input-browse-nodes.component.html | 50 ++---
.../static-tree-input-browse-nodes.component.scss | 29 ++-
.../static-tree-input-browse-nodes.component.ts | 7 +-
.../static-tree-input-button-menu.component.html | 46 +++--
.../static-tree-input-button-menu.component.ts | 17 +-
.../static-tree-input-node-details.component.html | 40 +++-
.../static-tree-input-node-details.component.scss} | 17 +-
.../static-tree-input-node-details.component.ts | 20 +-
...static-tree-input-selected-nodes.component.html | 63 ++++--
...static-tree-input-selected-nodes.component.scss | 37 +++-
.../static-tree-input-selected-nodes.component.ts | 8 +
19 files changed, 936 insertions(+), 157 deletions(-)
diff --git a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
index 20218feeed..e08df19a47 100644
--- a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
+++ b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
@@ -139,16 +139,38 @@ public class OpcUaAdapter implements StreamPipesAdapter, IPullAdapter, SupportsR
this.allNodes.forEach(node -> this.nodeIdToLabelMapping
.put(node.nodeInfo().getNodeId().toString(), node.nodeInfo().getDisplayName()));
-
} catch (Exception e) {
- LOG.debug(
- "The connection to the OPC UA server {} could not be established for selected nodes {}",
+ var errorMessage = buildStartupErrorMessage(e);
+ LOG.error(
+ "OPC UA adapter startup failed for server {} and selected nodes {}: {}",
opcUaAdapterConfig.getOpcServerURL(),
opcUaAdapterConfig.getSelectedNodeNames(),
+ errorMessage,
e
);
- throw new AdapterException("The Connection to the OPC UA server could not be established.", e);
+ throw new AdapterException(errorMessage, e);
+ }
+ }
+
+ private String buildStartupErrorMessage(Exception exception) {
+ var rootCause = getRootCause(exception);
+ var rootMessage = rootCause.getMessage();
+
+ if (rootMessage == null || rootMessage.isBlank()) {
+ rootMessage = rootCause.getClass().getSimpleName();
}
+
+ return "Could not start OPC UA adapter: " + rootMessage;
+ }
+
+ private Throwable getRootCause(Throwable throwable) {
+ var current = throwable;
+
+ while (current.getCause() != null && current.getCause() != current) {
+ current = current.getCause();
+ }
+
+ return current;
}
@Override
diff --git a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeBrowser.java b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeBrowser.java
index 38dcacf530..9dfff5a345 100644
--- a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeBrowser.java
+++ b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeBrowser.java
@@ -34,13 +34,17 @@ import org.eclipse.milo.opcua.stack.core.UaException;
import org.eclipse.milo.opcua.stack.core.UaRuntimeException;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
import org.eclipse.milo.opcua.stack.core.types.builtin.StatusCode;
+import org.eclipse.milo.opcua.stack.core.types.enumerated.BrowseDirection;
import org.eclipse.milo.opcua.stack.core.types.enumerated.NodeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
@@ -124,21 +128,37 @@ public class OpcUaNodeBrowser {
OpcUaClient client,
NodeId nodeId
) throws UaException {
+
+ var options = AddressSpace.BrowseOptions.builder()
+ .setBrowseDirection(BrowseDirection.Forward)
+ .setReferenceType(Identifiers.HierarchicalReferences)
+ .setIncludeSubtypes(true)
+ .setNodeClassMask(Set.of(NodeClass.Object, NodeClass.Variable))
+ .build();
+
return client
.getAddressSpace()
- .browseNodes(nodeId)
+ .browseNodes(nodeId, options)
+ .stream()
+ .collect(Collectors.toMap(
+ node -> node.getNodeId().toParseableString(),
+ node -> {
+ TreeInputNode childNode = new TreeInputNode();
+ childNode.setNodeName(node.getDisplayName()
+ .getText());
+ childNode.setInternalNodeName(node.getNodeId()
+ .toParseableString());
+ childNode.setDataNode(isDataNode(node));
+ childNode.setNodeMetadata(new OpcUaNodeMetadataExtractor(client, node).extract());
+ return childNode;
+ },
+ (existing, duplicate) -> existing,
+ LinkedHashMap::new
+ ))
+ .values()
.stream()
- .map(node -> {
- TreeInputNode childNode = new TreeInputNode();
- childNode.setNodeName(node.getDisplayName()
- .getText());
- childNode.setInternalNodeName(node.getNodeId()
- .toParseableString());
- childNode.setDataNode(isDataNode(node));
- childNode.setNodeMetadata(new OpcUaNodeMetadataExtractor(client, node).extract());
- return childNode;
- })
- .collect(Collectors.toList());
+ .sorted(Comparator.comparing(TreeInputNode::getNodeName, String.CASE_INSENSITIVE_ORDER))
+ .toList();
}
diff --git a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeMetadataExtractor.java b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeMetadataExtractor.java
index 82cc8c57e4..2fdc6e9260 100644
--- a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeMetadataExtractor.java
+++ b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaNodeMetadataExtractor.java
@@ -20,15 +20,19 @@ package org.apache.streampipes.extensions.connectors.opcua.adapter;
import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.sdk.client.nodes.UaNode;
+import org.eclipse.milo.opcua.sdk.client.nodes.UaObjectNode;
import org.eclipse.milo.opcua.sdk.client.nodes.UaVariableNode;
import org.eclipse.milo.opcua.stack.core.StatusCodes;
import org.eclipse.milo.opcua.stack.core.UaException;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
import org.eclipse.milo.opcua.stack.core.types.builtin.DateTime;
import org.eclipse.milo.opcua.stack.core.types.builtin.NodeId;
+import org.eclipse.milo.opcua.stack.core.types.builtin.unsigned.UByte;
import org.eclipse.milo.opcua.stack.core.types.enumerated.TimestampsToReturn;
-import java.util.HashMap;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
public class OpcUaNodeMetadataExtractor {
@@ -40,15 +44,17 @@ public class OpcUaNodeMetadataExtractor {
public OpcUaNodeMetadataExtractor(OpcUaClient client, UaNode node) {
this.client = client;
this.node = node;
- this.metadata = new HashMap<>();
+ this.metadata = new LinkedHashMap<>();
}
public Map<String, Object> extract() {
+ extractNodeId(node);
extractNamespaceIndex();
extractNodeClass();
extractDescription();
extractBrowseName();
extractDisplayName();
+ extractTypeDefinition();
if (node instanceof UaVariableNode) {
extractValue();
@@ -57,12 +63,17 @@ public class OpcUaNodeMetadataExtractor {
var dataTypeNode = client.getAddressSpace().getNode(dataTypeNodeId);
var value = client.readValue(0, TimestampsToReturn.Both, node.getNodeId());
- extractNodeId((UaVariableNode) node);
extractSourceTime(value);
extractServerTime(value);
extractStatusCode(value);
extractDataType(dataTypeNode);
extractDataTypeNodeId(dataTypeNodeId);
+ extractValueRank((UaVariableNode) node);
+ extractArrayDimensions((UaVariableNode) node);
+ extractAccessLevel((UaVariableNode) node);
+ extractUserAccessLevel((UaVariableNode) node);
+ extractMinimumSamplingInterval((UaVariableNode) node);
+ extractHistorizing((UaVariableNode) node);
} catch (UaException e) {
throw new RuntimeException(e);
}
@@ -71,7 +82,7 @@ public class OpcUaNodeMetadataExtractor {
return metadata;
}
- public void extractNodeId(UaVariableNode node) {
+ public void extractNodeId(UaNode node) {
if (node != null && node.getNodeId() != null) {
add("Node ID", node.getNodeId().toParseableString());
} else {
@@ -140,6 +151,54 @@ public class OpcUaNodeMetadataExtractor {
}
}
+ public void extractValueRank(UaVariableNode node) {
+ if (node == null || node.getValueRank() == null) {
+ add("ValueRank", "N/A");
+ return;
+ }
+
+ add("ValueRank", formatValueRank(node.getValueRank()));
+ }
+
+ public void extractArrayDimensions(UaVariableNode node) {
+ if (node == null || node.getArrayDimensions() == null || node.getArrayDimensions().length == 0) {
+ add("ArrayDimensions", "N/A");
+ return;
+ }
+
+ add(
+ "ArrayDimensions",
+ Arrays.stream(node.getArrayDimensions())
+ .map(String::valueOf)
+ .toList()
+ .toString()
+ );
+ }
+
+ public void extractAccessLevel(UaVariableNode node) {
+ add("AccessLevel", formatUnsignedByte(node == null ? null : node.getAccessLevel()));
+ }
+
+ public void extractUserAccessLevel(UaVariableNode node) {
+ add("UserAccessLevel", formatUnsignedByte(node == null ? null : node.getUserAccessLevel()));
+ }
+
+ public void extractMinimumSamplingInterval(UaVariableNode node) {
+ if (node == null || node.getMinimumSamplingInterval() == null) {
+ add("MinimumSamplingInterval", "N/A");
+ } else {
+ add("MinimumSamplingInterval", String.valueOf(node.getMinimumSamplingInterval()));
+ }
+ }
+
+ public void extractHistorizing(UaVariableNode node) {
+ if (node == null || node.getHistorizing() == null) {
+ add("Historizing", "N/A");
+ } else {
+ add("Historizing", String.valueOf(node.getHistorizing()));
+ }
+ }
+
public void extractSourceTime(DataValue value) {
add("SourceTime", dateTimeToString(value.getSourceTime()));
}
@@ -170,6 +229,21 @@ public class OpcUaNodeMetadataExtractor {
}
}
+ public void extractTypeDefinition() {
+ try {
+ if (node instanceof UaVariableNode uaVariableNode) {
+ var typeDefinition = uaVariableNode.getTypeDefinition();
+ addTypeDefinition(typeDefinition == null ? null : typeDefinition.getNodeId(), typeDefinition);
+ } else if (node instanceof UaObjectNode uaObjectNode) {
+ var typeDefinition = uaObjectNode.getTypeDefinition();
+ addTypeDefinition(typeDefinition == null ? null : typeDefinition.getNodeId(), typeDefinition);
+ }
+ } catch (UaException e) {
+ add("TypeDefinition", "N/A");
+ add("TypeDefinition Node ID", "N/A");
+ }
+ }
+
private String dateTimeToString(DateTime time) {
if (time != null) {
return time.getJavaDate().toString();
@@ -186,4 +260,70 @@ public class OpcUaNodeMetadataExtractor {
metadata.put(key, value);
}
+ private void addTypeDefinition(NodeId typeDefinitionId, UaNode typeDefinitionNode) {
+ if (typeDefinitionNode != null && typeDefinitionNode.getDisplayName() != null) {
+ add("TypeDefinition", typeDefinitionNode.getDisplayName().getText());
+ } else {
+ add("TypeDefinition", "N/A");
+ }
+
+ if (typeDefinitionId != null) {
+ add("TypeDefinition Node ID", typeDefinitionId.toParseableString());
+ } else {
+ add("TypeDefinition Node ID", "N/A");
+ }
+ }
+
+ private String formatUnsignedByte(UByte value) {
+ if (value == null) {
+ return "N/A";
+ }
+
+ var numericValue = value.intValue();
+ var flags = describeAccessLevelFlags(numericValue);
+
+ if (flags.isEmpty()) {
+ return numericValue + " (None)";
+ }
+
+ return String.join(", ", flags) + " (" + numericValue + ")";
+ }
+
+ private String formatValueRank(Integer valueRank) {
+ switch (valueRank) {
+ case -3:
+ return "-3 (Scalar or OneDimension)";
+ case -2:
+ return "-2 (Any)";
+ case -1:
+ return "-1 (Scalar)";
+ case 0:
+ return "0 (One or more dimensions)";
+ case 1:
+ return "1 (One dimension)";
+ default:
+ return valueRank + " (" + valueRank + " dimensions)";
+ }
+ }
+
+ private List<String> describeAccessLevelFlags(int numericValue) {
+ var flags = new java.util.ArrayList<String>();
+
+ addAccessLevelFlag(flags, numericValue, 0x01, "CurrentRead");
+ addAccessLevelFlag(flags, numericValue, 0x02, "CurrentWrite");
+ addAccessLevelFlag(flags, numericValue, 0x04, "HistoryRead");
+ addAccessLevelFlag(flags, numericValue, 0x08, "HistoryWrite");
+ addAccessLevelFlag(flags, numericValue, 0x10, "SemanticChange");
+ addAccessLevelFlag(flags, numericValue, 0x20, "StatusWrite");
+ addAccessLevelFlag(flags, numericValue, 0x40, "TimestampWrite");
+
+ return flags;
+ }
+
+ private void addAccessLevelFlag(List<String> flags, int numericValue, int mask, String label) {
+ if ((numericValue & mask) != 0) {
+ flags.add(label);
+ }
+ }
+
}
diff --git a/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java b/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
index 97ac22c5c8..1b35a0f071 100644
--- a/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
+++ b/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
@@ -91,10 +91,11 @@ public class AdapterStateChangeOperationHandler implements ExtensionBrokerOperat
adapterDescription.getElementId(),
e
);
+ var responseException = new AdapterException(e.getMessage());
return new ExtensionServiceBrokerResponseEnvelope(
request.getRequestId(),
ExtensionBrokerResponseFactory.HTTP_STATUS_INTERNAL_SERVER_ERROR,
- objectMapper.writeValueAsString(e),
+ objectMapper.writeValueAsString(responseException),
new ExtensionServiceBrokerErrorEnvelope(e.getClass().getSimpleName(), e.getMessage())
);
}
diff --git a/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.smoke.spec.ts b/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.smoke.spec.ts
index ace1314fdc..35d46b1c1e 100644
--- a/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.smoke.spec.ts
+++ b/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.smoke.spec.ts
@@ -62,7 +62,7 @@ describe('Test OPC-UA Adapter Configuration', () => {
TreeStaticPropertyUtils.validateAmountOfShownNodeDetailsMetaDataRows(0);
TreeStaticPropertyUtils.showNodeDetails('StepUp');
TreeStaticPropertyUtils.validateAmountOfShownNodeDetailsMetaDataRows(
- 12,
+ 20,
);
TreeStaticPropertyUtils.hideNodeDetails('StepUp');
TreeStaticPropertyUtils.validateAmountOfShownNodeDetailsMetaDataRows(0);
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.html b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.html
index fb7e15cd3f..ee2cc5dc3e 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.html
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.html
@@ -16,15 +16,19 @@
~
-->
<div [formGroup]="parentForm" id="formWrapper" fxFlex="100" fxLayout="column">
- <sp-static-tree-input-button-menu
- [showOptions]="showOptions"
- [loading]="loading"
- [editorMode]="editorMode"
- (selectedEditorModeEmitter)="changeEditorMode($event)"
- (resetOptionsAndReload)="resetOptionsAndReload()"
- (reload)="reload()"
- >
- </sp-static-tree-input-button-menu>
+ @if (!treeFullscreen) {
+ <sp-static-tree-input-button-menu
+ [showOptions]="showOptions"
+ [loading]="loading"
+ [editorMode]="editorMode"
+ [treeFullscreen]="treeFullscreen"
+ (selectedEditorModeEmitter)="changeEditorMode($event)"
+ (toggleTreeFullscreenEmitter)="toggleTreeFullscreen()"
+ (resetOptionsAndReload)="resetOptionsAndReload()"
+ (reload)="reload()"
+ >
+ </sp-static-tree-input-button-menu>
+ }
@if (error) {
<div fxLayout="column" class="mt-10">
@@ -35,33 +39,118 @@
}
@if (editorMode === 'tree') {
- <div fxLayout="row" fxLayoutGap="15px" data-cy="tree-editor">
- <div fxFlex="30" class="tree-input-section" fxLayout="column">
- <sp-static-tree-input-browse-nodes
- #staticTreeInputBrowseNodesComponent
- [staticProperty]="staticProperty"
- (showNodeDetailsEmitter)="showNodeDetails($event)"
- (loadOptionsFromRestApiEmitter)="
- loadOptionsFromRestApi($event)
- "
- (performValidationEmitter)="performValidation()"
- >
- </sp-static-tree-input-browse-nodes>
- </div>
- <div fxFlex="40" class="tree-input-section" fxLayout="column">
- <sp-static-tree-input-node-details
- [nodeMetadata]="nodeDetails?.nodeMetadata"
+ <div
+ class="tree-workspace-shell mt-10"
+ [class.tree-workspace-shell-fullscreen]="treeFullscreen"
+ >
+ @if (treeFullscreen) {
+ <div class="tree-workspace-shell-header">
+ <div
+ class="tree-workspace-toolbar"
+ fxLayout="row"
+ fxLayoutAlign="space-between center"
+ >
+ <div class="tree-workspace-title" fxLayout="row">
+ <span>{{
+ staticProperty.label || ('Tree' | translate)
+ }}</span>
+ </div>
+ <button
+ mat-icon-button
+ color="accent"
+ (click)="toggleTreeFullscreen()"
+ [matTooltip]="'Exit fullscreen' | translate"
+ data-cy="toggle-tree-fullscreen-inline"
+ >
+ <mat-icon>fullscreen_exit</mat-icon>
+ </button>
+ </div>
+ <sp-static-tree-input-button-menu
+ class="tree-workspace-menu"
+ [showOptions]="showOptions"
+ [loading]="loading"
+ [editorMode]="editorMode"
+ [treeFullscreen]="treeFullscreen"
+ [showFullscreenToggle]="false"
+ (selectedEditorModeEmitter)="changeEditorMode($event)"
+ (toggleTreeFullscreenEmitter)="toggleTreeFullscreen()"
+ (resetOptionsAndReload)="resetOptionsAndReload()"
+ (reload)="reload()"
+ >
+ </sp-static-tree-input-button-menu>
+ </div>
+ }
+ <div
+ #treeWorkspace
+ class="tree-workspace"
+ fxLayout="row"
+ [class.tree-workspace-resizing]="isResizingPanels"
+ data-cy="tree-editor"
+ >
+ <div
+ class="tree-panel tree-input-section"
+ fxLayout="column"
+ [style.flex-basis.%]="browsePanelWidth"
>
- </sp-static-tree-input-node-details>
- </div>
- <div class="tree-input-section" fxLayout="column" fxFlex="30">
- <sp-static-tree-input-selected-nodes
- [selectedNodesInternalNames]="
- staticProperty.selectedNodesInternalNames
- "
- (removeSelectedNode)="removeSelectedNode($event)"
+ <sp-static-tree-input-browse-nodes
+ fxFlex="100"
+ #staticTreeInputBrowseNodesComponent
+ [staticProperty]="staticProperty"
+ (showNodeDetailsEmitter)="showNodeDetails($event)"
+ (loadOptionsFromRestApiEmitter)="
+ loadOptionsFromRestApi($event)
+ "
+ (performValidationEmitter)="performValidation()"
+ >
+ </sp-static-tree-input-browse-nodes>
+ </div>
+ <div
+ class="tree-panel-resizer"
+ cdkDrag
+ cdkDragLockAxis="x"
+ (cdkDragStarted)="onPanelResizeStarted()"
+ (cdkDragMoved)="onPanelResizeMoved($event)"
+ (cdkDragEnded)="onPanelResizeEnded($event)"
>
- </sp-static-tree-input-selected-nodes>
+ <div class="tree-panel-resizer-handle"></div>
+ </div>
+ <div class="tree-panel tree-inspector-panel" fxLayout="column">
+ <div
+ class="tree-inspector-content"
+ fxFlex="100"
+ fxLayout="column"
+ fxLayoutGap="15px"
+ >
+ <div
+ class="tree-input-section tree-inspector-section"
+ fxFlex="60"
+ fxLayout="column"
+ >
+ <sp-static-tree-input-node-details
+ fxFlex="100"
+ [node]="nodeDetails"
+ >
+ </sp-static-tree-input-node-details>
+ </div>
+ <div
+ class="tree-input-section tree-inspector-section"
+ fxFlex="40"
+ fxLayout="column"
+ >
+ <sp-static-tree-input-selected-nodes
+ fxFlex="100"
+ [selectedNodesInternalNames]="
+ staticProperty.selectedNodesInternalNames
+ "
+ [activeNodeId]="nodeDetails?.internalNodeName"
+ (removeSelectedNode)="
+ removeSelectedNode($event)
+ "
+ >
+ </sp-static-tree-input-selected-nodes>
+ </div>
+ </div>
+ </div>
</div>
</div>
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.scss b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.scss
index 460ecc8c94..b3d1a099c8 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.scss
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.scss
@@ -16,6 +16,25 @@
*
*/
+:host {
+ display: block;
+}
+
+:host(.tree-detached-host) {
+ position: fixed;
+ top: var(--tree-overlay-top, 0);
+ left: var(--tree-overlay-left, 0);
+ width: var(--tree-overlay-width, 100vw);
+ height: var(--tree-overlay-height, 100vh);
+ z-index: 1200;
+ background: var(--color-bg-1);
+ box-shadow: -1rem 0 2.5rem rgba(15, 23, 42, 0.16);
+}
+
+:host(.tree-detached-host) #formWrapper {
+ height: 100%;
+}
+
.sp-tree {
overflow-y: auto;
}
@@ -48,12 +67,16 @@
.tree-input-section {
border: 1px solid var(--color-bg-3);
margin-top: 10px;
+ border-radius: 0.5rem;
+ background: var(--color-bg-0);
+ min-width: 0;
+ overflow: hidden;
}
.tree-input-header {
background: var(--color-bg-2);
- height: 40px;
- padding: 5px;
+ min-height: 2.5rem;
+ padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--color-bg-3);
}
@@ -74,3 +97,191 @@
.node-name {
font-weight: bold;
}
+
+.tree-workspace-shell {
+ position: relative;
+ min-height: 0;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.tree-workspace-shell-fullscreen {
+ margin-top: 0;
+ height: 100%;
+ overflow: hidden;
+}
+
+.tree-workspace-shell-header {
+ display: flex;
+ flex-direction: column;
+ flex: 0 0 auto;
+}
+
+.tree-workspace-toolbar {
+ position: sticky;
+ top: 0;
+ z-index: 3;
+ min-height: 3.125rem;
+ padding: 0 0.75rem 0 1rem;
+ background: var(--color-secondary);
+ color: var(--color-toolbar-text, #fff);
+}
+
+.tree-workspace-menu {
+ display: block;
+ padding: 0.75rem 1rem 0;
+ background: var(--color-bg-1);
+}
+
+.tree-workspace-title {
+ font-size: 1.125rem;
+ font-weight: 600;
+}
+
+.tree-workspace {
+ flex: 1 1 auto;
+ width: 100%;
+ height: clamp(32rem, 70vh, 44rem);
+ min-height: 32rem;
+ max-height: 44rem;
+ overflow: hidden;
+ align-items: stretch;
+}
+
+.tree-workspace-shell-fullscreen .tree-workspace {
+ flex: 1 1 auto;
+ width: 100%;
+ height: auto;
+ max-height: none;
+ min-height: 0;
+ padding: 1rem;
+ border-radius: 0.75rem;
+ background: var(--color-bg-1);
+ box-shadow: 0 1.5rem 3rem rgba(15, 23, 42, 0.2);
+}
+
+.tree-workspace-shell-fullscreen .tree-workspace {
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
+
+.tree-panel {
+ min-width: 0;
+ height: auto;
+ margin-top: 0;
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ align-self: stretch;
+}
+
+.tree-inspector-panel {
+ flex: 1 1 0;
+ min-height: 0;
+}
+
+.tree-inspector-content {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: hidden;
+}
+
+.tree-inspector-section {
+ flex: 1 1 0;
+ margin-top: 0;
+ min-height: 0;
+ overflow: hidden;
+}
+
+.tree-panel-resizer {
+ flex: 0 0 0.75rem;
+ cursor: ew-resize;
+ position: relative;
+ z-index: 2;
+ display: flex;
+ align-items: stretch;
+ justify-content: center;
+}
+
+.tree-panel-resizer::before {
+ content: '';
+ width: 1px;
+ background: var(--color-bg-3);
+ margin: 0.5rem 0;
+}
+
+.tree-panel-resizer-handle {
+ position: absolute;
+ inset: 0;
+}
+
+.tree-workspace-resizing,
+.tree-workspace-resizing * {
+ cursor: ew-resize;
+ user-select: none;
+}
+
+.tree-empty-state {
+ color: var(--fg-muted);
+}
+
+.node-summary {
+ border-bottom: 1px solid var(--color-bg-3);
+}
+
+.node-summary-label {
+ color: var(--fg-muted);
+ margin-bottom: 0.25rem;
+}
+
+.node-summary-name,
+.node-summary-path,
+.node-metadata-value {
+ overflow-wrap: anywhere;
+}
+
+.node-summary-path {
+ margin-top: 0.5rem;
+ color: var(--fg-muted);
+}
+
+.node-metadata-list {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: auto;
+}
+
+.node-metadata {
+ display: grid;
+ grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr);
+ column-gap: 0.75rem;
+ row-gap: 0.25rem;
+}
+
+.node-metadata-key {
+ color: var(--fg-muted);
+}
+
+@media (max-width: 1100px) {
+ .tree-workspace {
+ flex-direction: column;
+ height: auto;
+ max-height: none;
+ gap: 0.75rem;
+ }
+
+ .tree-panel-resizer {
+ display: none;
+ }
+
+ .tree-panel,
+ .tree-inspector-panel {
+ flex-basis: auto !important;
+ height: auto;
+ }
+
+ .node-metadata {
+ grid-template-columns: minmax(0, 1fr);
+ }
+}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
index b2ac9a98a7..42fc868170 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-runtime-resolvable-tree-input.component.ts
@@ -16,7 +16,15 @@
*
*/
-import { Component, OnInit, ViewChild, inject } from '@angular/core';
+import {
+ Component,
+ ElementRef,
+ HostListener,
+ inject,
+ OnDestroy,
+ OnInit,
+ ViewChild,
+} from '@angular/core';
import { BaseRuntimeResolvableInput } from '../static-runtime-resolvable-input/base-runtime-resolvable-input';
import {
RuntimeResolvableTreeInputStaticProperty,
@@ -32,14 +40,20 @@ import { StaticTreeInputServiceService } from './static-tree-input-service.servi
import { StaticTreeInputBrowseNodesComponent } from './static-tree-input-browse-nodes/static-tree-input-browse-nodes.component';
import {
FlexDirective,
+ LayoutAlignDirective,
LayoutDirective,
LayoutGapDirective,
} from '@ngbracket/ngx-layout/flex';
+import { CdkDrag, CdkDragEnd, CdkDragMove } from '@angular/cdk/drag-drop';
+import { MatIconButton } from '@angular/material/button';
+import { MatIcon } from '@angular/material/icon';
+import { MatTooltip } from '@angular/material/tooltip';
import { StaticTreeInputButtonMenuComponent } from './static-tree-input-button-menu/static-tree-input-button-menu.component';
import { SpExceptionMessageComponent } from '@streampipes/shared-ui';
import { StaticTreeInputNodeDetailsComponent } from './static-tree-input-node-details/static-tree-input-node-details.component';
import { StaticTreeInputSelectedNodesComponent } from './static-tree-input-selected-nodes/static-tree-input-selected-nodes.component';
import { StaticTreeInputTextEditorComponent } from './static-tree-input-text-editor/static-tree-input-text-editor.component';
+import { TranslatePipe } from '@ngx-translate/core';
@Component({
selector: 'sp-static-runtime-resolvable-tree-input',
@@ -47,12 +61,18 @@ import { StaticTreeInputTextEditorComponent } from './static-tree-input-text-edi
styleUrls: ['./static-runtime-resolvable-tree-input.component.scss'],
imports: [
FlexDirective,
+ LayoutAlignDirective,
LayoutDirective,
FormsModule,
ReactiveFormsModule,
StaticTreeInputButtonMenuComponent,
SpExceptionMessageComponent,
LayoutGapDirective,
+ CdkDrag,
+ MatIconButton,
+ MatIcon,
+ MatTooltip,
+ TranslatePipe,
StaticTreeInputBrowseNodesComponent,
StaticTreeInputNodeDetailsComponent,
StaticTreeInputSelectedNodesComponent,
@@ -61,11 +81,12 @@ import { StaticTreeInputTextEditorComponent } from './static-tree-input-text-edi
})
export class StaticRuntimeResolvableTreeInputComponent
extends BaseRuntimeResolvableInput<RuntimeResolvableTreeInputStaticProperty>
- implements OnInit
+ implements OnInit, OnDestroy
{
private staticTreeInputServiceService = inject(
StaticTreeInputServiceService,
);
+ private host = inject(ElementRef<HTMLElement>);
nodeDetails: TreeInputNode;
@@ -76,10 +97,20 @@ export class StaticRuntimeResolvableTreeInputComponent
// should not be stored in the static property object
latestFetchedNodes = [];
nodes = [];
+ treeFullscreen = false;
+ browsePanelWidth = 50;
+ isResizingPanels = false;
+ private readonly minPanelWidthPercent = 30;
+ private readonly maxPanelWidthPercent = 70;
@ViewChild('staticTreeInputBrowseNodesComponent')
private staticTreeInputBrowseNodesComponent: StaticTreeInputBrowseNodesComponent;
+ @ViewChild('treeWorkspace')
+ private treeWorkspace: ElementRef<HTMLDivElement>;
+
+ private placeholderNode?: Comment;
+
ngOnInit(): void {
// if a node is selected it is assumed the adapter was opened in edit mode
// when that is the case, the browse tree should be reloaded
@@ -118,6 +149,10 @@ export class StaticRuntimeResolvableTreeInputComponent
return staticProperty as RuntimeResolvableTreeInputStaticProperty;
}
+ ngOnDestroy(): void {
+ this.restoreHostPosition();
+ }
+
afterOptionsLoaded(
staticProperty: RuntimeResolvableTreeInputStaticProperty,
node: TreeInputNode,
@@ -196,9 +231,130 @@ export class StaticRuntimeResolvableTreeInputComponent
if (mode === 'tree') {
this.resetStaticPropertyStateAndReload();
+ } else {
+ this.closeTreeFullscreen();
+ }
+ }
+
+ toggleTreeFullscreen() {
+ if (this.treeFullscreen) {
+ this.closeTreeFullscreen();
+ } else {
+ this.detachHostToOverlay();
+ this.treeFullscreen = true;
+ }
+ }
+
+ onPanelResizeStarted() {
+ this.isResizingPanels = true;
+ }
+
+ onPanelResizeMoved(event: CdkDragMove) {
+ const workspaceElement = this.treeWorkspace?.nativeElement;
+
+ if (!workspaceElement) {
+ return;
+ }
+
+ const rect = workspaceElement.getBoundingClientRect();
+ const relativeLeft = event.pointerPosition.x - rect.left;
+ const widthPercent = (relativeLeft / rect.width) * 100;
+
+ this.browsePanelWidth = Math.min(
+ Math.max(widthPercent, this.minPanelWidthPercent),
+ this.maxPanelWidthPercent,
+ );
+
+ event.source.element.nativeElement.style.transform = 'none';
+ }
+
+ onPanelResizeEnded(event: CdkDragEnd) {
+ this.isResizingPanels = false;
+ event.source.element.nativeElement.style.transform = 'none';
+ }
+
+ @HostListener('window:resize')
+ onWindowResize() {
+ if (this.treeFullscreen) {
+ this.updateDetachedHostBounds();
}
}
+ @HostListener('window:keydown.escape')
+ onEscapePressed() {
+ if (this.treeFullscreen) {
+ this.closeTreeFullscreen();
+ }
+ }
+
+ private closeTreeFullscreen() {
+ this.treeFullscreen = false;
+ this.restoreHostPosition();
+ }
+
+ private detachHostToOverlay() {
+ const hostEl = this.host.nativeElement;
+
+ if (this.placeholderNode || hostEl.parentNode === document.body) {
+ this.updateDetachedHostBounds();
+ return;
+ }
+
+ const parent = hostEl.parentNode;
+
+ if (!parent) {
+ return;
+ }
+
+ this.placeholderNode = document.createComment(
+ 'sp-static-tree-input-placeholder',
+ );
+ parent.insertBefore(this.placeholderNode, hostEl);
+ document.body.appendChild(hostEl);
+ hostEl.classList.add('tree-detached-host');
+ this.updateDetachedHostBounds();
+ }
+
+ private restoreHostPosition() {
+ const hostEl = this.host.nativeElement;
+
+ if (this.placeholderNode?.parentNode) {
+ this.placeholderNode.parentNode.insertBefore(
+ hostEl,
+ this.placeholderNode,
+ );
+ this.placeholderNode.parentNode.removeChild(this.placeholderNode);
+ }
+
+ this.placeholderNode = undefined;
+ hostEl.classList.remove('tree-detached-host');
+ hostEl.style.removeProperty('--tree-overlay-top');
+ hostEl.style.removeProperty('--tree-overlay-left');
+ hostEl.style.removeProperty('--tree-overlay-width');
+ hostEl.style.removeProperty('--tree-overlay-height');
+ }
+
+ private updateDetachedHostBounds() {
+ const hostEl = this.host.nativeElement;
+ const mainSection = document.querySelector(
+ '.main-section',
+ ) as HTMLElement | null;
+ const targetRect =
+ mainSection?.getBoundingClientRect() ??
+ document.documentElement.getBoundingClientRect();
+
+ hostEl.style.setProperty('--tree-overlay-top', `${targetRect.top}px`);
+ hostEl.style.setProperty('--tree-overlay-left', `${targetRect.left}px`);
+ hostEl.style.setProperty(
+ '--tree-overlay-width',
+ `${targetRect.width}px`,
+ );
+ hostEl.style.setProperty(
+ '--tree-overlay-height',
+ `${targetRect.height}px`,
+ );
+ }
+
/**
* The static property keeps the state of the last fetched nodes to be able
* to set the subtree to the right node. When a user switches the editor
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.html b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.html
index 927e341c39..f7d1f839f2 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.html
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.html
@@ -17,25 +17,7 @@
-->
<div class="tree-input-header" fxLayoutAlign="start center">
- <div fxLayout="row" fxFlex="100">
- <div fxFlex fxLayoutAlign="start center">
- <b>{{ 'Browse' | translate }}</b>
- </div>
- <div fxLayoutAlign="end center">
- <button
- mat-icon-button
- color="accent"
- (click)="largeView = !largeView"
- >
- @if (!largeView) {
- <mat-icon>open_in_full</mat-icon>
- }
- @if (largeView) {
- <mat-icon>close_fullscreen </mat-icon>
- }
- </button>
- </div>
- </div>
+ <b>{{ 'Browse' | translate }}</b>
</div>
<mat-tree
@@ -43,10 +25,11 @@
[childrenAccessor]="childrenAccessor"
#tree
class="sp-tree"
- [ngClass]="largeView ? 'tree-large-height' : 'tree-normal-height'"
>
<mat-tree-node *matTreeNodeDef="let node" matTreeNodeToggle>
<div
+ class="tree-node-content"
+ fxLayout="row"
fxLayoutAlign="start center"
[attr.data-cy]="'tree-node-' + node.nodeName"
>
@@ -57,6 +40,7 @@
(click)="addNode(node)"
[attr.data-cy]="'select-' + node.nodeName"
[matTooltip]="'Add node' | translate"
+ matTooltipPosition="above"
>add_circle</i
>
}
@@ -65,6 +49,7 @@
class="material-icons pr-5 icon-button"
(click)="removeNode(node)"
[matTooltip]="'Remove node' | translate"
+ matTooltipPosition="above"
>remove_circle</i
>
}
@@ -74,6 +59,7 @@
[attr.data-cy]="'show-node-details-' + node.nodeName"
(click)="showNodeDetails(node)"
[matTooltip]="'Show details' | translate"
+ matTooltipPosition="above"
>visibility</i
>
}
@@ -83,10 +69,16 @@
[attr.data-cy]="'hide-node-details-' + node.nodeName"
(click)="hideNodeDetails()"
[matTooltip]="'Show details' | translate"
+ matTooltipPosition="above"
>visibility_off</i
>
}
- <span class="pr-5">{{ node.nodeName }}</span>
+ <span
+ fxFlex
+ class="tree-node-label pr-5"
+ [matTooltip]="node.internalNodeName || node.nodeName"
+ >{{ node.nodeName }}</span
+ >
</div>
</mat-tree-node>
<mat-nested-tree-node *matTreeNodeDef="let node; when: hasChild">
@@ -104,7 +96,12 @@
}}
</mat-icon>
</button>
- <div fxLayoutAlign="start center">
+ <div
+ class="tree-node-content"
+ fxFlex
+ fxLayout="row"
+ fxLayoutAlign="start center"
+ >
@if (!tree.isExpanded(node)) {
<i class="material-icons color-primary pr-5">folder</i>
}
@@ -125,6 +122,7 @@
[attr.data-cy]="'show-node-details-' + node.nodeName"
(click)="showNodeDetails(node)"
[matTooltip]="'Show details' | translate"
+ matTooltipPosition="above"
>visibility</i
>
}
@@ -134,10 +132,16 @@
[attr.data-cy]="'hide-node-details-' + node.nodeName"
(click)="hideNodeDetails()"
[matTooltip]="'Show details' | translate"
+ matTooltipPosition="above"
>visibility_off</i
>
}
- <span class="node-name pr-5"> {{ node.nodeName }}</span>
+ <span
+ fxFlex
+ class="node-name tree-node-label pr-5"
+ [matTooltip]="node.internalNodeName || node.nodeName"
+ > {{ node.nodeName }}</span
+ >
</div>
</div>
@if (tree.isExpanded(node)) {
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.scss b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.scss
index 7a03232d17..5cf2ee6e9a 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.scss
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.scss
@@ -16,11 +16,30 @@
*
*/
-.tree-normal-height {
- min-height: 400px;
- max-height: 400px;
+:host {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 0;
+ overflow: hidden;
}
-.tree-large-height {
- min-height: 800px;
+.sp-tree {
+ flex: 1 1 auto;
+ height: 100%;
+ min-height: 0;
+ padding: 0.5rem 0;
+ overflow: auto;
+}
+
+.tree-node-content {
+ width: 100%;
+ min-width: 0;
+}
+
+.tree-node-label {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
index 90e13ebbfd..54eec25a9b 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-browse-nodes/static-tree-input-browse-nodes.component.ts
@@ -18,11 +18,11 @@
import {
Component,
EventEmitter,
+ inject,
Input,
OnInit,
Output,
ViewChild,
- inject,
} from '@angular/core';
import {
RuntimeResolvableTreeInputStaticProperty,
@@ -45,8 +45,6 @@ import {
} from '@ngbracket/ngx-layout/flex';
import { MatIconButton } from '@angular/material/button';
import { MatIcon } from '@angular/material/icon';
-import { NgClass } from '@angular/common';
-import { DefaultClassDirective } from '@ngbracket/ngx-layout/extended';
import { MatTooltip } from '@angular/material/tooltip';
import { TranslatePipe } from '@ngx-translate/core';
@@ -64,8 +62,6 @@ import { TranslatePipe } from '@ngx-translate/core';
MatIconButton,
MatIcon,
MatTree,
- NgClass,
- DefaultClassDirective,
MatTreeNodeDef,
MatTreeNode,
MatTreeNodeToggle,
@@ -97,7 +93,6 @@ export class StaticTreeInputBrowseNodesComponent implements OnInit {
@ViewChild('tree')
tree: MatTree<TreeInputNode>;
- largeView = false;
childrenAccessor = node => node.children;
dataSource = new MatTreeNestedDataSource<TreeInputNode>();
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.html b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.html
index b61424e820..9da8b1c965 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.html
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.html
@@ -62,18 +62,38 @@
}
<div fxFlex fxLayoutAlign="end center">
- <mat-button-toggle-group
- [attr.aria-label]="'Font Style' | translate"
- class="small-button"
- [(value)]="editorMode"
- (change)="onChangeEditor($event.value)"
- >
- <mat-button-toggle data-cy="editor-mode-tree" value="tree">{{
- 'Tree' | translate
- }}</mat-button-toggle>
- <mat-button-toggle data-cy="editor-mode-text" value="text">{{
- 'Text' | translate
- }}</mat-button-toggle>
- </mat-button-toggle-group>
+ <div fxLayout="row" fxLayoutGap="10px" fxLayoutAlign="end center">
+ @if (editorMode === 'tree' && showFullscreenToggle) {
+ <button
+ mat-icon-button
+ color="accent"
+ (click)="onToggleTreeFullscreen()"
+ [matTooltip]="
+ treeFullscreen
+ ? ('Exit fullscreen' | translate)
+ : ('Open fullscreen' | translate)
+ "
+ data-cy="toggle-tree-fullscreen"
+ >
+ <mat-icon>{{
+ treeFullscreen ? 'fullscreen_exit' : 'fullscreen'
+ }}</mat-icon>
+ </button>
+ }
+
+ <mat-button-toggle-group
+ [attr.aria-label]="'Font Style' | translate"
+ class="small-button"
+ [(value)]="editorMode"
+ (change)="onChangeEditor($event.value)"
+ >
+ <mat-button-toggle data-cy="editor-mode-tree" value="tree">{{
+ 'Tree' | translate
+ }}</mat-button-toggle>
+ <mat-button-toggle data-cy="editor-mode-text" value="text">{{
+ 'Text' | translate
+ }}</mat-button-toggle>
+ </mat-button-toggle-group>
+ </div>
</div>
</div>
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.ts
index c48469615f..365889ea5d 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-button-menu/static-tree-input-button-menu.component.ts
@@ -22,12 +22,14 @@ import {
LayoutDirective,
LayoutGapDirective,
} from '@ngbracket/ngx-layout/flex';
-import { MatButton } from '@angular/material/button';
+import { MatButton, MatIconButton } from '@angular/material/button';
+import { MatIcon } from '@angular/material/icon';
import { MatProgressSpinner } from '@angular/material/progress-spinner';
import {
MatButtonToggle,
MatButtonToggleGroup,
} from '@angular/material/button-toggle';
+import { MatTooltip } from '@angular/material/tooltip';
import { TranslatePipe } from '@ngx-translate/core';
@Component({
@@ -39,10 +41,13 @@ import { TranslatePipe } from '@ngx-translate/core';
LayoutGapDirective,
LayoutAlignDirective,
MatButton,
+ MatIconButton,
+ MatIcon,
MatProgressSpinner,
FlexDirective,
MatButtonToggleGroup,
MatButtonToggle,
+ MatTooltip,
TranslatePipe,
],
})
@@ -53,6 +58,10 @@ export class StaticTreeInputButtonMenuComponent {
loading: boolean;
@Input()
editorMode: 'tree' | 'text';
+ @Input()
+ treeFullscreen: boolean;
+ @Input()
+ showFullscreenToggle = true;
@Output()
resetOptionsAndReload = new EventEmitter<void>();
@@ -60,6 +69,8 @@ export class StaticTreeInputButtonMenuComponent {
reload = new EventEmitter<void>();
@Output()
selectedEditorModeEmitter = new EventEmitter<'tree' | 'text'>();
+ @Output()
+ toggleTreeFullscreenEmitter = new EventEmitter<void>();
onResetOptionsAndReload() {
this.resetOptionsAndReload.emit();
@@ -72,4 +83,8 @@ export class StaticTreeInputButtonMenuComponent {
onChangeEditor(mode: 'tree' | 'text') {
this.selectedEditorModeEmitter.emit(mode);
}
+
+ onToggleTreeFullscreen() {
+ this.toggleTreeFullscreenEmitter.emit();
+ }
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.html b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.html
index debf1a9698..02b439086e 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.html
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.html
@@ -18,16 +18,36 @@
<div class="tree-input-header" fxLayoutAlign="start center">
<b>{{ 'Node Details' | translate }}</b>
</div>
-@for (metadata of nodeMetadata | keyvalue; track metadata) {
- <div
- class="node-metadata p-xs"
- fxLayout="row"
- fxLayoutGap="5px"
- [attr.data-cy]="'node-details-metadata-row-' + metadata.key"
- >
- <span class="text-sm" style="color: var(--fg-muted)">{{
- metadata.key
+@if (!node) {
+ <div class="tree-empty-state p-md">
+ <span class="text-sm">{{
+ 'Select a node to inspect its details' | translate
}}</span>
- <span class="text-sm font-emphasized">{{ metadata.value }}</span>
+ </div>
+}
+@if (node) {
+ <div class="node-summary p-md">
+ <div class="node-summary-name font-emphasized">
+ {{ node.nodeName }}
+ </div>
+ <div class="node-summary-path text-sm">
+ {{ node.internalNodeName }}
+ </div>
+ </div>
+
+ <div class="node-metadata-list">
+ @for (metadata of node.nodeMetadata | keyvalue; track metadata.key) {
+ <div
+ class="node-metadata p-sm"
+ [attr.data-cy]="'node-details-metadata-row-' + metadata.key"
+ >
+ <div class="node-metadata-key text-sm">
+ {{ metadata.key }}
+ </div>
+ <div class="node-metadata-value text-sm font-emphasized">
+ {{ metadata.value }}
+ </div>
+ </div>
+ }
</div>
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.scss
similarity index 78%
copy from ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss
copy to ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.scss
index 64122b4f23..e4c6e19244 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.scss
@@ -16,8 +16,17 @@
*
*/
-.selected-node {
- background: var(--color-bg-1);
- padding: 5px;
- border: 1px solid var(--color-bg-3);
+:host {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 0;
+ overflow: hidden;
+}
+
+.node-metadata-list {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: auto;
+ padding-bottom: 0.75rem;
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.ts
index 398fb874db..7091f71f66 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-node-details/static-tree-input-node-details.component.ts
@@ -17,27 +17,21 @@
*/
import { Component, Input } from '@angular/core';
-import {
- LayoutAlignDirective,
- LayoutDirective,
-} from '@ngbracket/ngx-layout/flex';
+import { LayoutAlignDirective } from '@ngbracket/ngx-layout/flex';
import { KeyValuePipe } from '@angular/common';
+import { TreeInputNode } from '@streampipes/platform-services';
import { TranslatePipe } from '@ngx-translate/core';
-import { LayoutGapDirective } from '@ngbracket/ngx-layout';
@Component({
selector: 'sp-static-tree-input-node-details',
templateUrl: './static-tree-input-node-details.component.html',
- styleUrl: '../static-runtime-resolvable-tree-input.component.scss',
- imports: [
- LayoutAlignDirective,
- LayoutDirective,
- KeyValuePipe,
- TranslatePipe,
- LayoutGapDirective,
+ styleUrls: [
+ '../static-runtime-resolvable-tree-input.component.scss',
+ './static-tree-input-node-details.component.scss',
],
+ imports: [LayoutAlignDirective, KeyValuePipe, TranslatePipe],
})
export class StaticTreeInputNodeDetailsComponent {
@Input()
- nodeMetadata: { [index: string]: any };
+ node: TreeInputNode;
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.html b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.html
index 112c9f5a07..ca2acf8d8b 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.html
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.html
@@ -16,27 +16,48 @@
~
-->
<div class="tree-input-header" fxLayoutAlign="start center">
- <b>{{ 'Selected Nodes' | translate }}</b>
+ <b
+ >{{ 'Selected Nodes' | translate }} ({{
+ selectedNodesInternalNames?.length || 0
+ }})</b
+ >
</div>
-@for (selectedNodeName of selectedNodesInternalNames; track selectedNodeName) {
- <div>
- <div
- class="selected-node"
- fxLayout="row"
- fxLayoutAlign="start center"
- [attr.data-cy]="'selected-node-' + selectedNodeName"
- >
- <span fxFlex>{{ selectedNodeName }}</span>
- <div fxLayoutAlign="end center">
- <button
- mat-icon-button
- color="accent"
- [attr.data-cy]="'remove-' + selectedNodeName"
- (click)="onRemoveSelectedNode(selectedNodeName)"
- >
- <i class="material-icons">remove</i>
- </button>
- </div>
- </div>
+@if (!selectedNodesInternalNames?.length) {
+ <div class="tree-empty-state p-md">
+ <span class="text-sm">{{ 'No nodes selected yet' | translate }}</span>
</div>
}
+<div class="selected-node-list">
+ @for (
+ selectedNodeName of selectedNodesInternalNames;
+ track selectedNodeName
+ ) {
+ <div class="selected-node-wrapper">
+ <div
+ class="selected-node"
+ [class.selected-node-active]="isActiveNode(selectedNodeName)"
+ fxLayout="row"
+ fxLayoutAlign="start center"
+ [attr.data-cy]="'selected-node-' + selectedNodeName"
+ >
+ <div fxFlex class="selected-node-text text-sm">
+ <div
+ class="selected-node-name"
+ [matTooltip]="selectedNodeName"
+ >
+ {{ selectedNodeName }}
+ </div>
+ </div>
+ <div fxLayoutAlign="end center">
+ <button
+ mat-icon-button
+ [attr.data-cy]="'remove-' + selectedNodeName"
+ (click)="onRemoveSelectedNode(selectedNodeName)"
+ >
+ <i class="small-icon material-icons">remove</i>
+ </button>
+ </div>
+ </div>
+ </div>
+ }
+</div>
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss
index 64122b4f23..79442196fb 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.scss
@@ -16,8 +16,43 @@
*
*/
+:host {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 0;
+ overflow: hidden;
+}
+
+.selected-node-list {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow: auto;
+ padding-bottom: 0.75rem;
+}
+
.selected-node {
background: var(--color-bg-1);
- padding: 5px;
+ padding: 0.25rem;
border: 1px solid var(--color-bg-3);
+ border-radius: 0.5rem;
+ gap: 0.5rem;
+}
+
+.selected-node-wrapper {
+ padding: 0.25rem 0.5rem 0;
+}
+
+.selected-node-text {
+ min-width: 0;
+}
+
+.selected-node-name {
+ overflow-wrap: anywhere;
+ line-height: 1.4;
+}
+
+.selected-node-active {
+ border-color: var(--color-secondary);
+ background: var(--color-bg-2);
}
diff --git a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.ts b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.ts
index 74b85b134c..da97b48b4a 100644
--- a/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-runtime-resolvable-tree-input/static-tree-input-selected-nodes/static-tree-input-selected-nodes.component.ts
@@ -23,6 +23,7 @@ import {
LayoutDirective,
} from '@ngbracket/ngx-layout/flex';
import { MatIconButton } from '@angular/material/button';
+import { MatTooltip } from '@angular/material/tooltip';
import { TranslatePipe } from '@ngx-translate/core';
@Component({
@@ -37,12 +38,15 @@ import { TranslatePipe } from '@ngx-translate/core';
LayoutDirective,
FlexDirective,
MatIconButton,
+ MatTooltip,
TranslatePipe,
],
})
export class StaticTreeInputSelectedNodesComponent {
@Input()
selectedNodesInternalNames: string[];
+ @Input()
+ activeNodeId: string;
@Output()
removeSelectedNode = new EventEmitter<string>();
@@ -50,4 +54,8 @@ export class StaticTreeInputSelectedNodesComponent {
onRemoveSelectedNode(selectedNodeName: string) {
this.removeSelectedNode.emit(selectedNodeName);
}
+
+ isActiveNode(selectedNodeName: string) {
+ return this.activeNodeId === selectedNodeName;
+ }
}