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

dominikriemer pushed a commit to branch add-resource-dtos
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 9737c1ecba2c7bf2677fa70d34363b46ea74c52b
Author: Dominik Riemer <[email protected]>
AuthorDate: Fri Jun 12 23:20:50 2026 +0200

    Add asset summary dto
---
 .../streampipes/model/assets/AssetSummaryDto.java  | 25 +++++++++
 .../resource/management/AssetResourceManager.java  | 62 ++++++++++++++++++++++
 .../resource/management/SpResourceManager.java     |  4 ++
 .../rest/impl/AssetManagementResource.java         | 13 +++++
 .../src/lib/apis/asset-management.service.ts       | 10 ++++
 .../lib/model/resource/resource-summary.model.ts   |  7 +++
 .../asset-overview/asset-overview.component.ts     | 19 +++----
 7 files changed, 131 insertions(+), 9 deletions(-)

diff --git 
a/streampipes-model/src/main/java/org/apache/streampipes/model/assets/AssetSummaryDto.java
 
b/streampipes-model/src/main/java/org/apache/streampipes/model/assets/AssetSummaryDto.java
new file mode 100644
index 0000000000..26bbde8471
--- /dev/null
+++ 
b/streampipes-model/src/main/java/org/apache/streampipes/model/assets/AssetSummaryDto.java
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.model.assets;
+
+public record AssetSummaryDto(String elementId,
+                              String assetName,
+                              String assetDescription,
+                              boolean removable) {
+}
diff --git 
a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AssetResourceManager.java
 
b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AssetResourceManager.java
new file mode 100644
index 0000000000..b8aa3a0ba4
--- /dev/null
+++ 
b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/AssetResourceManager.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ *
+ */
+
+package org.apache.streampipes.resource.management;
+
+import org.apache.streampipes.model.assets.AssetSummaryDto;
+import org.apache.streampipes.model.assets.SpAssetModel;
+import org.apache.streampipes.model.resource.ResourceSummaryDto;
+import 
org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
+import org.apache.streampipes.storage.api.system.IAssetStorage;
+import org.apache.streampipes.storage.management.StorageDispatcher;
+
+import org.springframework.security.core.Authentication;
+
+public class AssetResourceManager extends 
AbstractResourceManager<IAssetStorage> {
+
+  private final SpPermissionEvaluator permissionEvaluator;
+
+  public AssetResourceManager() {
+    super(StorageDispatcher.INSTANCE.getNoSqlStore().getAssetStorage());
+    this.permissionEvaluator = new SpPermissionEvaluator();
+  }
+
+  public ResourceSummaryDto<AssetSummaryDto> getSummary(Authentication auth) {
+    var assets = db.findAll().stream()
+        .filter(asset -> canReadAsset(auth, asset))
+        .map(this::toSummary)
+        .toList();
+
+    return new ResourceSummaryDto<>(assets, assets.size());
+  }
+
+  private boolean canReadAsset(Authentication auth, SpAssetModel asset) {
+    return asset != null
+        && asset.getElementId() != null
+        && permissionEvaluator.hasPermission(auth, asset.getElementId(), 
"READ");
+  }
+
+  private AssetSummaryDto toSummary(SpAssetModel asset) {
+    return new AssetSummaryDto(
+        asset.getElementId(),
+        asset.getAssetName(),
+        asset.getAssetDescription(),
+        asset.isRemovable()
+    );
+  }
+}
diff --git 
a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
 
