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:49:00 UTC
[incubator-streampipes] branch dev updated: [STREAMPIPES-427] Fix
some resource path issues
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
The following commit(s) were added to refs/heads/dev by this push:
new 822e5c7 [STREAMPIPES-427] Fix some resource path issues
822e5c7 is described below
commit 822e5c78fcc7c5b63cafb04c3445ad671d996d90
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Fri Sep 24 15:48:50 2021 +0200
[STREAMPIPES-427] Fix some resource path issues
---
.../impl/ExtensionsServiceEndpointResource.java | 7 +-
ui/src/app/editor/services/editor.service.ts | 6 +-
.../app/notifications/notifications.component.ts | 94 +++++++++++-----------
.../apis/pipeline-element-template.service.ts | 29 ++++---
.../apis/pipeline-monitoring.service.ts | 6 +-
5 files changed, 71 insertions(+), 71 deletions(-)
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 6d8d35e..56410bb 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
@@ -25,7 +25,7 @@ import org.apache.streampipes.model.SpDataSet;
import org.apache.streampipes.model.base.NamedStreamPipesEntity;
import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpoint;
import org.apache.streampipes.model.client.endpoint.ExtensionsServiceEndpointItem;
-import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResource;
import org.apache.streampipes.rest.shared.annotation.GsonWithIds;
import org.apache.streampipes.sdk.utils.Assets;
import org.apache.streampipes.storage.api.IExtensionsServiceEndpointStorage;
@@ -39,7 +39,7 @@ import java.util.List;
import java.util.stream.Collectors;
@Path("/v2/rdfendpoints")
-public class ExtensionsServiceEndpointResource extends AbstractRestResource {
+public class ExtensionsServiceEndpointResource extends AbstractAuthGuardedRestResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
@@ -76,8 +76,9 @@ public class ExtensionsServiceEndpointResource extends AbstractRestResource {
@Path("/items")
@Produces(MediaType.APPLICATION_JSON)
@GsonWithIds
- public Response getEndpointContents(@PathParam("username") String username) {
+ public Response getEndpointContents() {
List<ExtensionsServiceEndpoint> endpoints = getEndpoints();
+ String username = getAuthenticatedUsername();
List<ExtensionsServiceEndpointItem> items = Operations.getEndpointUriContents(endpoints);
items.forEach(item -> item.setInstalled(isInstalled(item.getElementId(), username)));
diff --git a/ui/src/app/editor/services/editor.service.ts b/ui/src/app/editor/services/editor.service.ts
index 8a76279..189924e 100644
--- a/ui/src/app/editor/services/editor.service.ts
+++ b/ui/src/app/editor/services/editor.service.ts
@@ -69,7 +69,7 @@ export class EditorService {
}
updateDataSet(dataSet): Observable<DataSetModificationMessage> {
- return this.http.post(this.platformServicesCommons.authUserBasePath() + '/pipelines/update/dataset', dataSet)
+ return this.http.post(this.platformServicesCommons.apiBasePath() + '/pipelines/update/dataset', dataSet)
.pipe(map(data => DataSetModificationMessage.fromData(data as DataSetModificationMessage)));
}
@@ -130,7 +130,7 @@ export class EditorService {
}
updateCachedCanvasMetadata(pipelineCanvasMetadata: PipelineCanvasMetadata) {
- return this.http.post(this.platformServicesCommons.authUserBasePath()
+ return this.http.post(this.platformServicesCommons.apiBasePath()
+ '/pipeline-canvas-cache', pipelineCanvasMetadata);
}
@@ -143,7 +143,7 @@ export class EditorService {
}
private get pipelinesResourceUrl() {
- return this.platformServicesCommons.authUserBasePath() + '/pipelines';
+ return this.platformServicesCommons.apiBasePath() + '/pipelines';
}
announceConfiguredElement(pipelineElementDomId: string) {
diff --git a/ui/src/app/notifications/notifications.component.ts b/ui/src/app/notifications/notifications.component.ts
index 3568850..5f15856 100644
--- a/ui/src/app/notifications/notifications.component.ts
+++ b/ui/src/app/notifications/notifications.component.ts
@@ -16,18 +16,18 @@
*
*/
-import {Component, ElementRef, OnDestroy, OnInit, ViewChild} from "@angular/core";
-import {RestApi} from "../services/rest-api.service";
-import {NotificationItem, ExistingNotification} from "./model/notifications.model";
-import {ElementIconText} from "../services/get-element-icon-text.service";
-import {NotificationsService} from "./service/notifications.service";
-import {Message} from "@stomp/stompjs";
-import {Subscription} from "rxjs";
-import {RxStompService} from "@stomp/ng2-stompjs";
-import {AuthStatusService} from "../services/auth-status.service";
-import {NotificationUtils} from "./utils/notifications.utils";
-import {NotificationCountService} from "../services/notification-count-service";
-import {FreeTextStaticProperty, Pipeline} from "../core-model/gen/streampipes-model";
+import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
+import { ExistingNotification, NotificationItem } from './model/notifications.model';
+import { ElementIconText } from '../services/get-element-icon-text.service';
+import { NotificationsService } from './service/notifications.service';
+import { Message } from '@stomp/stompjs';
+import { Subscription } from 'rxjs';
+import { RxStompService } from '@stomp/ng2-stompjs';
+import { AuthStatusService } from '../services/auth-status.service';
+import { NotificationUtils } from './utils/notifications.utils';
+import { NotificationCountService } from '../services/notification-count-service';
+import { FreeTextStaticProperty, Pipeline } from '../core-model/gen/streampipes-model';
+import { PipelineService } from '../platform-services/apis/pipeline.service';
@Component({
selector: 'notifications',
@@ -36,41 +36,41 @@ import {FreeTextStaticProperty, Pipeline} from "../core-model/gen/streampipes-mo
})
export class NotificationsComponent implements OnInit, OnDestroy {
- static readonly NOTIFICATIONS_APP_ID = "org.apache.streampipes.sinks.internal.jvm.notification";
- static readonly NOTIFICATION_TOPIC_PREFIX = "org.apache.streampipes.notifications.";
- static readonly NOTIFICATION_TITLE_KEY = "title";
+ static readonly NOTIFICATIONS_APP_ID = 'org.apache.streampipes.sinks.internal.jvm.notification';
+ static readonly NOTIFICATION_TOPIC_PREFIX = 'org.apache.streampipes.notifications.';
+ static readonly NOTIFICATION_TITLE_KEY = 'title';
@ViewChild('notificationPane') private notificationContainer: ElementRef;
- notifications: Array<NotificationItem> = [];
+ notifications: NotificationItem[] = [];
unreadNotifications: any;
- existingNotifications: Array<ExistingNotification> = [];
+ existingNotifications: ExistingNotification[] = [];
currentlySelectedNotification: ExistingNotification;
currentlySelectedNotificationId: string;
- pipelinesWithNotificationsPresent: boolean = false;
- notificationsLoading: boolean = false;
+ pipelinesWithNotificationsPresent = false;
+ notificationsLoading = false;
- currentOffset: number = 0;
- liveOffset: number = 0;
+ currentOffset = 0;
+ liveOffset = 0;
previousScrollHeight: number;
subscription: Subscription;
notificationTopic: string;
- newNotificationInfo: Array<boolean> = [];
+ newNotificationInfo: boolean[] = [];
- newEventArriving: boolean = false;
+ newEventArriving = false;
- constructor(private RestApi: RestApi,
- private AuthStatusService: AuthStatusService,
+ constructor(private pipelineService: PipelineService,
+ private authStatusService: AuthStatusService,
public elementIconText: ElementIconText,
private notificationService: NotificationsService,
private rxStompService: RxStompService,
- private NotificationCountService: NotificationCountService) {
+ private notificationCountService: NotificationCountService) {
this.notifications = [];
this.unreadNotifications = [];
- this.notificationTopic = NotificationsComponent.NOTIFICATION_TOPIC_PREFIX + AuthStatusService.email;
+ this.notificationTopic = NotificationsComponent.NOTIFICATION_TOPIC_PREFIX + authStatusService.email;
}
ngOnInit() {
@@ -78,15 +78,15 @@ export class NotificationsComponent implements OnInit, OnDestroy {
}
createSubscription() {
- this.subscription = this.rxStompService.watch("/topic/" +this.notificationTopic).subscribe((message: Message) => {
+ this.subscription = this.rxStompService.watch('/topic/' + this.notificationTopic).subscribe((message: Message) => {
let scrollToBottom = false;
if ((this.notificationContainer.nativeElement.scrollHeight - this.notificationContainer.nativeElement.scrollTop) <= (this.notificationContainer.nativeElement.clientHeight + 10) &&
(this.notificationContainer.nativeElement.scrollHeight - this.notificationContainer.nativeElement.scrollTop) >= (this.notificationContainer.nativeElement.clientHeight - 10)) {
scrollToBottom = true;
}
this.newEventArriving = true;
- let notification: NotificationItem = JSON.parse(message.body) as NotificationItem;
- let notificationId = NotificationUtils.makeNotificationId(notification.correspondingPipelineId, notification.title);
+ const notification: NotificationItem = JSON.parse(message.body) as NotificationItem;
+ const notificationId = NotificationUtils.makeNotificationId(notification.correspondingPipelineId, notification.title);
if (this.currentlySelectedNotificationId === notificationId) {
this.notifications.push(notification);
this.liveOffset++;
@@ -110,7 +110,7 @@ export class NotificationsComponent implements OnInit, OnDestroy {
getPipelinesWithNotifications() {
this.notificationsLoading = true;
- this.RestApi.getOwnPipelines().subscribe(pipelines => {
+ this.pipelineService.getOwnPipelines().subscribe(pipelines => {
this.filterForNotifications(pipelines);
this.notificationsLoading = false;
if (this.existingNotifications.length > 0) {
@@ -123,15 +123,15 @@ export class NotificationsComponent implements OnInit, OnDestroy {
filterForNotifications(pipelines: Pipeline[]) {
pipelines.forEach(pipeline => {
- let notificationActions = pipeline.actions.filter(sink => sink.appId === NotificationsComponent.NOTIFICATIONS_APP_ID);
+ const notificationActions = pipeline.actions.filter(sink => sink.appId === NotificationsComponent.NOTIFICATIONS_APP_ID);
notificationActions.forEach(notificationAction => {
- let notificationName = notificationAction
+ const notificationName = notificationAction
.staticProperties
.filter(sp => sp.internalName === NotificationsComponent.NOTIFICATION_TITLE_KEY)
.map(sp => (sp as FreeTextStaticProperty).value)[0];
- let pipelineName = pipeline.name;
+ const pipelineName = pipeline.name;
this.existingNotifications.push({notificationTitle: notificationName,
- pipelineName: pipelineName, pipelineId: pipeline._id, notificationId: NotificationUtils.makeNotificationId(pipeline._id, notificationName)});
+ pipelineName, pipelineId: pipeline._id, notificationId: NotificationUtils.makeNotificationId(pipeline._id, notificationName)});
});
});
}
@@ -149,17 +149,17 @@ export class NotificationsComponent implements OnInit, OnDestroy {
} else {
setTimeout(() => {
this.notificationContainer.nativeElement.scrollTop = this.notificationContainer.nativeElement.scrollHeight - this.previousScrollHeight;
- })
+ });
}
- notifications.forEach(notification => {
- if (!notification.read) {
- notification.read = true;
- this.NotificationCountService.decreaseNotificationCount();
- this.notificationService.updateNotification(notification).subscribe();
+ notifications.forEach(n => {
+ if (!n.read) {
+ n.read = true;
+ this.notificationCountService.decreaseNotificationCount();
+ this.notificationService.updateNotification(n).subscribe();
}
- })
- })
- };
+ });
+ });
+ }
selectNotification(notification: ExistingNotification) {
this.notifications = [];
@@ -167,7 +167,7 @@ export class NotificationsComponent implements OnInit, OnDestroy {
this.liveOffset = 0;
this.currentlySelectedNotification = notification;
this.currentlySelectedNotificationId = NotificationUtils.makeNotificationIdFromNotification(notification);
- this.NotificationCountService.lockIncreaseUpdateForId(this.currentlySelectedNotificationId);
+ this.notificationCountService.lockIncreaseUpdateForId(this.currentlySelectedNotificationId);
this.getNotifications(notification, this.currentOffset, 10, true);
}
@@ -183,6 +183,6 @@ export class NotificationsComponent implements OnInit, OnDestroy {
if (this.subscription) {
this.subscription.unsubscribe();
}
- this.NotificationCountService.unlockIncreaseUpdate();
+ this.notificationCountService.unlockIncreaseUpdate();
}
-};
+}
diff --git a/ui/src/app/platform-services/apis/pipeline-element-template.service.ts b/ui/src/app/platform-services/apis/pipeline-element-template.service.ts
index 25f6628..27dc59d 100644
--- a/ui/src/app/platform-services/apis/pipeline-element-template.service.ts
+++ b/ui/src/app/platform-services/apis/pipeline-element-template.service.ts
@@ -16,16 +16,16 @@
*
*/
-import {Injectable} from "@angular/core";
-import {HttpClient} from "@angular/common/http";
-import {Observable} from "rxjs";
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
import {
DataProcessorInvocation,
DataSinkInvocation,
PipelineElementTemplate
-} from "../../core-model/gen/streampipes-model";
-import {PlatformServicesCommons} from "./commons.service";
-import {map} from "rxjs/operators";
+} from '../../core-model/gen/streampipes-model';
+import { PlatformServicesCommons } from './commons.service';
+import { map } from 'rxjs/operators';
@Injectable()
export class PipelineElementTemplateService {
@@ -35,34 +35,33 @@ export class PipelineElementTemplateService {
}
- getPipelineElementTemplates(appId: string): Observable<Array<PipelineElementTemplate>> {
+ getPipelineElementTemplates(appId: string): Observable<PipelineElementTemplate[]> {
return this.http
- .get(this.platformServicesCommons.authUserBasePath()
- + "/pipeline-element-templates?appId=" + appId)
+ .get(this.platformServicesCommons.apiBasePath()
+ + '/pipeline-element-templates?appId=' + appId)
.pipe(map(data => {
- console.log(data);
return (data as []).map(dpi => PipelineElementTemplate.fromData(dpi));
}));
}
getConfiguredDataProcessorForTemplate(templateId: string, invocation: DataProcessorInvocation): Observable<DataProcessorInvocation> {
- return this.http.post(this.platformServicesCommons.authUserBasePath()
- + "/pipeline-element-templates/" + templateId + "/processor", invocation)
+ return this.http.post(this.platformServicesCommons.apiBasePath()
+ + '/pipeline-element-templates/' + templateId + '/processor', invocation)
.pipe(map(response => {
return DataProcessorInvocation.fromData(response as DataProcessorInvocation);
}));
}
getConfiguredDataSinkForTemplate(templateId: string, invocation: DataSinkInvocation): Observable<DataSinkInvocation> {
- return this.http.post(this.platformServicesCommons.authUserBasePath()
- + "/pipeline-element-templates/" + templateId + "/sink", invocation)
+ return this.http.post(this.platformServicesCommons.apiBasePath()
+ + '/pipeline-element-templates/' + templateId + '/sink', invocation)
.pipe(map(response => {
return DataSinkInvocation.fromData(response as DataSinkInvocation);
}));
}
storePipelineElementTemplate(template: PipelineElementTemplate) {
- return this.http.post(this.platformServicesCommons.authUserBasePath() + "/pipeline-element-templates", template);
+ return this.http.post(this.platformServicesCommons.apiBasePath() + '/pipeline-element-templates', template);
}
diff --git a/ui/src/app/platform-services/apis/pipeline-monitoring.service.ts b/ui/src/app/platform-services/apis/pipeline-monitoring.service.ts
index cef42ea..cf9e8f3 100644
--- a/ui/src/app/platform-services/apis/pipeline-monitoring.service.ts
+++ b/ui/src/app/platform-services/apis/pipeline-monitoring.service.ts
@@ -33,10 +33,10 @@ export class PipelineMonitoringService {
}
getPipelineMonitoringInfo(pipelineId: string): Observable<PipelineMonitoringInfo> {
- return this.http.get(this.platformServicesCommons.authUserBasePath()
- + "/pipeline-monitoring/"
+ return this.http.get(this.platformServicesCommons.apiBasePath()
+ + '/pipeline-monitoring/'
+ pipelineId)
.pipe(map(response => PipelineMonitoringInfo.fromData(response as any)));
}
-}
\ No newline at end of file
+}