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 2022/03/27 10:01:15 UTC
[incubator-streampipes] branch dev updated: [hotfix] Auto-select first timestamp in create adapter view
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 3f36d9c [hotfix] Auto-select first timestamp in create adapter view
new a15394d Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
3f36d9c is described below
commit 3f36d9cbb79fce8543edb4603950f8ec94a00b0a
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Mar 27 12:00:59 2022 +0200
[hotfix] Auto-select first timestamp in create adapter view
---
.../start-adapter-configuration.component.html | 8 +++++---
.../start-adapter-configuration.component.ts | 21 ++++++++++++++++-----
ui/src/app/connect/filter/timestamp.pipe.ts | 10 ++--------
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.html b/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.html
index 055729c..f5fabf7 100644
--- a/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.html
+++ b/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.html
@@ -24,8 +24,9 @@
<div class="sp-blue-border padding" style="padding: 15px; margin-bottom: 2%;">
<div fxLayoutAlign="center" fxLayout="column" fxFlex="100">
<mat-form-field color="accent">
- <input matInput id="input-AdapterName" [ngModelOptions]="{standalone: true}" placeholder="Adapter Name"
- [(ngModel)]="adapterDescription.name" data-cy="sp-adapter-name">
+ <input formControlName="adapterName"
+ matInput id="input-AdapterName" placeholder="Adapter Name"
+ data-cy="sp-adapter-name" required>
</mat-form-field>
<mat-form-field color="accent">
<input matInput id="input-AdapterDescription" [ngModelOptions]="{standalone: true}"
@@ -66,6 +67,7 @@
<!-- Start pipeline template to store raw events in data lake -->
<mat-checkbox [(ngModel)]="saveInDataLake"
+ (change)="findDefaultTimestamp($event)"
[ngModelOptions]="{standalone: true}"
data-cy="sp-store-in-datalake">
Store in Datalake
@@ -89,7 +91,7 @@
<button class="mat-basic" mat-raised-button (click)="removeSelection()">Cancel</button>
<button style="margin-left:10px;" class="mat-basic stepper-button" mat-raised-button (click)="goBack()">Back
</button>
- <button [disabled]="startAdapterSettingsFormValid" mat-raised-button id="button-startAdapter"
+ <button [disabled]="!(startAdapterSettingsFormValid)" mat-raised-button id="button-startAdapter"
color="accent" (click)="startAdapter()" mat-button style="margin-left:10px;">
Start Adapter
</button>
diff --git a/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.ts b/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.ts
index 49bb90b..211c41d 100644
--- a/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.ts
+++ b/ui/src/app/connect/components/start-adapter-configuration/start-adapter-configuration.component.ts
@@ -26,13 +26,15 @@ import {
RemoveDuplicatesTransformationRuleDescription,
SpecificAdapterSetDescription
} from '@streampipes/platform-services';
-import { FormBuilder, FormGroup } from '@angular/forms';
+import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { MatStepper } from '@angular/material/stepper';
import { AdapterStartedDialog } from '../../dialog/adapter-started/adapter-started-dialog.component';
import { PanelType } from '../../../core-ui/dialog/base-dialog/base-dialog.model';
import { ShepherdService } from '../../../services/tour/shepherd.service';
import { DialogService } from '../../../core-ui/dialog/base-dialog/base-dialog.service';
import { ConnectService } from '../../services/connect.service';
+import { TimestampPipe } from "../../filter/timestamp.pipe";
+import { MatCheckboxChange } from "@angular/material/checkbox";
@Component({
selector: 'sp-start-adapter-configuration',
@@ -90,20 +92,29 @@ export class StartAdapterConfigurationComponent implements OnInit {
private dialogService: DialogService,
private shepherdService: ShepherdService,
private connectService: ConnectService,
- private _formBuilder: FormBuilder) {
+ private _formBuilder: FormBuilder,
+ private timestampPipe: TimestampPipe) {
}
ngOnInit(): void {
// initialize form for validation
this.startAdapterForm = this._formBuilder.group({});
+ this.startAdapterForm.addControl('adapterName', new FormControl(this.adapterDescription.name, Validators.required));
+ this.startAdapterForm.valueChanges.subscribe(v => this.adapterDescription.name = v.adapterName);
this.startAdapterForm.statusChanges.subscribe((status) => {
this.startAdapterSettingsFormValid = this.startAdapterForm.valid;
});
+ }
- if (this.adapterDescription instanceof GenericAdapterSetDescription ||
- this.adapterDescription instanceof SpecificAdapterSetDescription) {
+ findDefaultTimestamp(event: MatCheckboxChange) {
+ if (event.checked) {
+ const timestampFields = this.timestampPipe.transform(this.eventSchema.eventProperties);
+ if (timestampFields.length > 0) {
+ this.dataLakeTimestampField = timestampFields[0].runtimeName;
+ }
+ } else {
+ this.dataLakeTimestampField = '';
}
-
}
public triggerDialog() {
diff --git a/ui/src/app/connect/filter/timestamp.pipe.ts b/ui/src/app/connect/filter/timestamp.pipe.ts
index cc30e8b..bb9067b 100644
--- a/ui/src/app/connect/filter/timestamp.pipe.ts
+++ b/ui/src/app/connect/filter/timestamp.pipe.ts
@@ -24,13 +24,7 @@ import { EventPropertyUnion } from '@streampipes/platform-services';
pure: false
})
export class TimestampPipe implements PipeTransform {
- transform(items: EventPropertyUnion[]): any {
- return items.filter(item => {
- if (item.domainProperties.some(dp => dp === 'http://schema.org/DateTime')) {
- return true;
- } else {
- return false;
- }
- });
+ transform(items: EventPropertyUnion[]): EventPropertyUnion[] {
+ return items.filter(item => item.domainProperties.some(dp => dp === 'http://schema.org/DateTime'));
}
}