You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2020/08/18 19:53:12 UTC

[incubator-streampipes] branch STREAMPIPES-193 updated: [STREAMPIPES-193] display version info in toolbar

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

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


The following commit(s) were added to refs/heads/STREAMPIPES-193 by this push:
     new a850854  [STREAMPIPES-193] display version info in toolbar
a850854 is described below

commit a8508545de432274a2b9facf7982a57a470cd078
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Tue Aug 18 21:51:38 2020 +0200

    [STREAMPIPES-193] display version info in toolbar
---
 .../core/components/toolbar/toolbar.component.html |  3 ++
 .../core/components/toolbar/toolbar.component.ts   |  9 ++++
 ui/src/app/home/home.component.html                |  2 +-
 ui/src/app/info/info.component.ts                  |  1 -
 ui/src/app/info/info.module.ts                     |  5 +-
 .../info/versions/service/version-info.service.ts  | 55 ----------------------
 ui/src/app/info/versions/versions.component.ts     | 12 ++---
 ui/src/app/services/rest-api.service.ts            |  8 ++++
 8 files changed, 28 insertions(+), 67 deletions(-)

diff --git a/ui/src/app/core/components/toolbar/toolbar.component.html b/ui/src/app/core/components/toolbar/toolbar.component.html
index 759526a..c531d89 100644
--- a/ui/src/app/core/components/toolbar/toolbar.component.html
+++ b/ui/src/app/core/components/toolbar/toolbar.component.html
@@ -30,6 +30,9 @@
         </div>
         <span fxFlex></span>
         <div fxFlex="40" fxLayout fxLayoutAlign="end center" *ngIf="authenticated" style="height:100%;">
+            <div style="color:white;padding: 5px 5px;margin-left:10px;font-size:12pt;">
+                <span style="margin-top:12px;font-weight:bold;">version: </span><span style="font-weight: normal;" *ngIf="versionInfo">{{versionInfo.backendVersion}}</span>
+            </div>
             <div style="height:100%;">
                 <div [ngStyle]="feedbackOpen.menuOpen ? {'background-color': 'white'} : {'background-color': '#39b54a'}" fxLayout fxLayoutAlign="center center" style="height: 100%;">
                     <button mat-button mat-icon-button
diff --git a/ui/src/app/core/components/toolbar/toolbar.component.ts b/ui/src/app/core/components/toolbar/toolbar.component.ts
index f20d134..7d84414 100644
--- a/ui/src/app/core/components/toolbar/toolbar.component.ts
+++ b/ui/src/app/core/components/toolbar/toolbar.component.ts
@@ -22,6 +22,7 @@ import {Router} from "@angular/router";
 import {RestApi} from "../../../services/rest-api.service";
 import {AuthStatusService} from "../../../services/auth-status.service";
 import {MatMenuTrigger} from "@angular/material/menu";
+import {VersionInfo} from "../../../info/versions/service/version-info.model";
 
 @Component({
   selector: 'toolbar',
@@ -33,6 +34,8 @@ export class ToolbarComponent extends BaseNavigationComponent implements OnInit
   @ViewChild('feedbackOpen') feedbackOpen: MatMenuTrigger;
   @ViewChild('accountMenuOpen') accountMenuOpen: MatMenuTrigger;
 
+  versionInfo: VersionInfo;
+
   constructor(Router: Router,
               private RestApi: RestApi,
               private AuthStatusService: AuthStatusService) {
@@ -41,6 +44,7 @@ export class ToolbarComponent extends BaseNavigationComponent implements OnInit
 
   ngOnInit(): void {
     super.onInit();
+    this.getVersion()
   }
 
   closeFeedbackWindow() {
@@ -65,4 +69,9 @@ export class ToolbarComponent extends BaseNavigationComponent implements OnInit
     });
   };
 
+  getVersion(){
+    this.RestApi.getVersionInfo().subscribe((response) => {
+      this.versionInfo = response as VersionInfo;
+    })
+  }
 }
\ No newline at end of file
diff --git a/ui/src/app/home/home.component.html b/ui/src/app/home/home.component.html
index 0f1090b..9811109 100644
--- a/ui/src/app/home/home.component.html
+++ b/ui/src/app/home/home.component.html
@@ -20,7 +20,7 @@
     <div fxFlex fxLayout="row" fxLayoutAlign="start start">
         <div fxFlex="100">
             <div class="md-padding">
-                <h1>Welcome to StreamPipes!</h1>
+                <h1>Welcome to Apache StreamPipes!</h1>
                 <hr>
                 <status></status>
                 <div class="home-margin">
