From 5eeb0cedb83387afadf5a7fabf36fbcb98f39361 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Fri, 10 Feb 2023 13:33:22 +0100 Subject: [PATCH] Added human readable view for DSS and weather --- html/dsslist.html | 35 +++++++++++++++++++++++++++++++++ html/index.html | 5 +++-- html/weatherdatasourcelist.html | 28 ++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 html/dsslist.html create mode 100644 html/weatherdatasourcelist.html diff --git a/html/dsslist.html b/html/dsslist.html new file mode 100644 index 0000000..5fab85e --- /dev/null +++ b/html/dsslist.html @@ -0,0 +1,35 @@ +<html> + <head> + <title>DSS list - MaDIPHS Integration platform</title> + </head> + <body> + <a href="/"><img src="css/images/MaDiPHS_logo.png" style="width: 300px;" alt="MaDiPHS logo"/></a> + <h1>DSS list</h1> + <p>A human-friendly view of the data returned from <a href="/dss/rest/dss">this endpoint</a></p> + <div id="dsslist"> + + </div> + </body> + <script type="text/javascript"> + fetch("https://test.madiphs.org/dss/rest/dss/") + .then(x => x.json()) + .then(dsss => + { + var html = ""; + for(var i in dsss) + { + dss = dsss[i]; + html += "<h2>" + dss.name + "</h2>\n"; + html += "<ul>"; + for(var j in dss.models) + { + model = dss.models[j]; + console.info(model.name); + html += "<li><b>" + model.name + "</b>: " + model.purpose + "</li>"; + } + html += "</ul>"; + } + document.getElementById("dsslist").innerHTML = html; + }); + </script> +</html> \ No newline at end of file diff --git a/html/index.html b/html/index.html index 7e36dff..b0412b1 100644 --- a/html/index.html +++ b/html/index.html @@ -1,3 +1,4 @@ +<!DOCTYPE html> <html> <head> <title>MaDIPHS Integration platform</title> @@ -15,13 +16,13 @@ </p> <ul> <li><a href="/dss/apidocs/">API documentation</a></li> - <li><a href="/dss/rest/dss">List all DSSs available</a></p></li> + <li><a href="/dsslist.html">List all DSSs available</a></p></li> </ul> <h3>Weather API</h3> <p>This is the web service API for discovery of and usage of weather datasources, providing input data to DSS, both measured/calculated data from the current growing season and weather forecasts.</p> <ul> <li><a href="/weather/apidocs/">API documentation</a></li> - <li><a href="/weather/rest/dss">List all DSSs available</a></p></li> + <li><a href="/weatherdatasourcelist">List all weather datasources available</a></p></li> </ul> <p style="font-size: small;"> The DSS API and the Weather API are based on software developed for a similar purpose in Europe in the <a href="https://platform.ipmdecisions.net/" target="new">IPM Decisions project</a> diff --git a/html/weatherdatasourcelist.html b/html/weatherdatasourcelist.html new file mode 100644 index 0000000..3cc9795 --- /dev/null +++ b/html/weatherdatasourcelist.html @@ -0,0 +1,28 @@ +<html> + <head> + <title>Weather datasource list - MaDIPHS Integration platform</title> + </head> + <body> + <a href="/"><img src="css/images/MaDiPHS_logo.png" style="width: 300px;" alt="MaDiPHS logo"/></a> + <h1>DSS list</h1> + <p>A human-friendly view of the data returned from <a href="/weather/rest/weatherdatasource">this endpoint</a></p> + <div id="weatherdatasourcelist"> + + </div> + </body> + <script type="text/javascript"> + fetch("https://test.madiphs.org/weather/rest/weatherdatasource") + .then(x => x.json()) + .then(wdss => + { + var html = ""; + for(var i in wdss) + { + wds = wdss[i]; + html += "<h2>" + wds.name + "</h2>\n"; + html += "<p>" + wds.description + "</p>\n"; + } + document.getElementById("weatherdatasourcelist").innerHTML = html; + }); + </script> +</html> \ No newline at end of file -- GitLab