You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by oe...@apache.org on 2026/04/16 14:42:37 UTC
(streampipes) branch 4378-expose-asset-context-for-data-streams-in-pipeline-editor updated: Clean up service
This is an automated email from the ASF dual-hosted git repository.
oehler pushed a commit to branch 4378-expose-asset-context-for-data-streams-in-pipeline-editor
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/4378-expose-asset-context-for-data-streams-in-pipeline-editor by this push:
new a64e0773cf Clean up service
a64e0773cf is described below
commit a64e0773cf76b32f22d900509b6de584f07d6a83
Author: Sven Oehler <oe...@web.de>
AuthorDate: Thu Apr 16 16:42:29 2026 +0200
Clean up service
---
.../sp-table-asset-context.service.ts | 20 ++++++++-
.../pipeline-element-help.component.ts | 20 ++++++---
.../services/data-stream-asset-context.service.ts | 52 ----------------------
.../streampipes/shared-ui/src/public-api.ts | 1 -
.../pipeline-element-icon-stand-row.component.ts | 22 ++++++---
5 files changed, 49 insertions(+), 66 deletions(-)
diff --git a/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-asset-context/sp-table-asset-context.service.ts b/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-asset-context/sp-table-asset-context.service.ts
index 368ba67faf..ce6d578a57 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-asset-context/sp-table-asset-context.service.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/components/sp-table/sp-asset-context/sp-table-asset-context.service.ts
@@ -17,7 +17,7 @@
*/
import { Injectable } from '@angular/core';
-import { SpAsset, SpLabel } from '@streampipes/platform-services';
+import { SpAsset, SpDataStream, SpLabel } from '@streampipes/platform-services';
import { AssetBrowserData } from '../../asset-browser/asset-browser.model';
import {
SpTableAssetContextValue,
@@ -65,6 +65,24 @@ export class SpTableAssetContextService {
return index;
}
+ resolveDataStreamAssetContext(
+ assetData?: AssetBrowserData,
+ dataStream?: SpDataStream,
+ ): SpTableResolvedAssetContext | undefined {
+ if (!assetData || !dataStream) {
+ return undefined;
+ }
+
+ const assetContextIndex = this.buildAssetContextIndex(assetData);
+
+ return (
+ assetContextIndex
+ .get('adapter')
+ ?.get(dataStream.correspondingAdapterId) ??
+ assetContextIndex.get('stream')?.get(dataStream.elementId)
+ );
+ }
+
private collectAssetContexts(
asset: SpAsset,
index: Map<string, Map<string, SpTableResolvedAssetContext>>,
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
index 140b236eb1..8bc7eb43f5 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/pipeline-element-help/pipeline-element-help.component.ts
@@ -34,11 +34,13 @@ import { PipelineElementRuntimeInfoComponent } from '../../components/pipeline-e
import { PipelineElementDocumentationComponent } from '../../components/pipeline-element-documentation/pipeline-element-documentation.component';
import { MatDivider } from '@angular/material/divider';
import { MatButton } from '@angular/material/button';
-import { DataStreamAssetContextService } from '../../services/data-stream-asset-context.service';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { SpLabelComponent } from '../../components/sp-label/sp-label.component';
+import { SpAssetBrowserService } from '../../components/asset-browser/asset-browser.service';
+import { SpTableAssetContextService } from '../../components/sp-table/sp-asset-context/sp-table-asset-context.service';
import { SpTableResolvedAssetContext } from '../../components/sp-table/sp-table.model';
import { MatTooltip } from '@angular/material/tooltip';
+import { map } from 'rxjs';
@Component({
selector: 'sp-pipeline-element-help',
@@ -62,7 +64,8 @@ import { MatTooltip } from '@angular/material/tooltip';
export class PipelineElementHelpComponent implements OnInit {
private dialogRef =
inject<DialogRef<PipelineElementHelpComponent>>(DialogRef);
- private dataStreamAssetContextService = inject(DataStreamAssetContextService);
+ private assetBrowserService = inject(SpAssetBrowserService);
+ private assetContextService = inject(SpTableAssetContextService);
private destroyRef = inject(DestroyRef);
selectedTabIndex = 0;
@@ -89,9 +92,16 @@ export class PipelineElementHelpComponent implements OnInit {
if (this.pipelineElement instanceof SpDataStream) {
this.tabs = this.availableTabs;
this.isDataStream = true;
- this.dataStreamAssetContextService
- .watchDataStreamAssetContext(this.pipelineElement)
- .pipe(takeUntilDestroyed(this.destroyRef))
+ this.assetBrowserService.assetData$
+ .pipe(
+ map(assetData =>
+ this.assetContextService.resolveDataStreamAssetContext(
+ assetData,
+ this.pipelineElement as SpDataStream,
+ ),
+ ),
+ takeUntilDestroyed(this.destroyRef),
+ )
.subscribe(assetContext => this.assetContext = assetContext);
} else {
this.tabs.push(this.availableTabs[1]);
diff --git a/ui/projects/streampipes/shared-ui/src/lib/services/data-stream-asset-context.service.ts b/ui/projects/streampipes/shared-ui/src/lib/services/data-stream-asset-context.service.ts
deleted file mode 100644
index 09ed291723..0000000000
--- a/ui/projects/streampipes/shared-ui/src/lib/services/data-stream-asset-context.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, inject } from '@angular/core';
-import { map, Observable } from 'rxjs';
-import { SpDataStream } from '@streampipes/platform-services';
-import { SpAssetBrowserService } from '../components/asset-browser/asset-browser.service';
-import { SpTableAssetContextService } from '../components/sp-table/sp-asset-context/sp-table-asset-context.service';
-import { SpTableResolvedAssetContext } from '../components/sp-table/sp-table.model';
-
-@Injectable({ providedIn: 'root' })
-export class DataStreamAssetContextService {
- private assetBrowserService = inject(SpAssetBrowserService);
- private assetContextService = inject(SpTableAssetContextService);
-
- watchDataStreamAssetContext(
- dataStream?: SpDataStream,
- ): Observable<SpTableResolvedAssetContext | undefined> {
- return this.assetBrowserService.assetData$.pipe(
- map(assetData => {
- if (!assetData || !dataStream) {
- return undefined;
- }
-
- const assetContextIndex =
- this.assetContextService.buildAssetContextIndex(assetData);
-
- return (
- assetContextIndex
- .get('adapter')
- ?.get(dataStream.correspondingAdapterId) ??
- assetContextIndex.get('stream')?.get(dataStream.elementId)
- );
- }),
- );
- }
-}
diff --git a/ui/projects/streampipes/shared-ui/src/public-api.ts b/ui/projects/streampipes/shared-ui/src/public-api.ts
index d0b42b692e..8301499bf6 100644
--- a/ui/projects/streampipes/shared-ui/src/public-api.ts
+++ b/ui/projects/streampipes/shared-ui/src/public-api.ts
@@ -82,7 +82,6 @@ export * from './lib/components/asset-browser/asset-browser.service';
export * from './lib/services/date-format.service';
export * from './lib/services/pipeline-element-schema.service';
export * from './lib/services/asset-configuration.service';
-export * from './lib/services/data-stream-asset-context.service';
export * from './lib/services/local-storage-settings.service';
export * from './lib/services/keyboard-shortcut.service';
export * from './lib/components/sp-table/sp-paginator/sp-paginator.service';
diff --git a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
index 3adb1ac321..114994306f 100644
--- a/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
+++ b/ui/src/app/editor/components/pipeline-element-icon-stand/pipeline-element-icon-stand-row/pipeline-element-icon-stand-row.component.ts
@@ -32,15 +32,16 @@ import { MatTooltip } from '@angular/material/tooltip';
import { NgClass } from '@angular/common';
import { ClassDirective } from '@ngbracket/ngx-layout/extended';
import {
- DataStreamAssetContextService,
PipelineElementComponent,
SpLabelComponent,
+ SpAssetBrowserService,
+ SpTableAssetContextService,
} from '@streampipes/shared-ui';
import { MatButton } from '@angular/material/button';
-import { TranslatePipe } from '@ngx-translate/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { SpDataStream } from '@streampipes/platform-services';
import { SpTableResolvedAssetContext } from '@streampipes/shared-ui';
+import { map } from 'rxjs';
@Component({
selector: 'sp-pe-icon-stand-row',
@@ -56,12 +57,12 @@ import { SpTableResolvedAssetContext } from '@streampipes/shared-ui';
SpLabelComponent,
LayoutAlignDirective,
MatButton,
- TranslatePipe,
],
})
export class PipelineElementIconStandRowComponent implements OnInit {
private editorService = inject(EditorService);
- private dataStreamAssetContextService = inject(DataStreamAssetContextService);
+ private assetBrowserService = inject(SpAssetBrowserService);
+ private assetContextService = inject(SpTableAssetContextService);
private destroyRef = inject(DestroyRef);
@Input()
@@ -81,9 +82,16 @@ export class PipelineElementIconStandRowComponent implements OnInit {
this.cypressName = this.element.name.toLowerCase().replace(' ', '_');
if (this.element instanceof SpDataStream) {
- this.dataStreamAssetContextService
- .watchDataStreamAssetContext(this.element)
- .pipe(takeUntilDestroyed(this.destroyRef))
+ this.assetBrowserService.assetData$
+ .pipe(
+ map(assetData =>
+ this.assetContextService.resolveDataStreamAssetContext(
+ assetData,
+ this.element as SpDataStream,
+ ),
+ ),
+ takeUntilDestroyed(this.destroyRef),
+ )
.subscribe(assetContext => this.assetContext = assetContext);
}
}