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 2020/08/20 14:58:46 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-132] Add minor improvements to JS evaluation component

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 7b1b7f3  [STREAMPIPES-132] Add minor improvements to JS evaluation component
     new 47f4aeb  Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
7b1b7f3 is described below

commit 7b1b7f37b885367360a707a0657448d9a80484fb
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Thu Aug 20 16:58:20 2020 +0200

    [STREAMPIPES-132] Add minor improvements to JS evaluation component
---
 .../apache/streampipes/sdk/helpers/CodeLanguage.java   |  4 +++-
 .../static-code-input/static-code-input.component.html |  2 +-
 .../static-code-input/static-code-input.component.ts   |  2 --
 .../runtime-resolvable.service.ts                      | 18 ++++++++++++++++++
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
index 81c91e7..144771e 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/CodeLanguage.java
@@ -22,7 +22,9 @@ public enum CodeLanguage {
   Javascript("function process(event) {\n" +
           "    // do processing here.\n" +
           "    // return processed event.\n" +
-          "    return {id: event.id, tempInCelsius: (event.tempInKelvin - 273.15)};\n" +
+          "   // Type 'event' and press Ctrl+Space to see available fields.\n" +
+          "   // Example: \n" +
+          "    return {timestamp: event.timestamp, tempInCelsius: (event.tempInKelvin - 273.15)};\n" +
           "}");
 
   private String defaultSkeleton;
diff --git a/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.html b/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.html
index 2572c55..011ea19 100644
--- a/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.html
+++ b/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.html
@@ -17,7 +17,7 @@
   -->
 
 <div fxFlex="100" fxLayout="column">
-    <div flex="100" layout="row" layout-align="start center">
+    <div fxFlex="100" fxLayout="row" fxLayoutAlign="start center">
         <button mat-button mat-raised-button color="primary" class="small-button" (click)="resetCode()"
                 style="margin-right:10px;margin-bottom:10px;">Reset code template
         </button>
diff --git a/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.ts b/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.ts
index d847a3e..f8c27d0 100644
--- a/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.ts
+++ b/ui/src/app/connect/static-properties/static-code-input/static-code-input.component.ts
@@ -53,7 +53,6 @@ export class StaticCodeInputComponent
     }
   };
 
-
   constructor() {
     super();
   }
@@ -62,7 +61,6 @@ export class StaticCodeInputComponent
     if (!this.staticProperty.value || this.staticProperty.value === "") {
       this.staticProperty.value = this.staticProperty.codeTemplate;
     }
-
   }
 
   ngAfterViewInit() {
diff --git a/ui/src/app/connect/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts b/ui/src/app/connect/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
index 8e0274d..54b8a67 100644
--- a/ui/src/app/connect/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
+++ b/ui/src/app/connect/static-properties/static-runtime-resolvable-input/runtime-resolvable.service.ts
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 import {Observable} from "rxjs";
 import {
   RuntimeOptionsRequest,