diff --git a/ui/src/app/info/info.component.ts b/ui/src/app/info/info.component.ts
index d73f4f6..69d48d5 100644
--- a/ui/src/app/info/info.component.ts
+++ b/ui/src/app/info/info.component.ts
@@ -32,7 +32,6 @@ export class InfoComponent {
     }
 
     tabChanged(tabChangeEvent: MatTabChangeEvent): void {
-        console.log(tabChangeEvent);
         this.currentTabIndex = tabChangeEvent.index;
     }
 
diff --git a/ui/src/app/info/info.module.ts b/ui/src/app/info/info.module.ts
index b0626d6..77aad70 100644
--- a/ui/src/app/info/info.module.ts
+++ b/ui/src/app/info/info.module.ts
@@ -34,7 +34,6 @@ import {CustomMaterialModule} from "../CustomMaterial/custom-material.module";
 import {LicenseComponent} from "./license/license.component";
 import {AboutComponent} from "./about/about.component";
 import {VersionsComponent} from "./versions/versions.component";
-import {VersionInfoService} from "./versions/service/version-info.service";
 
 @NgModule({
     imports: [
@@ -56,9 +55,7 @@ import {VersionInfoService} from "./versions/service/version-info.service";
         VersionsComponent,
         AboutComponent
     ],
-    providers: [
-        VersionInfoService
-    ],
+    providers: [],
     entryComponents: [
         InfoComponent
     ]
diff --git a/ui/src/app/info/versions/service/version-info.service.ts b/ui/src/app/info/versions/service/version-info.service.ts
deleted file mode 100644
index 53c4bc8..0000000
--- a/ui/src/app/info/versions/service/version-info.service.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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 {Injectable} from '@angular/core';
-import {HttpClient} from '@angular/common/http';
-import {Observable} from 'rxjs';
-import {map} from 'rxjs/operators';
-
-import {VersionInfo} from './version-info.model';
-import {SystemInfo} from "./system-info.model";
-
-@Injectable()
-export class VersionInfoService {
-
-    constructor(private http: HttpClient) {
-    }
-
-    getServerUrl() {
-        return '/streampipes-backend';
-    }
-
-    getVersionInfo(): Observable<VersionInfo> {
-        return this.http.get(this.getServerUrl() + '/api/v2/info/versions')
-            .pipe(
-                map(response => {
-                    return response as VersionInfo;
-                })
-            );
-    }
-
-    getSysteminfo(): Observable<SystemInfo> {
-        return this.http.get(this.getServerUrl() + '/api/v2/info/system')
-            .pipe(
-                map(response => {
-                    return response as SystemInfo;
-                })
-            );
-    }
-
-}
\ No newline at end of file
diff --git a/ui/src/app/info/versions/versions.component.ts b/ui/src/app/info/versions/versions.component.ts
index a208f75..f493112 100644
--- a/ui/src/app/info/versions/versions.component.ts
+++ b/ui/src/app/info/versions/versions.component.ts
@@ -17,9 +17,9 @@
  */
 
 import {Component} from '@angular/core';
-import {VersionInfoService} from "./service/version-info.service";
 import {VersionInfo} from "./service/version-info.model";
 import {SystemInfo} from "./service/system-info.model";
+import {RestApi} from "../../services/rest-api.service";
 
 @Component({
     selector: 'sp-versions',
@@ -31,24 +31,24 @@ export class VersionsComponent  {
     versionInfo: VersionInfo;
     systemInfo: SystemInfo;
 
-    constructor(private versionInfoService: VersionInfoService) {
+    constructor(private RestApi: RestApi) {
         this.getVersionInfo();
         this.getSystemInfo();
     }
 
     getVersionInfo(): void {
-        this.versionInfoService.getVersionInfo()
+        this.RestApi.getVersionInfo()
             .subscribe(response => {
-                this.versionInfo = response;
+                this.versionInfo = response as VersionInfo;
             }, error => {
                 console.error(error);
             });
     }
 
     getSystemInfo(): void {
-        this.versionInfoService.getSysteminfo()
+        this.RestApi.getSystemInfo()
             .subscribe(response => {
-                this.systemInfo = response;
+                this.systemInfo = response as SystemInfo;
             }, error => {
                 console.error(error);
             });
diff --git a/ui/src/app/services/rest-api.service.ts b/ui/src/app/services/rest-api.service.ts
index bf72812..515f022 100644
--- a/ui/src/app/services/rest-api.service.ts
+++ b/ui/src/app/services/rest-api.service.ts
@@ -472,4 +472,12 @@ export class RestApi {
     removePipelineFromCache() {
         return this.$http.delete(this.urlBase() + "/pipeline-cache");
     }
+
+    getVersionInfo() {
+        return this.$http.get(this.getServerUrl() + "/info/versions");
+    }
+
+    getSystemInfo() {
+        return this.$http.get(this.getServerUrl() + "/info/system");
+    }
 }