You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2024/08/21 06:13:44 UTC

(streampipes) branch dev updated: fix(#3163): Nodes are only reloaded with a full configuration (#3164)

This is an automated email from the ASF dual-hosted git repository.

zehnder 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 ada9657e80 fix(#3163): Nodes are only reloaded with a full configuration (#3164)
ada9657e80 is described below

commit ada9657e8064caac20abf1924a13886da48ee66d
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Wed Aug 21 08:13:38 2024 +0200

    fix(#3163): Nodes are only reloaded with a full configuration (#3164)
---
 ui/cypress/support/utils/ErrorMessageUtils.ts              |  4 ++++
 .../tests/connect/opcua/opcAdapterConfiguration.spec.ts    | 14 ++++++++++----
 .../sp-exception-message.component.html                    |  7 ++++++-
 .../static-runtime-resolvable-tree-input.component.ts      |  9 +++++++--
 .../static-tree-input-button-menu.component.html           |  1 +
 5 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/ui/cypress/support/utils/ErrorMessageUtils.ts b/ui/cypress/support/utils/ErrorMessageUtils.ts
index 31aa9baa3a..f1e5db2cd1 100644
--- a/ui/cypress/support/utils/ErrorMessageUtils.ts
+++ b/ui/cypress/support/utils/ErrorMessageUtils.ts
@@ -17,6 +17,10 @@
  */
 
 export class ErrorMessageUtils {
+    public static getExceptionComponent() {
+        return cy.dataCy('display-exception');
+    }
+
     /**
      * Validates that an error message is displayed and that this message contains the @param message
      */
diff --git a/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.spec.ts b/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.spec.ts
index 6dc6624e33..8889c18542 100644
--- a/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.spec.ts
+++ b/ui/cypress/tests/connect/opcua/opcAdapterConfiguration.spec.ts
@@ -153,7 +153,7 @@ describe('Test OPC-UA Adapter Configuration', () => {
 const getAdapterBuilder = () => {
     const host: string = ParameterUtils.get('localhost', 'opcua');
 
-    const builder = AdapterBuilder.create('OPC_UA')
+    return AdapterBuilder.create('OPC_UA')
         .setName('OPC UA Configuration Test')
         .addInput('radio', 'adapter_type-pull_mode', '')
         .addInput('input', 'undefined-PULLING_INTERVAL-0', '1000')
@@ -164,15 +164,21 @@ const getAdapterBuilder = () => {
             'undefined-OPC_SERVER_URL-0',
             'opc.tcp://' + host + ':50000',
         )
-
         .setAutoAddTimestampPropery();
-
-    return builder;
 };
 
 const setUpInitialConfiguration = (adapterInput: AdapterInput) => {
     ConnectUtils.goToConnect();
     ConnectUtils.goToNewAdapterPage();
     ConnectUtils.selectAdapter(adapterInput.adapterType);
+
+    // Wait for the first static property to be rendered
+    cy.dataCy(adapterInput.adapterConfiguration[0].selector).should(
+        'be.visible',
+    );
+    // Validate that no error is not shown when nothing is configured
+    cy.dataCy('reloading-nodes', { timeout: 3000 }).should('not.exist');
+    ErrorMessageUtils.getExceptionComponent().should('not.exist');
+
     StaticPropertyUtils.input(adapterInput.adapterConfiguration);
 };
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
index 741bc96a9f..2efd80acc1 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-exception-message/sp-exception-message.component.html
@@ -16,7 +16,12 @@
   ~
   -->
 
-<div fxLayout="column" fxFlex="100" class="error-panel error">
+<div
+    fxLayout="column"
+    fxFlex="100"
+    class="error-panel error"
+    data-cy="display-exception"
+>
     <div fxLayout="row">
         <div fxFlex="100" fxLayoutAlign="start center">
             <div
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 d9b5f64768..1a1a60ea85 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
@@ -52,7 +52,8 @@ export class StaticRuntimeResolvableTreeInputComponent
     }
 
     ngOnInit(): void {
-        this.resetStaticPropertyStateAndReload();
+        this.resetStaticPropertyState();
+
         if (
             this.staticProperty.nodes.length === 0 &&
             (!this.staticProperty.dependsOn ||
@@ -168,8 +169,12 @@ export class StaticRuntimeResolvableTreeInputComponent
      * this state should be reset
      */
     private resetStaticPropertyStateAndReload() {
+        this.resetStaticPropertyState();
+        this.reload();
+    }
+
+    private resetStaticPropertyState(): void {
         this.staticProperty.latestFetchedNodes = [];
         this.staticProperty.nextBaseNodeToResolve = undefined;
-        this.reload();
     }
 }
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 a8d8386e10..a0c3df6e29 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
@@ -45,6 +45,7 @@
         fxLayout="row"
         *ngIf="loading && editorMode === 'tree'"
         fxLayoutAlign="start center"
+        data-cy="reloading-nodes"
     >
         <mat-spinner
             color="accent"