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

Feature #1076: support full configuration response in selfservice.

Plus minor fixes in occi-server
(cherry picked from commit f3fe56b383f78d0795ed72b565a0325b097ffc37)
This commit is contained in:
Hector Sanjuan 2012-02-14 11:20:10 +01:00 committed by Ruben S. Montero
parent 8ecc77cd78
commit 8285b50b65
3 changed files with 46 additions and 12 deletions

View File

@ -317,8 +317,8 @@ get '/ui/config' do
config = "<UI_CONFIGURARION>"
config << " <LANG>#{session[:lang]}</LANG>"
congig << " <WSS>#{wss}</WSS>"
congig << " <VNC>#{vnc}</VNC>"
config << " <WSS>#{wss}</WSS>"
config << " <VNC>#{vnc}</VNC>"
config << "</UI_CONFIGURARION>"
return [200, config]

View File

@ -342,6 +342,31 @@ var OCCI = {
}
},
"Config": {
"resource": "CONFIG",
"list": function(params){
var callback = params.success;
var callback_error = params.error;
var resource = OCCI.Config.resource;
var request = OCCI.Helper.request(resource,"list");
$.ajax({
url: "ui/config",
type: "GET",
dataType: "xml ONEjson",
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
}
},
"Network": {
"resource": "NETWORK",

View File

@ -41,14 +41,33 @@ var config_tab_content =
</tr>\
</table></form>';
var config_actions = {
"Config.list" : {
type : 'list',
call : OCCI.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;
//These two variables defined in compute.js
vnc_enable = config['VNC'] == 'true' || config['VNC'] == 'yes' ? true : false;
use_wss = config['WSS'] == 'true' || config['WSS'] == 'yes'? true : false;
};
$(document).ready(function(){
Sunstone.runAction('Config.list');
$('#li_config_tab').click(function(){
hideDialog();
});
@ -64,14 +83,4 @@ $(document).ready(function(){
//Vendor customization, change small logo
$('div#logo img').attr('src',logo_small);
$.get('ui/config/vnc',function(response){
if (response == "true" || response == "yes")
vnc_enable=true; //defined in compute.js
});
$.get('ui/config/wss', function(response){
if (response == "true" || response == "yes")
use_wss=true; //defined in compute.js
});
});