mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #992:
This commit contains the following changes: * Cookies are fully enabled, with timeouts etc. "remember" box should take effect just as in Sunstone. * Username is now accesible with the "username" variable. * Logout button works. * Closing storage panels leads to storage dashboard and not to Vnet dashboard. * Instance types for compute resource creation are fetched dynamically from server. * 'Description' is now part of storage extended information. * Error messages are now shown correctly. * Compute with NIC section submission is fixed. * Publish/Unpublish notions and related actions have been removed. * Reset icon is now ui-icon-scissors * Storage persistency can be changed from a tickbox in the information.
This commit is contained in:
parent
d61613b905
commit
91732de746
@ -123,6 +123,18 @@ before do
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
unless request.path=='/ui/login' || request.path=='/ui'
|
||||
unless session[:remember]
|
||||
if params[:timeout] == true
|
||||
env['rack.session.options'][:defer] = true
|
||||
else
|
||||
env['rack.session.options'][:expire_after] = 60*10
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Response treatment
|
||||
helpers do
|
||||
def authorized?
|
||||
@ -141,8 +153,29 @@ helpers do
|
||||
else
|
||||
client = settings.cloud_auth.client(username)
|
||||
@occi_server = OCCIServer.new(client, settings.config)
|
||||
|
||||
user_id = OpenNebula::User::SELF
|
||||
user = OpenNebula::User.new_with_id(user_id, client)
|
||||
rc = user.info
|
||||
if OpenNebula.is_error?(rc)
|
||||
# Add a log message
|
||||
return [500, ""]
|
||||
end
|
||||
|
||||
session[:ip] = request.ip
|
||||
session[:user] = username
|
||||
session[:remember] = params[:remember]
|
||||
|
||||
if user['TEMPLATE/LANG']
|
||||
session[:lang] = user['TEMPLATE/LANG']
|
||||
else
|
||||
session[:lang] = settings.config[:lang]
|
||||
end
|
||||
|
||||
if params[:remember]
|
||||
env['rack.session.options'][:expire_after] = 30*60*60*24
|
||||
end
|
||||
|
||||
return [204, ""]
|
||||
end
|
||||
end
|
||||
@ -295,8 +328,12 @@ get '/ui' do
|
||||
return File.read(File.dirname(__FILE__)+'/ui/templates/login.html')
|
||||
end
|
||||
|
||||
time = Time.now + 60
|
||||
response.set_cookie("occi-user",
|
||||
:value=>"#{session[:user]}",
|
||||
:expires=>time)
|
||||
|
||||
erb :index
|
||||
#return File.read(File.dirname(__FILE__)+'/ui/templates/index.html')
|
||||
end
|
||||
|
||||
post '/ui/upload' do
|
||||
|
@ -50,21 +50,11 @@ var OCCI = {
|
||||
|
||||
"Error": function(resp)
|
||||
{
|
||||
var error = {};
|
||||
if (resp.responseText)
|
||||
{
|
||||
try {
|
||||
error = JSON.parse(resp.responseText);
|
||||
}
|
||||
catch (e) {
|
||||
error.error = {message: "It appears there was a server exception. Please check server's log."};
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
error.error = {};
|
||||
}
|
||||
error.error.http_status = resp.status;
|
||||
var error = {
|
||||
error : {
|
||||
message: resp.responseText,
|
||||
http_status : resp.status}
|
||||
};
|
||||
return error;
|
||||
},
|
||||
|
||||
@ -484,7 +474,7 @@ var OCCI = {
|
||||
var im_name = obj.image_name;
|
||||
params.data.body = '<DISK id="'+disk_id+'"><SAVE_AS name="'+im_name+'" /></DISK>';
|
||||
OCCI.Action.update(params,OCCI.VM.resource,"saveas");
|
||||
}
|
||||
},
|
||||
/* "vnc" : function(params,startstop){
|
||||
var callback = params.success;
|
||||
var callback_error = params.error;
|
||||
@ -619,4 +609,11 @@ var OCCI = {
|
||||
}
|
||||
},
|
||||
|
||||
"Instance_type" : {
|
||||
"resource" : "INSTANCE_TYPE",
|
||||
"list" : function(params){
|
||||
OCCI.Action.list(params,OCCI.Instance_type.resource);
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
|
@ -75,9 +75,7 @@ var create_vm_tmpl ='<form id="create_vm_form" action="">\
|
||||
<fieldset>\
|
||||
<label for="instance_type">'+tr("Instance type")+':</label>\
|
||||
<select id="instance_type">\
|
||||
<option value="small">'+tr("Small")+'</option>\
|
||||
<option value="medium">'+tr("Medium")+'</option>\
|
||||
<option value="big">'+tr("Big")+'</option>\
|
||||
<option value="">'+tr("Loading")+'...</option>\
|
||||
</select><br />\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
@ -170,7 +168,7 @@ var vm_actions = {
|
||||
"VM.suspend" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.suspend,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -179,7 +177,7 @@ var vm_actions = {
|
||||
"VM.resume" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.resume,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -188,7 +186,7 @@ var vm_actions = {
|
||||
"VM.stop" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.stop,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -197,7 +195,7 @@ var vm_actions = {
|
||||
"VM.done" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.done,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -206,7 +204,7 @@ var vm_actions = {
|
||||
"VM.shutdown" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.shutdown,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -215,7 +213,7 @@ var vm_actions = {
|
||||
"VM.cancel" : {
|
||||
type: "multiple",
|
||||
call: OCCI.VM.cancel,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
elements: vmElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -232,7 +230,7 @@ var vm_actions = {
|
||||
"VM.saveas" : {
|
||||
type: "single",
|
||||
call: OCCI.VM.saveas,
|
||||
callback: vmShow,
|
||||
//callback: vmShow,
|
||||
error:onError
|
||||
},
|
||||
|
||||
@ -242,6 +240,23 @@ var vm_actions = {
|
||||
callback: saveasDisksCallback,
|
||||
error: onError
|
||||
},
|
||||
"VM.getInstanceTypes" : {
|
||||
type: "list",
|
||||
call: OCCI.Instance_type.list,
|
||||
callback: function(request,response){
|
||||
if (response.constructor != Array){
|
||||
response = [response];
|
||||
};
|
||||
var options = "";
|
||||
for (var i = 0; i<response.length; i++){
|
||||
var type = response[i].INSTANCE_TYPE.NAME;
|
||||
options += '<option value="'+type+'">'+type+'</option>';
|
||||
};
|
||||
$('#dialog select#instance_type').html(options);
|
||||
},
|
||||
error: onError
|
||||
},
|
||||
|
||||
/*
|
||||
"VM.startvnc" : {
|
||||
type: "single",
|
||||
@ -338,7 +353,15 @@ var vm_buttons = {
|
||||
|
||||
var vm_info_panel = {
|
||||
"vm_info_tab" : {
|
||||
title: tr("Compute resource information"),
|
||||
title: tr("Compute resource"),
|
||||
content: ""
|
||||
},
|
||||
"vm_disks_tab" : {
|
||||
title: tr("Disks"),
|
||||
content: ""
|
||||
},
|
||||
"vm_networks_tab" : {
|
||||
title: tr("Networks"),
|
||||
content: ""
|
||||
},
|
||||
}
|
||||
@ -366,10 +389,6 @@ function vmElements() {
|
||||
return getSelectedNodes(dataTable_vMachines);
|
||||
}
|
||||
|
||||
function vmShow(req) {
|
||||
// Sunstone.runAction("VM.show",req.request.data[0]);
|
||||
}
|
||||
|
||||
// Returns a human readable running time for a VM
|
||||
function str_start_time(vm){
|
||||
return pretty_time(vm.STIME);
|
||||
@ -466,9 +485,13 @@ function updateVMInfo(request,vm){
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+vm_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Instance type")+'</td>\
|
||||
<td class="value_td">'+vm_info.INSTANCE_TYPE+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("State")+'</td>\
|
||||
<td class="value_td">'+tr(vm_state)+'</td>\
|
||||
<td class="value_td">'+tr(vm_info.STATE)+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("CPU")+'</td>\
|
||||
@ -482,7 +505,95 @@ function updateVMInfo(request,vm){
|
||||
</table>\
|
||||
<div class="form_buttons">\
|
||||
<button class="vm_close_dialog_link"/></div>'
|
||||
}
|
||||
};
|
||||
|
||||
var disks_str = '<table class="info_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Disks information")+'</th></tr>\
|
||||
</thead><tbody>';
|
||||
|
||||
var disks = vm_info.DISK;
|
||||
if (disks){
|
||||
if (disks.constructor != Array) // 1lease
|
||||
disks = [disks];
|
||||
|
||||
for (var i=0;i<disks.length; i++){
|
||||
disks_str += '<tr>\
|
||||
<td class="key_td">'+tr("ID")+'</td>\
|
||||
<td class="value_td">'+disks[i].id+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+disks[i].STORAGE.name+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Target")+'</td>\
|
||||
<td class="value_td">'+disks[i].TARGET+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Type")+'</td>\
|
||||
<td class="value_td">'+disks[i].TYPE+'</td>\
|
||||
</tr><tr><td></td><td></td></tr>';
|
||||
};
|
||||
|
||||
} else {
|
||||
disks_str += '<tr><td class="key_td">'+
|
||||
tr("No disks defined")+'</td><td></td></tr>';
|
||||
};
|
||||
|
||||
disks_str += '</tbody></table>\
|
||||
<div class="form_buttons">\
|
||||
<button class="vm_close_dialog_link"/></div>';
|
||||
|
||||
var disks_tab = {
|
||||
title : tr("Disks"),
|
||||
content : disks_str
|
||||
};
|
||||
|
||||
var networks_str = '<table class="info_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Networks information")+'</th></tr>\
|
||||
</thead><tbody>';
|
||||
|
||||
var networks = vm_info.NIC;
|
||||
if (networks){
|
||||
if (networks.constructor != Array) // 1lease
|
||||
networks = [networks];
|
||||
|
||||
for (var i=0;i<networks.length; i++){
|
||||
var net_id = networks[i].NETWORK.href;
|
||||
net_id = net_id[net_id.length-1]
|
||||
networks_str += '<tr>\
|
||||
<td class="key_td">'+tr("ID")+'</td>\
|
||||
<td class="value_td">'+net_id+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+networks[i].NETWORK.name+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("IP")+'</td>\
|
||||
<td class="value_td">'+networks[i].IP+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("MAC")+'</td>\
|
||||
<td class="value_td">'+networks[i].MAC+'</td>\
|
||||
</tr><tr><td></td><td></td></tr>';
|
||||
};
|
||||
|
||||
} else {
|
||||
networks_str += '<tr><td class="key_td">'+
|
||||
tr("No networks defined")+'</td><td></td></tr>';
|
||||
};
|
||||
|
||||
networks_str += '</tbody></table>\
|
||||
<div class="form_buttons">\
|
||||
<button class="vm_close_dialog_link"/></div>';
|
||||
|
||||
var networks_tab = {
|
||||
title : tr("Networks"),
|
||||
content : networks_str
|
||||
};
|
||||
|
||||
/*
|
||||
var monitoring_tab = {
|
||||
@ -492,6 +603,8 @@ function updateVMInfo(request,vm){
|
||||
*/
|
||||
|
||||
Sunstone.updateInfoPanelTab("vm_info_panel","vm_info_tab",info_tab);
|
||||
Sunstone.updateInfoPanelTab("vm_info_panel","vm_disks_tab",disks_tab);
|
||||
Sunstone.updateInfoPanelTab("vm_info_panel","vm_networks_tab",networks_tab);
|
||||
//Sunstone.updateInfoPanelTab("vm_info_panel","vm_monitoring_tab",monitoring_tab);
|
||||
|
||||
//Pop up the info panel and asynchronously get vm_log and stats
|
||||
@ -510,6 +623,7 @@ function updateVMInfo(request,vm){
|
||||
// Open creation dialog
|
||||
function popUpCreateVMDialog(){
|
||||
Sunstone.popUpInfoPanel("vm_create_panel");
|
||||
Sunstone.runAction("VM.getInstanceTypes");
|
||||
var dialog = $('#dialog');
|
||||
$create_vm_dialog = dialog;
|
||||
|
||||
@ -523,7 +637,7 @@ function popUpCreateVMDialog(){
|
||||
});
|
||||
$('#reset_vm',dialog).button({
|
||||
icons: {
|
||||
primary: "ui-icon-document"
|
||||
primary: "ui-icon-scissors"
|
||||
},
|
||||
text: false
|
||||
});
|
||||
@ -601,11 +715,11 @@ function popUpCreateVMDialog(){
|
||||
var nets = $('#network_box option[clicked="clicked"]');
|
||||
|
||||
if (nets.length){
|
||||
vm["NETWORK"] = [];
|
||||
vm["NIC"] = [];
|
||||
|
||||
nets.each(function(){
|
||||
var value = $(this).val();
|
||||
vm["NETWORK"].push('<NETWORK href="'+href+'/network/'+value+'" />');
|
||||
vm["NIC"].push('<NETWORK href="'+href+'/network/'+value+'" />');
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -125,23 +125,23 @@ var vnet_actions = {
|
||||
}
|
||||
},
|
||||
|
||||
"Network.publish" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Network.publish,
|
||||
callback: vnShow,
|
||||
elements: vnElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
// "Network.publish" : {
|
||||
// type: "multiple",
|
||||
// call: OCCI.Network.publish,
|
||||
// //callback: vnShow,
|
||||
// elements: vnElements,
|
||||
// error: onError,
|
||||
// notify: true
|
||||
// },
|
||||
|
||||
"Network.unpublish" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Network.unpublish,
|
||||
callback: vnShow,
|
||||
elements: vnElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
// "Network.unpublish" : {
|
||||
// type: "multiple",
|
||||
// call: OCCI.Network.unpublish,
|
||||
// //callback: vnShow,
|
||||
// elements: vnElements,
|
||||
// error: onError,
|
||||
// notify: true
|
||||
// },
|
||||
|
||||
"Network.delete" : {
|
||||
type: "multiple",
|
||||
@ -166,15 +166,15 @@ var vnet_buttons = {
|
||||
text: tr("+ New")
|
||||
},
|
||||
|
||||
"Network.publish" : {
|
||||
type: "action",
|
||||
text: tr("Publish")
|
||||
},
|
||||
// "Network.publish" : {
|
||||
// type: "action",
|
||||
// text: tr("Publish")
|
||||
// },
|
||||
|
||||
"Network.unpublish" : {
|
||||
type: "action",
|
||||
text: tr("Unpublish")
|
||||
},
|
||||
// "Network.unpublish" : {
|
||||
// type: "action",
|
||||
// text: tr("Unpublish")
|
||||
// },
|
||||
|
||||
"Network.delete" : {
|
||||
type: "action",
|
||||
@ -213,10 +213,6 @@ function vnElements(){
|
||||
return getSelectedNodes(dataTable_vNetworks);
|
||||
}
|
||||
|
||||
function vnShow(req){
|
||||
//Sunstone.runAction("Network.show",req.request.data[0]);
|
||||
}
|
||||
|
||||
//returns an array with the VNET information fetched from the JSON object
|
||||
function vNetworkElementArray(vn_json){
|
||||
var network = vn_json.NETWORK;
|
||||
@ -301,10 +297,6 @@ function updateVNetworkInfo(request,vn){
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+vn_info.NAME+'</td>\
|
||||
<tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Public")+'</td>\
|
||||
<td class="value_td">'+ vn_info.PUBLIC.toLowerCase() +'</td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
<div class="form_buttons">\
|
||||
<button class="vnet_close_dialog_link"/></div>';
|
||||
@ -339,7 +331,7 @@ function popUpCreateVnetDialog() {
|
||||
});
|
||||
$('#reset_vn',dialog).button({
|
||||
icons: {
|
||||
primary: "ui-icon-document"
|
||||
primary: "ui-icon-scissors"
|
||||
},
|
||||
text: false
|
||||
});
|
||||
|
@ -166,9 +166,6 @@ var image_actions = {
|
||||
"Image.persistent" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Image.persistent,
|
||||
callback: function (req) {
|
||||
//Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
elements: imageElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
@ -177,35 +174,32 @@ var image_actions = {
|
||||
"Image.nonpersistent" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Image.nonpersistent,
|
||||
callback: function (req) {
|
||||
//Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
elements: imageElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
|
||||
"Image.publish" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Image.publish,
|
||||
callback: function (req) {
|
||||
//Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
elements: imageElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
// "Image.publish" : {
|
||||
// type: "multiple",
|
||||
// call: OCCI.Image.publish,
|
||||
// callback: function (req) {
|
||||
// //Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
// },
|
||||
// elements: imageElements,
|
||||
// error: onError,
|
||||
// notify: true
|
||||
// },
|
||||
|
||||
"Image.unpublish" : {
|
||||
type: "multiple",
|
||||
call: OCCI.Image.unpublish,
|
||||
callback: function (req) {
|
||||
//Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
},
|
||||
elements: imageElements,
|
||||
error: onError,
|
||||
notify: true
|
||||
},
|
||||
// "Image.unpublish" : {
|
||||
// type: "multiple",
|
||||
// call: OCCI.Image.unpublish,
|
||||
// callback: function (req) {
|
||||
// //Sunstone.runAction("Image.show",req.request.data[0]);
|
||||
// },
|
||||
// elements: imageElements,
|
||||
// error: onError,
|
||||
// notify: true
|
||||
// },
|
||||
|
||||
"Image.delete" : {
|
||||
type: "multiple",
|
||||
@ -228,32 +222,27 @@ var image_buttons = {
|
||||
type: "create_dialog",
|
||||
text: tr('+ New')
|
||||
},
|
||||
"Image.update_dialog" : {
|
||||
"Image.persistent" : {
|
||||
type: "action",
|
||||
text: tr("Update a template"),
|
||||
alwaysActive: true
|
||||
text: tr("Make persistent")
|
||||
},
|
||||
"action_list" : {
|
||||
type: "select",
|
||||
actions: {
|
||||
"Image.publish" : {
|
||||
type: "action",
|
||||
text: tr("Publish")
|
||||
},
|
||||
"Image.unpublish" : {
|
||||
type: "action",
|
||||
text: tr("Unpublish")
|
||||
},
|
||||
"Image.persistent" : {
|
||||
type: "action",
|
||||
text: tr("Make persistent")
|
||||
},
|
||||
"Image.nonpersistent" : {
|
||||
type: "action",
|
||||
text: tr("Make non persistent")
|
||||
}
|
||||
}
|
||||
"Image.nonpersistent" : {
|
||||
type: "action",
|
||||
text: tr("Make non persistent")
|
||||
},
|
||||
// "action_list" : {
|
||||
// type: "select",
|
||||
// actions: {
|
||||
// "Image.publish" : {
|
||||
// type: "action",
|
||||
// text: tr("Publish")
|
||||
// },
|
||||
// "Image.unpublish" : {
|
||||
// type: "action",
|
||||
// text: tr("Unpublish")
|
||||
// },
|
||||
// }
|
||||
// },
|
||||
"Image.delete" : {
|
||||
type: "action",
|
||||
text: tr("Delete")
|
||||
@ -367,7 +356,7 @@ function updateImageInfo(request,img){
|
||||
var info_tab = {
|
||||
title: tr("Image information"),
|
||||
content:
|
||||
'<table id="info_img_table" class="info_table" style="width:80%;">\
|
||||
'<form><table id="info_img_table" class="info_table" style="width:80%;">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">'+tr("Image")+' "'+img_info.NAME+'" '+
|
||||
tr("information")+'</th></tr>\
|
||||
@ -380,16 +369,17 @@ function updateImageInfo(request,img){
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+img_info.NAME+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Name")+'</td>\
|
||||
<td class="value_td">'+img_info.DESCRIPTION+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Type")+'</td>\
|
||||
<td class="value_td">'+OCCI.Helper.image_type(img_info.TYPE)+'</td>\
|
||||
</tr>\
|
||||
<td class="key_td">'+tr("Public")+'</td>\
|
||||
<td class="value_td">'+img_info.PUBLIC.toLowerCase()+'</td>\
|
||||
</tr>\
|
||||
</tr>\
|
||||
<td class="key_td">'+tr("Persistent")+'</td>\
|
||||
<td class="value_td">'+img_info.PERSISTENT.toLowerCase()+'</td>\
|
||||
<td class="value_td"><input type="checkbox" '+(img_info.PERSISTENT == "YES" ? 'checked="checked"' : "")+' /></td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">'+tr("Filesystem type")+'</td>\
|
||||
@ -399,7 +389,7 @@ function updateImageInfo(request,img){
|
||||
<td class="key_td">'+tr("Size (Mb)")+'</td>\
|
||||
<td class="value_td">'+img_info.SIZE+'</td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
</table></form>\
|
||||
<div class="form_buttons">\
|
||||
<button class="image_close_dialog_link"/></div>'
|
||||
};
|
||||
@ -410,6 +400,12 @@ function updateImageInfo(request,img){
|
||||
text:false,
|
||||
icons: { primary: "ui-icon-closethick" }
|
||||
});
|
||||
$('#dialog input').click(function(){
|
||||
if ($(this).is(':checked'))
|
||||
Sunstone.runAction("Image.persistent",[img_info.ID])
|
||||
else
|
||||
Sunstone.runAction("Image.nonpersistent",[img_info.ID])
|
||||
});
|
||||
}
|
||||
|
||||
function popUpCreateImageDialog(){
|
||||
@ -425,7 +421,7 @@ function popUpCreateImageDialog(){
|
||||
});
|
||||
$('#reset_image',dialog).button({
|
||||
icons: {
|
||||
primary: "ui-icon-document"
|
||||
primary: "ui-icon-scissors"
|
||||
},
|
||||
text: false
|
||||
});
|
||||
@ -441,6 +437,7 @@ function popUpCreateImageDialog(){
|
||||
$('#img_fstype',dialog).parents('div.img_param').hide();
|
||||
$('#img_size',dialog).parents('div.img_param').hide();
|
||||
|
||||
/*
|
||||
$('#img_public',dialog).click(function(){
|
||||
$('#img_persistent',$create_image_dialog).removeAttr('checked');
|
||||
});
|
||||
@ -448,7 +445,7 @@ function popUpCreateImageDialog(){
|
||||
$('#img_persistent',dialog).click(function(){
|
||||
$('#img_public',$create_image_dialog).removeAttr('checked');
|
||||
});
|
||||
|
||||
*/
|
||||
$('#img_type',dialog).change(function(){
|
||||
if ($(this).val() == "DATABLOCK"){
|
||||
$('#img_fstype',$create_image_dialog).parents('div.img_param').show();
|
||||
@ -639,7 +636,7 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$('.image_close_dialog_link').live("click",function(){
|
||||
popUpVNetDashboard();
|
||||
popUpImageDashboard();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -366,6 +366,7 @@ $(document).ready(function(){
|
||||
$('.action_blocks .action_list:visible',main_tabs_context).hide();
|
||||
});
|
||||
|
||||
//Close open panel
|
||||
$('.close_dialog_link').live("click",function(){
|
||||
hideDialog();
|
||||
return false;
|
||||
@ -402,6 +403,9 @@ function setLogin(){
|
||||
case "ozones":
|
||||
username = cookie["ozones-user"];
|
||||
break;
|
||||
case "occi":
|
||||
username = cookie["occi-user"];
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
@ -416,6 +420,9 @@ function setLogin(){
|
||||
case "ozones":
|
||||
oZones.Auth.logout({success:redirect});
|
||||
break;
|
||||
case "occi":
|
||||
OCCI.Auth.logout({success:function(){window.location.href = "ui";}});
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@ -424,8 +431,13 @@ function setLogin(){
|
||||
//returns whether we are Sunstone, or oZones
|
||||
//not the most elegant way, but better in its own function
|
||||
function whichUI(){
|
||||
return (typeof(OpenNebula)!="undefined"? "sunstone" : "ozones");
|
||||
}
|
||||
if (typeof(OpenNebula)!="undefined")
|
||||
return "sunstone";
|
||||
if (typeof(oZones)!="undefined")
|
||||
return "ozones";
|
||||
if (typeof(OCCI)!="undefined")
|
||||
return "occi";
|
||||
};
|
||||
|
||||
//Inserts all main tabs in the DOM
|
||||
function insertTabs(){
|
||||
|
@ -403,6 +403,9 @@ function setLogin(){
|
||||
case "ozones":
|
||||
username = cookie["ozones-user"];
|
||||
break;
|
||||
case "occi":
|
||||
username = cookie["occi-user"];
|
||||
break;
|
||||
};
|
||||
|
||||
|
||||
@ -417,6 +420,9 @@ function setLogin(){
|
||||
case "ozones":
|
||||
oZones.Auth.logout({success:redirect});
|
||||
break;
|
||||
case "occi":
|
||||
OCCI.Auth.logout({success:function(){window.location.href = "ui";}});
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@ -425,8 +431,13 @@ function setLogin(){
|
||||
//returns whether we are Sunstone, or oZones
|
||||
//not the most elegant way, but better in its own function
|
||||
function whichUI(){
|
||||
return (typeof(OpenNebula)!="undefined"? "sunstone" : "ozones");
|
||||
}
|
||||
if (typeof(OpenNebula)!="undefined")
|
||||
return "sunstone";
|
||||
if (typeof(oZones)!="undefined")
|
||||
return "ozones";
|
||||
if (typeof(OCCI)!="undefined")
|
||||
return "occi";
|
||||
};
|
||||
|
||||
//Inserts all main tabs in the DOM
|
||||
function insertTabs(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user