Commit 6fa781df authored by Otto Jonassen Wittner's avatar Otto Jonassen Wittner
Browse files

Re-added config file loading.

parent f1673d87
Pipeline #49413 passed with stages
in 56 seconds
......@@ -164,6 +164,8 @@
<script type="module">
import LatLon from "./js/latlon-spherical.js";
var conffile=[]; //Config file loaded initially
var point_distance_min = 50; // meters between
var point_distance_stretch = 0.001; // delta degrees
var period_length = 86400; // a day - to be replaced by dynamic length
......@@ -1772,6 +1774,27 @@ function hhmmss(d){
// initialization
$(document).ready ( function(){
// OJW 2021-12-09 BEGIN CONFIG FILE LOAD
// Fetch config info and initialize page
$.getJSON( "yaml-to-json.cgi?inputfile=mapconfig.yml", function(read_conffile) {
if (Object.keys(read_conffile).length > 0) {
console.log("Config file non-empty: " + read_conffile.msg);
conffile = read_conffile.config;
// Remove default measurement variants from select list
$("#network").empty();
for (const mvar in conffile) {
// Add option for measurement variant
$("#network").append("<option value=" + mvar + ">" + conffile[mvar].title + "</option>");
}
//Select first measurement variant in list
$("#network option:eq(0)").prop("selected", true);
// $("#network").selectmenu("refresh");
}
// OJW 2021-12-09 CONTINUES AT END OF "document ready"
parms=get_parms( );
if ( parms.net){
......@@ -1981,6 +2004,14 @@ $(document).ready ( function(){
$("#network").trigger("change"); // draw the map
//OJW 2021-12-09 CONTINUED CONFIG FILE LOAD
})
.fail( function(e, textStatus, error ) {
// Config not avaiable
console.log("Failed to get conf.json :" + textStatus + ", " + error);
});
//OJW 2021-12-09 END CONFIG FILE LOAD
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment