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 650e25a8d0df8247f22ce47c506118d516f0e71a
Author: Philipp Zehnder <[email protected]>
AuthorDate: Thu Jul 2 13:40:50 2020 +0200

    [STREAMPIPES-145] Add edit data type component
---
 ui/src/app/connect/connect.module.ts               |  4 +++-
 .../edit-data-type/edit-data-type.component.css    | 20 +++++++++++++++++++
 .../edit-data-type.component.html}                 | 16 +++++++--------
 .../edit-data-type.component.ts}                   | 23 ++++++++--------------
 .../edit-event-property-list.component.html        | 12 +++--------
 .../edit-event-property-list.component.ts          | 21 ++++----------------
 .../edit-event-property-primitive.component.html   | 11 ++++-------
 .../edit-event-property-primitive.component.ts     | 14 ++++++-------
 .../edit-event-property.component.html             | 19 +++++++++---------
 9 files changed, 64 insertions(+), 76 deletions(-)

diff --git a/ui/src/app/connect/connect.module.ts 
b/ui/src/app/connect/connect.module.ts
index a989b52..d7edcf6 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -94,6 +94,7 @@ import { EventPropertyRowComponent } from 
'./schema-editor/event-property-row/ev
 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';
+import { EditDataTypeComponent } from 
'./dialog/edit-data-type/edit-data-type.component';
 
 
 @NgModule({
@@ -158,7 +159,8 @@ import { EditTimestampPropertyComponent } from 
'./dialog/edit-timestamp-property
         StaticColorPickerComponent,
         PipelineElementRuntimeInfoComponent,
         UnitTransformationComponent,
-        EditTimestampPropertyComponent
+        EditTimestampPropertyComponent,
+        EditDataTypeComponent
     ],
     providers: [
         RestService,
diff --git 
a/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.css 
b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.css
new file mode 100644
index 0000000..4bfbbb7
--- /dev/null
+++ b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.css
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ *
+ */
+.doubleWidth {
+    width: 370px !important;
+}
diff --git 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
 b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.html
similarity index 69%
copy from 
ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
copy to ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.html
index 35d45e0..fd44003 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
+++ b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.html
@@ -16,12 +16,10 @@
   ~
   -->
 
-<div class="body">
-    <mat-form-field class="doubleWidth">
-        <mat-select placeholder="Runtime Type" 
[(ngModel)]="property.eventProperty.runtimeType">
-            <mat-option *ngFor="let dataType of runtimeDataTypes" 
[value]="dataType.url">
-                {{ dataType.label }}
-            </mat-option>
-        </mat-select>
-    </mat-form-field>
-</div>
\ No newline at end of file
+<mat-form-field class="doubleWidth" >
+    <mat-select placeholder="Runtime Type" 
[(ngModel)]="cachedProperty.runtimeType">
+        <mat-option *ngFor="let dataType of runtimeDataTypes" 
[value]="dataType.url">
+            {{ dataType.label }}
+        </mat-option>
+    </mat-select>
+</mat-form-field>
diff --git 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
 b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.ts
similarity index 65%
copy from 
ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
copy to ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.ts
index 24e07b4..968d182 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
+++ b/ui/src/app/connect/dialog/edit-data-type/edit-data-type.component.ts
@@ -16,30 +16,23 @@
  *
  */
 
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { EventProperty } from '../../../core-model/gen/streampipes-model';
+import { Component, Input, OnInit } from '@angular/core';
 import { DataTypesService } from '../../schema-editor/data-type.service';
 
 @Component({
-  selector: 'sp-edit-event-property-list',
-  templateUrl: './edit-event-property-list.component.html',
-  styleUrls: ['./edit-event-property-list.component.css']
+  selector: 'sp-edit-data-type',
+  templateUrl: './edit-data-type.component.html',
+  styleUrls: ['./edit-data-type.component.css']
 })
-export class EditEventPropertyListComponent implements OnInit {
-
-  constructor(private dataTypeService: DataTypesService) { }
+export class EditDataTypeComponent implements OnInit {
 
-
-  @Input() property: any;
-  @Input() index: number;
+  @Input() cachedProperty: any;
 
   runtimeDataTypes;
-
-  @Input() isEditable: boolean;
-
-  @Output() delete: EventEmitter<EventProperty> = new 
EventEmitter<EventProperty>();
+  constructor(private dataTypeService: DataTypesService) { }
 
   ngOnInit() {
     this.runtimeDataTypes = this.dataTypeService.getDataTypes();
   }
+
 }
diff --git 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
 
b/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
index 35d45e0..92c744b 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
+++ 
b/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.html
@@ -16,12 +16,6 @@
   ~
   -->
 
-<div class="body">
-    <mat-form-field class="doubleWidth">
-        <mat-select placeholder="Runtime Type" 
[(ngModel)]="property.eventProperty.runtimeType">
-            <mat-option *ngFor="let dataType of runtimeDataTypes" 
[value]="dataType.url">
-                {{ dataType.label }}
-            </mat-option>
-        </mat-select>
-    </mat-form-field>
-</div>
\ No newline at end of file
+<sp-edit-data-type
+        [cachedProperty]= "cachedProperty.eventProperty">
+</sp-edit-data-type>
diff --git 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
 
b/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
index 24e07b4..75b7e7a 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
+++ 
b/ui/src/app/connect/dialog/edit-event-property-list/edit-event-property-list.component.ts
@@ -16,30 +16,17 @@
  *
  */
 
-import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { EventProperty } from '../../../core-model/gen/streampipes-model';
-import { DataTypesService } from '../../schema-editor/data-type.service';
+import { Component, Input } from '@angular/core';
 
 @Component({
   selector: 'sp-edit-event-property-list',
   templateUrl: './edit-event-property-list.component.html',
   styleUrls: ['./edit-event-property-list.component.css']
 })
-export class EditEventPropertyListComponent implements OnInit {
+export class EditEventPropertyListComponent {
 
-  constructor(private dataTypeService: DataTypesService) { }
+  constructor() { }
 
+  @Input() cachedProperty: any;
 
-  @Input() property: any;
-  @Input() index: number;
-
-  runtimeDataTypes;
-
-  @Input() isEditable: boolean;
-
-  @Output() delete: EventEmitter<EventProperty> = new 
EventEmitter<EventProperty>();
-
-  ngOnInit() {
-    this.runtimeDataTypes = this.dataTypeService.getDataTypes();
-  }
 }
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 4b36ce2..0d2d13e 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
@@ -23,13 +23,10 @@
             showEditTimestampProperty="!isTimestampProperty">
     </sp-edit-timestamp-property>
 
-    <mat-form-field class="doubleWidth" *ngIf="!isTimestampProperty">
-        <mat-select placeholder="Runtime Type" 
[(ngModel)]="cachedProperty.runtimeType">
-            <mat-option *ngFor="let dataType of runtimeDataTypes" 
[value]="dataType.url">
-                {{ dataType.label }}
-            </mat-option>
-        </mat-select>
-    </mat-form-field>
+    <sp-edit-data-type
+            *ngIf="!isTimestampProperty"
+            [cachedProperty]= "cachedProperty">
+    </sp-edit-data-type>
 
     <sp-unit-transformation
             [cachedProperty]= "cachedProperty"
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 99ad079..fa5cbec 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
@@ -25,22 +25,20 @@ import { DataTypesService } from 
'../../schema-editor/data-type.service';
   templateUrl: './edit-event-property-primitive.component.html',
   styleUrls: ['./edit-event-property-primitive.component.css']
 })
-export class EditEventPropertyPrimitiveComponent implements OnInit {
+export class EditEventPropertyPrimitiveComponent {
 
   @Input() cachedProperty: any;
   @Input() index: number;
   @Input() isTimestampProperty: boolean;
 
-  runtimeDataTypes;
+  // runtimeDataTypes;
 
-  constructor(private formBuilder: FormBuilder,
-              private dataTypeService: DataTypesService
-              ) {
+  constructor() {
   }
 
-  ngOnInit() {
-    this.runtimeDataTypes = this.dataTypeService.getDataTypes();
-  }
+  // ngOnInit() {
+  //   this.runtimeDataTypes = this.dataTypeService.getDataTypes();
+  // }
 
   staticValueAddedByUser() {
     if 
(this.cachedProperty.elementId.startsWith('http://eventProperty.de/staticValue/'))
 {
diff --git 
a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
 
b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
index 6e3cef2..59ed3c6 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
+++ 
b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
@@ -54,16 +54,15 @@
     </div>
   </form>
 
-  <div *ngIf="isEventPropertyPrimitive">
-    <sp-edit-event-property-primitive
-            [isTimestampProperty]="isTimestampProperty"
-            [cachedProperty]="cachedProperty">
-    </sp-edit-event-property-primitive>
-  </div>
-  <div *ngIf="isEventPropertyList">
-    <sp-edit-event-property-list [isEditable]="isEditable" 
[property]="cachedProperty">
-    </sp-edit-event-property-list>
-  </div>
+  <sp-edit-event-property-primitive
+          *ngIf="isEventPropertyPrimitive"
+          [isTimestampProperty]="isTimestampProperty"
+          [cachedProperty]="cachedProperty">
+  </sp-edit-event-property-primitive>
+  <sp-edit-event-property-list
+          *ngIf="isEventPropertyList"
+          [property]="cachedProperty">
+  </sp-edit-event-property-list>
 
 </mat-dialog-content>
 

Reply via email to