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


The following commit(s) were added to refs/heads/STREAMPIPES-380 by this push:
     new 31fc1b4  [STREAMPIPES-380] Add confirmation dialog when adapter is 
deleted
31fc1b4 is described below

commit 31fc1b45d07ea61b1f756f0ba5274a11001ebc21
Author: Philipp Zehnder <[email protected]>
AuthorDate: Tue Jul 6 15:58:31 2021 +0200

    [STREAMPIPES-380] Add confirmation dialog when adapter is deleted
---
 .../transformation-jvm/countArray1/expected.csv    | 10 ++---
 .../transformation-jvm/splitArray1/expected.csv    |  5 +--
 .../pipelineElement/SinglePipelineElement.ts       |  2 +-
 ui/cypress/support/utils/AdapterUtils.ts           |  4 +-
 .../support/utils/ProcessingElementTestUtils.ts    |  1 -
 .../existing-adapters.component.ts                 | 44 +++++++++++++++-------
 ui/src/app/connect/connect.module.ts               |  2 +
 .../delete-adapter-dialog.component.html           | 16 +++-----
 ...t.scss => delete-adapter-dialog.component.scss} |  0
 .../delete-adapter-dialog.component.ts             | 42 ++++++++-------------
 10 files changed, 66 insertions(+), 60 deletions(-)

diff --git 
a/ui/cypress/fixtures/pipelineElement/transformation-jvm/countArray1/expected.csv
 
b/ui/cypress/fixtures/pipelineElement/transformation-jvm/countArray1/expected.csv
index 4d3c5e9..c2b09ea 100644
--- 
a/ui/cypress/fixtures/pipelineElement/transformation-jvm/countArray1/expected.csv
+++ 
b/ui/cypress/fixtures/pipelineElement/transformation-jvm/countArray1/expected.csv
@@ -1,5 +1,5 @@
-time;arrayPropery;countvalue;sp_internal_label;timestamp
-1623871499055;[1, 2, 4, 4];4;;1.623871499055E12
-1623871500059;[1, 4];2;;1.623871500059E12
-1623871507091;[1, 3, 3, 3, 4];5;;1.623871507091E12
-1623871508093;[1];1;;1.623871508093E12
+time;arrayproperty;countvalue;sp_internal_label;timestamp
+1623871499055;[1, 2, 4, 4];4.0;;1.623871499055E12
+1623871500059;[1, 4];2.0;;1.623871500059E12
+1623871507091;[1, 3, 3, 3, 4];5.0;;1.623871507091E12
+1623871508093;[1];1.0;;1.623871508093E12
diff --git 
a/ui/cypress/fixtures/pipelineElement/transformation-jvm/splitArray1/expected.csv
 
b/ui/cypress/fixtures/pipelineElement/transformation-jvm/splitArray1/expected.csv
index 4802d6a..df5baf1 100644
--- 
a/ui/cypress/fixtures/pipelineElement/transformation-jvm/splitArray1/expected.csv
+++ 
b/ui/cypress/fixtures/pipelineElement/transformation-jvm/splitArray1/expected.csv
@@ -1,4 +1,3 @@
 time;array_value;sp_internal_label;timestamp
-1623871500059;1;;1.623871500059E12
-1623871500059;4;;1.623871500059E12
-1623871508093;1;;1.623871508093E12
+1623871500059;4.0;;1.623871500059E12
+1623871508093;1.0;;1.623871508093E12
diff --git a/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts 
b/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
index a1b817a..06f7c73 100644
--- a/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
+++ b/ui/cypress/integration/pipelineElement/SinglePipelineElement.ts
@@ -22,7 +22,7 @@ import { ProcessorTest } from 
'../../support/model/ProcessorTest';
 const allTests = Cypress.env('processingElements');
 
 allTests.forEach(test => {
-  const testName = 'signalEdgeFilter1';
+  const testName = 'splitArray1';
 
   const processorTest = test as ProcessorTest;
 
diff --git a/ui/cypress/support/utils/AdapterUtils.ts 
b/ui/cypress/support/utils/AdapterUtils.ts
index 202144b..46d2b7d 100644
--- a/ui/cypress/support/utils/AdapterUtils.ts
+++ b/ui/cypress/support/utils/AdapterUtils.ts
@@ -193,7 +193,9 @@ export class AdapterUtils {
             cy.get('div').contains('My Adapters').parent().click();
             cy.dataCy('delete').should('have.length', 1);
             cy.dataCy('delete').click();
-            cy.get('[data-cy=delete]', { timeout: 10000 
}).should('have.length', 0);
+            cy.dataCy('delete-adapter').click();
+            cy.dataCy('adapter-deletion-in-progress' , { timeout: 10000 
}).should('be.visible');
+            cy.dataCy('delete', { timeout: 20000 }).should('have.length', 0);
         });
     }
 }
