var sync_weather = {
set_data: function(data_) {
//See data_: http://127.0.0.1:5030/eicdata/ajax/?&action=data_state&id=2016-12-01
//if (data_.ACK) {
//var res = sync_weather.tuned_state(data_.status.service_status, ' ');
//document.getElementById(divparam).innerHTML = '';
//document.getElementById('global').innerHTML = res;
var res = sync_weather.object_to_tree(data_, ' ');
//document.getElementById(divparam).innerHTML = '';
document.getElementById('refresh').innerHTML = res;
//}
},
tuned_state: function(data) {
res ='
';
if (data.len_queue > 4) {
res += sync_weather.get_warning("len_queue", data.len_queue);
} else {
res += sync_weather.get_success("len_queue", data.len_queue);
}
res += sync_weather.get_success("status_time", data.status_time);
res += sync_weather.get_success("resource_locator", data.resource_locator);
if (data.NatsConn == false) {
res += sync_weather.get_warning("NatsConn", data.NatsConn);
} else {
res += sync_weather.get_success("NatsConn", data.NatsConn);
}
res += sync_weather.get_success("status", data.status);
res += "
";
return res
},
get_success: function(name, value) {return ''+name+': | '+value+' |
';},
get_warning: function(name, value) {return ''+name+': | '+value+' |
';},
setTimeout:function(){
//alert("change");
Async.status.timeout = document.getElementById('timer_select').value * 1000;
},
object_to_tree: function(argObject, level) {
var msg = '';
for (var propertyName in argObject) {
if (typeof argObject[propertyName] == 'object'){
msg += '' + level + propertyName + ': (' + typeof argObject[propertyName] + ')
';
msg += this.object_to_tree(argObject[propertyName], level + '-- ');
} else if (typeof argObject[propertyName] == 'function'){
msg += '' + level + propertyName + ': (' + typeof argObject[propertyName] + ')
';
} else {
msg += '' + level + propertyName + ': (' + typeof argObject[propertyName] + ') ' + argObject[propertyName] + '
';
}
}
return msg
}
}