You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2024/03/31 16:18:44 UTC

(streampipes) 07/07: Remove obsolete cypress webpack deps, fix connect service injection

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

riemer pushed a commit to branch bump-angular-eslint
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit fab5cdde23ec57520a880b8d194e0ec2949e015b
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Mar 31 18:17:51 2024 +0200

    Remove obsolete cypress webpack deps, fix connect service injection
---
 ui/cypress/plugins/index.ts                        | 57 ++++++++++------------
 .../new-adapter/new-adapter.component.ts           |  2 -
 ui/src/app/connect/connect.module.ts               | 12 +----
 ui/src/app/connect/filter/adapter-filter.pipe.ts   |  3 +-
 ui/src/app/connect/services/connect.service.ts     | 52 --------------------
 ui/src/app/connect/services/data-type.service.ts   |  2 +-
 ui/src/app/connect/services/rest.service.ts        |  2 +-
 .../app/connect/services/unit-provider.service.ts  |  2 +-
 8 files changed, 32 insertions(+), 100 deletions(-)

diff --git a/ui/cypress/plugins/index.ts b/ui/cypress/plugins/index.ts
index 10ec1a65d1..2c4d168819 100644
--- a/ui/cypress/plugins/index.ts
+++ b/ui/cypress/plugins/index.ts
@@ -33,9 +33,6 @@ import { ProcessorTest } from '../support/model/ProcessorTest';
 // tslint:disable-next-line:no-var-requires
 const { rmdir } = require('fs');
 
-// tslint:disable-next-line:no-var-requires no-implicit-dependencies
-const webpackPreprocessor = require('@cypress/webpack-batteries-included-preprocessor');
-
 function readProcessingElements(): ProcessorTest[] {
     const result: ProcessorTest[] = [];
 
@@ -78,33 +75,33 @@ function readProcessingElements(): ProcessorTest[] {
 }
 
 module.exports = (on, config) => {
-    const webpackOptions = webpackPreprocessor.defaultOptions.webpackOptions;
-
-    webpackOptions.resolve.fallback = {
-        stream: require.resolve('stream-browserify'),
-    };
-    webpackOptions.module.rules.unshift({
-        test: /[/\\]@angular[/\\].+\.m?js$/,
-        resolve: {
-            fullySpecified: false,
-        },
-        use: {
-            loader: 'babel-loader',
-            options: {
-                plugins: ['@angular/compiler-cli/linker/babel'],
-                compact: false,
-                cacheDirectory: true,
-            },
-        },
-    });
-
-    on(
-        'file:preprocessor',
-        webpackPreprocessor({
-            webpackOptions,
-            typescript: require.resolve('typescript'),
-        }),
-    );
+    // const webpackOptions = webpackPreprocessor.defaultOptions.webpackOptions;
+    //
+    // webpackOptions.resolve.fallback = {
+    //     stream: require.resolve('stream-browserify'),
+    // };
+    // webpackOptions.module.rules.unshift({
+    //     test: /[/\\]@angular[/\\].+\.m?js$/,
+    //     resolve: {
+    //         fullySpecified: false,
+    //     },
+    //     use: {
+    //         loader: 'babel-loader',
+    //         options: {
+    //             plugins: ['@angular/compiler-cli/linker/babel'],
+    //             compact: false,
+    //             cacheDirectory: true,
+    //         },
+    //     },
+    // });
+    //
+    // on(
+    //     'file:preprocessor',
+    //     webpackPreprocessor({
+    //         webpackOptions,
+    //         typescript: require.resolve('typescript'),
+    //     }),
+    // );
 
     config.env.processingElements = readProcessingElements();
 
diff --git a/ui/src/app/connect/components/new-adapter/new-adapter.component.ts b/ui/src/app/connect/components/new-adapter/new-adapter.component.ts
index 835c9fde39..220780b959 100644
--- a/ui/src/app/connect/components/new-adapter/new-adapter.component.ts
+++ b/ui/src/app/connect/components/new-adapter/new-adapter.component.ts
@@ -22,7 +22,6 @@ import {
     AdapterService,
 } from '@streampipes/platform-services';
 import { ActivatedRoute } from '@angular/router';
-import { ConnectService } from '../../services/connect.service';
 import { SpConnectRoutes } from '../../connect.routes';
 import { SpBreadcrumbService } from '@streampipes/shared-ui';
 
@@ -38,7 +37,6 @@ export class NewAdapterComponent implements OnInit {
 
     constructor(
         private breadcrumbService: SpBreadcrumbService,
-        private connectService: ConnectService,
         private adapterService: AdapterService,
         private route: ActivatedRoute,
     ) {}
diff --git a/ui/src/app/connect/connect.module.ts b/ui/src/app/connect/connect.module.ts
index 00f7197aee..e2c75588c2 100644
--- a/ui/src/app/connect/connect.module.ts
+++ b/ui/src/app/connect/connect.module.ts
@@ -31,12 +31,9 @@ import { RestService } from './services/rest.service';
 
 import { MatInputModule } from '@angular/material/input';
 import { AdapterStartedDialog } from './dialog/adapter-started/adapter-started-dialog.component';
-import { DataTypesService } from './services/data-type.service';
 import { StaticPropertyUtilService } from '../core-ui/static-properties/static-property-util.service';
-import { ConnectService } from './services/connect.service';
 import { AdapterDescriptionComponent } from './components/data-marketplace/adapter-description/adapter-description.component';
 import { DataMarketplaceComponent } from './components/data-marketplace/data-marketplace.component';
-import { UnitProviderService } from './services/unit-provider.service';
 
 import { AdapterFilterPipe } from './filter/adapter-filter.pipe';
 import { TimestampPipe } from './filter/timestamp.pipe';
@@ -225,14 +222,7 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
         CanNotEditAdapterDialog,
         AllAdapterActionsComponent,
     ],
-    providers: [
-        RestService,
-        ConnectService,
-        DataTypesService,
-        StaticPropertyUtilService,
-        UnitProviderService,
-        TimestampPipe,
-    ],
+    providers: [StaticPropertyUtilService, TimestampPipe],
     schemas: [CUSTOM_ELEMENTS_SCHEMA],
 })
 export class ConnectModule {}
