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

zehnder pushed a commit to branch 
2997-timestamp-rule-is-not-persisted-in-ui-when-selecting-milliseconds
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to 
refs/heads/2997-timestamp-rule-is-not-persisted-in-ui-when-selecting-milliseconds
 by this push:
     new 730423fdf3 fix(#2997): Fix default selection for timestamp rule
730423fdf3 is described below

commit 730423fdf3735cd2f747e1a532356a35ecc9b273
Author: Philipp Zehnder <[email protected]>
AuthorDate: Thu Jul 4 23:04:53 2024 +0200

    fix(#2997): Fix default selection for timestamp rule
---
 ui/cypress/tests/adapter/fileStream.smoke.spec.ts  | 40 ++++++++++++----------
 .../edit-timestamp-property.component.html         |  2 +-
 .../edit-timestamp-property.component.ts           | 20 ++++++-----
 3 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/ui/cypress/tests/adapter/fileStream.smoke.spec.ts 
b/ui/cypress/tests/adapter/fileStream.smoke.spec.ts
index c93bbb6ba5..ebf1815dfc 100644
--- a/ui/cypress/tests/adapter/fileStream.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/fileStream.smoke.spec.ts
@@ -85,24 +85,26 @@ describe(
             );
         });
 
-        // it('File Stream adapter with unix timestamp in milliseconds', () => 
{
-        //     
FileManagementUtils.addFile('connect/fileReplay/timestampInMilliseconds/input.csv');
-        //     const adapterConfiguration =
-        //         ConnectUtils.setUpPreprocessingRuleTest(false);
-        //
-        //     // Edit timestamp property
-        //     ConnectEventSchemaUtils.editTimestampPropertyWithNumber(
-        //         'timestamp',
-        //         'Milliseconds',
-        //     );
-        //
-        //     ConnectEventSchemaUtils.finishEventSchemaConfiguration();
-        //     ConnectUtils.tearDownPreprocessingRuleTest(
-        //         adapterConfiguration,
-        //         
'cypress/fixtures/connect/fileReplay/timestampInMilliseconds/expected.csv',
-        //         false,
-        //         2000,
-        //     );
-        // });
+        it('File Stream adapter with unix timestamp in milliseconds', () => {
+            FileManagementUtils.addFile(
+                'connect/fileReplay/timestampInMilliseconds/input.csv',
+            );
+            const adapterConfiguration =
+                ConnectUtils.setUpPreprocessingRuleTest(false);
+
+            // Edit timestamp property
+            ConnectEventSchemaUtils.editTimestampPropertyWithNumber(
+                'timestamp',
+                'Milliseconds',
+            );
+
+            ConnectEventSchemaUtils.finishEventSchemaConfiguration();
+            ConnectUtils.tearDownPreprocessingRuleTest(
+                adapterConfiguration,
+                
'cypress/fixtures/connect/fileReplay/timestampInMilliseconds/expected.csv',
+                false,
+                2000,
+            );
+        });
     },
 );
diff --git 
a/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.html
 
b/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.html
index da7236b67b..8b5ffd30d7 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.html
+++ 
b/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.html
@@ -64,7 +64,7 @@
                     Milliseconds
                 </mat-option>
                 <mat-option
-                    value="second"
+                    value="seconds"
                     (click)="
                         cachedProperty.additionalMetadata.multiplier = 1000
                     "
diff --git 
a/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.ts
 
b/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.ts
index 4c02c8a1b5..26bbb8e0e1 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.ts
+++ 
b/ui/src/app/connect/dialog/edit-event-property/components/edit-value-transformation/edit-timestamp-property/edit-timestamp-property.component.ts
@@ -16,21 +16,25 @@
  *
  */
 
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
 
 @Component({
     selector: 'sp-edit-timestamp-property',
     templateUrl: './edit-timestamp-property.component.html',
     styleUrls: ['./edit-timestamp-property.component.scss'],
 })
-export class EditTimestampPropertyComponent {
-    @Input() cachedProperty: any;
-    @Input() showEditTimestampProperty: boolean;
+export class EditTimestampPropertyComponent implements OnInit {
+    @Input()
+    cachedProperty: any;
+    @Input()
+    showEditTimestampProperty: boolean;
 
-    private selectedTimeMultiplier;
+    selectedTimeMultiplier = 'seconds';
 
-    constructor() {
-        // Set preselected value
-        this.selectedTimeMultiplier = 'second';
+    ngOnInit(): void {
+        // Change default if multiplier is 1
+        if (this.cachedProperty.additionalMetadata.multiplier == 0) {
+            this.selectedTimeMultiplier = 'milliseconds';
+        }
     }
 }

Reply via email to