mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Merge branch 'sunstone' of opennebula.org:one-ui into sunstone
Conflicts: src/sunstone/public/js/one-ui_views.js
This commit is contained in:
commit
f2e66cdc29
@ -32,6 +32,14 @@ fi
|
||||
PORT="4567"
|
||||
HOST="127.0.0.1"
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo "Usage: sunstone-server [-H host] [-p port]"
|
||||
echo
|
||||
echo "-H: Host for the Sunstone server, default value: localhost"
|
||||
echo "-p: Port for incoming connections, default value: 4567"
|
||||
}
|
||||
|
||||
setup()
|
||||
{
|
||||
|
||||
@ -92,30 +100,25 @@ stop()
|
||||
# Kill the sunstone daemon
|
||||
kill -INT `cat $SUNSTONE_PID` &> /dev/null
|
||||
|
||||
# Remove pid files
|
||||
rm -f $SUNSTONE_LOCK_FILE &> /dev/null
|
||||
|
||||
echo "sunstone-server stopped"
|
||||
}
|
||||
|
||||
while getopts "p:h:" OPTION
|
||||
while getopts "p:H:" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
p) PORT=$OPTARG;;
|
||||
h) HOST=$OPTARG;;
|
||||
\?) echo "Invalid option: -$OPTARG" >&2; exit 3 ;;
|
||||
p) PORT=$OPTARG;;
|
||||
H) HOST=$OPTARG;;
|
||||
*) usage; exit 3;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
setup
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: sunstone {start|stop}" >&2
|
||||
exit 3
|
||||
;;
|
||||
start) setup; start;;
|
||||
stop) stop;;
|
||||
*) usage; exit 3;;
|
||||
esac
|
||||
|
@ -14,8 +14,6 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
# TBD Change path for intallation tree
|
||||
|
||||
ONE_LOCATION = ENV["ONE_LOCATION"]
|
||||
|
||||
if !ONE_LOCATION
|
||||
@ -24,7 +22,6 @@ else
|
||||
VAR_LOCATION = ONE_LOCATION+"/var"
|
||||
end
|
||||
|
||||
#require 'OpenNebulaJSON'
|
||||
require 'models/OpenNebulaJSON'
|
||||
include OpenNebulaJSON
|
||||
|
||||
@ -61,9 +58,8 @@ class SunstoneServer
|
||||
############################################################################
|
||||
#
|
||||
############################################################################
|
||||
def get_pool(kind, user_id)
|
||||
user_flag = user_id=="0" ? -2 : -1
|
||||
|
||||
def get_pool(kind)
|
||||
user_flag = -1
|
||||
pool = case kind
|
||||
when "cluster" then ClusterPoolJSON.new(@client)
|
||||
when "host" then HostPoolJSON.new(@client)
|
||||
@ -199,8 +195,7 @@ class SunstoneServer
|
||||
begin
|
||||
log = File.read(vm_log_file)
|
||||
rescue Exception => e
|
||||
error = Error.new("Error: log for VM #{id} not available")
|
||||
return [500, error.to_s]
|
||||
return [200, "Log for VM #{id} not available"]
|
||||
end
|
||||
|
||||
return [200, log]
|
||||
|
@ -179,7 +179,8 @@ function initDataTables(){
|
||||
"aoColumnDefs": [
|
||||
{ "bSortable": false, "aTargets": ["check"] },
|
||||
{ "sWidth": "60px", "aTargets": [0] },
|
||||
{ "sWidth": "35px", "aTargets": [1] }
|
||||
{ "sWidth": "35px", "aTargets": [1] },
|
||||
{ "sWidth": "100px", "aTargets": [2] }
|
||||
]
|
||||
});
|
||||
|
||||
@ -190,8 +191,9 @@ function initDataTables(){
|
||||
"sPaginationType": "full_numbers",
|
||||
"aoColumnDefs": [
|
||||
{ "bSortable": false, "aTargets": ["check"] },
|
||||
{ "sWidth": "60px", "aTargets": [0,5,6,7] },
|
||||
{ "sWidth": "35px", "aTargets": [1] }
|
||||
{ "sWidth": "60px", "aTargets": [0,4,5,6,7] },
|
||||
{ "sWidth": "35px", "aTargets": [1] },
|
||||
{ "sWidth": "100px", "aTargets": [2] }
|
||||
]
|
||||
});
|
||||
|
||||
@ -217,7 +219,8 @@ function initDataTables(){
|
||||
"aoColumnDefs": [
|
||||
{ "bSortable": false, "aTargets": ["check"] },
|
||||
{ "sWidth": "60px", "aTargets": [0,3] },
|
||||
{ "sWidth": "35px", "aTargets": [1] }
|
||||
{ "sWidth": "35px", "aTargets": [1] },
|
||||
{ "sWidth": "100px", "aTargets": [2,3] }
|
||||
]
|
||||
});
|
||||
|
||||
@ -345,11 +348,11 @@ function refreshButtonListener(){
|
||||
callback = updateHostsView;
|
||||
waiting_nodes(dataTable_hosts);
|
||||
OpenNebula.Host.list({success: callback, error: onError});
|
||||
callback = updateClustersView;
|
||||
OpenNebula.Cluster.list({success: callback, error: onError});
|
||||
break;
|
||||
case "OpenNebula.Cluster.list":
|
||||
callback = updateClustersView;
|
||||
waiting_nodes(dataTable_clusters);
|
||||
OpenNebula.Cluster.list({success: callback, error: onError});
|
||||
//we have no cluster button for this
|
||||
break;
|
||||
case "OpenNebula.VM.list":
|
||||
callback = updateVMachinesView;
|
||||
@ -523,7 +526,7 @@ function confirmWithSelectListener(){
|
||||
dataTable="null";
|
||||
select_var = clusters_select;
|
||||
callback = function (){
|
||||
OpenNebula.Host.list({success: updateClustersView,error: onError});
|
||||
OpenNebula.Cluster.list({success: updateClustersView,error: onError});
|
||||
}
|
||||
break;
|
||||
case "OpenNebula.VM.deploy":
|
||||
@ -739,9 +742,8 @@ function actionButtonListener(){
|
||||
nodes_id.push($(this).val());
|
||||
//Calling action(id,callback,error_callback)
|
||||
if (extra_param!=null){ //action with two parameters
|
||||
data = extra_param;
|
||||
data.id = $(this).val();
|
||||
(eval(action)({data: data, success: callback, error: onError}));
|
||||
var data_arg = {cluster_id: extra_param, id: $(this).val()};
|
||||
(eval(action)({data: data_arg, success: callback, error: onError}));
|
||||
} else { //action with one parameter
|
||||
(eval(action)({data:{id:$(this).val()},success: callback,error: onError}));
|
||||
};
|
||||
@ -810,11 +812,11 @@ function setupImageAttributesDialogs(){
|
||||
<div>\
|
||||
<input type="hidden" id="img_attr_action" />\
|
||||
<label for="img_attr_name">Name:</label>\
|
||||
<input type="text" id="img_attr_name" name="img_attr_name" value="NAME" />\
|
||||
<input type="text" id="img_attr_name" name="img_attr_name" value="" />\
|
||||
</div>\
|
||||
<div>\
|
||||
<label for="img_attr_value">Value:</label>\
|
||||
<input type="text" id="img_attr_value" name="img_attr_value" value="value" />\
|
||||
<input type="text" id="img_attr_value" name="img_attr_value" value="" />\
|
||||
</div>\
|
||||
<div>\
|
||||
<button id="img_attr_proceed" value="">OK</button>\
|
||||
@ -827,7 +829,7 @@ function setupImageAttributesDialogs(){
|
||||
autoOpen:false,
|
||||
width:400,
|
||||
modal:true,
|
||||
height:270,
|
||||
height:200,
|
||||
resizable:false,
|
||||
});
|
||||
|
||||
@ -1046,7 +1048,7 @@ function createClusterDialog(){
|
||||
//If it's successfull we refresh the list.
|
||||
OpenNebula.Cluster.create({ data:cluster_json,
|
||||
success: function(){
|
||||
OpenNebula.Cluster.list(updateClustersView,onError)},
|
||||
OpenNebula.Cluster.list({success:updateClustersView,error:onError})},
|
||||
error: onError});
|
||||
$create_cluster_dialog.dialog('close');
|
||||
return false;
|
||||
@ -2090,7 +2092,7 @@ function createImageDialog(){
|
||||
break;
|
||||
}
|
||||
obj = { "image" : img_json };
|
||||
OpenNebula.Image.create({data: obj,success: addImageElement,error: onError});
|
||||
OpenNebula.Image.register({data: obj,success: addImageElement,error: onError});
|
||||
|
||||
$create_image_dialog.dialog('close');
|
||||
return false;
|
||||
@ -2236,9 +2238,17 @@ function tableCheckboxesListener(dataTable){
|
||||
dataTable = $(this).parents('table').dataTable();
|
||||
context = dataTable.parents('form');
|
||||
last_action_b = $('.last_action_button',context);
|
||||
nodes_length = $('input:checked',dataTable.fnGetNodes()).length;
|
||||
nodes = dataTable.fnGetNodes();
|
||||
total_length = nodes.length;
|
||||
checked_length = $('input:checked',nodes).length;
|
||||
|
||||
if (nodes_length){
|
||||
if (total_length == checked_length){
|
||||
$('.check_all',dataTable).attr("checked","checked");
|
||||
} else {
|
||||
$('.check_all',dataTable).removeAttr("checked");
|
||||
}
|
||||
|
||||
if (checked_length){
|
||||
$('.top_button, .list_button',context).button("enable");
|
||||
if (last_action_b.length && last_action_b.val().length){
|
||||
last_action_b.button("enable");
|
||||
@ -2765,12 +2775,14 @@ function updateVNetworkElement(request, vn_json){
|
||||
|
||||
function deleteVNetworkElement(req){
|
||||
deleteElement(dataTable_vNetworks,'#vnetwork_'+req.request.data);
|
||||
//How to delete vNetwork select option here?
|
||||
}
|
||||
|
||||
function addVNetworkElement(request,vn_json){
|
||||
element = vNetworkElementArray(vn_json);
|
||||
addElement(element,dataTable_vNetworks);
|
||||
|
||||
vnetworks_select += "<option value=\""+vn_json.VNET.NAME+"\">"+vn_json.VNET.NAME+"</option>";
|
||||
$('div.vm_section#networks select#NETWORK').html(vnetworks_select);
|
||||
}
|
||||
|
||||
function updateVNetworksView(request, network_list){
|
||||
@ -2822,11 +2834,14 @@ function updateImageElement(request, image_json){
|
||||
|
||||
function deleteImageElement(req){
|
||||
deleteElement(dataTable_images,'#image_'+req.request.data);
|
||||
//how to update the image select here?
|
||||
}
|
||||
|
||||
function addImageElement(request, image_json){
|
||||
element = imageElementArray(image_json);
|
||||
addElement(element,dataTable_images);
|
||||
images_select += "<option value=\""+image_json.IMAGE.NAME+"\">"+image_json.IMAGE.NAME+"</option>";
|
||||
$('div.vm_section#disks select#IMAGE').html(images_select);
|
||||
}
|
||||
|
||||
function updateImagesView(request, images_list){
|
||||
@ -3112,14 +3127,16 @@ function updateVNetworkInfo(request,vn){
|
||||
<td class="key_td">Public</td>\
|
||||
<td class="value_td">'+(parseInt(vn_info.PUBLIC) ? "yes" : "no" )+'</td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
<table id="vn_leases_info_table" class="info_table">\
|
||||
</table>';
|
||||
if (vn_info.TEMPLATE.TYPE == "FIXED"){
|
||||
rendered_info += '<table id="vn_leases_info_table" class="info_table">\
|
||||
<thead>\
|
||||
<tr><th colspan="2">Leases information</th></tr>\
|
||||
</thead>'+
|
||||
prettyPrintJSON(vn_info.LEASES)+
|
||||
'</table>\
|
||||
</div>\
|
||||
'</table>';
|
||||
}
|
||||
rendered_info += '</div>\
|
||||
<div id="vn_template">\
|
||||
<table id="vn_template_table" class="info_table">\
|
||||
<thead><tr><th colspan="2">Virtual Network template</th></tr></thead>'+
|
||||
@ -3163,11 +3180,11 @@ function updateImageInfo(request,img){
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Public</td>\
|
||||
<td class="value_td">'+(img_info.PUBLIC ? "yes" : "no")+'</td>\
|
||||
<td class="value_td">'+(parseInt(img_info.PUBLIC) ? "yes" : "no")+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Persistent</td>\
|
||||
<td class="value_td">'+(img_info.PERSISTENT ? "yes" : "no")+'</td>\
|
||||
<td class="value_td">'+(parseInt(img_info.PERSISTENT) ? "yes" : "no")+'</td>\
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">Source</td>\
|
||||
@ -3175,7 +3192,7 @@ function updateImageInfo(request,img){
|
||||
</tr>\
|
||||
<tr>\
|
||||
<td class="key_td">State</td>\
|
||||
<td class="value_td">'+img_info.STATE+'</td>\
|
||||
<td class="value_td">'+OpenNebula.Helper.resource_state("image",img_info.STATE)+'</td>\
|
||||
</tr>\
|
||||
</table>\
|
||||
</div>\
|
||||
|
@ -168,14 +168,14 @@ var hostlist_tmpl =
|
||||
</div>\
|
||||
<div class="action_block">\
|
||||
<button class="create_cluster_button top_button new_button">+ New Cluster</button>\
|
||||
<button class="confirm_with_select_button top_button new_button" value="OpenNebula.Cluster.delete">Delete cluster</button>\
|
||||
<select class="multi_action_slct" id="cluster_actions_select">\
|
||||
<option class="confirm_with_select_button" value="OpenNebula.Cluster.delete">Delete cluster</option>\
|
||||
<option class="confirm_with_select_button" value="OpenNebula.Cluster.addhost">Add host to cluster</option>\
|
||||
<option class="action_button" value="OpenNebula.Cluster.removehost">Remove host from cluster</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
<div class="action_block" style="border:none;">\
|
||||
<button class="action_button top_button" value="OpenNebula.Host.delete">Delete</button>\
|
||||
<button class="action_button top_button" value="OpenNebula.Host.delete">Delete host</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<table id="datatable_hosts" class="display">\
|
||||
@ -895,7 +895,7 @@ var userlist_tmpl =
|
||||
'<form id="user_form" action="" action="javascript:alert(\'js error!\');">\
|
||||
<div class="action_blocks">\
|
||||
<div class="action_block">\
|
||||
<img src="/images/Refresh-icon.png" class="refresh_image" alt="OpenNebula.VM.list" />\
|
||||
<img src="/images/Refresh-icon.png" class="refresh_image" alt="OpenNebula.User.list" />\
|
||||
</div>\
|
||||
<div class="action_block">\
|
||||
<button class="create_user_button top_button new_button">+ New</button>\
|
||||
@ -1042,10 +1042,13 @@ var create_image_tmpl =
|
||||
<fieldset>\
|
||||
<div class="" id="src_path_select">\
|
||||
<label style="height:3em;">Path vs. source:</label>\
|
||||
<input type="radio" name="src_path" id="path_img" value="path">Provide a path</input><br />\
|
||||
<input type="radio" name="src_path" id="source_img" value="source">Provide a source</input><br />\
|
||||
<input type="radio" name="src_path" id="datablock_img" value="datablock">Create an empty datablock</input>\
|
||||
<div class="tip">Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.</div>\
|
||||
<input type="radio" name="src_path" id="path_img" value="path" />\
|
||||
<label style="float:none">Provide a path</label><br />\
|
||||
<input type="radio" name="src_path" id="source_img" value="source" />\
|
||||
<label style="float:none">Provide a source</label><br />\
|
||||
<input type="radio" name="src_path" id="datablock_img" value="datablock" />\
|
||||
<label style="float:none;vertical-align:top">Create an empty datablock</label>\
|
||||
<div class="tip">Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.</div><br />\
|
||||
</div>\
|
||||
<div class="img_param">\
|
||||
<label for="img_path">Path:</label>\
|
||||
|
@ -145,7 +145,9 @@ var OpenNebula = {
|
||||
|
||||
var p_pool = [];
|
||||
|
||||
pool = response[pool_name][type];
|
||||
if (response[pool_name]) {
|
||||
pool = response[pool_name][type];
|
||||
} else { pull = null };
|
||||
|
||||
if (pool == null)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ end
|
||||
# GET Pool information
|
||||
##############################################################################
|
||||
get '/:pool' do
|
||||
@SunstoneServer.get_pool(params[:pool], session["user_id"])
|
||||
@SunstoneServer.get_pool(params[:pool])
|
||||
end
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user