b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
index 0eaf2f7947..294f9ddb1b 100644
--- 
a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
+++ 
b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/SpResourceManager.java
@@ -21,6 +21,10 @@ import 
org.apache.streampipes.storage.api.explorer.IDataExplorerWidgetStorage;
 
 public class SpResourceManager {
 
+  public AssetResourceManager manageAssets() {
+    return new AssetResourceManager();
+  }
+
   public AdapterResourceManager manageAdapters() {
     return new AdapterResourceManager();
   }
diff --git 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetManagementResource.java
 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetManagementResource.java
index 897285c710..27140f71f5 100644
--- 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetManagementResource.java
+++ 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AssetManagementResource.java
@@ -18,8 +18,11 @@
 
 package org.apache.streampipes.rest.impl;
 
+import org.apache.streampipes.model.assets.AssetSummaryDto;
 import org.apache.streampipes.model.assets.SpAssetModel;
 import org.apache.streampipes.model.client.user.DefaultPrivilege;
+import org.apache.streampipes.model.resource.ResourceSummaryDto;
+import org.apache.streampipes.resource.management.AssetResourceManager;
 import org.apache.streampipes.resource.management.CrudResourceManager;
 import 
org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
 import org.apache.streampipes.rest.security.AuthConstants;
@@ -54,6 +57,12 @@ public class AssetManagementResource extends 
AbstractAuthGuardedRestResource {
     this.resourceManager = new CrudResourceManager<>(assetStorage, 
SpAssetModel.class);
   }
 
+  @GetMapping(path = "/summary", produces = MediaType.APPLICATION_JSON_VALUE)
+  @PreAuthorize(AuthConstants.IS_AUTHENTICATED)
+  public ResourceSummaryDto<AssetSummaryDto> getAssetSummary() {
+    return getResourceManager().getSummary(getAuthentication());
+  }
+
   @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
   @PreAuthorize(AuthConstants.IS_AUTHENTICATED)
   @PostFilter("hasPermission(filterObject.elementId, 'READ')")
@@ -104,4 +113,8 @@ public class AssetManagementResource extends 
AbstractAuthGuardedRestResource {
   public boolean hasWriteAuthority() {
     return 
isAdminOrHasAnyAuthority(DefaultPrivilege.Constants.PRIVILEGE_WRITE_ASSETS_VALUE);
   }
+
+  private AssetResourceManager getResourceManager() {
+    return getSpResourceManager().manageAssets();
+  }
 }
diff --git 
a/ui/projects/streampipes/platform-services/src/lib/apis/asset-management.service.ts
 
b/ui/projects/streampipes/platform-services/src/lib/apis/asset-management.service.ts
index 2d1312157b..f1670af6e7 100644
--- 
a/ui/projects/streampipes/platform-services/src/lib/apis/asset-management.service.ts
+++ 
b/ui/projects/streampipes/platform-services/src/lib/apis/asset-management.service.ts
@@ -21,6 +21,10 @@ import { HttpClient } from '@angular/common/http';
 import { PlatformServicesCommons } from './commons.service';
 import { Observable } from 'rxjs';
 import { SpAssetModel } from '../model/gen/streampipes-model';
+import {
+    AssetSummaryDto,
+    ResourceSummaryDto,
+} from '../model/resource/resource-summary.model';
 
 @Injectable({
     providedIn: 'root',
@@ -37,6 +41,12 @@ export class AssetManagementService {
         return this.http.get<SpAssetModel[]>(this.assetBasePath);
     }
 
+    getAssetSummary(): Observable<ResourceSummaryDto<AssetSummaryDto>> {
+        return this.http.get<ResourceSummaryDto<AssetSummaryDto>>(
+            `${this.assetBasePath}/summary`,
+        );
+    }
+
     getAsset(assetId: string): Observable<SpAssetModel> {
         return this.http.get<SpAssetModel>(`${this.assetBasePath}/${assetId}`);
     }
diff --git 
a/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
 
b/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
index 067d05ea54..b4348b7d19 100644
--- 
a/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
+++ 
b/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
@@ -43,6 +43,13 @@ export interface AdapterSummaryDto {
     icon: string;
 }
 
+export interface AssetSummaryDto {
+    elementId: string;
+    assetName: string;
+    assetDescription: string;
+    removable: boolean;
+}
+
 export interface DatasetSummaryDto {
     elementId: string;
     measureName: string;
diff --git 
a/ui/src/app/assets/components/asset-overview/asset-overview.component.ts 
b/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
index 3a875e2da7..d270b80e3b 100644
--- a/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
+++ b/ui/src/app/assets/components/asset-overview/asset-overview.component.ts
@@ -26,6 +26,7 @@ import {
     MatTableDataSource,
 } from '@angular/material/table';
 import {
+    AssetSummaryDto,
     AssetManagementService,
     SpAssetModel,
 } from '@streampipes/platform-services';
@@ -99,16 +100,16 @@ export class SpAssetOverviewComponent implements OnInit {
     private dialog = inject(MatDialog);
     private translateService = inject(TranslateService);
 
-    existingAssets: SpAssetModel[] = [];
-    filteredAssets: SpAssetModel[] = [];
+    existingAssets: AssetSummaryDto[] = [];
+    filteredAssets: AssetSummaryDto[] = [];
 
     displayedColumns: string[] = ['assetName', 'actions'];
 
     @ViewChild(MatSort)
     sort: MatSort;
 
-    dataSource: MatTableDataSource<SpAssetModel> =
-        new MatTableDataSource<SpAssetModel>();
+    dataSource: MatTableDataSource<AssetSummaryDto> =
+        new MatTableDataSource<AssetSummaryDto>();
 
     hasWritePrivilege = false;
 
@@ -153,8 +154,8 @@ export class SpAssetOverviewComponent implements OnInit {
     }
 
     loadAssets(): void {
-        this.assetService.getAllAssets().subscribe(result => {
-            this.existingAssets = (result as SpAssetModel[]).sort((a, b) =>
+        this.assetService.getAssetSummary().subscribe(result => {
+            this.existingAssets = result.resources.sort((a, b) =>
                 a.assetName.localeCompare(b.assetName),
             );
             this.applyAssetFilters(this.currentFilterIds);
@@ -210,12 +211,12 @@ export class SpAssetOverviewComponent implements OnInit {
         });
     }
 
-    goToDetailsView(asset: SpAssetModel, editMode = false) {
+    goToDetailsView(asset: AssetSummaryDto, editMode = false) {
         const mode = editMode && this.hasWritePrivilege ? 'edit' : 'view';
         this.router.navigate(['assets', 'details', asset.elementId, mode]);
     }
 
-    deleteAsset(asset: SpAssetModel) {
+    deleteAsset(asset: AssetSummaryDto) {
         const dialogRef = this.dialog.open(ConfirmDialogComponent, {
             width: '500px',
             data: {
@@ -239,7 +240,7 @@ export class SpAssetOverviewComponent implements OnInit {
         });
     }
 
-    openPermissionsDialog(asset: SpAssetModel) {
+    openPermissionsDialog(asset: AssetSummaryDto) {
         this.dialogService.open(ObjectPermissionDialogComponent, {
             panelType: PanelType.SLIDE_IN_PANEL,
             title: this.translateService.instant('Manage permissions'),

Reply via email to