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 2020/07/02 09:27:25 UTC
[incubator-streampipes] 01/03: [STREAMPIPES-145] Create edit
timestamp component
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-145
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit d0d3bd4ba9c2855d50988dc42bee49c860a9baa3
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Jul 2 09:40:00 2020 +0200
[STREAMPIPES-145] Create edit timestamp component
---
.../Apache_StreamPipes___Connect_Master.xml | 11 -----
ui/src/app/connect/connect.module.ts | 4 +-
ui/src/app/connect/connect.service.ts | 4 +-
.../edit-event-property-primitive.component.html | 34 ++-------------
.../edit-event-property-primitive.component.ts | 13 +-----
.../edit-timestamp-property.component.css | 44 ++++++++++++++++++++
.../edit-timestamp-property.component.html | 48 ++++++++++++++++++++++
.../edit-timestamp-property.component.ts} | 10 +++--
8 files changed, 108 insertions(+), 60 deletions(-)
diff --git a/.idea/runConfigurations/Apache_StreamPipes___Connect_Master.xml b/.idea/runConfigurations/Apache_StreamPipes___Connect_Master.xml
index f053ace..f1b9be8 100644
--- a/.idea/runConfigurations/Apache_StreamPipes___Connect_Master.xml
+++ b/.idea/runConfigurations/Apache_StreamPipes___Connect_Master.xml
@@ -8,17 +8,6 @@
</envs>
<option name="MAIN_CLASS_NAME" value="org.apache.streampipes.connect.container.master.init.AdapterMasterContainer" />
<module name="streampipes-connect-container-master" />
- <extension name="net.ashald.envfile">
- <option name="IS_ENABLED" value="true" />
- <option name="IS_SUBST" value="false" />
- <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
- <option name="IS_IGNORE_MISSING_FILES" value="false" />
- <option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
- <ENTRIES>
- <ENTRY IS_ENABLED="true" PARSER="runconfig" />
- <ENTRY IS_ENABLED="true" PARSER="env" PATH="streampipes-connect-container-master/development/env" />
- </ENTRIES>
- </extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index 99e5465..a989b52 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -93,6 +93,7 @@ import { PipelineElementRuntimeInfoComponent } from './new-adapter/component/run
import { EventPropertyRowComponent } from './schema-editor/event-property-row/event-property-row.component';
import { EventSchemaPreviewComponent } from './schema-editor/event-schema-preview/event-schema-preview.component';
import { StaticColorPickerComponent } from './static-properties/static-color-picker/static-color-picker.component';
+import { EditTimestampPropertyComponent } from './dialog/edit-timestamp-property/edit-timestamp-property.component';
@NgModule({
@@ -156,7 +157,8 @@ import { StaticColorPickerComponent } from './static-properties/static-color-pic
StaticCollectionComponent,
StaticColorPickerComponent,
PipelineElementRuntimeInfoComponent,
- UnitTransformationComponent
+ UnitTransformationComponent,
+ EditTimestampPropertyComponent
],
providers: [
RestService,
diff --git a/ui/src/app/connect/connect.service.ts b/ui/src/app/connect/connect.service.ts
index 87aba2d..9f3d03e 100644
--- a/ui/src/app/connect/connect.service.ts
+++ b/ui/src/app/connect/connect.service.ts
@@ -16,14 +16,14 @@
*
*/
-import {Injectable} from '@angular/core';
+import { Injectable } from '@angular/core';
import {
AdapterDescription,
GenericAdapterSetDescription,
GenericAdapterStreamDescription,
SpecificAdapterSetDescription,
SpecificAdapterStreamDescription
-} from "../core-model/gen/streampipes-model";
+} from '../core-model/gen/streampipes-model';
@Injectable()
export class ConnectService {
diff --git a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.html b/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.html
index 9a08e38..32342a9 100644
--- a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.html
+++ b/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.html
@@ -31,36 +31,10 @@
[showUnitTransformation]="!isTimestampProperty">
</sp-unit-transformation>
- <div fxLayout="row" fxLayoutAlign="start" *ngIf="isTimestampProperty">
- <div class="form-group" fxFlexAlign="center">
- <mat-form-field [class.example-full-width]="cachedProperty.timestampTransformationMode !== undefined "
- style="margin-right: 10px" [class.doubleWidth]="cachedProperty.timestampTransformationMode === undefined"
- [class.aThirdWidth]="selectedTimeMultiplier === 'custom' && cachedProperty.timestampTransformationMode === 'timeUnit'">
- <mat-select placeholder="Timestamp converter (unix timestamp)"
- [(value)]="cachedProperty.timestampTransformationMode">
- <mat-option>None</mat-option>
- <mat-option value="formatString">Date String</mat-option>
- <mat-option value="timeUnit">Date Number</mat-option>
- </mat-select>
- </mat-form-field>
- </div>
- <div class="form-group" fxFlexAlign="center">
- <mat-form-field *ngIf="cachedProperty.timestampTransformationMode === 'formatString'">
- <input matInput placeholder="E.g. yyyy-MM-dd HH:mm:ss.SSSZ"
- [(ngModel)]="cachedProperty.timestampTransformationFormatString">
- </mat-form-field>
- <mat-form-field *ngIf="cachedProperty.timestampTransformationMode === 'timeUnit'"
- [class.example-full-width]="selectedTimeMultiplier !== 'custom'"
- [class.aThirdWidth]="selectedTimeMultiplier === 'custom'">
- <mat-select placeholder="Current time unit" [(value)]="selectedTimeMultiplier">
- <mat-option value="milliseconds" (click)="cachedProperty.timestampTransformationMultiplier = 0">
- Milliseconds</mat-option>
- <mat-option value="second" (click)="cachedProperty.timestampTransformationMultiplier = 1000">Seconds
- </mat-option>
- </mat-select>
- </mat-form-field>
- </div>
- </div>
+ <sp-edit-timestamp-property
+ [cachedProperty]= "cachedProperty"
+ showEditTimestampProperty="!isTimestampProperty">
+ </sp-edit-timestamp-property>
<mat-form-field *ngIf="staticValueAddedByUser()" class="doubleWidth">
<input matInput placeholder="Static Value" name="static_value" id="static_value" [matAutocomplete]="auto"
diff --git a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts b/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts
index 3d340a8..3ba4fa5 100644
--- a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts
+++ b/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts
@@ -18,13 +18,9 @@
import { Component, DoCheck, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormBuilder } from '@angular/forms';
-import { Subscription } from 'rxjs';
import { EventProperty } from '../../../core-model/gen/streampipes-model';
-import { ShepherdService } from '../../../services/tour/shepherd.service';
-import { RestService } from '../../rest.service';
import { DataTypesService } from '../../schema-editor/data-type.service';
import { DomainPropertyProbabilityList } from '../../schema-editor/model/DomainPropertyProbabilityList';
-import { UnitProviderService } from '../../schema-editor/unit-provider.service';
@Component({
selector: 'sp-edit-event-property-primitive',
@@ -50,13 +46,8 @@ export class EditEventPropertyPrimitiveComponent implements OnInit, DoCheck {
private selectedTimeMultiplier;
isTimestampProperty: boolean;
-
-
constructor(private formBuilder: FormBuilder,
- private dataTypeService: DataTypesService,
- private ShepherdService: ShepherdService,
- private restService: RestService,
- private unitProviderService: UnitProviderService) {
+ private dataTypeService: DataTypesService) {
this.dataTypeService = dataTypeService;
this.runtimeDataTypes = this.dataTypeService.getDataTypes();
@@ -66,8 +57,6 @@ export class EditEventPropertyPrimitiveComponent implements OnInit, DoCheck {
}
protected open = false;
- subscription: Subscription;
-
ngOnInit() {
this.isTimestampProperty = this.cachedProperty.domainProperties.some(dp => dp === this.soTimestamp);
diff --git a/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.css b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.css
new file mode 100644
index 0000000..1c1657f
--- /dev/null
+++ b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.css
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+.header {
+ border-left: thin;
+}
+.container {
+ border: dotted;
+}
+.doubleWidth {
+ width: 370px !important;
+}
+.divBorder {
+ /* margin: auto; */
+ width: 380px;
+ /* border: solid #ccc 2px;
+ border-radius: 5px; */
+}
+
+.aThirdWidth {
+ width: 120px !important;
+}
+.onhover:hover {
+ background-color: darkgrey;
+}
+
+::ng-deep .cdk-overlay-pane {
+ width: auto !important;
+}
\ No newline at end of file
diff --git a/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.html b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.html
new file mode 100644
index 0000000..39327e1
--- /dev/null
+++ b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.html
@@ -0,0 +1,48 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ -->
+
+<div fxLayout="row" fxLayoutAlign="start" *ngIf="isTimestampProperty">
+ <div class="form-group" fxFlexAlign="center">
+ <mat-form-field [class.example-full-width]="cachedProperty.timestampTransformationMode !== undefined "
+ style="margin-right: 10px" [class.doubleWidth]="cachedProperty.timestampTransformationMode === undefined"
+ [class.aThirdWidth]="selectedTimeMultiplier === 'custom' && cachedProperty.timestampTransformationMode === 'timeUnit'">
+ <mat-select placeholder="Timestamp converter (unix timestamp)"
+ [(value)]="cachedProperty.timestampTransformationMode">
+ <mat-option>None</mat-option>
+ <mat-option value="formatString">Date String</mat-option>
+ <mat-option value="timeUnit">Date Number</mat-option>
+ </mat-select>
+ </mat-form-field>
+ </div>
+ <div class="form-group" fxFlexAlign="center">
+ <mat-form-field *ngIf="cachedProperty.timestampTransformationMode === 'formatString'">
+ <input matInput placeholder="E.g. yyyy-MM-dd HH:mm:ss.SSSZ"
+ [(ngModel)]="cachedProperty.timestampTransformationFormatString">
+ </mat-form-field>
+ <mat-form-field *ngIf="cachedProperty.timestampTransformationMode === 'timeUnit'"
+ [class.example-full-width]="selectedTimeMultiplier !== 'custom'"
+ [class.aThirdWidth]="selectedTimeMultiplier === 'custom'">
+ <mat-select placeholder="Current time unit" [(value)]="selectedTimeMultiplier">
+ <mat-option value="milliseconds" (click)="cachedProperty.timestampTransformationMultiplier = 0">
+ Milliseconds</mat-option>
+ <mat-option value="second" (click)="cachedProperty.timestampTransformationMultiplier = 1000">Seconds
+ </mat-option>
+ </mat-select>
+ </mat-form-field>
+ </div>
+</div>
diff --git a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.ts
similarity index 91%
copy from ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts
copy to ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.ts
index 3d340a8..8e0b46b 100644
--- a/ui/src/app/connect/dialog/edit-event-property-primitive/edit-event-property-primitive.component.ts
+++ b/ui/src/app/connect/dialog/edit-timestamp-property/edit-timestamp-property.component.ts
@@ -27,15 +27,17 @@ import { DomainPropertyProbabilityList } from '../../schema-editor/model/DomainP
import { UnitProviderService } from '../../schema-editor/unit-provider.service';
@Component({
- selector: 'sp-edit-event-property-primitive',
- templateUrl: './edit-event-property-primitive.component.html',
- styleUrls: ['./edit-event-property-primitive.component.css']
+ selector: 'sp-edit-timestamp-property',
+ templateUrl: './edit-timestamp-property.component.html',
+ styleUrls: ['./edit-timestamp-property.component.css']
})
-export class EditEventPropertyPrimitiveComponent implements OnInit, DoCheck {
+export class EditTimestampPropertyComponent implements OnInit, DoCheck {
soTimestamp = 'http://schema.org/DateTime';
@Input() cachedProperty: any;
+ @Input() showEditTimestampProperty: boolean;
+
@Input() index: number;
@Input() domainPropertyGuess: DomainPropertyProbabilityList;