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 2021/06/11 21:21:52 UTC
[incubator-streampipes] branch STREAMPIPES-380 created (now 46bf66f)
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a change to branch STREAMPIPES-380
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git.
at 46bf66f Start refactoring connect ui code
This branch includes the following new commits:
new 46bf66f Start refactoring connect ui code
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-streampipes] 01/01: Start refactoring connect ui code
Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch STREAMPIPES-380
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit 46bf66f27c38b7020a21f7a52fbb0f2f9d4042db
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Jun 11 23:21:17 2021 +0200
Start refactoring connect ui code
---
.../format-component/format.component.ts | 15 +++++-----
ui/src/app/connect/components/format-form/csv.ts | 34 ----------------------
.../format-form/format-form.component.html | 8 +++--
.../format-form/format-form.component.ts | 20 ++++++-------
.../app/connect/components/format-form/format.ts | 25 ----------------
ui/src/app/connect/components/format-form/json.ts | 31 --------------------
.../format-list.component.html | 6 ++--
.../format-list-component/format-list.component.ts | 22 ++++++--------
.../new-adapter/new-adapter.component.html | 7 +++--
9 files changed, 39 insertions(+), 129 deletions(-)
diff --git a/ui/src/app/connect/components/format-component/format.component.ts b/ui/src/app/connect/components/format-component/format.component.ts
index a93345b..47e7716 100644
--- a/ui/src/app/connect/components/format-component/format.component.ts
+++ b/ui/src/app/connect/components/format-component/format.component.ts
@@ -16,12 +16,12 @@
*
*/
-import {Component, EventEmitter, Input, Output} from '@angular/core';
-import {ShepherdService} from '../../../services/tour/shepherd.service';
-import {FormatDescription} from "../../../core-model/gen/streampipes-model";
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { ShepherdService } from '../../../services/tour/shepherd.service';
+import { FormatDescription } from '../../../core-model/gen/streampipes-model';
@Component({
- selector: 'app-format',
+ selector: 'sp-format',
templateUrl: './format.component.html',
styleUrls: ['./format.component.css'],
})
@@ -37,9 +37,9 @@ export class FormatComponent {
@Output()
selectedFormatEmitter = new EventEmitter();
- hasConfig: Boolean;
+ hasConfig: boolean;
- constructor(private ShepherdService: ShepherdService) {
+ constructor(private shepherdService: ShepherdService) {
this.hasConfig = true;
}
@@ -47,7 +47,7 @@ export class FormatComponent {
this.selectedFormat = this.format;
this.selectedFormatEmitter.emit(this.selectedFormat);
- this.ShepherdService.trigger("select-" + this.selectedFormat.name.toLocaleLowerCase());
+ this.shepherdService.trigger('select-' + this.selectedFormat.name.toLocaleLowerCase());
}
@@ -68,5 +68,4 @@ export class FormatComponent {
return this.selectedFormat.name === this.format.name;
}
}
- ngOnInit() {}
}
diff --git a/ui/src/app/connect/components/format-form/csv.ts b/ui/src/app/connect/components/format-form/csv.ts
deleted file mode 100644
index 80eda57..0000000
--- a/ui/src/app/connect/components/format-form/csv.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- *
- */
-
-import {Format} from './format';
-
-export class Csv extends Format {
-
- public properties: {offset: number, delimiter: String} = {'offset': 0, 'delimiter': ','};
- constructor(
- public delimiter: string,
- public offset: number,
- public name: string,
- ) {
- super('org.apache.streampipes.streamconnect.model.adapter.CsvFormat');
- this.properties.delimiter = delimiter;
- this.properties.offset = offset;
- }
-
-}
diff --git a/ui/src/app/connect/components/format-form/format-form.component.html b/ui/src/app/connect/components/format-form/format-form.component.html
index 2551f13..dfb6922 100644
--- a/ui/src/app/connect/components/format-form/format-form.component.html
+++ b/ui/src/app/connect/components/format-form/format-form.component.html
@@ -16,7 +16,11 @@
~
-->
-<app-format-list [allFormats]="allFormats" [(selectedFormat)]="selectedFormat" (selectedFormatEmitter)="formatSelected($event)" (validateEmitter)="validateAll($event)">
-</app-format-list>
+<sp-format-list
+ [allFormats]="allFormats"
+ [selectedFormat]="selectedFormat"
+ (selectedFormatEmitter)="formatSelected($event)"
+ (validateEmitter)="validateAll($event)">
+</sp-format-list>
diff --git a/ui/src/app/connect/components/format-form/format-form.component.ts b/ui/src/app/connect/components/format-form/format-form.component.ts
index b361564..6cea4ea 100644
--- a/ui/src/app/connect/components/format-form/format-form.component.ts
+++ b/ui/src/app/connect/components/format-form/format-form.component.ts
@@ -16,12 +16,11 @@
*
*/
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {isUndefined} from 'util';
-import {FormatDescription} from "../../../core-model/gen/streampipes-model";
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { FormatDescription } from '../../../core-model/gen/streampipes-model';
@Component({
- selector: 'app-format-form',
+ selector: 'sp-format-form',
templateUrl: './format-form.component.html',
styleUrls: ['./format-form.component.css']
})
@@ -30,18 +29,18 @@ export class FormatFormComponent implements OnInit {
@Input() selectedFormat: FormatDescription;
@Output() selectedFormatChange = new EventEmitter<FormatDescription>();
- @Output() inputValueChanged = new EventEmitter<Boolean>();
+ @Output() inputValueChanged = new EventEmitter<boolean>();
@Output() selectedFormatEmitter = new EventEmitter();
@Input() allFormats: FormatDescription[];
- showStaticProperty: Boolean[] = [false]
- hasInput: Boolean[] = [false];
+ showStaticProperty: boolean[] = [false]
+ hasInput: boolean[] = [false];
constructor() {
}
isSelected(f: FormatDescription): boolean {
- if (isUndefined(this.selectedFormat)) {
+ if (this.selectedFormat === undefined) {
return false;
} else {
this.selectedFormatChange.emit(this.selectedFormat);
@@ -49,13 +48,12 @@ export class FormatFormComponent implements OnInit {
}
}
-
ngOnInit() {
- var selectedFormat = this.selectedFormat;
+ const selectedFormat = this.selectedFormat;
setTimeout(() => {
for (var i = 0; i < this.allFormats.length ; i++) {
- if (selectedFormat && this.allFormats[i].name == selectedFormat.name) {
+ if (selectedFormat && this.allFormats[i].name === selectedFormat.name) {
this.showStaticProperty.push(true);
this.hasInput.push(true);
} else {
diff --git a/ui/src/app/connect/components/format-form/format.ts b/ui/src/app/connect/components/format-form/format.ts
deleted file mode 100644
index 875fddc..0000000
--- a/ui/src/app/connect/components/format-form/format.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- *
- */
-
-export class Format {
-
- constructor(
- public type: string,
- ) {}
-
-}
diff --git a/ui/src/app/connect/components/format-form/json.ts b/ui/src/app/connect/components/format-form/json.ts
deleted file mode 100644
index cd54dca..0000000
--- a/ui/src/app/connect/components/format-form/json.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- *
- */
-
-import {Format} from './format';
-
-export class Json extends Format {
-
- public properties: {key: String} = {'key': ''};
- constructor(
- public key: string,
- public name: string,
- ) {
- super('org.apache.streampipes.streamconnect.model.adapter.JsonFormat');
- this.properties.key = key;
- }
-}
diff --git a/ui/src/app/connect/components/format-list-component/format-list.component.html b/ui/src/app/connect/components/format-list-component/format-list.component.html
index b178584..a7d441b 100644
--- a/ui/src/app/connect/components/format-list-component/format-list.component.html
+++ b/ui/src/app/connect/components/format-list-component/format-list.component.html
@@ -18,10 +18,10 @@
<div fxLayout="row wrap" fxLayoutAlign="start stretch">
<div fxFlex="33" *ngFor="let format of allFormats">
- <app-format [format]="format" (validateEmitter)="validateAll($event)"
+ <sp-format [format]="format" (validateEmitter)="validateAll($event)"
(editableEmitter)="formatEditable($event)"
- [(selectedFormat)]="selectedFormat"
+ [selectedFormat]="selectedFormat"
(selectedFormatEmitter)="formatSelected($event)">
- </app-format>
+ </sp-format>
</div>
</div>
\ No newline at end of file
diff --git a/ui/src/app/connect/components/format-list-component/format-list.component.ts b/ui/src/app/connect/components/format-list-component/format-list.component.ts
index 549a2bf..6ad0c35 100644
--- a/ui/src/app/connect/components/format-list-component/format-list.component.ts
+++ b/ui/src/app/connect/components/format-list-component/format-list.component.ts
@@ -16,44 +16,40 @@
*
*/
-import {Component, EventEmitter, Input, Output} from '@angular/core';
-import {FormatDescription} from "../../../core-model/gen/streampipes-model";
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { FormatDescription } from '../../../core-model/gen/streampipes-model';
@Component({
- selector: 'app-format-list',
+ selector: 'sp-format-list',
templateUrl: './format-list.component.html',
styleUrls: ['./format-list.component.css']
})
export class FormatListComponent {
+
@Input() selectedFormat: FormatDescription;
- @Input() allFormats: FormatDescription[];
+ @Input() allFormats: FormatDescription[];
@Output() validateEmitter = new EventEmitter();
@Output() selectedFormatEmitter = new EventEmitter();
constructor() {
-
}
- formatEditable(selectedFormat) {
+ formatEditable(selectedFormat) {
this.allFormats.forEach(format => {
- if(format!=selectedFormat){
+ if (format !== selectedFormat) {
(format as any).edit = false;
}
});
-
}
formatSelected(selectedFormat) {
this.selectedFormat = selectedFormat;
- this.selectedFormatEmitter.emit(this.selectedFormat)
+ this.selectedFormatEmitter.emit(this.selectedFormat);
}
validateAll(allValid) {
this.validateEmitter.emit(allValid);
}
- ngOnInit(){
- }
-
- }
\ No newline at end of file
+}
diff --git a/ui/src/app/connect/components/new-adapter/new-adapter.component.html b/ui/src/app/connect/components/new-adapter/new-adapter.component.html
index d82ed2e..4be9978 100644
--- a/ui/src/app/connect/components/new-adapter/new-adapter.component.html
+++ b/ui/src/app/connect/components/new-adapter/new-adapter.component.html
@@ -97,8 +97,11 @@
<h4>Select format</h4>
</div>
<div class="sp-blue-border padding">
- <app-format-form fxFlex="100" (selectedFormatEmitter)="formatSelected($event)"
- [(selectedFormat)]="adapter.formatDescription" [allFormats]="allFormats"></app-format-form>
+ <sp-format-form fxFlex="100"
+ (selectedFormatEmitter)="formatSelected($event)"
+ [(selectedFormat)]="adapter.formatDescription"
+ [allFormats]="allFormats">
+ </sp-format-form>
</div>
<div class="assemblyOptions sp-blue-bg">