From f69beedf455bc78614e69c5751e8d83ffd4bf287 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Thu, 4 Oct 2018 13:55:42 +0200
Subject: [PATCH] chore: adding more style to plugin styls, better kg entry
 component

---
 src/res/css/plugin_styles.css              |  7 +++++++
 src/ui/kgEntryViewer/kgentry.component.ts  |  6 ++++--
 src/ui/kgEntryViewer/kgentry.template.html | 13 +++++++++++--
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/res/css/plugin_styles.css b/src/res/css/plugin_styles.css
index 8c8a08edb..f69c0a7c5 100644
--- a/src/res/css/plugin_styles.css
+++ b/src/res/css/plugin_styles.css
@@ -58,4 +58,11 @@
   transform: translateY(2px);
   color:rgba(255,255,255,1.0);
   box-shadow: inset 0 2px 2px -2px rgba(0,0,0,0.2);
+}
+
+[darktheme="true"] .alert.alert-danger
+{
+  color: #f2dede;
+  background-color: rgba(169, 68, 66, 0.5);
+  border-color: rgba(169, 68, 66,0.2)
 }
\ No newline at end of file
diff --git a/src/ui/kgEntryViewer/kgentry.component.ts b/src/ui/kgEntryViewer/kgentry.component.ts
index 5d65b4175..a46314e4f 100644
--- a/src/ui/kgEntryViewer/kgentry.component.ts
+++ b/src/ui/kgEntryViewer/kgentry.component.ts
@@ -12,25 +12,27 @@ export class KgEntryViewer implements OnInit{
   @Input() kgQueryString : string = null
 
   public kgData : any = null
+  public kgError : any = null
 
   ngOnInit(){
     if(this.kgQueryString){
       fetch(`${KGROOT}${this.kgQueryString}`)
         .then(res => res.json())
         .then(json => {
-          console.log({json})
           if(json.found)
             return json._source
           else
-            throw new Error('json.found returns false')
+            throw new Error('No documents were found.')
         })
         .then(json => this.kgData = json)
         .catch(e => {
           console.error('fetching KG data error', e)
           this.kgData = null
+          this.kgError = JSON.stringify(e)
         })
     }else{
       console.error('kgQueryString empty!')
+      this.kgError = 'Knowledge Graph ID empty'
     }
   }
 
diff --git a/src/ui/kgEntryViewer/kgentry.template.html b/src/ui/kgEntryViewer/kgentry.template.html
index e43aeed7f..8b66cc73f 100644
--- a/src/ui/kgEntryViewer/kgentry.template.html
+++ b/src/ui/kgEntryViewer/kgentry.template.html
@@ -117,10 +117,19 @@
 
   </readmore-component>
   <a target = "_blank" [href] = "kgHref">
-    See the entry in Knowledge Graph
+    See this dataset in the Knowledge Graph <i class = "glyphicon glyphicon-new-window"></i>
   </a>
 
 </div>
 <ng-template #showDefault>
-  Fetching KG Data ...
+  <div reportError *ngIf = "kgError">
+    Fetching metadata from the Knowledge Graph failed - {{ kgError }}
+  </div>
+  <div *ngIf = "!kgError">
+    Fetching KG Data 
+
+    <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
+    <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
+    <span class = "homeAnimationDots loadingAnimationDots">&bull;</span>
+  </div>
 </ng-template>
\ No newline at end of file
-- 
GitLab