Commit b8a3b8ae14c944542297d009acce65f704baf7f7
1 parent
e4bfbacd
Fixed startTs, endTs in deleteEntityTimeseries
Showing
1 changed file
with
11 additions
and
5 deletions
@@ -50,11 +50,17 @@ export class AttributeService { | @@ -50,11 +50,17 @@ export class AttributeService { | ||
50 | } | 50 | } |
51 | 51 | ||
52 | public deleteEntityTimeseries(entityId: EntityId, timeseries: Array<AttributeData>, deleteAllDataForKeys = false, | 52 | public deleteEntityTimeseries(entityId: EntityId, timeseries: Array<AttributeData>, deleteAllDataForKeys = false, |
53 | - config?: RequestConfig): Observable<any> { | 53 | + startTs?: number, endTs?: number, config?: RequestConfig): Observable<any> { |
54 | const keys = timeseries.map(attribute => encodeURI(attribute.key)).join(','); | 54 | const keys = timeseries.map(attribute => encodeURI(attribute.key)).join(','); |
55 | - return this.http.delete(`/api/plugins/telemetry/${entityId.entityType}/${entityId.id}/timeseries/delete` + | ||
56 | - `?keys=${keys}&deleteAllDataForKeys=${deleteAllDataForKeys}`, | ||
57 | - defaultHttpOptionsFromConfig(config)); | 55 | + let url = `/api/plugins/telemetry/${entityId.entityType}/${entityId.id}/timeseries/delete` + |
56 | + `?keys=${keys}&deleteAllDataForKeys=${deleteAllDataForKeys}`; | ||
57 | + if (startTs) { | ||
58 | + url += `&startTs=${startTs}`; | ||
59 | + } | ||
60 | + if (endTs) { | ||
61 | + url += `&endTs=${endTs}`; | ||
62 | + } | ||
63 | + return this.http.delete(url, defaultHttpOptionsFromConfig(config)); | ||
58 | } | 64 | } |
59 | 65 | ||
60 | public saveEntityAttributes(entityId: EntityId, attributeScope: AttributeScope, attributes: Array<AttributeData>, | 66 | public saveEntityAttributes(entityId: EntityId, attributeScope: AttributeScope, attributes: Array<AttributeData>, |
@@ -97,7 +103,7 @@ export class AttributeService { | @@ -97,7 +103,7 @@ export class AttributeService { | ||
97 | }); | 103 | }); |
98 | let deleteEntityTimeseriesObservable: Observable<any>; | 104 | let deleteEntityTimeseriesObservable: Observable<any>; |
99 | if (deleteTimeseries.length) { | 105 | if (deleteTimeseries.length) { |
100 | - deleteEntityTimeseriesObservable = this.deleteEntityTimeseries(entityId, deleteTimeseries, true, config); | 106 | + deleteEntityTimeseriesObservable = this.deleteEntityTimeseries(entityId, deleteTimeseries, true, null, null, config); |
101 | } else { | 107 | } else { |
102 | deleteEntityTimeseriesObservable = of(null); | 108 | deleteEntityTimeseriesObservable = of(null); |
103 | } | 109 | } |