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/09 13:43:41 UTC
(streampipes) 02/02: Add total count to dataset feature card
This is an automated email from the ASF dual-hosted git repository.
SvenO3 pushed a commit to branch improve-dataset-details-and-feature-card-views
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 7aaa10e4aa71a4e25152f06b8775841f8d5ff2cf
Author: Sven Oehler <oe...@web.de>
AuthorDate: Thu Jul 9 15:43:11 2026 +0200
Add total count to dataset feature card
---
.../dataset-feature-card.component.html | 20 +++++++
.../dataset-feature-card.component.ts | 62 +++++++++++++---------
2 files changed, 58 insertions(+), 24 deletions(-)
diff --git a/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.html b/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.html
index 9c46386282..f6ccb81b0d 100644
--- a/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.html
+++ b/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.html
@@ -54,6 +54,26 @@
</sp-label>
</div>
</div>
+
+ <div
+ class="feature-card-meta-box"
+ fxLayout="row"
+ fxLayoutAlign="start center"
+ fxLayoutGap="0.75rem"
+ >
+ <mat-icon class="feature-card-meta-icon">numbers</mat-icon>
+ <div>
+ <div class="feature-card-meta-field-label">
+ {{ 'Total events' | translate }}
+ </div>
+ <div
+ class="feature-card-meta-field-value mt-xs"
+ data-cy="dataset-feature-card-total-events"
+ >
+ {{ totalEventCount ?? '-' }}
+ </div>
+ </div>
+ </div>
</sp-feature-card-meta-section>
<div class="feature-card-meta-section__label">
diff --git a/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.ts b/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.ts
index f14d2f9332..84adc59302 100644
--- a/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.ts
+++ b/ui/src/app/dataset/components/dataset-feature-card/dataset-feature-card.component.ts
@@ -35,7 +35,7 @@ import {
GenericStorageService,
SpQueryResult,
} from '@streampipes/platform-services';
-import { forkJoin } from 'rxjs';
+import { catchError, forkJoin, Observable, of } from 'rxjs';
import { TranslatePipe } from '@ngx-translate/core';
import { MatIcon } from '@angular/material/icon';
import {
@@ -72,6 +72,7 @@ export class DatasetFeatureCardComponent implements OnInit {
assetLinkType: AssetLinkType;
dataPreview: SpQueryResult;
lastEventTs: number | undefined;
+ totalEventCount: number | undefined;
previewRows: PreviewRow[] = [];
private datalakeRestService = inject(DatalakeRestService);
@@ -93,30 +94,43 @@ export class DatasetFeatureCardComponent implements OnInit {
}
loadSampleData(): void {
- this.datalakeRestService
- .getData(this.dataset.measureName, {
- endDate: new Date().getTime(),
- startDate: 0,
- limit: 1,
- order: 'DESC',
- missingValueBehaviour: 'empty',
- columns: this.dataset.eventSchema.eventProperties
- .map(ep => ep.runtimeName)
- .toString(),
- })
- .subscribe(res => {
- this.dataPreview = res;
- if (res.total > 0) {
- const previewRow = res.allDataSeries?.[0]?.rows?.[0] ?? [];
- this.lastEventTs = Number(previewRow[0]);
- this.previewRows = res.headers.map((header, index) =>
+ forkJoin({
+ dataPreview: this.datalakeRestService
+ .getData(this.dataset.measureName, {
+ endDate: new Date().getTime(),
+ startDate: 0,
+ limit: 1,
+ order: 'DESC',
+ missingValueBehaviour: 'empty',
+ columns: this.dataset.eventSchema.eventProperties
+ .map(ep => ep.runtimeName)
+ .toString(),
+ })
+ .pipe(catchError(() => of(new SpQueryResult()))),
+ totalEventCount: this.loadTotalEventCount(),
+ }).subscribe(res => {
+ this.dataPreview = res.dataPreview;
+ this.totalEventCount = res.totalEventCount;
+
+ if (res.dataPreview.total > 0) {
+ const previewRow =
+ res.dataPreview.allDataSeries?.[0]?.rows?.[0] ?? [];
+ this.lastEventTs = Number(previewRow[0]);
+ this.previewRows = res.dataPreview.headers.map(
+ (header, index) =>
this.toPreviewRow(header, previewRow[index]),
- );
- } else {
- this.previewRows = [];
- this.lastEventTs = undefined;
- }
- });
+ );
+ } else {
+ this.previewRows = [];
+ this.lastEventTs = undefined;
+ }
+ });
+ }
+
+ private loadTotalEventCount(): Observable<number> {
+ return this.datalakeRestService
+ .getMeasurementEntryCount(this.dataset.elementId)
+ .pipe(catchError(() => of(0)));
}
formatDate(timestamp?: number): string {