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/24 07:31:54 UTC

[incubator-streampipes] branch STREAMPIPES-597 created (now 860dc4094)

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

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


      at 860dc4094 [WIP] Check if adapter is used within a pipeline

This branch includes the following new commits:

     new 860dc4094 [WIP] Check if adapter is used within a pipeline

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: [WIP] Check if adapter is used within a pipeline

Posted by ze...@apache.org.
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

commit 860dc4094b15624feaad983c074af77268dec811
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Mon Oct 24 09:31:31 2022 +0200

    [WIP] Check if adapter is used within a pipeline
---
 .../streampipes/rest/impl/PipelineResource.java    |  20 ++
 ui/cypress/support/utils/PipelineUtils.ts          |   6 -
 .../support/utils/ThirdPartyIntegrationUtils.ts    |   2 +-
 ui/cypress/tests/adapter/editAdapter.smoke.spec.ts |  28 +--
 .../adapter/editAdapterWithPipeline.smoke.spec.ts  |  50 +++++
 .../restartStreamPipes/restartStreamPipes1.ts      |   2 +-
 .../testJvmArchetype/testJvmArchetype.ts           |   2 +-
 .../tests/pipeline/pipelineTest.smoke.spec.ts      |   2 +-
 .../streampipes/platform-services/karma.conf.js    |   1 -
 .../streampipes/platform-services/package.json     |   9 +
 .../src/lib/apis/pipeline.service.spec.ts          |  59 ++++++
 .../src/lib/apis/pipeline.service.ts               | 220 +++++++++++++--------
 .../existing-adapters.component.ts                 |   1 +
 13 files changed, 289 insertions(+), 113 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
index 678164973..2f2e636aa 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineResource.java
@@ -261,4 +261,24 @@ public class PipelineResource extends AbstractAuthGuardedRestResource {
     message.addNotification(new Notification("id", pipelineId));
     return ok(message);
   }
+
+  @GET
+  @Produces(MediaType.APPLICATION_JSON)
+  @Path("/contains/{elementId}")
+  @JacksonSerialized
+  @Operation(summary = "TODO",
+      tags = {"Pipeline"},
+      responses = {
+          @ApiResponse(content = {
+              @Content(
+                  mediaType = "application/json",
+                  array = @ArraySchema(schema = @Schema(implementation = Pipeline.class)))
+          })})
+  @PreAuthorize(AuthConstants.HAS_READ_PIPELINE_PRIVILEGE)
+  public List<Pipeline> getPipelinesContainingElements(@PathParam("elementId") String pipelineId) {
+    // TODO What happens when user does not have privileges
+//    return PipelineManager.getAllPipelines();
+    return null;
+  }
+
 }
