130130 font-size : 10pt ;
131131 resize : none;
132132 }
133+
134+ .dot {
135+ display : inline-block;
136+ width : 10px ; height : 10px ;
137+ border-radius : 50% ;
138+ background : # 999 ;
139+ box-shadow : 0 0 0 1px rgba (0 , 0 , 0 , .15 ) inset;
140+ }
141+ .dot .green { background : # 17c964 ; }
142+ .dot .red { background : # f31260 ; }
143+
144+ # apiStatusResponse {
145+ text-align : center;
146+ background-color : # f3f3f3 ;
147+ padding-top : 1px ;
148+ padding-bottom : 1px ;
149+ margin : 10px 0px 10px 0px ;
150+ }
151+
152+ # h1id { text-align : center}
153+
133154 </ style >
134155
135156 < title id ="titleid "> </ title >
136- < h1 id ="h1id "> </ h1 >
157+
158+
159+ < div id ="apiStatusResponse ">
160+ < h2 id ="h1id "> </ h2 >
161+ < h3 >
162+ < span > Server Status: </ span >
163+ < span class ="status "> 8002: < span id ="s8002 " class ="dot "> </ span > </ span >
164+ < span class ="status "> 8003: < span id ="s8003 " class ="dot "> </ span > </ span >
165+ </ h3 >
166+ </ div >
167+
137168
138169 <!-- Leaflet CSS file -->
139170 < link rel ="stylesheet " href ="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css "
@@ -175,7 +206,8 @@ <h1 id="h1id"></h1>
175206 var postjobsurl = hostlocation . concat ( "/api/v1/jobs/" ) ;
176207
177208 // url path for logs endpoint (provive full path when debugging localy)
178- var logsBaseURL = hostlocation . concat ( "/api/v1/logs/" ) ;
209+ var logsBaseURL = hostlocation . concat ( "/api/v1/logs/" ) ;
210+ var healthBaseURL = hostlocation . concat ( "/api/v1/health" ) ;
179211
180212 // ######################################################################
181213
@@ -193,7 +225,7 @@ <h1 id="h1id"></h1>
193225
194226 < label for ="provider "> Provider:</ label >
195227 < input type ="text " id ="provider " name ="provider " value ="osm "
196- style ="background-color:Gainsboro " readonly > < br >
228+ style ="background-color:#f3f3f3 " readonly > < br >
197229
198230 < label for ="bbox "> Boundingbox:</ label >
199231 < input type ="text " id ="bbox " name ="bbox "
@@ -206,15 +238,15 @@ <h1 id="h1id"></h1>
206238
207239 <!-- To do: at the moment tupdating the packages does not work since the files are moved after creation. -->
208240 <!--<label for="update">Update:</label>
209- <input type="checkbox" id="update" name="update" value="true" style="background-color:Gainsboro " checked><br>-->
241+ <input type="checkbox" id="update" name="update" value="true" style="background-color:#f3f3f3 " checked><br>-->
210242
211243 < input id ="submitBtn " type ="submit " value ="Start Routing Packager Export ">
212244 </ form >
213245
214246 < script >
215247
216248 document . getElementById ( "titleid" ) . innerHTML = "KARP GUI " . concat ( hostname ) ;
217- document . getElementById ( "h1id" ) . innerHTML = "KARP - KADAS Routing Packager GUI " . concat ( hostname ) ;
249+ document . getElementById ( "h1id" ) . innerHTML = "KARP " + hostname
218250
219251 // Variables for extent
220252 var sw = 0.0 ;
@@ -355,10 +387,11 @@ <h1 id="h1id"></h1>
355387
356388 <!-- rightpane with jobs table -->
357389 < div id ="rightpane " style ="width: 49%; float:left; ">
390+
358391 < div id ="jobhistory " style ="height: 415px ">
359392 < b > Job History </ b >
360393 < button onclick ="destroyRecreateTable(); "> Refresh</ button >
361- < div style ="color: gainsboro ; font-size:8pt;float:right;text-align:right "> v.1.3. bao
394+ < div style ="color: #f3f3f3 ; font-size:8pt;float:right;text-align:right "> v.1.3. bao
362395 </ div >
363396 < br >
364397 < div id ="jobdelstatus " name ="jobdelstatus "
@@ -538,6 +571,8 @@ <h1 id="h1id"></h1>
538571 } ;
539572 </ script >
540573 </ div >
574+
575+
541576 <!-- Logs right, below table -->
542577 < div id ="apiLogResponse " style ="height: 415px ">
543578 < br >
@@ -555,8 +590,35 @@ <h1 id="h1id"></h1>
555590 <!-- Response content appears here -->
556591 </ div >
557592 < script >
593+ function setDot ( el , code ) {
594+ el . classList . remove ( 'green' , 'red' ) ;
595+ if ( code === 200 ) {
596+ el . classList . add ( 'green' ) ;
597+ } else {
598+ el . classList . add ( 'red' ) ;
599+ }
600+ }
601+
558602 $ ( document ) . ready ( function ( ) {
559-
603+ //fill in statuses
604+ $ . ajax ( {
605+ url : healthBaseURL ,
606+ type : "GET" ,
607+ headers : {
608+ "x-api-key" : apikey ,
609+ } ,
610+ crossDomain : true ,
611+ success : function ( data ) {
612+ const map = data . valhalla || { } ;
613+ setDot ( document . getElementById ( 's8002' ) , map [ "8002" ] ) ;
614+ setDot ( document . getElementById ( 's8003' ) , map [ "8003" ] ) ;
615+ } ,
616+ error : function ( ) {
617+ setDot ( document . getElementById ( 's8002' ) , 0 ) ;
618+ setDot ( document . getElementById ( 's8003' ) , 0 ) ;
619+ }
620+ } ) ;
621+
560622 // openLink function
561623 function openLink ( event , endpoint ) {
562624 event . preventDefault ( ) ;
@@ -567,9 +629,9 @@ <h1 id="h1id"></h1>
567629 $ . ajax ( {
568630 url : fullURL ,
569631 type : "GET" ,
570- headers : {
571- "x-api-key" : apikey ,
572- } ,
632+ headers : {
633+ "x-api-key" : apikey ,
634+ } ,
573635 crossDomain : true ,
574636 success : function ( data ) {
575637 // Check if the response container is available
0 commit comments