forked from MapComplete/MapComplete
		
	Feature: add source.mapcomplete.org and plantnet to status page
This commit is contained in:
		
							parent
							
								
									290e737e0b
								
							
						
					
					
						commit
						588e10cb27
					
				
					 1 changed files with 44 additions and 14 deletions
				
			
		|  | @ -8,6 +8,7 @@ | |||
|   import { Utils } from "../../Utils" | ||||
|   import Loading from "../Base/Loading.svelte" | ||||
|   import Checkbox from "../Base/Checkbox.svelte" | ||||
|   import PlantNet from "../../Logic/Web/PlantNet" | ||||
| 
 | ||||
|   let services: MCService[] = [] | ||||
| 
 | ||||
|  | @ -62,7 +63,7 @@ | |||
|             return "offline" | ||||
|         } | ||||
|       }), | ||||
|       message: osmApi, | ||||
|       message: osmApi | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -90,7 +91,7 @@ | |||
|         } | ||||
|         const files: string[] = s["success"]["allFiles"] | ||||
|         return "Contains " + (files.length ?? "no") + " files" | ||||
|       }), | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
|   { | ||||
|  | @ -106,7 +107,7 @@ | |||
|           return "degraded" | ||||
|         } | ||||
|       }), | ||||
|       message: simpleMessage(testDownload(Constants.panoramax.url + "/api")), | ||||
|       message: simpleMessage(testDownload(Constants.panoramax.url + "/api")) | ||||
|     }) | ||||
|   } | ||||
|   { | ||||
|  | @ -122,7 +123,7 @@ | |||
|           return "degraded" | ||||
|         } | ||||
|       }), | ||||
|       message: simpleMessage(testDownload(Constants.GeoIpServer + "/ip")), | ||||
|       message: simpleMessage(testDownload(Constants.GeoIpServer + "/ip")) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -141,7 +142,7 @@ | |||
|         } | ||||
|         return "degraded" | ||||
|       }), | ||||
|       message: simpleMessage(status), | ||||
|       message: simpleMessage(status) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -160,7 +161,7 @@ | |||
|         } | ||||
|         return "online" | ||||
|       }), | ||||
|       message: simpleMessage(status), | ||||
|       message: simpleMessage(status) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -199,7 +200,7 @@ | |||
| 
 | ||||
|         const json = JSON.stringify(s["success"], null, "  ") | ||||
|         return "Database is " + Math.floor(timediffDays) + " days out of sync\n\n" + json | ||||
|       }), | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -212,7 +213,7 @@ | |||
|         layer: "food", | ||||
|         z: 14, | ||||
|         x: 8848, | ||||
|         y: 5828, | ||||
|         y: 5828 | ||||
|       }) | ||||
|     ) | ||||
|     services.push({ | ||||
|  | @ -223,7 +224,7 @@ | |||
|         } | ||||
|         return "online" | ||||
|       }), | ||||
|       message: new ImmutableStore("See SettingUpPSQL.md to fix"), | ||||
|       message: new ImmutableStore("See SettingUpPSQL.md to fix") | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -242,7 +243,7 @@ | |||
|         } | ||||
|         return "degraded" | ||||
|       }), | ||||
|       message: status.map((s) => JSON.stringify(s)), | ||||
|       message: status.map((s) => JSON.stringify(s)) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -261,7 +262,7 @@ | |||
|           return "online" | ||||
|         } | ||||
|         return "degraded" | ||||
|       }), | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -280,7 +281,7 @@ | |||
|         } | ||||
|         return "degraded" | ||||
|       }), | ||||
|       message: simpleMessage(status), | ||||
|       message: simpleMessage(status) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  | @ -306,7 +307,7 @@ | |||
| 
 | ||||
|           return "online" | ||||
|         }), | ||||
|         message: simpleMessage(status), | ||||
|         message: simpleMessage(status) | ||||
|       }) | ||||
|     } | ||||
|   } | ||||
|  | @ -319,7 +320,36 @@ | |||
|           return "online" | ||||
|         } | ||||
|         return "offline" | ||||
|       }), | ||||
|       }) | ||||
|     }) | ||||
| 
 | ||||
|     services.push({ | ||||
|       name: "Plantnet", | ||||
|       status: testDownload(PlantNet.baseUrl, true).mapD((r) => { | ||||
|         if (r["success"]) { | ||||
|           return "online" | ||||
|         } | ||||
|         // This code will break in the future. Time to blame past me! | ||||
|         const response = JSON.parse(r["error"].substring("other error: , ".length)) | ||||
|         if (response.message === "\"images\" is required") { | ||||
|           // Actual expected behaviour | ||||
|           return "online" | ||||
|         } | ||||
|         console.log("R", response) | ||||
|         return "offline" | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
|   { | ||||
|     services.push({ | ||||
|       name: "Version Control Server (Forgéjo)", | ||||
|       status: testDownload("https://source.mapcomplete.org", true).mapD(r => { | ||||
|         if (r["success"]) { | ||||
|           return "online" | ||||
|         } | ||||
|         return "offline" | ||||
| 
 | ||||
|       }) | ||||
|     }) | ||||
|   } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue