Commit 43a8314d authored by Otto Jonassen Wittner's avatar Otto Jonassen Wittner
Browse files

Bugfix + made default event-type and meas-var selection operational

parent 0dda99b1
Pipeline #50342 passed with stages
in 1 minute and 3 seconds
......@@ -148,6 +148,7 @@ dragonlab:
unit: ""
descr: "List of hosts in latest routes"
default_field: "anomality_class"
default_event_type: "gap"
uninett:
title: "Uninett"
......@@ -245,7 +245,8 @@ var points_cache=[];
function update_props(mvar) {
// Repopulate property structures based on given measuerment network variant and config file
// Also re-init event type and variable select-lists
if (jQuery.isEmptyObject(conffile)) {
// No config file data available
return
......@@ -264,6 +265,38 @@ var points_cache=[];
prop_desc[f] = title + ( unit ? " (" + unit + ")" : "") ;
}
}
// Init select list for measurement types / datasets / event types
event_names = Object.keys(prop_names_list);
make_prop_select("event_type", event_names, event_desc );
// Select event type
if (parms.event) {
$("#event_type").val(parms.event);
} else {
// Apply default event type if available
if ( "default_event_type" in conffile[parms.net] ) {
$("#event_type").val(conffile[parms.net].default_event_type);
}
parms.event = $("#event_type").val()
}
// Init measurement variable select list
prop_names = prop_names_list[ $("#event_type").val() ];
make_prop_select("prop_select", prop_names, prop_desc );
// Select measurement variable
if (parms.property) {
$("#prop_select").val(parms.property);
} else {
// Apply default measurement variable/property if available
if ( "default_field" in conffile[parms.net].event_type[parms.event] ) {
$("#prop_select").val(conffile[parms.net].event_type[parms.event].default_field);
}
parms.property = $("#prop_select").val()
}
// Update period
if (parms.period) $("#period").val(parms.period);
}
// sorting table
......@@ -1823,21 +1856,14 @@ $(document).ready ( function(){
parms=get_parms( );
update_props(parms.net);
if ( parms.net){
$("#network").val(parms.net);
} else {
parms.net = $("#network").val();
}
event_names = Object.keys(prop_names_list);
make_prop_select("event_type", event_names, event_desc );
if (parms.event) $("#event_type").val(parms.event);
if (parms.period) $("#period").val(parms.period);
prop_names = prop_names_list[ $("#event_type").val() ];
make_prop_select("prop_select", prop_names, prop_desc );
// Update properties according to selected measurement network variant
update_props(parms.net);
$.ajaxSetup({
beforeSend:function(){
......@@ -1948,10 +1974,23 @@ $(document).ready ( function(){
// event_type parameter change
$("#event_type").change( function(){
parms.event = $("#event_type").val()
// Refresh measurement variable (property) select list
prop_names = prop_names_list[ $("#event_type").val() ];
//remove_links();
prop_names = prop_names_list[ $("#event_type").val() ];
make_prop_select("prop_select", prop_names, prop_desc );
// Select measurement variable
if (parms.property && (parms.property in prop_names)) {
$("#prop_select").val(parms.property);
} else {
// Apply default measurement variable/property if available
if ( "default_field" in conffile[parms.net].event_type[$("#event_type").val()] ) {
$("#prop_select").val(conffile[parms.net].event_type[$("#event_type").val()].default_field);
}
parms.property = $("#prop_select").val()
}
get_connections();
update_url();
});
......
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