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 2022/10/12 14:36:00 UTC

[incubator-streampipes] branch STREAMPIPES-597 updated: [STREAMPIPES-597] Remove legacy code

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

zehnder pushed a commit to branch STREAMPIPES-597
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/STREAMPIPES-597 by this push:
     new 86a9a82c5 [STREAMPIPES-597] Remove legacy code
86a9a82c5 is described below

commit 86a9a82c5c2fefe06670578310b17207df4d7e05
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Wed Oct 12 16:35:51 2022 +0200

    [STREAMPIPES-597] Remove legacy code
---
 .../adapter-configuration.component.ts             |  9 +--
 .../adapter-description.component.ts               | 31 +----------
 ui/src/app/connect/connect.module.ts               |  4 --
 .../adapter-export-dialog.component.scss           | 31 -----------
 .../adapter-export-dialog.component.ts             | 54 ------------------
 .../adapter-export/adapter-export-dialog.html      | 34 ------------
 .../adapter-upload-dialog.component.scss           | 20 -------
 .../adapter-upload-dialog.component.ts             | 64 ----------------------
 .../adapter-upload/adapter-upload-dialog.html      | 47 ----------------
 ui/src/app/connect/services/rest.service.ts        |  2 +-
 10 files changed, 6 insertions(+), 290 deletions(-)

diff --git a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
index 49e4e2ee9..b840e3b2f 100644
--- a/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/adapter-configuration.component.ts
@@ -29,7 +29,6 @@ import {
 } from '@streampipes/platform-services';
 import { ShepherdService } from '../../../services/tour/shepherd.service';
 import { ConnectService } from '../../services/connect.service';
-import { ConfigurationInfo } from '../../model/ConfigurationInfo';
 import { EventSchemaComponent } from './schema-editor/event-schema/event-schema.component';
 import { TransformationRuleService } from '../../services/transformation-rule.service';
 import { Router } from '@angular/router';