diff --git a/ui/cypress/support/utils/ProcessingElementTestUtils.ts 
b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
index 18930b5..f600ac3 100644
--- a/ui/cypress/support/utils/ProcessingElementTestUtils.ts
+++ b/ui/cypress/support/utils/ProcessingElementTestUtils.ts
@@ -49,7 +49,6 @@ export class ProcessingElementTestUtils {
           .create('File_Set')
           .setName(adapterName)
           .setTimestampProperty('timestamp')
-          .addProtocolInput('input', 'interval-key', '0')
           .setFormat(formatType);
 
         if (formatType === 'csv') {
diff --git 
a/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.ts
 
b/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.ts
index cbf50e3..01a606c 100644
--- 
a/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.ts
+++ 
b/ui/src/app/connect/components/data-marketplace/existing-adapters/existing-adapters.component.ts
@@ -16,11 +16,15 @@
  *
  */
 
-import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
-import {AdapterDescriptionUnion} from 
"../../../../core-model/gen/streampipes-model";
-import {MatTableDataSource} from "@angular/material/table";
-import {ConnectService} from "../../../services/connect.service";
-import {DataMarketplaceService} from 
"../../../services/data-marketplace.service";
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
+import { AdapterDescriptionUnion } from 
'../../../../core-model/gen/streampipes-model';
+import { MatTableDataSource } from '@angular/material/table';
+import { ConnectService } from '../../../services/connect.service';
+import { DataMarketplaceService } from 
'../../../services/data-marketplace.service';
+import { DialogRef } from '../../../../core-ui/dialog/base-dialog/dialog-ref';
+import { PanelType } from 
'../../../../core-ui/dialog/base-dialog/base-dialog.model';
+import { DialogService } from 
'../../../../core-ui/dialog/base-dialog/base-dialog.service';
+import { DeleteAdapterDialogComponent } from 
'../../../dialog/delete-adapter-dialog/delete-adapter-dialog.component';
 
 @Component({
   selector: 'sp-existing-adapters',
@@ -29,7 +33,7 @@ import {DataMarketplaceService} from 
"../../../services/data-marketplace.service
 })
 export class ExistingAdaptersComponent implements OnInit {
 
-  _existingAdapters: Array<AdapterDescriptionUnion>;
+  _existingAdapters: AdapterDescriptionUnion[];
 
   @Input()
   filterTerm: string;
@@ -45,7 +49,8 @@ export class ExistingAdaptersComponent implements OnInit {
   dataSource: MatTableDataSource<AdapterDescriptionUnion>;
 
   constructor(public connectService: ConnectService,
-              private dataMarketplaceService: DataMarketplaceService) {
+              private dataMarketplaceService: DataMarketplaceService,
+              private dialogService: DialogService) {
 
   }
 
@@ -67,29 +72,42 @@ export class ExistingAdaptersComponent implements OnInit {
 
   getIconUrl(adapter: AdapterDescriptionUnion) {
     if (adapter.includedAssets.length > 0) {
-      return this.dataMarketplaceService.getAssetUrl(adapter.appId) + "/icon";
+      return this.dataMarketplaceService.getAssetUrl(adapter.appId) + '/icon';
     } else {
       return 'assets/img/connect/' + adapter.iconUrl;
     }
   }
 
   deleteAdapter(adapter: AdapterDescriptionUnion): void {
-    this.dataMarketplaceService.deleteAdapter(adapter).subscribe(res => {
-      this.updateAdapterEmitter.emit();
+    const dialogRef: DialogRef<DeleteAdapterDialogComponent> = 
this.dialogService.open(DeleteAdapterDialogComponent, {
+      panelType: PanelType.STANDARD_PANEL,
+      title: 'Delete Adapter',
+      width: '70vw',
+      data: {
+        'adapter': adapter,
+      }
     });
-  }
+
+    dialogRef.afterClosed().subscribe(data => {
+      if (data) {
+        this.dataMarketplaceService.deleteAdapter(adapter).subscribe(res => {
+          this.updateAdapterEmitter.emit();
+        });
+      }
+    });
+  };
 
   createTemplate(adapter: AdapterDescriptionUnion): void {
     this.createTemplateEmitter.emit(adapter);
   }
 
   @Input()
-  set existingAdapters(adapters: Array<AdapterDescriptionUnion>) {
+  set existingAdapters(adapters: AdapterDescriptionUnion[]) {
     this._existingAdapters = adapters;
     this.dataSource = new MatTableDataSource(adapters);
   }
 
-  get existingAdapters(): Array<AdapterDescriptionUnion> {
+  get existingAdapters(): AdapterDescriptionUnion[] {
     return this._existingAdapters;
   }
 
diff --git a/ui/src/app/connect/connect.module.ts 
b/ui/src/app/connect/connect.module.ts
index 816b567..79e7e2b 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -79,6 +79,7 @@ import { ErrorMessageComponent } from 
'./components/schema-editor/error-message/
 import { LoadingMessageComponent } from 
'./components/schema-editor/loading-message/loading-message.component';
 import { SchemaEditorHeaderComponent } from 
'./components/schema-editor/schema-editor-header/schema-editor-header.component';
 import { StartAdapterConfigurationComponent } from 
'./components/start-adapter-configuration/start-adapter-configuration.component';
+import { DeleteAdapterDialogComponent } from 
'./dialog/delete-adapter-dialog/delete-adapter-dialog.component';
 
 @NgModule({
     imports: [
@@ -107,6 +108,7 @@ import { StartAdapterConfigurationComponent } from 
'./components/start-adapter-c
         AdapterUploadDialog,
         ConnectComponent,
         DataMarketplaceComponent,
+        DeleteAdapterDialogComponent,
         EventSchemaComponent,
         EditEventPropertyPrimitiveComponent,
         EditEventPropertyComponent,
diff --git 
a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.html
 
b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.html
index ab26a9f..506b7ed 100644
--- 
a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.html
+++ 
b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.html
@@ -20,23 +20,19 @@
     <div class="sp-dialog-content p-15">
         <div *ngIf="!isInProgress" fxLayout="column">
             <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column">
-                <b><h4>Do you really want to delete pipeline 
{{pipeline.name}}?</h4></b>
-                <b><h4 *ngIf="pipeline.running">This pipeline is still 
running.</h4></b>
+                <b><h4>Do you really want to delete adapter 
{{adapter.name}}?</h4></b>
                 <b><h5>This operation cannot be undone.</h5></b>
             </div>
 
             <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column">
-                <button mat-button mat-raised-button color="primary" 
*ngIf="!pipeline.running"
-                        (click)="deletePipeline()">Delete
-                    pipeline
-                </button>
-                <button mat-button mat-raised-button color="primary" 
*ngIf="pipeline.running"
-                        (click)="stopAndDeletePipeline()">Stop and
-                    delete pipeline
+                <button mat-button mat-raised-button color="primary"
+                        (click)="deleteAdapter()"
+                        data-cy="delete-adapter">Delete
+                    adapter
                 </button>
             </div>
         </div>
-        <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column" 
*ngIf="isInProgress">
+        <div fxFlex="100" fxLayoutAlign="center center" fxLayout="column" 
*ngIf="isInProgress" data-cy="adapter-deletion-in-progress">
             <div fxLayout="row" fxLayoutAlign="space-around">
                 <mat-spinner [mode]="'indeterminate'"></mat-spinner>
             </div>
diff --git 
a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-pipeline-dialog.component.scss
 
b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.scss
similarity index 100%
rename from 
ui/src/app/connect/dialog/delete-adapter-dialog/delete-pipeline-dialog.component.scss
rename to 
ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.scss
diff --git 
a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
 
b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
index 7d8fb59..e5083c1 100644
--- 
a/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
+++ 
b/ui/src/app/connect/dialog/delete-adapter-dialog/delete-adapter-dialog.component.ts
@@ -16,49 +16,39 @@
  *
  */
 
-import {Component, Input} from "@angular/core";
-import {Pipeline} from "../../../core-model/gen/streampipes-model";
-import {PipelineService} from 
"../../../platform-services/apis/pipeline.service";
-import {DialogRef} from "../../../core-ui/dialog/base-dialog/dialog-ref";
+import { Component, Input } from '@angular/core';
+import { AdapterDescriptionUnion } from 
'../../../core-model/gen/streampipes-model';
+import { DialogRef } from '../../../core-ui/dialog/base-dialog/dialog-ref';
+import { DataMarketplaceService } from 
'../../services/data-marketplace.service';
 
 @Component({
-    selector: 'delete-adapter-dialog',
+    selector: 'sp-delete-adapter-dialog',
     templateUrl: './delete-adapter-dialog.component.html',
     styleUrls: ['./delete-adapter-dialog.component.scss']
 })
 export class DeleteAdapterDialogComponent {
 
     @Input()
-    pipeline: Pipeline;
+    adapter: AdapterDescriptionUnion;
 
-    isInProgress: boolean = false;
+    isInProgress = false;
     currentStatus: any;
 
     constructor(private dialogRef: DialogRef<DeleteAdapterDialogComponent>,
-                private pipelineService: PipelineService) {
+                private dataMarketplaceService: DataMarketplaceService) {
     }
 
-    close(refreshPipelines: boolean) {
-        this.dialogRef.close(refreshPipelines);
-    };
+    close(refreshAdapters: boolean) {
+        this.dialogRef.close(refreshAdapters);
+    }
 
     deleteAdapter() {
         this.isInProgress = true;
-        this.currentStatus = "Deleting pipeline...";
-        this.pipelineService.deleteOwnPipeline(this.pipeline._id)
-            .subscribe(data => {
-                this.close(true);
-            });
-    }
+        this.currentStatus = 'Deleting adapter...';
 
-    stopAndDeleteAdapter() {
-        this.isInProgress = true;
-        this.currentStatus = "Stopping pipeline...";
-        this.pipelineService.stopPipeline(this.pipeline._id)
-            .subscribe(data => {
-               this.deleteAdapter();
-            }, data => {
-                this.deleteAdapter();
-            });
+        this.dataMarketplaceService.deleteAdapter(this.adapter).subscribe(data 
=> {
+            this.close(true);
+        });
     }
+
 }

Reply via email to