1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #1069: Update config plugin to accept full configuration object.

Whitespace cleanup and minor fixes in .rb files.
(cherry picked from commit da1e4a822937eaa3e5a2ef4c2126a5bbde15952b)
This commit is contained in:
Hector Sanjuan 2012-02-14 10:48:36 +01:00 committed by Ruben S. Montero
parent 8285b50b65
commit 7bad159c7d
3 changed files with 34 additions and 13 deletions

View File

@ -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

View File

@ -47,13 +47,33 @@ var config_tab_content =
</tr>\
</table></form>';
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');
});
});

View File

@ -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