From 4bd84bebdaa0c2d82050fbedd1fa8260eb62146d Mon Sep 17 00:00:00 2001
From: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Date: Thu, 27 Aug 2020 09:01:53 +0200
Subject: Add link calculation app

Add link calculation app to odlux

Issue-ID: CCSDK-2562
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: Ifc0a5b2a8bb974dfd85d70a9f05990b1f11925a3
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
---
 sdnr/wt/odlux/framework/src/views/about.tsx | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

(limited to 'sdnr/wt/odlux/framework/src/views/about.tsx')

diff --git a/sdnr/wt/odlux/framework/src/views/about.tsx b/sdnr/wt/odlux/framework/src/views/about.tsx
index c4a5488e0..f97d6ffb3 100644
--- a/sdnr/wt/odlux/framework/src/views/about.tsx
+++ b/sdnr/wt/odlux/framework/src/views/about.tsx
@@ -40,11 +40,23 @@ class AboutComponent extends React.Component<any, AboutState> {
     this.textarea = React.createRef();
     this.loadAboutContent();
   }
+  private getMarkOdluxVersionMarkdownTable(data:{version:string,build:string}|null|undefined):string{
+    if(!data) {
+      return "";
+    }
+    return `| | |\n| --- | --- |\n| Version | ${data.version} |\n| Build timestamp | ${data.build}|`
+  }
   private loadAboutContent(): void {
-    requestRestExt<string>('/about').then((response) => {
+    const baseUri = window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")+1);
+    const p1 = requestRestExt<string>('/about');
+    const p2 = requestRestExt<{version:string,build:string}>(`${baseUri}version.json`);
+    Promise.all([p1,p2]).then((responses) => {
+      const response = responses[0];
+      const response2 = responses[1];    
       const content = response.status == 200 ? response.data : `${response.status} ${response.message}` || "Server error";
+      const content2 = `\n## ODLUX Version Info\n`+(response2.status == 200 ? this.getMarkOdluxVersionMarkdownTable(response2.data) : `${response2.status} ${response2.message}` || "ODLUX Server error");
       const loadedSucessfully = response.status == 200 ? true : false;
-      this.setState({ content: content || null, isContentLoadedSucessfully: loadedSucessfully });
+      this.setState({ content: (content + content2) || null, isContentLoadedSucessfully: loadedSucessfully });
     }).catch((error) => {
       this.setState({ content: error })
     })
-- 
cgit 1.2.3-korg

