1
0
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

This commit is contained in:
Hector Sanjuan 2011-02-24 13:00:45 +01:00
commit b6d1ba03f0
7 changed files with 64 additions and 41 deletions

View File

@ -297,6 +297,11 @@ INSTALL_CLIENT_FILES=(
RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
)
INSTALL_SUNSTONE_RUBY_FILES=(
SUNSTONE_RUBY_LIB_FILES:$LIB_LOCATION/ruby
RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
)
INSTALL_SUNSTONE_FILES=(
SUNSTONE_FILES:$SUNSTONE_LOCATION
SUNSTONE_BIN_FILES:$BIN_LOCATION
@ -308,8 +313,6 @@ INSTALL_SUNSTONE_FILES=(
SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css
SUNSTONE_PUBLIC_CSS_VENDOR_FILES:$SUNSTONE_LOCATION/public/css/vendor
SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images
SUNSTONE_RUBY_LIB_FILES:$LIB_LOCATION/ruby
RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula
)
INSTALL_ETC_FILES=(
@ -818,7 +821,7 @@ do_file() {
if [ "$CLIENT" = "yes" ]; then
INSTALL_SET=${INSTALL_CLIENT_FILES[@]}
elif [ "$SUNSTONE" = "yes" ]; then
INSTALL_SET=${INSTALL_SUNSTONE_FILES[@]}
INSTALL_SET="${INSTALL_SUNSTONE_RUBY_FILES[@]} ${INSTALL_SUNSTONE_FILES[@]}"
else
INSTALL_SET="${INSTALL_FILES[@]} ${INSTALL_SUNSTONE_FILES[@]}"
fi

View File

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

View File

@ -14,7 +14,7 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
ONE_LOCATION = ENV["ONE_LOCATION"]
ONE_LOCATION = ENV["ONE_LOCATION"] if !ONE_LOCATION
if !ONE_LOCATION
RUBY_LIB_LOCATION = "/usr/lib/one/ruby"

View File

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

View File

@ -59,14 +59,14 @@ $(document).ready(function() {
confirmButtonListener(); //listen to buttons that require confirmation
confirmWithSelectListener(); //listen to buttons requiring a selector
actionButtonListener(); //listens to all simple actions (not creates)
hostInfoListener();
vMachineInfoListener();
vNetworkInfoListener();
imageInfoListener();
setupImageAttributesDialogs(); //setups the add/update/remove attr dialogs
//Jquery-ui eye-candy
@ -75,7 +75,7 @@ $(document).ready(function() {
emptyDashboard();
preloadTables();
setupAutoRefresh();
tableCheckboxesListener(dataTable_hosts);
tableCheckboxesListener(dataTable_vMachines);
tableCheckboxesListener(dataTable_vNetworks);
@ -504,7 +504,7 @@ function confirmWithSelectListener(){
});
$('div#confirm_with_select_dialog button').button();
$( '.confirm_with_select_button').live("click",function(){
val=$(this).val();
tip="";
@ -2220,7 +2220,7 @@ function updateSingleElement(element,data_table,tag){
position = data_table.fnGetPosition(tr);
data_table.fnUpdate(element,position,0);
$('input',data_table).trigger("change");
}
function tableCheckboxesListener(dataTable){
@ -2339,7 +2339,7 @@ function hostElementArray(host_json){
//Adds a listener to show the extended info when clicking on a row
function hostInfoListener(){
$('#tbodyhosts tr').live("click",function(e){
//do nothing if we are clicking a checkbox!
if ($(e.target).is('input')) {return true;}
@ -2360,13 +2360,17 @@ function hostInfoListener(){
//~ }
function vMachineElementArray(vm_json){
vm = vm_json.VM;
var vm = vm_json.VM;
var state = OpenNebula.Helper.resource_state("vm",vm.STATE);
if (state == "ACTIVE") {
state = OpenNebula.Helper.resource_state("vm_lcm",vm.LCM_STATE);
}
return [
'<input type="checkbox" id="vm_'+vm.ID+'" name="selected_items" value="'+vm.ID+'"/>',
vm.ID,
vm.USERNAME ? vm.USERNAME : getUserName(vm.UID),
vm.NAME,
OpenNebula.Helper.resource_state("vm",vm.STATE),
state,
vm.CPU,
humanize_size(vm.MEMORY),
vm.HISTORY ? vm.HISTORY.HOSTNAME : "--",
@ -2407,7 +2411,7 @@ function vNetworkElementArray(vn_json){
}
//Adds a listener to show the extended info when clicking on a row
function vNetworkInfoListener(){
$('#tbodyvnetworks tr').live("click", function(e){
if ($(e.target).is('input')) {return true;}
aData = dataTable_vNetworks.fnGetData(this);
@ -2443,7 +2447,7 @@ function imageElementArray(image_json){
}
function imageInfoListener(target){
$('#tbodyimages tr').live("click",function(e){
if ($(e.target).is('input')) {return true;}
aData = dataTable_images.fnGetData(this);
@ -2781,7 +2785,6 @@ function addVNetworkElement(request,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){
@ -3045,7 +3048,7 @@ function updateVMInfo(request,vm){
</tr>\
<tr>\
<td class="key_td">LCM State</td>\
<td class="value_td">'+OpenNebula.Helper.resource_state("vm",vm_info.LCMSTATE)+'</td>\
<td class="value_td">'+OpenNebula.Helper.resource_state("vm_lcm",vm_info.LCM_STATE)+'</td>\
</tr>\
<tr>\
<td class="key_td">Start time</td>\

View File

@ -65,6 +65,25 @@ var OpenNebula = {
"DONE",
"FAILED"][value];
break;
case "VM_LCM","vm_lcm":
return ["LCM_INIT",
"PROLOG",
"BOOT",
"RUNNING",
"MIGRATE",
"SAVE_STOP",
"SAVE_SUSPEND",
"SAVE_MIGRATE",
"PROLOG_MIGRATE",
"PROLOG_RESUME",
"EPILOG_STOP",
"EPILOG",
"SHUTDOWN",
"CANCEL",
"FAILURE",
"CLEANUP",
"UNKNOWN"][value];
break;
case "IMAGE","image":
return ["INIT",
"READY",

View File

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