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 2021/09/24 13:26:18 UTC

[incubator-streampipes] 04/12: [STREAMPIPES-427] Modify paths of deployment resource and extensions resource

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

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

commit a5e62d41de6fe0cfac21fabde92a672dd9eff60e
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Sep 24 13:59:19 2021 +0200

    [STREAMPIPES-427] Modify paths of deployment resource and extensions resource
---
 .../apache/streampipes/rest/impl/DataStream.java   |  2 +-
 .../apache/streampipes/rest/impl/Deployment.java   |  7 +++---
 .../impl/ExtensionsServiceEndpointResource.java    |  2 +-
 ui/src/app/add/services/add.service.ts             | 28 +++++++++++-----------
 4 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
index 747da3b..3e2aa7d 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/DataStream.java
@@ -28,7 +28,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
-@Path("/v2/users/{username}/streams")
+@Path("/v2/streams")
 public class DataStream extends AbstractRestResource {
 
   @Path("/update")
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
index f6d9c93..e4dd8fc 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/Deployment.java
@@ -37,7 +37,7 @@ import javax.ws.rs.core.Response;
 import java.io.File;
 
 
-@Path("/v2/users/{username}/deploy")
+@Path("/v2/deploy")
 public class Deployment extends AbstractRestResource {
 
     @POST
@@ -81,8 +81,7 @@ public class Deployment extends AbstractRestResource {
     @Path("/import")
     @Produces(MediaType.APPLICATION_JSON)
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public Response directImport(@PathParam("username") String username,
-                                 @FormDataParam("config") String config,
+    public Response directImport(@FormDataParam("config") String config,
                                  @FormDataParam("model") String model) {
 // TODO check if this can be deleted
 //        DataSourceDescription sep = new DataSourceDescription(GsonSerializer.getGsonWithIds().fromJson(model, DataSourceDescription.class));
@@ -104,7 +103,7 @@ public class Deployment extends AbstractRestResource {
     @Path("/update")
     @Produces(MediaType.APPLICATION_JSON)
     @Consumes(MediaType.MULTIPART_FORM_DATA)
-    public Response directUpdate(@PathParam("username") String username, @FormDataParam("config") String config, @FormDataParam("model") String model) {
+    public Response directUpdate(@FormDataParam("config") String config, @FormDataParam("model") String model) {
 
         DeploymentConfiguration deploymentConfig = fromJson(config);
 
diff --git a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
index 11403a8..6d8d35e 100644
--- a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
+++ b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/ExtensionsServiceEndpointResource.java
@@ -38,7 +38,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
-@Path("/v2/users/{username}/rdfendpoints")
+@Path("/v2/rdfendpoints")
 public class ExtensionsServiceEndpointResource extends AbstractRestResource {
 
   @GET
diff --git a/ui/src/app/add/services/add.service.ts b/ui/src/app/add/services/add.service.ts
index 0747e91..f8b2577 100644
--- a/ui/src/app/add/services/add.service.ts
+++ b/ui/src/app/add/services/add.service.ts
@@ -16,13 +16,13 @@
  *
  */
 
-import {Injectable} from "@angular/core";
-import {HttpClient} from "@angular/common/http";
-import {AuthStatusService} from "../../services/auth-status.service";
-import {PlatformServicesCommons} from "../../platform-services/apis/commons.service";
-import {Observable} from "rxjs";
-import {map} from "rxjs/operators";
-import {ExtensionsServiceEndpointItem} from "../../core-model/gen/streampipes-model-client";
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { AuthStatusService } from '../../services/auth-status.service';
+import { PlatformServicesCommons } from '../../platform-services/apis/commons.service';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { ExtensionsServiceEndpointItem } from '../../core-model/gen/streampipes-model-client';
 
 @Injectable()
 export class AddService {
@@ -34,28 +34,28 @@ export class AddService {
   }
 
   getRdfEndpoints(): Observable<any> {
-    return this.http.get(this.platformServicesCommons.authUserBasePath() + "/rdfendpoints");
+    return this.http.get(this.platformServicesCommons.apiBasePath() + '/rdfendpoints');
   }
 
-  getRdfEndpointItems(): Observable<Array<ExtensionsServiceEndpointItem>> {
+  getRdfEndpointItems(): Observable<ExtensionsServiceEndpointItem[]> {
     return this
         .http
-        .get(this.platformServicesCommons.authUserBasePath() + "/rdfendpoints/items")
+        .get(this.platformServicesCommons.apiBasePath() + '/rdfendpoints/items')
         .pipe(map(response => {
           return (response as any[]).map(item => ExtensionsServiceEndpointItem.fromData(item));
         }));
   }
 
   addRdfEndpoint(rdfEndpoint): Observable<any> {
-    return this.http.post(this.platformServicesCommons.authUserBasePath() + "/rdfendpoints", rdfEndpoint);
+    return this.http.post(this.platformServicesCommons.apiBasePath() + '/rdfendpoints', rdfEndpoint);
   }
 
   removeRdfEndpoint(rdfEndpointId): Observable<any> {
-    return this.http.delete(this.platformServicesCommons.authUserBasePath() + "/rdfendpoints/" + rdfEndpointId);
+    return this.http.delete(this.platformServicesCommons.apiBasePath() + '/rdfendpoints/' + rdfEndpointId);
   }
 
   getRdfEndpointIcon(item: ExtensionsServiceEndpointItem): Observable<any> {
-    return this.http.post(this.platformServicesCommons.authUserBasePath()
-        + "/rdfendpoints/items/icon", item, { responseType: 'blob' });
+    return this.http.post(this.platformServicesCommons.apiBasePath()
+        + '/rdfendpoints/items/icon', item, { responseType: 'blob' });
   }
 }