diff --git a/src/sunstone/OpenNebulaVNC.rb b/src/sunstone/OpenNebulaVNC.rb index ef628662f2..2da2e57d34 100644 --- a/src/sunstone/OpenNebulaVNC.rb +++ b/src/sunstone/OpenNebulaVNC.rb @@ -41,7 +41,7 @@ class OpenNebulaVNC # Start a VNC proxy def start(vm_resource) # Check configurations and VM attributes - + if @proxy_path == nil || @proxy_path.empty? return error(403,"VNC proxy not configured") end @@ -98,6 +98,6 @@ class OpenNebulaVNC return [code,msg] end end - + end diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index f342e91665..303961fb60 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -47,13 +47,33 @@ var config_tab_content = \ '; +var config_actions = { + "Config.list" : { + type: "list", + call: OpenNebula.Config.list, + callback: updateConfig, + error: onError + }, +}; + var config_tab = { title: tr("Configuration"), content: config_tab_content } +Sunstone.addActions(config_actions); Sunstone.addMainTab('config_tab',config_tab); + +function updateConfig(request,response){ + var config = response['user_config']; + + //Set wss checkbox to correct value + if (config["wss"] == "yes"){ + $('table#config_table input#wss_checkbox').attr('checked','checked'); + }; +}; + function updateWss(){ var user_info_req = { data : { @@ -84,16 +104,17 @@ function updateWss(){ }; $(document).ready(function(){ + Sunstone.runAction('Config.list'); + + //Set the language select to correct value if (lang) $('table#config_table #lang_sel option[value="'+lang+'"]').attr('selected','selected'); + + //Listener to change language $('table#config_table #lang_sel').change(function(){ setLang($(this).val()); }); + //Listener to wss change $('table#config_table #wss_checkbox').change(updateWss); - - $.get('config/wss',function(response){ - if (response != "no") - $('table#config_table input#wss_checkbox').attr('checked','checked'); - }); }); \ No newline at end of file diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 62081e24f2..a2636ed929 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -132,7 +132,7 @@ helpers do else wss = settings.config[:vnc_proxy_support_wss] #limit to yes,no options - session[:wss] = (wss == true || wss == "yes" || wss == "only" ? + session[:wss] = (wss == true || wss == "yes" || wss == "only" ? "yes" : "no") end @@ -231,14 +231,14 @@ end ############################################################################## get '/config' do - uconf = { + uconf = { :user_config => { - :lang => session[:lang] - :wss => session[:wss] + :lang => session[:lang], + :wss => session[:wss] } - } + } - [200, uconf.json] + [200, uconf.to_json] end post '/config' do