From 07f5a365f46a42b345ed0d895b9ac8366d065d0f Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 14 Jun 2022 19:39:19 +0200
Subject: [PATCH] add jquery, config file

---
 .gitignore                          |  1 +
 public_html/index.html              | 10 +++++++++-
 public_html/javascript/functions.js | 10 ++++------
 public_html/main.css                |  5 ++++-
 4 files changed, 18 insertions(+), 8 deletions(-)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5d5fc49
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+public_html/javascript/inc_config.js
diff --git a/public_html/index.html b/public_html/index.html
index 2575cb9..0cc50c6 100644
--- a/public_html/index.html
+++ b/public_html/index.html
@@ -4,8 +4,9 @@
 <title>Dashboard</title>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
 <meta http-equiv="refresh" content="3600">
+
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
 <link rel="stylesheet" href="main.css">
-<script src="javascript/functions.js" type="text/javascript"></script>
 
 <body>
     <header>
@@ -15,4 +16,11 @@
     <section id="app-section"><h2>📦 fetching...</h2></section>
     <section id="msg-section"><h2>🛎️ fetching...</h2></section>
 
+    <footer>
+        POC :: &copy; IML 2022
+    </footer>
+
+    <script src="javascript/inc_config.js" type="text/javascript"></script>
+    <script src="javascript/functions.js" type="text/javascript"></script>
+
 </html>
\ No newline at end of file
diff --git a/public_html/javascript/functions.js b/public_html/javascript/functions.js
index 9e15b71..c98b4e2 100644
--- a/public_html/javascript/functions.js
+++ b/public_html/javascript/functions.js
@@ -15,10 +15,6 @@ const AM_RESULTS={
     3: 'error'
 };
 
-const AM_SERVER_URL='http://localhost:8001/server/get.php?';
-const AM_URLS=[
-    '&item=apps&appid=60b1104800798cd79b694ca6f6764c15&what=all'
-];
 
 const OUT_ID_APPS='app-section';
 
@@ -57,15 +53,17 @@ function _getSingleAppStatus(sData){
 
     // ----- generate output
     let sReturn='<div class="app result'+ aData.meta.result +'">'
-        +'<div class="title">'
+        +'<div class="title" onclick="$(this).next().toggle()">'
             +'<span class="float-right">'+AM_RESULTS[aData.meta.result]+'</span>'
             +aData.meta.website
         +'</div>'
-        +'<table>'
+        ;
 
+    // age of the result data
     let iAge=Math.round((new Date()).getTime() / 1000)- aData.result.ts;
 
     sReturn+=''
+        +'<table class="details">'
         +_appItem('Summary', 'Application status: '+ AM_RESULTS[aData.meta.result] 
             + ' | Checks: ' + aData.checks.length 
             + ' | Age: ' + iAge + ' sec'
diff --git a/public_html/main.css b/public_html/main.css
index 629442f..4dfde07 100644
--- a/public_html/main.css
+++ b/public_html/main.css
@@ -19,6 +19,7 @@ body{
     font-family: verdana,arial;
 }
 
+footer{ position: fixed; bottom: 0; left: 0; width: 100%; padding: 1em; background: #eee; text-align: center;}
 h1{color: var(--color-h1)}
 h2{color: var(--color-h2)}
 
@@ -40,7 +41,9 @@ td{vertical-align: top;}
 
 .float-right{float: right;}
 
-.app .title{font-weight: bold; font-size: 130%; }
+.app .title{font-weight: bold; font-size: 130%; cursor: pointer;}
+
+.app .details{display: none;}
 
 .result0{background:#dfd    !important; background: linear-gradient(#dfd,#beb)!important;       color:#080}
 .result1{background:#eee    !important; background: linear-gradient(#eee,#ddd)!important;       color:#666;}
-- 
GitLab