@@ -53,7 +52,6 @@ export class AdapterConfigurationComponent implements OnInit {
   isDataStreamDescription = true;
   isGenericAdapter = false;
 
-
   myStepper: MatStepper;
   parentForm: FormGroup;
 
@@ -62,8 +60,6 @@ export class AdapterConfigurationComponent implements OnInit {
 
   private eventSchemaComponent: EventSchemaComponent;
 
-  completedStaticProperty: ConfigurationInfo;
-
   constructor(
     private transformationRuleService: TransformationRuleService,
     private shepherdService: ShepherdService,
@@ -84,7 +80,7 @@ export class AdapterConfigurationComponent implements OnInit {
   }
 
   removeSelection() {
-    this.router.navigate(['connect', 'create']);
+    this.router.navigate(['connect', 'create']).then();
   }
 
   clickProtocolSettingsNextButton() {
@@ -134,7 +130,6 @@ export class AdapterConfigurationComponent implements OnInit {
       console.log('Error: Adapter type is unknown');
     }
 
-
     this.transformationRuleService.setOldEventSchema(this.oldEventSchema);
 
     this.transformationRuleService.setNewEventSchema(this.eventSchema);
@@ -150,7 +145,7 @@ export class AdapterConfigurationComponent implements OnInit {
   }
 
   public adapterWasStarted() {
-    this.router.navigate(['connect']);
+    this.router.navigate(['connect']).then();
   }
 
   @ViewChild(EventSchemaComponent) set schemaComponent(eventSchemaComponent: EventSchemaComponent) {
diff --git a/ui/src/app/connect/components/data-marketplace/adapter-description/adapter-description.component.ts b/ui/src/app/connect/components/data-marketplace/adapter-description/adapter-description.component.ts
index c65fa3b09..b17d6f24e 100644
--- a/ui/src/app/connect/components/data-marketplace/adapter-description/adapter-description.component.ts
+++ b/ui/src/app/connect/components/data-marketplace/adapter-description/adapter-description.component.ts
@@ -18,10 +18,9 @@
 
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { ConnectService } from '../../../services/connect.service';
-import { AdapterExportDialog } from '../../../dialog/adapter-export/adapter-export-dialog.component';
 import { MatDialog } from '@angular/material/dialog';
 import { AdapterDescription, AdapterService } from '@streampipes/platform-services';
-import { DialogService, PanelType } from '@streampipes/shared-ui';
+import { DialogService } from '@streampipes/shared-ui';
 import { MatSnackBar } from '@angular/material/snack-bar';
 
 @Component({
@@ -40,7 +39,6 @@ export class AdapterDescriptionComponent implements OnInit {
   @Output()
   createTemplateEmitter: EventEmitter<AdapterDescription> = new EventEmitter<AdapterDescription>();
 
-  adapterToDelete: string;
   deleting = false;
   className = '';
   isDataSetDescription = false;
@@ -70,25 +68,6 @@ export class AdapterDescriptionComponent implements OnInit {
     return this.connectService.isGenericDescription(this.adapter);
   }
 
-  isSpecificDescription(): boolean {
-    return this.connectService.isSpecificDescription(this.adapter);
-  }
-
-  shareAdapterTemplate(adapter: AdapterDescription): void {
-    this.dialogService.open(AdapterExportDialog, {
-      panelType: PanelType.STANDARD_PANEL,
-      title: 'Export adapter template',
-      width: '50vw',
-      data: {
-        'adapter': adapter
-      }
-    });
-  }
-
-  createTemplate(adapter: AdapterDescription): void {
-    this.createTemplateEmitter.emit(adapter);
-  }
-
   getClassName() {
     let className = this.isRunningAdapter ? 'adapter-box' : 'adapter-description-box';
 
@@ -101,10 +80,6 @@ export class AdapterDescriptionComponent implements OnInit {
     return className;
   }
 
-  deleteInProgress(adapterCouchDbId) {
-    return this.deleting && (adapterCouchDbId === this.adapterToDelete);
-  }
-
   getIconUrl() {
     // TODO Use "this.adapter.includesAssets" if boolean demoralizing is working
     if (this.adapter.includedAssets.length > 0) {
@@ -115,9 +90,9 @@ export class AdapterDescriptionComponent implements OnInit {
   }
 
   removeAdapter(): void {
-    this.dataMarketplaceService.deleteAdapterDescription(this.adapter.elementId).subscribe(res => {
+    this.dataMarketplaceService.deleteAdapterDescription(this.adapter.elementId).subscribe(_ => {
       this.updateAdapterEmitter.emit();
-    }, error => {
+    }, _ => {
       this._snackBar.open('Cannot delete an adapter which has an active instance running.');
     });
   }
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index dd898403e..600e635cb 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -45,8 +45,6 @@ import { UnitProviderService } from './services/unit-provider.service';
 
 
 import { AdapterFilterPipe } from './filter/adapter-filter.pipe';
-import { AdapterExportDialog } from './dialog/adapter-export/adapter-export-dialog.component';
-import { AdapterUploadDialog } from './dialog/adapter-upload/adapter-upload-dialog.component';
 import { TimestampPipe } from './filter/timestamp.pipe';
 import { MatChipsModule } from '@angular/material/chips';
 import { MatSliderModule } from '@angular/material/slider';
@@ -165,9 +163,7 @@ import { EditAdapterComponent } from './components/edit-adapter/edit-adapter.com
   ],
   declarations: [
     AdapterDescriptionComponent,
-    AdapterExportDialog,
     AdapterStartedDialog,
-    AdapterUploadDialog,
     DataMarketplaceComponent,
     DeleteAdapterDialogComponent,
     EventSchemaComponent,
diff --git a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.scss b/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.scss
deleted file mode 100644
index 4e3de8e35..000000000
--- a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.scss
+++ /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 'src/scss/sp/sp-dialog';
-
-.code-container {
-    position: relative;
-}
-
-.download-icon {
-    cursor: pointer;
-    position: absolute;
-    top: 8px;
-    right: 16px;
-    font-size: 18px;
-}
\ No newline at end of file
diff --git a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.ts b/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.ts
deleted file mode 100644
index c263bfaff..000000000
--- a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.component.ts
+++ /dev/null
@@ -1,54 +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 { Component, Input } from '@angular/core';
-import { AdapterDescriptionUnion } from '@streampipes/platform-services';
-import { DialogRef } from '@streampipes/shared-ui';
-
-@Component({
-    selector: 'sp-dialog-adapter-started-dialog',
-    templateUrl: './adapter-export-dialog.html',
-    styleUrls: ['./adapter-export-dialog.component.scss'],
-})
-export class AdapterExportDialog {
-
-  @Input()
-  adapter: AdapterDescriptionUnion;
-
-    constructor(
-        private dialogRef: DialogRef<AdapterExportDialog>) {
-
-    }
-
-    ngOnInit() {
-        delete this.adapter['userName'];
-    }
-
-    download() {
-            const adapterDescriptionAsList = [this.adapter];
-            const data = 'data:application/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(adapterDescriptionAsList, null, 2));
-            const downloader = document.createElement('a');
-            downloader.setAttribute('href', data);
-            downloader.setAttribute('download', this.adapter.name + '-adapter-template.json');
-            downloader.click();
-    }
-
-    onCloseConfirm() {
-        this.dialogRef.close();
-    }
-}
diff --git a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.html b/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.html
deleted file mode 100644
index d3622b4df..000000000
--- a/ui/src/app/connect/dialog/adapter-export/adapter-export-dialog.html
+++ /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.
-  ~
-  -->
-
-<div class="sp-dialog-container">
-    <div class="sp-dialog-content p-15">
-        <pre class="code-container">
-           <div>{{adapter | json}}</div>
-        </pre>
-    </div>
-    <mat-divider></mat-divider>
-    <div class="sp-dialog-actions actions-align-right">
-        <button mat-button mat-raised-button color="primary" (click)="download()" style="margin-right: 10px;">
-            Download
-        </button>
-        <button mat-button mat-raised-button class="mat-basic" (click)="onCloseConfirm()">Close
-        </button>
-    </div>
-
-</div>
\ No newline at end of file
diff --git a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.scss b/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.scss
deleted file mode 100644
index 1848127d1..000000000
--- a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.scss
+++ /dev/null
@@ -1,20 +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 'src/scss/sp/sp-dialog';
-
diff --git a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.ts b/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.ts
deleted file mode 100644
index e13da3044..000000000
--- a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.component.ts
+++ /dev/null
@@ -1,64 +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 { Component, OnInit } from '@angular/core';
-import { RestService } from '../../services/rest.service';
-import { DialogRef } from '@streampipes/shared-ui';
-
-@Component({
-  selector: 'sp-dialog-adapter-started-dialog',
-  templateUrl: './adapter-upload-dialog.html',
-  styleUrls: ['./adapter-upload-dialog.component.scss']
-})
-export class AdapterUploadDialog implements OnInit {
-
-  private selectedUploadFile: File;
-  uploaded = false;
-
-  constructor(private dialogRef: DialogRef<AdapterUploadDialog>,
-              private restService: RestService) {
-
-  }
-
-  ngOnInit() {
-  }
-
-  handleFileInput(files: any) {
-    this.selectedUploadFile = files[0];
-
-    const fileReader = new FileReader();
-    fileReader.onload = (e) => {
-      this.uploaded = true;
-
-      const jsonString: any = fileReader.result;
-      const allTemplates: any[] = JSON.parse(jsonString);
-
-      // allTemplates.forEach(adapterTemplate => {
-      //     this.restService.addAdapterTemplate(adapterTemplate).subscribe(x => {
-      //     });
-      // });
-
-    };
-    fileReader.readAsText(this.selectedUploadFile);
-  }
-
-  onCloseConfirm() {
-    this.dialogRef.close();
-  }
-
-}
diff --git a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.html b/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.html
deleted file mode 100644
index b815be532..000000000
--- a/ui/src/app/connect/dialog/adapter-upload/adapter-upload-dialog.html
+++ /dev/null
@@ -1,47 +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.
-  ~
-  -->
-
-<div class="sp-dialog-container">
-    <div class="sp-dialog-content p-15">
-        <div *ngIf="!uploaded">
-            <div fxLayoutAlign="center" fxLayout="column" fxFlex="100">
-                <mat-form-field style="width: 50%" (click)="fileInput.click();">
-                    <input matInput placeholder="Upload Adapters" disabled (value)="fileName">
-                    <input #fileInput type="file" style="display:none;"
-                           (change)="handleFileInput($event.target.files)">
-                    {{fileName}}
-                    <button color="primary" matSuffix
-                            mat-button style="min-width: 0px">
-                        <mat-icon>insert_drive_file</mat-icon>
-                    </button>
-                </mat-form-field>
-
-            </div>
-        </div>
-
-        <div *ngIf="uploaded">
-            <h5>File uploaded successfully.</h5>
-        </div>
-    </div>
-    <mat-divider></mat-divider>
-    <div class="sp-dialog-actions actions-align-right">
-        <button mat-button class="mat-basic" mat-raised-button (click)="onCloseConfirm()">Close
-        </button>
-    </div>
-
-</div>
\ No newline at end of file
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index 17459d539..ab9621345 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -49,7 +49,7 @@ export class RestService {
 
   addAdapterDescription(adapter: AdapterDescription, url: string): Observable<Message> {
     adapter.userName = this.authService.getCurrentUser().username;
-    const promise = new Promise<Message>((resolve, reject) => {
+    const promise = new Promise<Message>((resolve) => {
       this.http
         .post(
           this.connectPath + url,