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/07/28 10:52:34 UTC
(streampipes) branch 4768-use-sp-search-select-in-the-add-asset-link-dialog updated: Prevent adding same asset links multiple times
This is an automated email from the ASF dual-hosted git repository.
SvenO3 pushed a commit to branch 4768-use-sp-search-select-in-the-add-asset-link-dialog
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/4768-use-sp-search-select-in-the-add-asset-link-dialog by this push:
new f64983b460 Prevent adding same asset links multiple times
f64983b460 is described below
commit f64983b4602303598029f64ef41fabd7cd15c86a
Author: Sven Oehler <oe...@web.de>
AuthorDate: Tue Jul 28 12:52:20 2026 +0200
Prevent adding same asset links multiple times
---
.../asset-details-links.component.ts | 1 +
.../asset-link-table/asset-link-table.component.ts | 1 +
.../edit-asset-link-dialog.component.ts | 45 +++++++++++++++++-----
3 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
index fa63a71fc9..27b932976e 100644
--- a/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
+++ b/ui/src/app/assets/components/asset-details/edit-asset/asset-details-panel/asset-details-links/asset-details-links.component.ts
@@ -138,6 +138,7 @@ export class AssetDetailsLinksComponent implements OnInit {
width: '50vw',
data: {
assetLink: assetLink,
+ assetLinks: this.asset.assetLinks,
assetLinkTypes: this.assetLinkTypes,
createMode: true,
},
diff --git a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts
index 1b4a3a0dc3..8f05e59a8a 100644
--- a/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts
+++ b/ui/src/app/assets/components/asset-details/view-asset/view-asset-links/asset-link-table/asset-link-table.component.ts
@@ -190,6 +190,7 @@ export class AssetLinkTableComponent implements OnInit, OnChanges, OnDestroy {
width: '50vw',
data: {
assetLink: assetLink,
+ assetLinks: this.asset.assetLinks,
assetLinkTypes: this.assetLinkTypes,
createMode: false,
},
diff --git a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
index 7cf4b0eee3..de6f56d043 100644
--- a/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
+++ b/ui/src/app/assets/dialog/edit-asset-link/edit-asset-link-dialog.component.ts
@@ -69,6 +69,9 @@ export class EditAssetLinkDialogComponent
@Input()
assetLinkTypes: AssetLinkType[];
+ @Input()
+ assetLinks: AssetLink[] = [];
+
@Input()
createMode: boolean;
@@ -102,24 +105,42 @@ export class EditAssetLinkDialogComponent
}
get selectableResources(): any[] {
+ let resources: any[];
+
switch (this.selectedLinkType.linkQueryHint) {
case 'pipeline':
- return this.pipelines ?? [];
+ resources = this.pipelines ?? [];
+ break;
case 'data-source':
- return this.dataSources ?? [];
+ resources = this.dataSources ?? [];
+ break;
case 'dashboard':
- return this.dashboards ?? [];
+ resources = this.dashboards ?? [];
+ break;
case 'chart':
- return this.charts ?? [];
+ resources = this.charts ?? [];
+ break;
case 'adapter':
- return this.adapters ?? [];
+ resources = this.adapters ?? [];
+ break;
case 'measurement':
- return this.dataLakeMeasures ?? [];
+ resources = this.dataLakeMeasures ?? [];
+ break;
case 'file':
- return this.files ?? [];
+ resources = this.files ?? [];
+ break;
default:
- return [];
+ resources = [];
}
+
+ return resources.filter(
+ resource =>
+ !this.assetLinks.some(
+ assetLink =>
+ assetLink !== this.assetLink &&
+ assetLink.resourceId === this.getResourceId(resource),
+ ),
+ );
}
ngOnInit(): void {
@@ -195,8 +216,14 @@ export class EditAssetLinkDialogComponent
afterResourcesLoaded(): void {
if (!this.createMode) {
this.currentResource = this.allResources.find(
- r => r.elementId === this.clonedAssetLink.resourceId,
+ resource =>
+ this.getResourceId(resource) ===
+ this.clonedAssetLink.resourceId,
);
}
}
+
+ private getResourceId(resource: any): string {
+ return resource.fileId ?? resource.elementId;
+ }
}