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

zehnder pushed a commit to branch 3014-file-not-stored-in-static-property
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/3014-file-not-stored-in-static-property by this push:
     new 04fb27d6a3 fix(#3014): Add test and fix edit of file static property
04fb27d6a3 is described below

commit 04fb27d6a35de410f193f44ca02769f7dca3b091
Author: Philipp Zehnder <[email protected]>
AuthorDate: Thu Jul 11 18:38:20 2024 +0200

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

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..c4c18ec744 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
@@ -19,7 +19,6 @@
 import {
     Component,
     EventEmitter,
-    NgModule,
     OnInit,
     Output,
 } from '@angular/core';
@@ -80,6 +79,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