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 025114e658 fix(#3014): Add test and fix edit of file static property 
(#3015)
025114e658 is described below

commit 025114e6588825646bddab50d1858a35b52c7cbb
Author: Philipp Zehnder <[email protected]>
AuthorDate: Fri Jul 12 08:18:53 2024 +0200

    fix(#3014): Add test and fix edit of file static property (#3015)
    
    * fix(#3014): Add test and fix edit of file static property
    
    * fix(#3014): Fix linting
---
 ...fileStream.smoke.spec.ts => fileStream.spec.ts} | 26 ++++++++++++++++++++++
 .../static-file-input.component.html               |  1 +
 .../static-file-input.component.ts                 | 14 ++++++------
 3 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/ui/cypress/tests/connect/fileStream.smoke.spec.ts 
b/ui/cypress/tests/connect/fileStream.spec.ts
similarity index 80%
rename from ui/cypress/tests/connect/fileStream.smoke.spec.ts
rename to ui/cypress/tests/connect/fileStream.spec.ts
index ebf1815dfc..16050b097f 100644
--- a/ui/cypress/tests/connect/fileStream.smoke.spec.ts
+++ b/ui/cypress/tests/connect/fileStream.spec.ts
@@ -106,5 +106,31 @@ describe(
                 2000,
             );
         });
+
+        it('File Stream adapter validate file is shown when editing file 
static property', () => {
+            // Add a sample file adapter to edit
+            FileManagementUtils.addFile('fileTest/random.csv');
+
+            const adapterInput = AdapterBuilder.create('File_Stream')
+                .setName('File Stream Adapter Test')
+                .setTimestampProperty('timestamp')
+                .addProtocolInput('checkbox', 'replaceTimestamp', 'check')
+                .setFormat('csv')
+                .addFormatInput('input', ConnectBtns.csvDelimiter(), ';')
+                .addFormatInput('checkbox', ConnectBtns.csvHeader(), 'check')
+                .setStartAdapter(false)
+                .build();
+
+            ConnectUtils.testAdapter(adapterInput);
+
+            // click on edit adapter
+            ConnectBtns.editAdapter().click();
+
+            // validate that the file name is set as default
+            cy.dataCy('file-input-file-name').should(
+                'have.value',
+                'random.csv',
+            );
+        });
     },
 );
diff --git 
a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.html
 
b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.html
index 0ac88d7e42..0c3e1ebca6 100644
--- 
a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.html
+++ 
b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.html
@@ -37,6 +37,7 @@
         >
             <mat-form-field color="accent" class="w-100">
                 <input
+                    data-cy="file-input-file-name"
                     type="text"
                     placeholder="Select file"
                     formControlName="{{ fieldName }}"
diff --git 
a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
 
b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
index 4d5d89c376..e181e438fe 100644
--- 
a/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
+++ 
b/ui/src/app/core-ui/static-properties/static-file-input/static-file-input.component.ts
@@ -16,13 +16,7 @@
  *
  */
 
-import {
-    Component,
-    EventEmitter,
-    NgModule,
-    OnInit,
-    Output,
-} from '@angular/core';
+import { Component, EventEmitter, OnInit, Output } from '@angular/core';
 import { HttpEventType, HttpResponse } from '@angular/common/http';
 import {
     FilesService,
@@ -80,6 +74,12 @@ export class StaticFileInputComponent
         this.enableValidators();
 
         this.chooseExistingFileControl.setValue(true);
+
+        if (this.staticProperty.label) {
+            this.parentForm.controls[this.fieldName].setValue(
+                this.staticProperty.label,
+            );
+        }
     }
 
     collectValidators() {

Reply via email to