diff --git a/ui/src/app/connect/filter/adapter-filter.pipe.ts b/ui/src/app/connect/filter/adapter-filter.pipe.ts
index b8f4d81194..cc775cb2d0 100644
--- a/ui/src/app/connect/filter/adapter-filter.pipe.ts
+++ b/ui/src/app/connect/filter/adapter-filter.pipe.ts
@@ -19,12 +19,11 @@
 import { Injectable, Pipe, PipeTransform } from '@angular/core';
 import { AdapterDescription } from '@streampipes/platform-services';
 import { AdapterFilterSettingsModel } from '../model/adapter-filter-settings.model';
-import { ConnectService } from '../services/connect.service';
 
 @Pipe({ name: 'adapterFilter' })
 @Injectable({ providedIn: 'root' })
 export class AdapterFilterPipe implements PipeTransform {
-    constructor(private connectService: ConnectService) {}
+    constructor() {}
 
     transform(
         adapterDescriptions: AdapterDescription[],
diff --git a/ui/src/app/connect/services/connect.service.ts b/ui/src/app/connect/services/connect.service.ts
deleted file mode 100644
index e7fb50c974..0000000000
--- a/ui/src/app/connect/services/connect.service.ts
+++ /dev/null
@@ -1,52 +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 { Injectable } from '@angular/core';
-
-@Injectable()
-export class ConnectService {
-    // isGenericDescription(adapter: AdapterDescription): boolean {
-    //     return adapter instanceof GenericAdapterStreamDescription;
-    // }
-    // getEventSchema(adapter: AdapterDescription): EventSchema {
-    //     let eventSchema: EventSchema;
-    //
-    //     if (adapter instanceof GenericAdapterStreamDescription) {
-    //         eventSchema =
-    //             (adapter as GenericAdapterStreamDescription).dataStream
-    //                 .eventSchema || new EventSchema();
-    //     } else if (adapter instanceof SpecificAdapterStreamDescription) {
-    //         eventSchema =
-    //             (adapter as SpecificAdapterStreamDescription).dataStream
-    //                 .eventSchema || new EventSchema();
-    //     } else {
-    //         eventSchema = new EventSchema();
-    //     }
-    //
-    //     if (
-    //         eventSchema &&
-    //         eventSchema.eventProperties &&
-    //         eventSchema.eventProperties.length > 0
-    //     ) {
-    //         return eventSchema;
-    //     } else {
-    //         eventSchema.eventProperties = [];
-    //         return eventSchema;
-    //     }
-    // }
-}
diff --git a/ui/src/app/connect/services/data-type.service.ts b/ui/src/app/connect/services/data-type.service.ts
index 0d9036cadc..aad5dd6c3d 100644
--- a/ui/src/app/connect/services/data-type.service.ts
+++ b/ui/src/app/connect/services/data-type.service.ts
@@ -18,7 +18,7 @@
 
 import { Injectable } from '@angular/core';
 
-@Injectable()
+@Injectable({ providedIn: 'root' })
 export class DataTypesService {
     public dataTypes: { label: string; url: string }[] = [
         {
diff --git a/ui/src/app/connect/services/rest.service.ts b/ui/src/app/connect/services/rest.service.ts
index 73a8f42978..a94f0044f0 100644
--- a/ui/src/app/connect/services/rest.service.ts
+++ b/ui/src/app/connect/services/rest.service.ts
@@ -32,7 +32,7 @@ import {
 } from '@streampipes/platform-services';
 import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client';
 
-@Injectable()
+@Injectable({ providedIn: 'root' })
 export class RestService {
     constructor(
         private http: HttpClient,
diff --git a/ui/src/app/connect/services/unit-provider.service.ts b/ui/src/app/connect/services/unit-provider.service.ts
index da446aaa05..c8e4454555 100644
--- a/ui/src/app/connect/services/unit-provider.service.ts
+++ b/ui/src/app/connect/services/unit-provider.service.ts
@@ -19,7 +19,7 @@
 import { UnitDescription } from '../model/UnitDescription';
 import { Injectable } from '@angular/core';
 
-@Injectable()
+@Injectable({ providedIn: 'root' })
 export class UnitProviderService {
     private units: UnitDescription[] = [
         {