From 32c2d44b0cd664aa832c4471c976690208dfa2be Mon Sep 17 00:00:00 2001 From: Ruslan Vasylkiv <87172504+rusikv@users.noreply.github.com> Date: Fri, 14 Jul 2023 12:37:40 +0300 Subject: [PATCH] added rewrite param to delete latest timeseries, enabled single selection deletion (#8933) --- ui-ngx/src/app/core/http/attribute.service.ts | 10 ++++++---- .../attribute/attribute-table.component.html | 2 +- .../components/attribute/attribute-table.component.ts | 11 ++++++----- .../attribute/delete-timeseries-panel.component.html | 2 ++ .../attribute/delete-timeseries-panel.component.ts | 6 +++++- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ui-ngx/src/app/core/http/attribute.service.ts b/ui-ngx/src/app/core/http/attribute.service.ts index b772cd63e6..cc20069e04 100644 --- a/ui-ngx/src/app/core/http/attribute.service.ts +++ b/ui-ngx/src/app/core/http/attribute.service.ts @@ -50,7 +50,7 @@ export class AttributeService { } public deleteEntityTimeseries(entityId: EntityId, timeseries: Array, deleteAllDataForKeys = false, - startTs?: number, endTs?: number, rewriteLatestIfDeleted = false, deleteLatest = false, + startTs?: number, endTs?: number, rewriteLatestIfDeleted = false, deleteLatest = true, config?: RequestConfig): Observable { const keys = timeseries.map(attribute => encodeURIComponent(attribute.key)).join(','); let url = `/api/plugins/telemetry/${entityId.entityType}/${entityId.id}/timeseries/delete` + @@ -64,9 +64,11 @@ export class AttributeService { return this.http.delete(url, defaultHttpOptionsFromConfig(config)); } - public deleteEntityLatestTimeseries(entityId: EntityId, timeseries: Array, config?: RequestConfig): Observable { + public deleteEntityLatestTimeseries(entityId: EntityId, timeseries: Array, rewrite = true, + config?: RequestConfig): Observable { const keys = timeseries.map(attribute => encodeURIComponent(attribute.key)).join(','); - let url = `/api/plugins/telemetry/${entityId.entityType}/${entityId.id}/timeseries/latest/delete?keys=${keys}`; + let url = `/api/plugins/telemetry/${entityId.entityType}/${entityId.id}/timeseries/latest/delete?keys=${keys}` + + `$rewrite=${rewrite}`; return this.http.delete(url, defaultHttpOptionsFromConfig(config)); } @@ -111,7 +113,7 @@ export class AttributeService { let deleteEntityTimeseriesObservable: Observable; if (deleteTimeseries.length) { deleteEntityTimeseriesObservable = this.deleteEntityTimeseries(entityId, deleteTimeseries, true, - null, null, false, false, config); + null, null, false, true, config); } else { deleteEntityTimeseriesObservable = of(null); } diff --git a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html index 1def300b78..95ade10645 100644 --- a/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html +++ b/ui-ngx/src/app/modules/home/components/attribute/attribute-table.component.html @@ -93,7 +93,7 @@ (click)="deleteAttributes($event)"> delete -