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 2026/06/10 21:25:21 UTC
(streampipes) 01/01: feat: Introduce summary DTO for dashboard overview
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a commit to branch introduce-summary-dto-for-dashboards
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit f36d565ba67c3836eacc3407f732c2b2a13ada5b
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Jun 10 23:24:44 2026 +0200
feat: Introduce summary DTO for dashboard overview
---
.../model/dashboard/DashboardSummaryDto.java | 26 ++++
.../model/resource/ResourceSummaryDto.java | 24 ++++
streampipes-resource-management/pom.xml | 10 ++
.../resource/management/CrudResourceManager.java | 3 +
.../management/DataExplorerResourceManager.java | 19 +++
.../permission}/SpPermissionEvaluator.java | 2 +-
.../base/impl/AbstractAuthGuardedRestResource.java | 5 +
.../rest/impl/AdapterMonitoringResource.java | 2 +-
.../rest/impl/connect/AdapterResource.java | 2 +-
.../impl/dashboard/DataLakeDashboardResource.java | 8 ++
.../impl/datalake/AbstractDataLakeResource.java | 2 +-
.../minimal/StreamPipesCoreApplicationMinimal.java | 2 +-
.../service/core/StreamPipesCoreApplication.java | 3 +-
.../src/lib/apis/dashboard.service.ts | 14 ++
.../lib/model/resource/resource-summary.model.ts | 30 +++++
.../dashboard-overview-table.component.html | 22 +--
.../dashboard-overview-table.component.ts | 150 +++++++++++----------
17 files changed, 228 insertions(+), 96 deletions(-)
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardSummaryDto.java b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardSummaryDto.java
new file mode 100644
index 0000000000..cd1c04fcd7
--- /dev/null
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/dashboard/DashboardSummaryDto.java
@@ -0,0 +1,26 @@
+/*
+ * 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.dashboard;
+
+public record DashboardSummaryDto(String elementId,
+ String name,
+ String description,
+ long createdAtEpochMs,
+ long lastModifiedEpochMs) {
+}
diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/resource/ResourceSummaryDto.java b/streampipes-model/src/main/java/org/apache/streampipes/model/resource/ResourceSummaryDto.java
new file mode 100644
index 0000000000..2d3439a3da
--- /dev/null
+++ b/streampipes-model/src/main/java/org/apache/streampipes/model/resource/ResourceSummaryDto.java
@@ -0,0 +1,24 @@
+/*
+ * 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.resource;
+
+import java.util.List;
+
+public record ResourceSummaryDto<T>(List<T> resources,
+ int totalCount) {}
diff --git a/streampipes-resource-management/pom.xml b/streampipes-resource-management/pom.xml
index 7cda933c3b..84f29f9bb5 100644
--- a/streampipes-resource-management/pom.xml
+++ b/streampipes-resource-management/pom.xml
@@ -43,6 +43,16 @@
<version>0.99.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.security</groupId>
+ <artifactId>spring-security-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+
<!-- Test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/CrudResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/CrudResourceManager.java
index a67c6e40f3..b4e9782173 100644
--- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/CrudResourceManager.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/CrudResourceManager.java
@@ -20,6 +20,7 @@ package org.apache.streampipes.resource.management;
import org.apache.streampipes.model.client.user.Permission;
import org.apache.streampipes.model.shared.api.Storable;
import org.apache.streampipes.model.util.ElementIdGenerator;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.storage.api.core.CRUDStorage;
import java.util.List;
@@ -28,11 +29,13 @@ public class CrudResourceManager<T extends Storable>
extends AbstractResourceManager<CRUDStorage<T>> {
private final Class<T> elementClass;
+ protected final SpPermissionEvaluator permissionEvaluator;
public CrudResourceManager(CRUDStorage<T> db,
Class<T> elementClass) {
super(db);
this.elementClass = elementClass;
+ this.permissionEvaluator = new SpPermissionEvaluator();
}
public List<T> findAll() {
diff --git a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
index cb5aa69656..f4fd8d00c0 100644
--- a/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/DataExplorerResourceManager.java
@@ -19,11 +19,15 @@ package org.apache.streampipes.resource.management;
import org.apache.streampipes.model.dashboard.CompositeDashboardModel;
import org.apache.streampipes.model.dashboard.DashboardModel;
+import org.apache.streampipes.model.dashboard.DashboardSummaryDto;
import org.apache.streampipes.model.datalake.DataExplorerWidgetModel;
+import org.apache.streampipes.model.resource.ResourceSummaryDto;
import org.apache.streampipes.storage.api.explorer.IDataExplorerWidgetStorage;
import org.apache.streampipes.storage.api.explorer.IDataLakeMeasureStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
+import org.springframework.security.core.Authentication;
+
import java.util.List;
import java.util.Map;
@@ -38,6 +42,21 @@ public class DataExplorerResourceManager extends CrudResourceManager<DashboardMo
this.dataLakeMeasureStorage = StorageDispatcher.INSTANCE.getNoSqlStore().getDataLakeStorage();
}
+ public ResourceSummaryDto<DashboardSummaryDto> getSummary(Authentication auth) {
+ var dashboards = findAll()
+ .stream()
+ .filter(dashboard -> permissionEvaluator.hasPermission(auth, dashboard.getElementId(), "READ"))
+ .map(dashboard -> new DashboardSummaryDto(
+ dashboard.getElementId(),
+ dashboard.getName(),
+ dashboard.getDescription(),
+ dashboard.getMetadata().getCreatedAtEpochMs(),
+ dashboard.getMetadata().getLastModifiedEpochMs()))
+ .toList();
+
+ return new ResourceSummaryDto<>(dashboards, dashboards.size());
+ }
+
public CompositeDashboardModel getCompositeDashboard(String dashboardId) {
var dashboard = db.getElementById(dashboardId);
var widgets = dashboard.getWidgets().stream()
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/permission/SpPermissionEvaluator.java
similarity index 98%
rename from streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
rename to streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/permission/SpPermissionEvaluator.java
index 1efe69cd66..0c208847c4 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/security/SpPermissionEvaluator.java
+++ b/streampipes-resource-management/src/main/java/org/apache/streampipes/resource/management/permission/SpPermissionEvaluator.java
@@ -15,7 +15,7 @@
* limitations under the License.
*
*/
-package org.apache.streampipes.rest.security;
+package org.apache.streampipes.resource.management.permission;
import org.apache.streampipes.model.client.user.DefaultRole;
import org.apache.streampipes.model.client.user.Permission;
diff --git a/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
index 34134979d9..ae5eb81695 100644
--- a/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
+++ b/streampipes-rest-core-base/src/main/java/org/apache/streampipes/rest/core/base/impl/AbstractAuthGuardedRestResource.java
@@ -21,6 +21,7 @@ package org.apache.streampipes.rest.core.base.impl;
import org.apache.streampipes.model.client.user.DefaultRole;
import org.apache.streampipes.user.management.model.PrincipalUserDetails;
+import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.ArrayList;
@@ -41,6 +42,10 @@ public class AbstractAuthGuardedRestResource extends AbstractRestResource {
return SecurityContextHolder.getContext().getAuthentication().getName();
}
+ protected Authentication getAuthentication() {
+ return SecurityContextHolder.getContext().getAuthentication();
+ }
+
protected PrincipalUserDetails<?> getPrincipal() {
return (PrincipalUserDetails<?>) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
}
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AdapterMonitoringResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AdapterMonitoringResource.java
index 487526d812..ff77d6a6d0 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AdapterMonitoringResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AdapterMonitoringResource.java
@@ -26,7 +26,7 @@ import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.client.user.DefaultPrivilege;
import org.apache.streampipes.model.connect.adapter.AdapterDescription;
import org.apache.streampipes.model.monitoring.SpMetricsEntry;
-import org.apache.streampipes.rest.security.SpPermissionEvaluator;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.storage.api.connect.IAdapterStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
index f408b9c1f4..ea5d106601 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/connect/AdapterResource.java
@@ -38,7 +38,7 @@ import org.apache.streampipes.model.util.ElementIdGenerator;
import org.apache.streampipes.resource.management.PermissionResourceManager;
import org.apache.streampipes.resource.management.SpResourceManager;
import org.apache.streampipes.rest.security.AuthConstants;
-import org.apache.streampipes.rest.security.SpPermissionEvaluator;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.rest.shared.constants.SpMediaType;
import org.apache.streampipes.storage.api.pipeline.IPipelineStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DataLakeDashboardResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DataLakeDashboardResource.java
index fd10324883..f940c21a0e 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DataLakeDashboardResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/dashboard/DataLakeDashboardResource.java
@@ -21,6 +21,8 @@ package org.apache.streampipes.rest.impl.dashboard;
import org.apache.streampipes.model.client.user.DefaultPrivilege;
import org.apache.streampipes.model.dashboard.DashboardModel;
+import org.apache.streampipes.model.dashboard.DashboardSummaryDto;
+import org.apache.streampipes.model.resource.ResourceSummaryDto;
import org.apache.streampipes.resource.management.DataExplorerResourceManager;
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.storage.api.user.IPermissionStorage;
@@ -61,6 +63,12 @@ public class DataLakeDashboardResource extends AbstractAuthGuardedRestResource {
return getResourceManager().findAll();
}
+ @GetMapping(path = "/summary", produces = MediaType.APPLICATION_JSON_VALUE)
+ @PreAuthorize("this.hasReadAuthority()")
+ public ResourceSummaryDto<DashboardSummaryDto> getDashboardSummary() {
+ return getResourceManager().getSummary(getAuthentication());
+ }
+
@GetMapping(path = "/{dashboardId}", produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("this.hasReadAuthority() and hasPermission(#dashboardId, 'READ')")
public DashboardModel getDashboard(@PathVariable("dashboardId") String dashboardId) {
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/AbstractDataLakeResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/AbstractDataLakeResource.java
index 36df49e52e..8eaad216b4 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/AbstractDataLakeResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/AbstractDataLakeResource.java
@@ -21,7 +21,7 @@ import org.apache.streampipes.dataexplorer.api.IDataExplorerSchemaManagement;
import org.apache.streampipes.dataexplorer.management.DataExplorerDispatcher;
import org.apache.streampipes.model.client.user.DefaultPrivilege;
import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
-import org.apache.streampipes.rest.security.SpPermissionEvaluator;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.storage.api.explorer.IDataLakeMeasureStorage;
import org.apache.streampipes.storage.management.StorageDispatcher;
diff --git a/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java b/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
index eb62ec0fcc..467be87746 100644
--- a/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
+++ b/streampipes-service-core-minimal/src/main/java/org/apache/streampipes/service/core/minimal/StreamPipesCoreApplicationMinimal.java
@@ -22,7 +22,7 @@ import org.apache.streampipes.connect.transformer.groovy.GroovyScriptEngine;
import org.apache.streampipes.connect.transformer.js.GraalJsScriptEngine;
import org.apache.streampipes.messaging.mqtt.SpMqttProtocolFactory;
import org.apache.streampipes.messaging.nats.SpNatsProtocolFactory;
-import org.apache.streampipes.rest.security.SpPermissionEvaluator;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.service.base.StreamPipesPrometheusConfig;
import org.apache.streampipes.service.core.OpenApiConfiguration;
import org.apache.streampipes.service.core.StreamPipesCoreApplication;
diff --git a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
index bffcc1be4d..33e8726054 100644
--- a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
+++ b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/StreamPipesCoreApplication.java
@@ -50,6 +50,7 @@ import org.apache.streampipes.model.configuration.SpCoreConfigurationStatus;
import org.apache.streampipes.model.pipeline.Pipeline;
import org.apache.streampipes.model.pipeline.PipelineOperationStatus;
import org.apache.streampipes.resource.management.SpResourceManager;
+import org.apache.streampipes.resource.management.permission.SpPermissionEvaluator;
import org.apache.streampipes.service.base.BaseNetworkingConfig;
import org.apache.streampipes.service.base.StreamPipesPrometheusConfig;
import org.apache.streampipes.service.base.StreamPipesServiceBase;
@@ -90,7 +91,7 @@ import java.util.function.Supplier;
@EnableScheduling
@Import({OpenApiConfiguration.class, StreamPipesPasswordEncoder.class,
StreamPipesPrometheusConfig.class, WebSecurityConfig.class, WelcomePageController.class,
- StorageApiConfiguration.class, ExtensionServiceRequestConfiguration.class})
+ StorageApiConfiguration.class, ExtensionServiceRequestConfiguration.class, SpPermissionEvaluator.class})
@ComponentScan({"org.apache.streampipes.rest.*", "org.apache.streampipes.service.core.oauth2",
"org.apache.streampipes.service.core.scheduler"})
public class StreamPipesCoreApplication extends StreamPipesServiceBase {
diff --git a/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts b/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts
index 06dee0d3bc..9cbcb4dc3c 100644
--- a/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts
+++ b/ui/projects/streampipes/platform-services/src/lib/apis/dashboard.service.ts
@@ -25,6 +25,10 @@ import {
Dashboard,
} from '../model/dashboard/dashboard.model';
import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client';
+import {
+ DashboardSummaryDto,
+ ResourceSummaryDto,
+} from '../model/resource/resource-summary.model';
@Injectable({
providedIn: 'root',
@@ -37,6 +41,12 @@ export class DashboardService {
return this.sharedDatalakeRestService.getDashboards(this.dashboardUrl);
}
+ getDashboardSummary(): Observable<ResourceSummaryDto<DashboardSummaryDto>> {
+ return this.http.get<ResourceSummaryDto<DashboardSummaryDto>>(
+ `${this.dashboardUrl}/summary`,
+ );
+ }
+
getDashboard(dashboardId: string): Observable<Dashboard> {
return this.http.get<Dashboard>(`${this.dashboardUrl}/${dashboardId}`);
}
@@ -70,6 +80,10 @@ export class DashboardService {
);
}
+ deleteDashboardById(elementId: string): Observable<any> {
+ return this.http.delete(`${this.dashboardUrl}/${elementId}`);
+ }
+
saveDashboard(dashboard: Dashboard): Observable<any> {
return this.sharedDatalakeRestService.saveDashboard(
this.dashboardUrl,
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
new file mode 100644
index 0000000000..92b6f46f56
--- /dev/null
+++ b/ui/projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model.ts
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ *
+ */
+
+export interface ResourceSummaryDto<T> {
+ totalCount: number;
+ resources: T[];
+}
+
+export interface DashboardSummaryDto {
+ elementId: string;
+ name: string;
+ description: string;
+ createdAtEpochMs: number;
+ lastModifiedEpochMs: number;
+}
diff --git a/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.html b/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.html
index dc8aefe950..fec74756b8 100644
--- a/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.html
+++ b/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.html
@@ -59,16 +59,11 @@
{{ 'Last modified' | translate }}
</th>
<td mat-cell *matCellDef="let element">
- @if (element.metadata) {
+ @if (element.lastModifiedEpochMs !== null) {
<div>
- {{
- this.formatDate(
- element.metadata.lastModifiedEpochMs
- )
- }}
+ {{ this.formatDate(element.lastModifiedEpochMs) }}
</div>
- }
- @if (!element.metadata) {
+ } @else {
<div>–</div>
}
</td>
@@ -79,16 +74,11 @@
{{ 'Created' | translate }}
</th>
<td mat-cell *matCellDef="let element">
- @if (element.metadata) {
+ @if (element.createdAtEpochMs !== null) {
<div>
- {{
- this.formatDate(
- element.metadata.createdAtEpochMs
- )
- }}
+ {{ this.formatDate(element.createdAtEpochMs) }}
</div>
- }
- @if (!element.metadata) {
+ } @else {
<div>–</div>
}
</td>
diff --git a/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.ts b/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.ts
index 94119f19d8..6d5c484257 100644
--- a/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.ts
+++ b/ui/src/app/dashboard/components/overview/dashboard-overview-table/dashboard-overview-table.component.ts
@@ -48,7 +48,6 @@ import {
} from '@streampipes/shared-ui';
import { MatDialog } from '@angular/material/dialog';
import { DataExplorerDashboardService } from '../../../../dashboard-shared/services/dashboard.service';
-import { ChartSharedService } from '../../../../chart-shared/services/chart-shared.service';
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
import { Router } from '@angular/router';
import { CloneDashboardDialogComponent } from '../../../dialogs/clone-dashboard/clone-dashboard-dialog.component';
@@ -63,6 +62,7 @@ import {
} from '@ngbracket/ngx-layout/flex';
import { MatMenuItem } from '@angular/material/menu';
import { MatIcon } from '@angular/material/icon';
+import { DashboardSummaryDto } from '../../../../../../projects/streampipes/platform-services/src/lib/model/resource/resource-summary.model';
@Component({
selector: 'sp-dashboard-overview-table',
@@ -94,7 +94,7 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
@Input()
hasDashboardWritePrivileges: boolean;
- dataSource = new MatTableDataSource<Dashboard>();
+ dataSource = new MatTableDataSource<DashboardSummaryDto>();
@ViewChild(MatSort)
sort: MatSort;
@@ -110,12 +110,11 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
resourceLinkType: 'dashboard',
resourceIdKey: 'elementId',
};
- dashboards: Dashboard[] = [];
- filteredDashboards: Dashboard[] = [];
+ dashboards: DashboardSummaryDto[] = [];
+ filteredDashboards: DashboardSummaryDto[] = [];
private dashboardService = inject(DashboardService);
private dataExplorerDashboardService = inject(DataExplorerDashboardService);
- private dataExplorerSharedService = inject(ChartSharedService);
private dialog = inject(MatDialog);
protected translateService = inject(TranslateService);
protected dateFormatService = inject(DateFormatService);
@@ -137,9 +136,9 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
this.dataSource.sortingDataAccessor = (dashboard, column) => {
if (column === 'lastModified') {
- return dashboard.metadata.lastModifiedEpochMs;
+ return dashboard.lastModifiedEpochMs;
} else if (column === 'createdAt') {
- return dashboard.metadata.createdAtEpochMs;
+ return dashboard.createdAtEpochMs;
}
return dashboard[column];
};
@@ -147,52 +146,49 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
this.getDashboards();
}
- showManageDialog(resource: Dashboard) {
- const resourceConfig: ObjectManageDialogResourceConfig<Dashboard> = {
- resourceLabel: 'Dashboard',
- nameLabel: 'Dashboard title',
- descriptionLabel: 'Dashboard description',
- nameProperty: 'name',
- assetLinkType: 'dashboard',
- assetLinkCheckboxLabel:
- 'Add the current dashboard to an existing asset',
- saveResource: resource =>
- this.dashboardService.updateDashboard(resource),
- };
- const dialogRef = this.dialogService.open(ObjectManageDialogComponent, {
- panelType: PanelType.SLIDE_IN_PANEL,
- title: this.translateService.instant('Manage'),
- width: '50vw',
- data: {
- objectInstanceId: resource.elementId,
- resource: { ...resource },
- saveMode: 'immediate',
- resourceConfig,
- headerTitle:
- this.translateService.instant('Manage Dashboard ') +
- resource.name,
- },
- });
- dialogRef.afterClosed().subscribe(refresh => {
- if (refresh) {
- this.getDashboards();
- }
- });
- }
-
- openEditDashboardDialog(dashboard: Dashboard) {
- const dialogRef =
- this.dataExplorerDashboardService.openDashboardModificationDialog(
- false,
- dashboard,
- );
-
- dialogRef.afterClosed().subscribe(() => {
- this.getDashboards();
- });
+ showManageDialog(dashboard: DashboardSummaryDto) {
+ this.dashboardService
+ .getDashboard(dashboard.elementId)
+ .subscribe(resource => {
+ const resourceConfig: ObjectManageDialogResourceConfig<Dashboard> =
+ {
+ resourceLabel: 'Dashboard',
+ nameLabel: 'Name',
+ descriptionLabel: 'Description',
+ nameProperty: 'name',
+ assetLinkType: 'dashboard',
+ assetLinkCheckboxLabel:
+ 'Add the current dashboard to an existing asset',
+ saveResource: resource =>
+ this.dashboardService.updateDashboard(resource),
+ };
+ const dialogRef = this.dialogService.open(
+ ObjectManageDialogComponent,
+ {
+ panelType: PanelType.SLIDE_IN_PANEL,
+ title: this.translateService.instant('Manage'),
+ width: '50vw',
+ data: {
+ objectInstanceId: resource.elementId,
+ resource: { ...resource },
+ saveMode: 'immediate',
+ resourceConfig,
+ headerTitle:
+ this.translateService.instant(
+ 'Manage Dashboard ',
+ ) + resource.name,
+ },
+ },
+ );
+ dialogRef.afterClosed().subscribe(refresh => {
+ if (refresh) {
+ this.getDashboards();
+ }
+ });
+ });
}
- openDeleteDashboardDialog(dashboard: Dashboard) {
+ openDeleteDashboardDialog(dashboard: DashboardSummaryDto) {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '600px',
data: {
@@ -212,7 +208,7 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
dialogRef.afterClosed().subscribe(result => {
if (result === 'confirm') {
this.dashboardService
- .deleteDashboard(dashboard)
+ .deleteDashboardById(dashboard.elementId)
.subscribe(() => {
this.getDashboards();
});
@@ -220,17 +216,19 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
});
}
- showDashboard(dashboard: Dashboard) {
+ showDashboard(dashboard: DashboardSummaryDto) {
this.routingService.navigateToDashboard(false, dashboard.elementId);
}
- editDashboard(dashboard: Dashboard) {
+ editDashboard(dashboard: DashboardSummaryDto) {
this.routingService.navigateToDashboard(true, dashboard.elementId);
}
getDashboards() {
- this.dashboardService.getDashboards().subscribe(data => {
- this.dashboards = data.sort((a, b) => a.name.localeCompare(b.name));
+ this.dashboardService.getDashboardSummary().subscribe(data => {
+ this.dashboards = data.resources.sort((a, b) =>
+ a.name.localeCompare(b.name),
+ );
this.applyDashboardFilters(this.currentFilterIds);
});
}
@@ -261,26 +259,30 @@ export class DashboardOverviewTableComponent implements OnInit, OnDestroy {
return `${window.location.protocol}//${window.location.host}/#/dashboard-kiosk/${dashboardId}`;
}
- openCloneDialog(dashboard: Dashboard): void {
- const dialogRef = this.dialogService.open(
- CloneDashboardDialogComponent,
- {
- panelType: PanelType.SLIDE_IN_PANEL,
- title: this.translateService.instant('Clone dashboard'),
- width: '50vw',
- data: {
- dashboard: dashboard,
- },
- },
- );
- dialogRef.afterClosed().subscribe(result => {
- if (result) {
- this.getDashboards();
- }
- });
+ openCloneDialog(dashboardSummary: DashboardSummaryDto): void {
+ this.dashboardService
+ .getDashboard(dashboardSummary.elementId)
+ .subscribe(dashboard => {
+ const dialogRef = this.dialogService.open(
+ CloneDashboardDialogComponent,
+ {
+ panelType: PanelType.SLIDE_IN_PANEL,
+ title: this.translateService.instant('Clone dashboard'),
+ width: '50vw',
+ data: {
+ dashboard: dashboard,
+ },
+ },
+ );
+ dialogRef.afterClosed().subscribe(result => {
+ if (result) {
+ this.getDashboards();
+ }
+ });
+ });
}
- onRowClicked(dashboard: Dashboard) {
+ onRowClicked(dashboard: DashboardSummaryDto) {
this.showDashboard(dashboard);
}