diff --git a/ui/cypress/support/utils/PipelineUtils.ts b/ui/cypress/support/utils/PipelineUtils.ts
index 6e2d18e39..49df698e0 100644
--- a/ui/cypress/support/utils/PipelineUtils.ts
+++ b/ui/cypress/support/utils/PipelineUtils.ts
@@ -22,12 +22,6 @@ import { OutputStrategyUtils } from './OutputStrategyUtils';
 
 export class PipelineUtils {
 
-  public static testPipeline(pipelineInput: PipelineInput) {
-
-    PipelineUtils.addPipeline(pipelineInput);
-
-  }
-
   public static addPipeline(pipelineInput: PipelineInput) {
 
     PipelineUtils.goToPipelineEditor();
diff --git a/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts b/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
index 7457c3af4..ca8f46117 100644
--- a/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
+++ b/ui/cypress/support/utils/ThirdPartyIntegrationUtils.ts
@@ -44,7 +44,7 @@ export class ThirdPartyIntegrationUtils {
       .addSink(sink)
       .build();
 
-    PipelineUtils.testPipeline(pipelineInput);
+    PipelineUtils.addPipeline(pipelineInput);
 
     if (adapter instanceof SpecificAdapterInput) {
       ConnectUtils.testSpecificStreamAdapter(adapter);
diff --git a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
index 60746a6ad..30dc0dc63 100644
--- a/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
+++ b/ui/cypress/tests/adapter/editAdapter.smoke.spec.ts
@@ -16,26 +16,18 @@
  *
  */
 
-import { SpecificAdapterBuilder } from '../../support/builder/SpecificAdapterBuilder';
-import { UserInputBuilder } from '../../support/builder/UserInputBuilder';
-import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
 import { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
+import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
+import { UserInputBuilder } from '../../support/builder/UserInputBuilder';
 
 describe('Test Edit Adapter', () => {
     beforeEach('Setup Test', () => {
         // To set up test add a stream adapter that can be configured
         cy.initStreamPipesTest();
-        const adapterInput = SpecificAdapterBuilder.create(
-            'Machine_Data_Simulator',
-        )
-            .setName('Machine Data Simulator Test')
-            .addInput('input', 'wait-time-ms', '1000')
-            .build();
-
-        ConnectUtils.testSpecificStreamAdapter(adapterInput);
+        ConnectUtils.addMachineDataSimulator('simulator');
     });
 
-    it('Perform Test', () => {
+    it('Successfully edit adapter', () => {
         const newAdapterName = 'Edited Adapter';
 
         ConnectUtils.goToConnect();
@@ -66,8 +58,9 @@ describe('Test Edit Adapter', () => {
 
         ConnectUtils.finishEventSchemaConfiguration();
 
-        cy.dataCy('sp-adapter-name').clear().type(newAdapterName);
-
+        cy.dataCy('sp-adapter-name')
+            .clear()
+            .type(newAdapterName);
 
         ConnectBtns.storeEditAdapter().click();
 
@@ -77,8 +70,7 @@ describe('Test Edit Adapter', () => {
 
         ConnectUtils.closeAdapterPreview();
 
-
-       // Start Adapter
+        // Start Adapter
         ConnectBtns.startAdapter().should('not.be.disabled');
         ConnectBtns.startAdapter().click();
 
@@ -89,7 +81,6 @@ describe('Test Edit Adapter', () => {
             .parent()
             .click();
 
-
         // Validate resulting event
         cy.dataCy('sp-connect-adapter-live-preview', { timeout: 10000 }).should(
             'be.visible',
@@ -100,9 +91,8 @@ describe('Test Edit Adapter', () => {
             .its('length')
             .should('eq', 3);
 
-        // TODO Validate that name of adapter and data source
+        // Validate that name of adapter and data source
         cy.dataCy('adapter-name').contains(newAdapterName);
         cy.get('.sp-dialog-content').contains(newAdapterName);
-
     });
 });
diff --git a/ui/cypress/tests/adapter/editAdapterWithPipeline.smoke.spec.ts b/ui/cypress/tests/adapter/editAdapterWithPipeline.smoke.spec.ts
new file mode 100644
index 000000000..00f405e56
--- /dev/null
+++ b/ui/cypress/tests/adapter/editAdapterWithPipeline.smoke.spec.ts
@@ -0,0 +1,50 @@
+/*
+ *  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 { ConnectUtils } from '../../support/utils/connect/ConnectUtils';
+import { PipelineUtils } from '../../support/utils/PipelineUtils';
+import { ConnectBtns } from '../../support/utils/connect/ConnectBtns';
+
+describe('Test Edit Adapter', () => {
+    beforeEach('Setup Test', () => {
+        // To set up test add a stream adapter that can be configured
+        cy.initStreamPipesTest();
+
+        ConnectUtils.addMachineDataSimulator('simulator', true);
+    });
+
+    it('Perform Test', () => {
+        // ensure edit mode is disabled
+        ConnectUtils.goToConnect();
+        ConnectBtns.editAdapter().should('be.disabled');
+
+        // stop adapter
+        ConnectBtns.stopAdapter().click();
+        ConnectBtns.startAdapter().should('be.visible');
+
+        // ensure edit mode is still disabled
+        ConnectBtns.editAdapter().should('be.disabled');
+
+        // Delete pipeline
+        PipelineUtils.deletePipeline();
+
+        // edit mode is enabled
+        ConnectUtils.goToConnect();
+        ConnectBtns.editAdapter().should('not.be.disabled');
+    });
+});
diff --git a/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts b/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
index ff388eb15..406d9828b 100644
--- a/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
+++ b/ui/cypress/tests/experimental/restartStreamPipes/restartStreamPipes1.ts
@@ -41,7 +41,7 @@ describe('Prepare StreamPipes for restart test', () => {
                 .build())
         .build();
 
-    PipelineUtils.testPipeline(pipelineInput);
+    PipelineUtils.addPipeline(pipelineInput);
 
     DashboardUtils.goToDashboard();
 
diff --git a/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts b/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
index 31174aa80..154b92c28 100644
--- a/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
+++ b/ui/cypress/tests/experimental/testJvmArchetype/testJvmArchetype.ts
@@ -46,7 +46,7 @@ describe('Prepare StreamPipes for archetype test', () => {
                 .build())
         .build();
 
-    PipelineUtils.testPipeline(pipelineInput);
+    PipelineUtils.addPipeline(pipelineInput);
 
     DashboardUtils.goToDashboard();
 
diff --git a/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts b/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
index 4f8a2693b..31cacba82 100644
--- a/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
+++ b/ui/cypress/tests/pipeline/pipelineTest.smoke.spec.ts
@@ -44,7 +44,7 @@ describe('Test Random Data Simulator Stream Adapter', () => {
           .build())
       .build();
 
-    PipelineUtils.testPipeline(pipelineInput);
+    PipelineUtils.addPipeline(pipelineInput);
     PipelineUtils.deletePipeline();
   });
 });
diff --git a/ui/projects/streampipes/platform-services/karma.conf.js b/ui/projects/streampipes/platform-services/karma.conf.js
index 71d129357..e5eebc5df 100644
--- a/ui/projects/streampipes/platform-services/karma.conf.js
+++ b/ui/projects/streampipes/platform-services/karma.conf.js
@@ -28,7 +28,6 @@ module.exports = function (config) {
       require('karma-jasmine'),
       require('karma-chrome-launcher'),
       require('karma-jasmine-html-reporter'),
-      require('karma-coverage'),
       require('@angular-devkit/build-angular/plugins/karma')
     ],
     client: {
diff --git a/ui/projects/streampipes/platform-services/package.json b/ui/projects/streampipes/platform-services/package.json
index 57a5c640b..f1a121c74 100644
--- a/ui/projects/streampipes/platform-services/package.json
+++ b/ui/projects/streampipes/platform-services/package.json
@@ -9,5 +9,14 @@
   },
   "dependencies": {
     "tslib": "^2.3.0"
+  },
+  "devDependencies": {
+    "karma": "~6.3.4",
+    "karma-chrome-launcher": "~3.1.0",
+    "karma-coverage-istanbul-reporter": "~3.0.2",
+    "karma-firefox-launcher": "^1.3.0",
+    "karma-jasmine": "~4.0.0",
+    "karma-jasmine-html-reporter": "^1.5.0",
+    "karma-verbose-reporter": "0.0.6"
   }
 }
diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.spec.ts b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.spec.ts
new file mode 100644
index 000000000..1bba134e8
--- /dev/null
+++ b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.spec.ts
@@ -0,0 +1,59 @@
+/*
+ *  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 { PipelineService } from './pipeline.service';
+import { HttpTestingController } from '@angular/common/http/testing';
+import { TestBed } from '@angular/core/testing';
+import { PlatformServicesCommons } from './commons.service';
+import { PlatformServicesModule } from '../platform-services.module';
+
+describe('PipelineService', () => {
+    let pipelineService: PipelineService;
+    let httpController: HttpTestingController;
+    let platformServicesCommons: PlatformServicesCommons;
+    const mockedPlatformServicesCommons = jasmine.createSpyObj('PlatformServicesCommons', ['apiBasePath']);
+    mockedPlatformServicesCommons.apiBasePath.and.returnValue('base/')
+
+    beforeEach(() => {
+        TestBed.configureTestingModule({
+            imports: [HttpTestingController],
+            // providers: [{
+                // platformServicesCommons: mockedPlatformServicesCommons
+            // }]
+        });
+        pipelineService = TestBed.inject(PipelineService);
+        httpController = TestBed.inject(HttpTestingController);
+        platformServicesCommons = TestBed.inject(PlatformServicesCommons);
+
+
+    });
+
+    it('Get pipelines containing element', () => {
+        const elementId = 'elementId';
+
+        pipelineService.getPipelinesContainingElementId('id').subscribe(pipelines => {
+            // TODO think about how to check this
+            expect(pipelines).toBe([]);
+        });
+
+        const req = httpController.expectOne({
+            method: 'GET',
+            url: `localhost:80/api/v2/pipelines/contains/${elementId}`
+        });
+    });
+});
diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts
index c5279adee..fcf1f6cd0 100644
--- a/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts
+++ b/ui/projects/streampipes/platform-services/src/lib/apis/pipeline.service.ts
@@ -21,93 +21,147 @@ import { HttpClient } from '@angular/common/http';
 import { PlatformServicesCommons } from './commons.service';
 import { Observable } from 'rxjs';
 import {
-  Message,
-  Pipeline,
-  PipelineCategory,
-  PipelineOperationStatus,
-  PipelineStatusMessage
+    Message,
+    Pipeline,
+    PipelineCategory,
+    PipelineOperationStatus,
+    PipelineStatusMessage,
 } from '../model/gen/streampipes-model';
 import { map } from 'rxjs/operators';
 
 @Injectable({
-  providedIn: 'root'
+    providedIn: 'root',
 })
 export class PipelineService {
-
-  constructor(private http: HttpClient,
-              private platformServicesCommons: PlatformServicesCommons) { }
-
-  getPipelineCategories(): Observable<PipelineCategory[]> {
-    return this.http.get(`${this.apiBasePath}/pipelinecategories`)
-        .pipe(map(response => {
-          return (response as any[]).map(p => PipelineCategory.fromData(p));
-        }));
-  }
-
-  storePipelineCategory(pipelineCategory: PipelineCategory) {
-    return this.http.post(`${this.apiBasePath}/pipelinecategories`, pipelineCategory);
-  }
-
-  deletePipelineCategory(categoryId: string) {
-    return this.http.delete(`${this.apiBasePath}/pipelinecategories/${categoryId}`);
-  }
-
-  startPipeline(pipelineId): Observable<PipelineOperationStatus> {
-    return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/start`)
-        .pipe(map(result => PipelineOperationStatus.fromData(result as PipelineOperationStatus)));
-  }
-
-  stopPipeline(pipelineId: string, forceStop?: boolean): Observable<PipelineOperationStatus> {
-    const queryAppendix = forceStop ? '?forceStop=' + forceStop : '';
-    return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/stop${queryAppendix}`)
-        .pipe(map(result => PipelineOperationStatus.fromData(result as PipelineOperationStatus)));
-  }
-
-  getPipelineById(pipelineId: string): Observable<Pipeline> {
-    return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}`)
-        .pipe(map(response => Pipeline.fromData(response as Pipeline)));
-  }
-
-  storePipeline(pipeline: Pipeline): Observable<Message> {
-    return this.http.post(`${this.apiBasePath}/pipelines`, pipeline)
-        .pipe(map(response => {
-          return Message.fromData(response as Message);
-        }));
-  }
-
-  updatePipeline(pipeline: Pipeline): Observable<Message> {
-    const pipelineId = pipeline._id;
-    return this.http.put(`${this.apiBasePath}/pipelines/${pipelineId}`, pipeline)
-        .pipe(map(response => {
-          return Message.fromData(response as Message);
-        }));
-  }
-
-  getOwnPipelines(): Observable<Pipeline[]> {
-    return this.http.get(`${this.apiBasePath}/pipelines/own`).pipe(map(response => {
-      return (response as any[]).map(p => Pipeline.fromData(p));
-    }));
-  }
-
-  deleteOwnPipeline(pipelineId): Observable<any> {
-    return this.http.delete(`${this.apiBasePath}/pipelines/${pipelineId}`);
-  }
-
-  getSystemPipelines(): Observable<Pipeline[]> {
-    return this.http.get(`${this.apiBasePath}/pipelines/system`).pipe(map(response => {
-      return (response as any[]).map(p => Pipeline.fromData(p));
-    }));
-  }
-
-  getPipelineStatusById(pipelineId): Observable<PipelineStatusMessage[]> {
-    return this.http.get(`${this.apiBasePath}/pipelines/${pipelineId}/status`)
-        .pipe(map(response => {
-          return (response as any[]).map(r => PipelineStatusMessage.fromData(r));
-        }));
-  }
-
-  get apiBasePath() {
-    return this.platformServicesCommons.apiBasePath;
-  }
-
+    constructor(
+        private http: HttpClient,
+        private platformServicesCommons: PlatformServicesCommons,
+    ) {}
+
+    getPipelineCategories(): Observable<PipelineCategory[]> {
+        return this.http.get(`${this.apiBasePath}/pipelinecategories`).pipe(
+            map(response => {
+                return (response as any[]).map(p =>
+                    PipelineCategory.fromData(p),
+                );
+            }),
+        );
+    }
+
+    storePipelineCategory(pipelineCategory: PipelineCategory) {
+        return this.http.post(
+            `${this.apiBasePath}/pipelinecategories`,
+            pipelineCategory,
+        );
+    }
+
+    deletePipelineCategory(categoryId: string) {
+        return this.http.delete(
+            `${this.apiBasePath}/pipelinecategories/${categoryId}`,
+        );
+    }
+
+    startPipeline(pipelineId): Observable<PipelineOperationStatus> {
+        return this.http
+            .get(`${this.apiBasePath}/pipelines/${pipelineId}/start`)
+            .pipe(
+                map(result =>
+                    PipelineOperationStatus.fromData(
+                        result as PipelineOperationStatus,
+                    ),
+                ),
+            );
+    }
+
+    stopPipeline(
+        pipelineId: string,
+        forceStop?: boolean,
+    ): Observable<PipelineOperationStatus> {
+        const queryAppendix = forceStop ? '?forceStop=' + forceStop : '';
+        return this.http
+            .get(
+                `${
+                    this.apiBasePath
+                }/pipelines/${pipelineId}/stop${queryAppendix}`,
+            )
+            .pipe(
+                map(result =>
+                    PipelineOperationStatus.fromData(
+                        result as PipelineOperationStatus,
+                    ),
+                ),
+            );
+    }
+
+    getPipelineById(pipelineId: string): Observable<Pipeline> {
+        return this.http
+            .get(`${this.apiBasePath}/pipelines/${pipelineId}`)
+            .pipe(map(response => Pipeline.fromData(response as Pipeline)));
+    }
+
+    storePipeline(pipeline: Pipeline): Observable<Message> {
+        return this.http.post(`${this.apiBasePath}/pipelines`, pipeline).pipe(
+            map(response => {
+                return Message.fromData(response as Message);
+            }),
+        );
+    }
+
+    updatePipeline(pipeline: Pipeline): Observable<Message> {
+        const pipelineId = pipeline._id;
+        return this.http
+            .put(`${this.apiBasePath}/pipelines/${pipelineId}`, pipeline)
+            .pipe(
+                map(response => {
+                    return Message.fromData(response as Message);
+                }),
+            );
+    }
+
+    getOwnPipelines(): Observable<Pipeline[]> {
+        return this.http.get(`${this.apiBasePath}/pipelines/own`).pipe(
+            map(response => {
+                return (response as any[]).map(p => Pipeline.fromData(p));
+            }),
+        );
+    }
+
+    deleteOwnPipeline(pipelineId): Observable<any> {
+        return this.http.delete(`${this.apiBasePath}/pipelines/${pipelineId}`);
+    }
+
+    getSystemPipelines(): Observable<Pipeline[]> {
+        return this.http.get(`${this.apiBasePath}/pipelines/system`).pipe(
+            map(response => {
+                return (response as any[]).map(p => Pipeline.fromData(p));
+            }),
+        );
+    }
+
+    getPipelineStatusById(pipelineId): Observable<PipelineStatusMessage[]> {
+        return this.http
+            .get(`${this.apiBasePath}/pipelines/${pipelineId}/status`)
+            .pipe(
+                map(response => {
+                    return (response as any[]).map(r =>
+                        PipelineStatusMessage.fromData(r),
+                    );
+                }),
+            );
+    }
+
+    // TODO test it
+    getPipelinesContainingElementId(elementId: string): Observable<Pipeline[]> {
+        return this.http
+            .get(`${this.apiBasePath}/pipelines/contains/${elementId}`)
+            .pipe(
+                map(response => {
+                    return (response as any[]).map(p => Pipeline.fromData(p));
+                }),
+            );
+    }
+
+    get apiBasePath() {
+        return this.platformServicesCommons.apiBasePath;
+    }
 }
diff --git a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
index 1c1c01b38..2be628c7c 100644
--- a/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
+++ b/ui/src/app/connect/components/existing-adapters/existing-adapters.component.ts
@@ -141,6 +141,7 @@ export class ExistingAdaptersComponent implements OnInit {
   }
 
   editAdapter(adapter: AdapterDescriptionUnion) {
+    // TODO validate that adapter is not used in a pipeline
     this.router.navigate(['connect', 'edit', adapter.elementId]);
   }