You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by eb...@apache.org on 2020/05/13 19:03:33 UTC

[incubator-streampipes] branch timeseries-labeling updated: Update endpoint definition and related http request for label update

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

ebi pushed a commit to branch timeseries-labeling
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/timeseries-labeling by this push:
     new c1c56c9  Update endpoint definition and related http request for label update
c1c56c9 is described below

commit c1c56c9355345e75d37a67340471f803325147be
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Wed May 13 21:04:14 2020 +0200

    Update endpoint definition and related http request for label update
---
 .../streampipes/rest/impl/datalake/DataLakeResourceV3.java  | 13 +++++++------
 ui/src/app/core-services/datalake/datalake-rest.service.ts  |  4 ++--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
index d4d61ac..db9b0b7 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/datalake/DataLakeResourceV3.java
@@ -212,15 +212,16 @@ public class DataLakeResourceV3 extends AbstractRestInterface {
 
   @POST
   @Produces(MediaType.TEXT_PLAIN)
-  @Path("/data/{index}/labeling/{startdate}/{enddate}/{label}")
-    public Response labelData(@PathParam("index") String index,
+  @Path("/data/{index}/{startdate}/{enddate}/labeling")
+    public Response labelData(@Context UriInfo info,
+                              @PathParam("index") String index,
                               @PathParam("startdate") long startdate,
-                              @PathParam("enddate") long enddate,
-                              @PathParam("label") String label) {
+                              @PathParam("enddate") long enddate) {
 
-    this.dataLakeManagement.updateLabels(index, startdate, enddate, label);
+        String label = info.getQueryParameters().getFirst("label");
+        this.dataLakeManagement.updateLabels(index, startdate, enddate, label);
 
-    return Response.ok("Successfully updated database.", MediaType.TEXT_PLAIN).build();
+        return Response.ok("Successfully updated database.", MediaType.TEXT_PLAIN).build();
   }
 
 
diff --git a/ui/src/app/core-services/datalake/datalake-rest.service.ts b/ui/src/app/core-services/datalake/datalake-rest.service.ts
index 59caebb..d0e2ccd 100644
--- a/ui/src/app/core-services/datalake/datalake-rest.service.ts
+++ b/ui/src/app/core-services/datalake/datalake-rest.service.ts
@@ -106,8 +106,8 @@ export class DatalakeRestService {
     }
 
     saveLabelsInDatabase(index, startDate, endDate, label) {
-        const request = new HttpRequest('POST', this.dataLakeUrlV3 + '/data/' + index + '/labeling/' + startDate + '/' +
-            endDate + '/' + label,  {}, {
+        const request = new HttpRequest('POST', this.dataLakeUrlV3 + '/data/' + index + '/' + startDate + '/' +
+            endDate + '/labeling?label=' + label,  {}, {
             reportProgress: true,
             responseType: 'text'
         });