1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-03 13:47:01 +03:00

Merge branch 'feature-992'

This commit is contained in:
Ruben S. Montero 2012-01-02 20:34:43 +01:00
commit 868369252b
58 changed files with 7014 additions and 536 deletions

View File

@ -285,6 +285,31 @@ OZONES_DIRS="$OZONES_LOCATION/lib \
$OZONES_LOCATION/public/images \
$OZONES_LOCATION/public/css"
SELF_SERVICE_DIRS="\
$LIB_LOCATION/ruby/cloud/occi/ui \
$LIB_LOCATION/ruby/cloud/occi/ui/templates \
$LIB_LOCATION/ruby/cloud/occi/ui/views \
$LIB_LOCATION/ruby/cloud/occi/ui/public \
$LIB_LOCATION/ruby/cloud/occi/ui/public/css \
$LIB_LOCATION/ruby/cloud/occi/ui/public/customize \
$LIB_LOCATION/ruby/cloud/occi/ui/public/images \
$LIB_LOCATION/ruby/cloud/occi/ui/public/js \
$LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins \
$LIB_LOCATION/ruby/cloud/occi/ui/public/locale \
$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US \
$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader \
$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json"
OZONES_CLIENT_DIRS="$LIB_LOCATION/ruby \
$LIB_LOCATION/ruby/OpenNebula \
$LIB_LOCATION/ruby/cli \
@ -311,14 +336,14 @@ CONF_CLI_DIRS="$ETC_LOCATION/cli"
if [ "$CLIENT" = "yes" ]; then
MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS \
$LIB_OCA_CLIENT_DIRS $LIB_CLI_CLIENT_DIRS $CONF_CLI_DIRS \
$ETC_LOCATION $OZONES_CLIENT_DIRS"
$ETC_LOCATION $OZONES_CLIENT_DIRS $SELF_SERVICE_DIRS"
elif [ "$SUNSTONE" = "yes" ]; then
MAKE_DIRS="$MAKE_DIRS $SUNSTONE_DIRS $LIB_OCA_CLIENT_DIRS"
elif [ "$OZONES" = "yes" ]; then
MAKE_DIRS="$MAKE_DIRS $OZONES_DIRS $OZONES_CLIENT_DIRS $LIB_OCA_CLIENT_DIRS"
else
MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS \
$OZONES_DIRS $OZONES_CLIENT_DIRS $SUNSTONE_DIRS"
$OZONES_DIRS $OZONES_CLIENT_DIRS $SUNSTONE_DIRS $SELF_SERVICE_DIRS"
fi
#-------------------------------------------------------------------------------
@ -470,6 +495,28 @@ INSTALL_OZONES_ETC_FILES=(
OZONES_ETC_FILES:$ETC_LOCATION
)
INSTALL_SELF_SERVICE_FILES=(
SELF_SERVICE_TEMPLATE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/templates
SELF_SERVICE_VIEWS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/views
SELF_SERVICE_PUBLIC_JS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js
SELF_SERVICE_PUBLIC_JS_PLUGINS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/js/plugins
SELF_SERVICE_PUBLIC_CSS_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/css
SELF_SERVICE_PUBLIC_CUSTOMIZE_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/customize
SELF_SERVICE_PUBLIC_VENDOR_DATATABLES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/dataTables
SELF_SERVICE_PUBLIC_VENDOR_JGROWL:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jGrowl
SELF_SERVICE_PUBLIC_VENDOR_JQUERY:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQuery
SELF_SERVICE_PUBLIC_VENDOR_JQUERYUI:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI
SELF_SERVICE_PUBLIC_VENDOR_JQUERYUIIMAGES:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryUI/images
SELF_SERVICE_PUBLIC_VENDOR_JQUERYLAYOUT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/jQueryLayout
SELF_SERVICE_PUBLIC_VENDOR_FLOT:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/flot
SELF_SERVICE_PUBLIC_VENDOR_CRYPTOJS:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/crypto-js
SELF_SERVICE_PUBLIC_VENDOR_FILEUPLOADER:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/fileuploader
SELF_SERVICE_PUBLIC_VENDOR_XML2JSON:$LIB_LOCATION/ruby/cloud/occi/ui/public/vendor/xml2json
SELF_SERVICE_PUBLIC_IMAGES_FILES:$LIB_LOCATION/ruby/cloud/occi/ui/public/images
SELF_SERVICE_PUBLIC_LOCALE_EN_US:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/en_US
SELF_SERVICE_PUBLIC_LOCALE_ES_ES:$LIB_LOCATION/ruby/cloud/occi/ui/public/locale/es_ES
)
INSTALL_ETC_FILES=(
ETC_FILES:$ETC_LOCATION
VMWARE_ETC_FILES:$ETC_LOCATION
@ -1122,6 +1169,19 @@ src/sunstone/public/vendor/flot/LICENSE.txt \
src/sunstone/public/vendor/flot/NOTICE \
src/sunstone/public/vendor/flot/README.txt"
SUNSTONE_PUBLIC_VENDOR_CRYPTOJS="\
src/sunstone/public/vendor/crypto-js/NOTICE \
src/sunstone/public/vendor/crypto-js/2.3.0-crypto-sha1.js \
src/sunstone/public/vendor/crypto-js/NEW-BSD-LICENSE.txt"
SUNSTONE_PUBLIC_VENDOR_FILEUPLOADER="\
src/sunstone/public/vendor/fileuploader/NOTICE \
src/sunstone/public/vendor/fileuploader/fileuploader.js"
SUNSTONE_PUBLIC_VENDOR_XML2JSON="\
src/sunstone/public/vendor/xml2json/NOTICE \
src/sunstone/public/vendor/xml2json/jquery.xml2json.pack.js"
SUNSTONE_PUBLIC_IMAGES_FILES="src/sunstone/public/images/ajax-loader.gif \
src/sunstone/public/images/login_over.png \
src/sunstone/public/images/login.png \
@ -1238,6 +1298,71 @@ OZONES_BIN_CLIENT_FILES="src/ozones/Client/bin/onevdc \
OZONES_RUBY_LIB_FILES="src/oca/ruby/OpenNebula.rb"
#-----------------------------------------------------------------------------
# Self-Service files
#-----------------------------------------------------------------------------
SELF_SERVICE_TEMPLATE_FILES="src/cloud/occi/lib/ui/templates/login.html"
SELF_SERVICE_VIEWS_FILES="src/cloud/occi/lib/ui/views/index.erb"
SELF_SERVICE_PUBLIC_JS_FILES="src/cloud/occi/lib/ui/public/js/layout.js \
src/cloud/occi/lib/ui/public/js/occi.js \
src/cloud/occi/lib/ui/public/js/locale.js \
src/cloud/occi/lib/ui/public/js/login.js \
src/sunstone/public/js/sunstone.js \
src/sunstone/public/js/sunstone-util.js"
SELF_SERVICE_PUBLIC_JS_PLUGINS_FILES="src/cloud/occi/lib/ui/public/js/plugins/compute.js \
src/cloud/occi/lib/ui/public/js/plugins/configuration.js \
src/cloud/occi/lib/ui/public/js/plugins/dashboard.js \
src/cloud/occi/lib/ui/public/js/plugins/network.js \
src/cloud/occi/lib/ui/public/js/plugins/storage.js"
SELF_SERVICE_PUBLIC_CSS_FILES="src/cloud/occi/lib/ui/public/css/application.css \
src/cloud/occi/lib/ui/public/css/layout.css \
src/cloud/occi/lib/ui/public/css/login.css"
SELF_SERVICE_PUBLIC_CUSTOMIZE_FILES="src/cloud/occi/lib/ui/public/customize/custom.js"
SELF_SERVICE_PUBLIC_VENDOR_DATATABLES=$SUNSTONE_PUBLIC_VENDOR_DATATABLES
SELF_SERVICE_PUBLIC_VENDOR_JGROWL=$SUNSTONE_PUBLIC_VENDOR_JGROWL
SELF_SERVICE_PUBLIC_VENDOR_JQUERY=$SUNSTONE_PUBLIC_VENDOR_JQUERY
SELF_SERVICE_PUBLIC_VENDOR_JQUERYUI=$SUNSTONE_PUBLIC_VENDOR_JQUERYUI
SELF_SERVICE_PUBLIC_VENDOR_JQUERYUIIMAGES=$SUNSTONE_PUBLIC_VENDOR_JQUERYUIIMAGES
SELF_SERVICE_PUBLIC_VENDOR_JQUERYLAYOUT=$SUNSTONE_PUBLIC_VENDOR_JQUERYLAYOUT
SELF_SERVICE_PUBLIC_VENDOR_FLOT=$SUNSTONE_PUBLIC_VENDOR_FLOT
SELF_SERVICE_PUBLIC_VENDOR_CRYPTOJS=$SUNSTONE_PUBLIC_VENDOR_CRYPTOJS
SELF_SERVICE_PUBLIC_VENDOR_FILEUPLOADER=$SUNSTONE_PUBLIC_VENDOR_FILEUPLOADER
SELF_SERVICE_PUBLIC_VENDOR_XML2JSON=$SUNSTONE_PUBLIC_VENDOR_XML2JSON
SELF_SERVICE_PUBLIC_IMAGES_FILES="\
src/cloud/occi/lib/ui/public/images/ajax-loader.gif \
src/cloud/occi/lib/ui/public/images/green_bullet.png \
src/cloud/occi/lib/ui/public/images/login_over.png \
src/cloud/occi/lib/ui/public/images/login.png \
src/cloud/occi/lib/ui/public/images/network_icon.png \
src/cloud/occi/lib/ui/public/images/one-compute.png \
src/cloud/occi/lib/ui/public/images/one-network.png \
src/cloud/occi/lib/ui/public/images/one-storage.png \
src/cloud/occi/lib/ui/public/images/opennebula-selfservice-big.png \
src/cloud/occi/lib/ui/public/images/opennebula-selfservice-icon.png \
src/cloud/occi/lib/ui/public/images/opennebula-selfservice-small.png \
src/cloud/occi/lib/ui/public/images/panel.png \
src/cloud/occi/lib/ui/public/images/panel_short.png \
src/cloud/occi/lib/ui/public/images/pbar.gif \
src/cloud/occi/lib/ui/public/images/red_bullet.png \
src/cloud/occi/lib/ui/public/images/Refresh-icon.png \
src/cloud/occi/lib/ui/public/images/server_icon.png \
src/cloud/occi/lib/ui/public/images/storage_icon.png \
src/cloud/occi/lib/ui/public/images/vnc_off.png \
src/cloud/occi/lib/ui/public/images/vnc_on.png \
src/cloud/occi/lib/ui/public/images/yellow_bullet.png"
SELF_SERVICE_PUBLIC_LOCALE_EN_US="src/cloud/occi/lib/ui/public/locale/en_US/en_US.js"
SELF_SERVICE_PUBLIC_LOCALE_ES_ES="src/cloud/occi/lib/ui/public/locale/es_ES/es_ES.js \
src/cloud/occi/lib/ui/public/locale/es_ES/es_datatable.txt"
#-----------------------------------------------------------------------------
# ACCT files
#-----------------------------------------------------------------------------
@ -1316,7 +1441,7 @@ elif [ "$OZONES" = "yes" ]; then
INSTALL_SET="${INSTALL_OZONES_RUBY_FILES[@]} ${INSTALL_OZONES_FILES[@]}"
else
INSTALL_SET="${INSTALL_FILES[@]} ${INSTALL_OZONES_FILES[@]} \
${INSTALL_SUNSTONE_FILES[@]}"
${INSTALL_SUNSTONE_FILES[@]} ${INSTALL_SELF_SERVICE_FILES[@]}"
fi
for i in ${INSTALL_SET[@]}; do

View File

@ -34,6 +34,9 @@
# x509, for x509 certificate encryption of tokens
:core_auth: cipher
# Life-time in seconds for token renewal (that used to handle OpenNebula auths)
:token_expiration_delta: 1800
# VM types allowed and its template file (inside templates directory)
:instance_types:
:small:
@ -48,3 +51,6 @@
:template: large.erb
:cpu: 8
:memory: 8192
# Default language setting for Self-Service UI
:lang: en_US

View File

@ -48,6 +48,9 @@ $: << RUBY_LIB_LOCATION+"/cloud" # For the Repository Manager
require 'rubygems'
require 'sinatra'
require 'yaml'
require 'erb'
require 'tempfile'
require 'json'
require 'OCCIServer'
require 'CloudAuth'
@ -71,6 +74,9 @@ CloudServer.print_configuration(conf)
##############################################################################
# Sinatra Configuration
##############################################################################
use Rack::Session::Pool, :key => 'occi'
set :public, Proc.new { File.join(root, "ui/public") }
set :views, settings.root + '/ui/views'
set :config, conf
if CloudServer.is_port_open?(settings.config[:server],
@ -98,22 +104,89 @@ set :cloud_auth, cloud_auth
##############################################################################
before do
begin
username = settings.cloud_auth.auth(request.env, params)
rescue Exception => e
error 500, e.message
end
unless request.path=='/ui/login' || request.path=='/ui'
if !authorized?
begin
username = settings.cloud_auth.auth(request.env, params)
rescue Exception => e
error 500, e.message
end
else
username = session[:user]
end
if username.nil?
error 401, ""
else
client = settings.cloud_auth.client(username)
@occi_server = OCCIServer.new(client, settings.config)
if username.nil? #unable to authenticate
error 401, ""
else
client = settings.cloud_auth.client(username)
@occi_server = OCCIServer.new(client, settings.config)
end
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?
session[:ip] && session[:ip]==request.ip ? true : false
end
def build_session
begin
username = settings.cloud_auth.auth(request.env, params)
rescue Exception => e
error 500, e.message
end
if username.nil?
error 401, ""
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 params[:remember]
env['rack.session.options'][:expire_after] = 30*60*60*24
end
if params[:lang]
session[:lang] = params[:lang]
else
session[:lang] = settings.config[:lang]
end
return [204, ""]
end
end
def destroy_session
session.clear
return [204, ""]
end
def treat_response(result,rc)
if OpenNebula::is_error?(result)
halt rc, result.message
@ -234,3 +307,55 @@ get '/user/:id' do
result,rc = @occi_server.get_user(request, params)
treat_response(result,rc)
end
##############################################
## UI
##############################################
post '/config' do
begin
body = JSON.parse(request.body.read)
rescue
[500, "POST Config: Error parsing configuration JSON"]
end
body.each do | key,value |
case key
when "lang" then session[:lang]=value
end
end
end
get '/ui/login' do
File.read(File.dirname(__FILE__)+'/ui/templates/login.html')
end
post '/ui/login' do
build_session
end
post '/ui/logout' do
destroy_session
end
get '/ui' do
if !authorized?
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
end
post '/ui/upload' do
file = Tempfile.new('uploaded_image')
request.params['file'] = file.path #so we can re-use occi post_storage()
file.write(request.env['rack.input'].read)
#file.close # this would allow that file is garbage-collected
result,rc = @occi_server.post_storage(request)
treat_response(result,rc)
end

View File

@ -0,0 +1,589 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
body {
font: 9pt Arial, Verdana, Geneva, Helvetica, sans-serif;
}
p {
margin:0 10px 10px;
}
a {
color: #000C96; text-decoration: none;
}
a:hover {
color: #127FE4; text-decoration: none;
}
select, button {
padding: 2px;
}
h2 {
float:left;
font-size:20px;
margin-bottom: 5px;
padding-bottom: 0}
h3 {
border-bottom: 1px solid #CCCCCC;
color: #353735;
font-size: 14px;
font-weight: normal;
padding: 5px 8px;
margin: 0 0;
}
table#dashboard_table{
width:100%;
margin: 0;
}
table#dashboard_table tr {
vertical-align: top;
}
table#dashboard_table > tbody > tr > td{
width:50%;
}
div.panel {
background-color: #ffffff;
padding:0;
margin: 10px;
border: 1px #ddd solid;
min-height: 50px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-moz-box-shadow: 5px 5px 5px #888;
-webkit-box-shadow: 5px 5px 5px #888;
box-shadow: 5px 5px 5px #888;
}
div.panel h3 {
border: 0;
padding:5px 10px 5px 10px;
margin: 0;
color: white;
font-weight: bold;
background-color: #353735;
-webkit-border-radius: 3px 3px 0 0;
-moz-border-radius: 3px 3px 0 0;
}
div.panel .new-resource {
float: right;
}
div.panel h3 a {
color: white;
font-weight: bold;
}
div.panel_info {
padding: 5px;
}
div.panel_info table.info_table {
background: none;
width: 100%;
margin:0;
}
div.panel_info table.info_table tr {
border: 0;
border-bottom: 1px dotted #ccc;
}
div.panel_info table.info_table > tbody > tr > td {
border: 0;
width: 100%!important;
}
div.panel_info table.info_table td.value_td {
text-align: right;
}
.green {
color: green!important;
}
.red {
color: #B81515!important;
}
ul.multi_action_menu { list-style: none; position: absolute; text-align: left; padding:0; border: 1px solid #D3D3D3; background-color: #F0EDED;}
ul.multi_action_menu li { cursor: pointer; padding: 2px 5px;}
ul.multi_action_menu li:hover { background-color: #D3D3D3;}
div.action_block {
display:inline;
margin-right: 5px;
border-right: 1px solid #D3D3D3;
}
div.action_blocks {
margin-bottom: 0.5em;
text-align: right;
margin-top: 0.5em;
}
input, textarea, select {
border: 0;
border: 1px #bbbbbb solid;
}
input, textarea {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
}
form.create_form{
margin:0;
padding:0;}
fieldset{
margin:0 0;
border:none;
border-top:1px solid #ccc;
padding: 10px 5px;}
fieldset div{
margin-bottom:.5em;
padding:0;
display:block;
}
fieldset input,
fieldset textarea{
width:140px;
/*border-top:1px solid #555;
border-left:1px solid #555;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;*/
padding:1px;color:#333;
vertical-align: top;
margin: 0 2px;
margin-bottom: 4px;
}
fieldset select{
width:144px;
/*border-top:1px solid #555;
border-left:1px solid #555;
border-bottom:1px solid #ccc;
border-right:1px solid #ccc;*/
padding:1px;
color:#333;
vertical-align: top;
margin: 0 2px;
margin-bottom: 4px;
}
/*Chrome hack*/
input[type="radio"],input[type="checkbox"] {
width:20px;
}
legend{
margin-top:0;
margin-bottom: 5px;
padding:0 .5em;
color:#036;
background:transparent;
font-size:1.0em;
font-weight:bold;
}
label{
float: left;
width:100px;
padding:0 1em;
text-align:left;
}
.dataTables_wrapper label {
float: none;
width: auto;
padding: 0 0;
text-align:right;
}
div.tip {
display: inline-block;
padding-left: 5px;
vertical-align: middle;
float:none;
}
div.tip span.ui-icon{
display:inline-block;
}
div.tip span.man_icon {
display:none;
}
.img_man .man_icon {
display:inline-block!important;
}
span.tipspan,div.full_info {
position: fixed;
display:block;
padding:4px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border: 1px solid #353735;
margin-left:2px;
margin-right:5px;
background-color: white;
color: #353735;
font-size:10px;
}
.vm_section input {
float:none;
}
.vm_section legend{
display:none!important;
}
.vm_section fieldset {
border:none!important;
}
div.show_hide {
float:none;
clear:both;
}
.vm_param label{
float:left;
}
fieldset div.vm_section {
margin-top:-8px;
margin-bottom:0px;
}
input:focus,
textarea:focus{
background:#efefef;
color:#000;
}
.form_buttons {
margin-top:6px;
text-align:left;
margin-bottom:20px;
}
.add_remove_button {
font-size:0.8em !important;
height:25px !important;
margin-bottom:4px;
}
.add_button {
margin-left:148px;
width:58px !important;
}
.remove_button {
}
tr.odd, tr.even {
background-color: #ffffff;
border: 1px #e9e9e9 solid;
height:30px!important;
}
tr.odd td, tr.even td{
border-left: 1px #e9e9e9 solid;
}
tr.odd:hover{
background-color: #0098C3 !important;
color: white;
}
tr.even:hover{
color: white;
background-color: #0098C3 !important;
}
.show_hide label{
width: 100%;
}
.clear {
clear: both;
}
/* Create dialogs */
/* host: */
#create_host_form fieldset label {
width: 200px;
}
.action_block_info{
width: 235px;
margin: auto;
}
.icon_right {
display: inline-block;
margin-left: 20px;
position: relative;
top: 2px;
}
.icon_left {
float: left;
margin-right: 20px;
position: relative;
top: 0px;
/*border:1px solid;*/
}
.info_table{
background: none repeat scroll 0 0 #FFFFFF;
border-collapse: collapse;
margin: 20px;
text-align: left;
display: inline-block;
width:85%;
vertical-align:top;
overflow:auto;
}
.info_table > thead th,h3 {
border-bottom: 2px solid #353735;
color: #353735;
font-size: 14px;
font-weight: normal;
padding: 10px 8px;
}
.info_table > tbody > tr > td{
border-bottom: 1px solid #CCCCCC;
color: #353735;
padding-top: 6px;
padding-bottom: 6px;
padding-left: 8px;
padding-right: 8px;
}
/*.info_table > tbody, .info_table > thead, info_table > tbody > tr {
width: 100%;
}*/
.info_table td.key_td{
min-width: 150px;
text-align:left;
font-weight:bold;
}
.info_table td.graph_td{
padding-top:0px!important;
padding-bottom:0px!important;
vertical-align:middle!important;
}
.info_table td.value_td{
text-align:left;
width:100%;
}
#dialog > div > div {
margin: 0;
padding: 0;
}
.loading_img {
vertical-align:middle;
display:inline;
overflow:hide;
}
.top_button {
font-size: 0.8em!important;
height: 25px;
margin: 3px 2px;
vertical-align: middle;
/*width: 89px;*/
}
.top_button button {
font-size: 0.9em;
height: 25px;
vertical-align: middle;
}
.image_button {
font-size: 0.8em;
margin: 3px 2px;
vertical-align: middle;
border:0;
}
/*
.multi_action_slct{
font-size: 0.7em;
vertical-align:middle;
margin:3px 0;
height: 25px;
}*/
.ui-icon-refresh{
position:relative!important;
top:14px!important;
}
#vm_log {
padding: 0 20px 0 20px !important;
}
#vm_log h3 {
border-bottom: 2px solid #353735;
}
#vm_log pre {
font-size: 0.9em;
}
#vm_log .vm_log_error {
color: red;
font-weight: bold;
}
/* Growl */
.jGrowl-notification h1 {
font-size: 1.2em;
}
.jGrowl-notification, .jGrowl-notify-submit {
border: 2px #444444 solid;
background-color: #F3F3F3!important;
color: #666666;
}
.jGrowl-notify-error {
border: 2px #660000 solid;
background-color: #F39999!important;
color: #660000;
}
.jGrowl-notify-error table td.key_error {
text-transform: capitalize;
width: 100%;
font-weight: bold;
}
.jGrowl-notify-error table td.key_error:after {
content:":";
}
.refresh_image {
position: relative;
top: 8px;
cursor: pointer;
}
.ui-widget-overlay { background: #353735; opacity: .60; filter:Alpha(Opacity=60); }
.ui-tabs .ui-tabs-nav li a {
/*padding: .5em 1em;*/
padding: .3em 1em;
}
ul.action_list{
/*background: #EDEDED;*/
border: 1px solid #525252;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.25, #E9E9E9),
color-stop(0.63, #F5F5F5)
);
background-image: -moz-linear-gradient(
center bottom,
#E9E9E9 25%,
#F5F5F5 63%
);
position:absolute;
z-index:1;
list-style-type:none;
text-align:left;
padding:5px 5px;
-webkit-border-radius:4px;
-webkit-border-bottom-right-radius:5px;
-webkit-border-bottom-left-radius:5px;
-moz-border-radius:4px;
-moz-border-radius-bottomright:5px;
-moz-border-radius-bottomleft:5px;
border-radius:4px;
border-bottom-right-radius:5px;
border-bottom-left-radius:5px;
}
ul.action_list li a{
font-size: 0.8em;
color:#575C5B;
}
ul.action_list li a:hover{
color:#0098C3;
}
.progress_bar{
height:10px;
background: #8F9392;
}
.ui-widget{
font: 10pt Arial, Verdana, Geneva, Helvetica, sans-serif;
}
.ui-layout-resizer-open-hover, /* hover-color to 'resize' */
.ui-layout-resizer-dragging {
background: #EEE;
}
.dashboard_p {
color: #353735;
text-align:justify;
}
.dashboard_p p{
padding-top:5px;
}
.dashboard_p img {
padding-left:10px;
padding-right: 10px;
border:0;
}

View File

@ -0,0 +1,183 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
body {
background: #f5f5f5;
}
.outer-center, .inner-center {
padding: 0;
}
.outer-center {
border: 0;
}
.inner-south {
padding: 0;
}
#dialog div {
border: 0;
}
.tab {
padding: 5px 10px 0 10px;
}
body {
font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;
font-size: 13px;
}
#header {
padding: 0 10px 0 10px;
background-color: #353735;
border:0;
}
#footer {
padding-top: 9px;
font-size: 0.8em;
color: white;
text-align: center;
background-color: #353735;
border:0;
}
#footer a {
color: white;
text-decoration: underline;
}
#logo {
padding-top: 6px;
font-weight: bold;
color: white;
float:left;
}
#login-info {
padding-top: 4px;
float: right;
padding-right: 5px;
}
#links {
padding-top: 4px;
margin-right: 40px;
float: right;
}
#login-info, #login-info a, #links, #links a {
color: white;
}
#login-info, #login-info a {
font-weight: bold;
}
.sunstone-color {
color: #0098C3;
}
#logo-wrapper {
float: right;
margin-top: 0px;
margin-right: 20px;
}
#menu {
padding-right: 0;
padding-left: 0;
border:0;
border-right: 1px solid #353735;
background-image: -webkit-gradient(
linear,
left top,
right top,
color-stop(0.95, rgb(99,102,99)),
color-stop(1, rgb(53,55,53))
);
background-image: -moz-linear-gradient(
left center,
rgb(99,102,99) 95%,
rgb(53,55,53) 100%
);
}
#navigation {
list-style: none;
padding: 0;
}
#navigation li {
line-height: 2em;
text-align: right;
padding-right: 10px;
}
#navigation li a {
color: #ffffff;
}
#navigation li:hover, .navigation-active-li {
background-image: -webkit-gradient(
linear,
left top,
right top,
color-stop(0.95, #0098C3),
color-stop(1, rgb(53,55,53))
);
background-image: -moz-linear-gradient(
left center,
#0098C3 95%,
rgb(53,55,53) 100%
);
/*
background-image: -webkit-gradient(
linear,
right top,
left top,
color-stop(0, rgb(0,152,192)),
color-stop(1, rgb(255,255,255))
);
background-image: -moz-linear-gradient(
right center,
rgb(0,152,192) 0%,
rgb(255,255,255) 100%
);
*/
}
.navigation-active-li-a {
font-weight: bold;
}
#navigation li:hover a, .navigation-active-li-a {
color: #ffffff !important;
}
#language {
float:right;
margin-top:2px;
margin-right:25px;
width: 100px;
}
#language select {
width: 100px;
height: 22px;
}

View File

@ -0,0 +1,162 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
body {
background: #FAFAFA;
margin: 0px;
}
#header {
height: 30px;
background-color: #353735;
padding: 0 10px 0 10px;
}
#logo {
padding-top: 6px;
font-size: 1.1em;
font-weight: bold;
color: white;
font-family: Arial, Verdana, Geneva, Helvetica, sans-serif;
font-size: 13px;
}
#wrapper{
margin-left: auto;
margin-right: auto;
width: 900px;
text-align: center;
}
div#logo_sunstone {
position: relative;
height: 100px;
width: 600px;
top: 80px;
margin-left: auto;
margin-right: auto;
background: url(../images/opennebula-selfservice-big.png) no-repeat center;
vertical-align: center;
}
div#login {
width: 400px;
height: 300px;
position: relative;
margin-left: auto;
margin-right: auto;
top: 90px;
padding-left: 80px;
padding-right: 80px;
background: url(../images/panel.png) no-repeat center ;
vertical-align: center;
}
.box {
font-size:0.8em;
width: 300px;
height: 25px;
background: #FFFFFF;
margin-left: auto;
margin-right: auto;
margin-bottom: 10px;
border-bottom-color: gray;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: gray;
border-left-style: solid;
border-left-width: 1px;
border-right-color: gray;
border-right-style: solid;
border-right-width: 1px;
border-top-color: gray;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-top-style: solid;
border-top-width: 1px;
-moz-border-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
}
div#login input#login_btn {
width: 130px;
height: 45px;
cursor: pointer;
margin-left: auto;
margin-right: 43px;
margin-top: 20px;
background-color: transparent;
border:0;
float: right;
background: url(../images/login.png) no-repeat center ;
}
div#login input#login_btn:hover {
width: 130px;
height: 45px;
cursor: pointer;
margin-left: auto;
margin-right: 43px;
margin-top: 20px;
background-color: transparent;
border:0;
float: right;
background: url(../images/login_over.png) no-repeat center ;
}
.error_message {
display: none;
position: relative;
top: 80px;
font-family: Arial, Helvetica, sans-serif;
color:red;
font-size:1.6em;
}
#label_remember {
color:#353735;
font-size:0.4em;
font-family: Arial, Helvetica, sans-serif;
}
.content {
padding-top:40px;
font-size:1.8em;
margin-bottom:0px;
margin-left:50px;
text-align:left;
font-family: Arial, Helvetica, sans-serif;
}
#check_remember {
margin-top: 35px;
margin-left:0px;
}

View File

@ -0,0 +1,105 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
//OpenNebula Self-Service customization file.
//Use tr("String") to enable text translation.
//You can use HTML and the following variables.
var $vm_count = '<span class="vm_count" />';
var $storage_count = '<span class="storage_count" />';
var $network_count = '<span class="network_count" />';
//Login logo 591x43px - not implemented
var logo_big = "images/opennebula-selfservice-big.png";
//Top left logo 179x14px - not implemented
var logo_small = "images/opennebula-selfservice-small.png";
////////////////////////////////////////////////////////////////
// Dashboard tab customization
////////////////////////////////////////////////////////////////
////
//Dashboard Welcome box
////
var dashboard_welcome_title = tr("Welcome to OpenNebula Self-Service");
var dashboard_welcome_image = "images/opennebula-selfservice-icon.png"
var dashboard_welcome_html = '<p>'+tr("OpenNebula Self-Service is a simplified user interface to manage OpenNebula compute, storage and network resources. It is focused on easiness and usability and features a limited set of operations directed towards end-users.")+'</p>\
<p>'+tr("Additionally, OpenNebula Self-Service allows easy customization of the interface (e.g. this text) and brings multi-language support.")+'</p>\
<p>'+tr("Have a cloudy experience!")+'</p>';
////
//Dashboard useful links box
//Array of { href: "address", text: "text" },...
////
var dashboard_links = [
{ href: "http://opennebula.org/documentation:documentation",
text: tr("Documentation")
},
{ href: "http://opennebula.org/support:support",
text: tr("Support")
},
{ href: "http://opennebula.org/community:community",
text: tr("Community")
}
];
////
//Dashboard right-side boxes
////
var compute_box_title = tr("Compute");
var compute_box_image = "images/server_icon.png"; //scaled to 100px width
var compute_box_html = '<p>'+tr("Compute resources are Virtual Machines attached to storage and network resources. OpenNebula Self-Service allows you to easily create, remove and manage them, including the possibility of pausing a Virtual Machine or taking a snapshot of one of their disks.")+'</p>';
var storage_box_title = tr("Storage");
var storage_box_image = "images/storage_icon.png"; //scaled to 100px width
var storage_box_html = '<p>'+tr("Storage pool is formed by several images. These images can contain from full operating systems to be used as base for compute resources, to simple data. OpenNebula Self-Service offers you the possibility to create or upload your own images.")+'</p>';
var network_box_title = tr("Network");
var network_box_image = "images/network_icon.png";
var network_box_html = '<p>'+tr("Your compute resources connectivity is performed using pre-defined virtual networks. You can create and manage these networks using OpenNebula Self-Service.")+'</p>';
///////////////////////////////////////////////////////////
//Compute tab
///////////////////////////////////////////////////////////
var compute_dashboard_image = "images/one-compute.png";
var compute_dashboard_html = '<p>' + tr("This is a list of your current compute resources. Virtual Machines use previously defined images and networks. You can easily create a new compute element by cliking \'new\' and filling-in an easy wizard.")+'</p>\
<p>'+tr("You can also manage compute resources and perform actions such as stop, resume, shutdown or cancel.")+'</p>\
<p>'+tr("Additionally, you can take a \'snapshot\' of the storage attached to these resources. They will be saved as new resources, visible from the Storage view and re-usable.")+'</p>\
<p>'+tr("There are currently")+' <b>'+$vm_count+'</b> '+
tr("virtual machines")+'.</p>';
///////////////////////////////////////////////////////////
//Storage tab
///////////////////////////////////////////////////////////
var storage_dashboard_image = "images/one-storage.png";
var storage_dashboard_html = '<p>'+tr("The Storage view offers you an overview of your current images. Storage elements are attached to compute resources at creation time. They can also be extracted from running virtual machines by taking an snapshot.")+'</p>\
<p>'+tr("You can add new storages by clicking \'new\'. Image files will be uploaded to OpenNebula and set ready to be used.")+'</p>\
<p>'+tr("Additionally, you can run several operations on defined storages, such as defining their persistance. Persistent images can only be used by 1 virtual machine, and the changes made by it have effect on the base image. Non-persistent images are cloned before being used in a Virtual Machine, therefore changes are lost unless a snapshot is taken prior to Virtual Machine shutdown.")+'</p>\
<p>'+tr("There are currently")+' <b>'+$storage_count+'</b> '+
tr("images")+'.</p>';
///////////////////////////////////////////////////////////
//Network tab
///////////////////////////////////////////////////////////
var network_dashboard_image = "image/one-network.png";
var network_dashboard_html = '<p>'+tr("In this view you can easily manage OpenNebula Network resources. You can add or remove virtual networks.")+'</p>\
<p>'+tr("Compute resources can be attached to these networks at creation time. Virtual machines will be provided with an IP and the correct parameters to ensure connectivity.")+'</p>\
<p>'+
tr("There are currently")+' <b>'+$network_count+'</b> '+
tr("networks")+'.</p>';

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

View File

@ -0,0 +1,110 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var activeTab;
var outerLayout, innerLayout;
function hideDialog(){
innerLayout.close("east");
}
function popDialog(content){
$("#dialog").html(content);
innerLayout.open("east");
}
function popDialogLoading(){
var loading = '<div style="margin-top:'+Math.round($("#dialog").height()/6)+'px; text-align: center; width: 100%"><img src="images/pbar.gif" alt="loading..." /></div>';
popDialog(loading);
}
function showTab(tabname){
activeTab = tabname;
//clean selected menu
$("#navigation li").removeClass("navigation-active-li");
$("#navigation li a").removeClass("navigation-active-li-a");
//select menu
var li = $("#navigation li:has(a[href='"+activeTab+"'])")
var li_a = $("#navigation li a[href='"+activeTab+"']")
li.addClass("navigation-active-li");
li_a.addClass("navigation-active-li-a");
//show tab
$(".tab").hide();
$(activeTab).show();
//~ if (activeTab == '#dashboard') {
//~ emptyDashboard();
//~ preloadTables();
//~ }
innerLayout.close("south");
}
$(document).ready(function () {
$(".tab").hide();
$(".outer-west ul li.subTab a").live("click",function(){
var tab = $(this).attr('href');
showTab(tab);
return false;
});
$(".outer-west ul li.topTab a").live("click",function(){
var tab = $(this).attr('href');
//toggle subtabs trick
$('li.'+tab.substr(1)).toggle();
showTab(tab);
return false;
});
outerLayout = $('body').layout({
applyDefaultStyles: false
, center__paneSelector: ".outer-center"
, west__paneSelector: ".outer-west"
, west__size: 133
, north__size: 26
, south__size: 26
, spacing_open: 0 // ALL panes
, spacing_closed: 0 // ALL panes
//, north__spacing_open: 0
//, south__spacing_open: 0
, north__maxSize: 200
, south__maxSize: 200
, south__closable: false
, north__closable: false
, west__closable: false
, south__resizable: false
, north__resizable: false
, west__resizable: false
});
var factor = 0.45;
var dialog_height = Math.floor($(".outer-center").width()*factor);
innerLayout = $('div.outer-center').layout({
fxName: "slide"
, initClosed: true
, center__paneSelector: ".inner-center"
, east__paneSelector: ".inner-east"
, east__size: dialog_height
, east__minSize: 400
, spacing_open: 5 // ALL panes
, spacing_closed: 5 // ALL panes
});
});

View File

@ -0,0 +1,56 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var lang=""
var locale = {};
var datatable_lang = "";
function tr(str){
var tmp = locale[str];
if ( tmp == null || tmp == "" ) {
//console.debug("Missing translation: "+str);
tmp = str;
}
return tmp;
};
//Pops up loading new language dialog. Retrieves the user template, updates the LANG variable.
//Updates template and session configuration and reloads the view.
function setLang(lang_str){
var dialog = $('<div title="'+tr("Changing language")+'">'+tr("Loading new language... please wait")+' '+spinner+'</div>').dialog({
draggable:false,
modal:true,
resizable:false,
buttons:{},
width: 460,
minHeight: 50
});
if (('localStorage' in window) && (window['localStorage'] !== null)){
localStorage['lang']=lang_str;
};
$.post('config',JSON.stringify({lang:lang_str}),function(){window.location.href = "./ui"});
};
$(document).ready(function(){
//Update static translations
$('#doc_link').text(tr("Documentation"));
$('#support_link').text(tr("Support"));
$('#community_link').text(tr("Community"));
$('#welcome').text(tr("Welcome"));
$('#logout').text(tr("Sign out"));
});

View File

@ -0,0 +1,71 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
function auth_success(req, response){
window.location.href = "./ui";
}
function auth_error(req, error){
var status = error.error.http_status;
switch (status){
case 401:
$("#one_error").hide();
$("#auth_error").fadeIn("slow");
break;
case 500:
$("#auth_error").hide();
$("#one_error").fadeIn("slow");
break;
};
}
function authenticate(){
var username = $("#username").val();
var password = $("#password").val();
password = Crypto.SHA1(password);
var remember = $("#check_remember").is(":checked");
var obj = { data: {username: username,
password: password},
remember: remember,
success: auth_success,
error: auth_error
};
if (('localStorage' in window) && (window['localStorage'] !== null) && (localStorage['lang'])){
obj['lang'] = localStorage['lang'];
};
OCCI.Auth.login(obj);
}
$(document).ready(function(){
$("#login_form").submit(function (){
authenticate();
return false;
});
//compact login elements according to screen height
if (screen.height <= 600){
$('div#logo_sunstone').css("top","15px");
$('div#login').css("top","10px");
$('.error_message').css("top","10px");
};
$("input#username.box").focus();
});

View File

@ -0,0 +1,623 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
//Convert json into the XML that OCCI server can understand
function json2xml(element,root_key) {
var xml = "";
if (!root_key) root_key="ROOT";
if (typeof element == "object") { //Its an object
$.each(element, function(key,value){
if (value.constructor == Array){
for (var i = 0; i < value.length; i++){
xml += json2xml(value[i],key);
};
//do not wrap arrays in root_key
return xml;
} else
xml += json2xml(value,key);
});
} else { //its a simple value. Base condition
xml += element.toString();
};
return "<" + root_key.toUpperCase() + ">" + xml + "</" + root_key.toUpperCase() + ">";
};
$.ajaxSetup({
converters: {
"xml ONEjson": function(xml){
return $.xml2json(xml);
},
}
});
var OCCI = {
"Error": function(resp)
{
var error = {
error : {
message: resp.responseText,
http_status : resp.status}
};
return error;
},
"is_error": function(obj)
{
return obj.error ? true : false;
},
"Helper": {
"resource_state": function(type, value)
{
switch(type)
{
case "HOST","host":
return ["INIT",
"MONITORING",
"MONITORED",
"ERROR",
"DISABLED"][value];
break;
case "HOST_SIMPLE","host_simple":
return ["ON",
"ON",
"ON",
"ERROR",
"OFF"][value];
break;
case "VM","vm":
return ["INIT",
"PENDING",
"HOLD",
"ACTIVE",
"STOPPED",
"SUSPENDED",
"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",
"USED",
"DISABLED",
"LOCKED",
"ERROR"][value];
break;
default:
return;
}
},
"image_type": function(value)
{
return ["OS", "CDROM", "DATABLOCK"][value];
},
"action": function(action, params)
{
obj = {
"action": {
"perform": action
}
}
if (params)
{
obj.action.params = params;
}
return obj;
},
"request": function(resource, method, data) {
var r = {
"request": {
"resource" : resource,
"method" : method
}
}
if (data)
{
if (typeof(data) != "array")
{
data = [data];
}
r.request.data = data;
}
return r;
},
"pool": function(resource, response)
{
var pool_name = resource + "_COLLECTION";
var type = resource;
var pool;
if (typeof(pool_name) == "undefined")
{
return Error('Incorrect Pool');
}
var p_pool = [];
if (response[pool_name]) {
pool = response[pool_name][type];
} else { pull = null };
if (pool == null)
{
return p_pool;
}
else if (pool.length)
{
for (i=0;i<pool.length;i++)
{
p_pool[i]={};
p_pool[i][type]=pool[i];
}
return(p_pool);
}
else
{
p_pool[0] = {};
p_pool[0][type] = pool;
return(p_pool);
}
}
},
"Action": {
//server requests helper methods
"create": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var data = json2xml(params.data,resource);
var request = OCCI.Helper.request(resource,"create", data);
$.ajax({
url: resource.toLowerCase(),
type: "POST",
dataType: "xml ONEjson",
data: data,
success: function(response){
var res = {};
res[resource] = response;
return callback ? callback(request, res) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
"delete": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var request = OCCI.Helper.request(resource,"delete", id);
$.ajax({
url: resource.toLowerCase() + "/" + id,
type: "DELETE",
dataType: "xml ONEjson",
success: function(){
return callback ? callback(request) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
"list": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var timeout = params.timeout || false;
var request = OCCI.Helper.request(resource,"list");
$.ajax({
url: resource.toLowerCase(),
type: "GET",
data: {timeout: timeout},
dataType: "xml ONEjson",
success: function(response){
var res = {};
res[resource+"_COLLECTION"] = response;
return callback ?
callback(request, OCCI.Helper.pool(resource,res)) : null;
},
error: function(response)
{
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
//Subresource examples: "fetch_template", "log"...
"show": function(params,resource){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var request = OCCI.Helper.request(resource,"show", id);
var url = resource.toLowerCase() + "/" + id;
$.ajax({
url: url,
type: "GET",
dataType: "xml ONEjson",
success: function(response){
var res = {};
res[resource] = response;
return callback ? callback(request, res) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
//Example: Simple action: publish. Simple action with action obj: deploy
//OCCI, rewrite
"update": function(params,resource,method,action_obj){
var callback = params.success;
var callback_error = params.error;
var id = params.data.id;
var body = json2xml(params.data.body,resource);
var request = OCCI.Helper.request(resource,method, id);
$.ajax({
url: resource.toLowerCase() + "/" + id,
type: "PUT",
data: body,
dataType: "xml ONEjson",
success: function(response){
var res = {};
res[resource] = response;
return callback ? callback(request,res) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
/*
"monitor": function(params,resource,all){
var callback = params.success;
var callback_error = params.error;
var data = params.data;
var method = "monitor";
var action = OpenNebula.Helper.action(method);
var request = OpenNebula.Helper.request(resource,method, data);
var url = resource.toLowerCase();
url = all ? url + "/monitor" : url + "/" + params.data.id + "/monitor";
$.ajax({
url: url,
type: "GET",
data: data['monitor'],
dataType: "json",
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OpenNebula.Error(response)) : null;
}
});
}
*/
},
"Auth": {
"resource": "AUTH",
"login": function(params)
{
var callback = params.success;
var callback_error = params.error;
var username = params.data.username;
var password = params.data.password;
var remember = params.remember;
var lang = params.lang;
var resource = OCCI.Auth.resource;
var request = OCCI.Helper.request(resource,"login");
$.ajax({
url: "ui/login",
type: "POST",
data: {remember: remember, lang: lang},
beforeSend : function(req) {
req.setRequestHeader( "Authorization",
"Basic " + btoa(username + ":" + password)
)
},
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
"logout": function(params)
{
var callback = params.success;
var callback_error = params.error;
var resource = OCCI.Auth.resource;
var request = OCCI.Helper.request(resource,"logout");
$.ajax({
url: "ui/logout",
type: "POST",
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",
"create": function(params){
OCCI.Action.create(params,OCCI.Network.resource);
},
"delete": function(params){
OCCI.Action.delete(params,OCCI.Network.resource);
},
"list": function(params){
OCCI.Action.list(params,OCCI.Network.resource);
},
"show": function(params){
OCCI.Action.show(params,OCCI.Network.resource);
},
"publish": function(params){
params.data.body = { "PUBLIC": "YES" };
OCCI.Action.update(params,OCCI.Network.resource,"publish");
},
"unpublish": function(params){
params.data.body = { "PUBLIC": "NO" };
OCCI.Action.update(params,OCCI.Network.resource,"unpublish");
},
},
"VM": {
"resource": "COMPUTE",
"create": function(params){
OCCI.Action.create(params,OCCI.VM.resource);
},
"delete": function(params){
OCCI.Action.delete(params,OCCI.VM.resource);
},
"list": function(params){
OCCI.Action.list(params,OCCI.VM.resource);
},
"show": function(params){
OCCI.Action.show(params,OCCI.VM.resource);
},
"shutdown": function(params){
params.data.body = { state : "SHUTDOWN" };
OCCI.Action.update(params,OCCI.VM.resource,"shutdown");
},
"stop": function(params){
params.data.body = { state : "STOPPED" };
OCCI.Action.update(params,OCCI.VM.resource,"stop");
},
"cancel": function(params){
params.data.body = { state : "CANCEL" };
OCCI.Action.update(params,OCCI.VM.resource,"cancel");
},
"suspend": function(params){
params.data.body = { state : "SUSPENDED" };
OCCI.Action.update(params,OCCI.VM.resource,"suspend");
},
"resume": function(params){
params.data.body = { state : "RESUME" };
OCCI.Action.update(params,OCCI.VM.resource,"resume");
},
"done": function(params){
params.data.body = { state : "DONE" };
OCCI.Action.update(params,OCCI.VM.resource,"done");
},
"saveas" : function(params){
var obj = params.data.extra_param;
var disk_id = obj.disk_id;
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;
var id = params.data.id;
var resource = OCCI.VM.resource;
var method = startstop;
var action = OCCI.Helper.action(method);
var request = OCCI.Helper.request(resource,method, id);
$.ajax({
url: "vm/" + id + "/" + method,
type: "POST",
dataType: "json",
success: function(response){
return callback ? callback(request, response) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
"startvnc" : function(params){
OCCI.VM.vnc(params,"startvnc");
},
"stopvnc" : function(params){
OCCI.VM.vnc(params,"stopvnc");
},
"monitor" : function(params){
OCCI.Action.monitor(params,OCCI.VM.resource,false);
},
"monitor_all" : function(params){
OCCI.Action.monitor(params,OCCI.VM.resource,true);
}*/
},
"Image": {
"resource": "STORAGE",
"create": function(params){
var callback = params.success;
var callback_error = params.error;
var data = {occixml : json2xml(params.data,OCCI.Image.resource)};
var request = OCCI.Helper.request(OCCI.Image.resource,"create", data);
$.ajax({
type: 'POST',
url: "storage",
data: data,
dataType: "xml ONEjson",
success: function(response){
var res = {};
res["STORAGE"] = response;
return callback ? callback(request, res) : null;
},
error: function(response){
return callback_error ?
callback_error(request, OCCI.Error(response)) : null;
}
});
},
"delete": function(params){
OCCI.Action.delete(params,OCCI.Image.resource);
},
"list": function(params){
OCCI.Action.list(params,OCCI.Image.resource);
},
"show": function(params){
OCCI.Action.show(params,OCCI.Image.resource);
},
"publish": function(params){
params.data.body = { "PUBLIC":"YES" };
OCCI.Action.update(params,OCCI.Image.resource,"publish");
},
"unpublish": function(params){
params.data.body = { "PUBLIC":"NO" };
OCCI.Action.update(params,OCCI.Image.resource,"unpublish");
},
"persistent": function(params){
params.data.body = { "PERSISTENT":"YES" };
OCCI.Action.update(params,OCCI.Image.resource,"persistent");
},
"nonpersistent": function(params){
params.data.body = { "PERSISTENT":"NO" };
OCCI.Action.update(params,OCCI.Image.resource,"nonpersistent");
},
},
"Template" : {
"resource" : "VMTEMPLATE",
"create" : function(params){
OCCI.Action.create(params,OCCI.Template.resource);
},
"delete" : function(params){
OCCI.Action.delete(params,OCCI.Template.resource);
},
"list" : function(params){
OCCI.Action.list(params,OCCI.Template.resource);
},
"show" : function(params){
OCCI.Action.show(params,OCCI.Template.resource);
},
"chown" : function(params){
OCCI.Action.chown(params,OCCI.Template.resource);
},
"chgrp" : function(params){
OCCI.Action.chgrp(params,OCCI.Template.resource);
},
"update" : function(params){
var action_obj = {"template_raw" : params.data.extra_param };
OCCI.Action.simple_action(params,
OCCI.Template.resource,
"update",
action_obj);
},
"fetch_template" : function(params){
OCCI.Action.show(params,OCCI.Template.resource,"template");
},
"publish" : function(params){
OCCI.Action.simple_action(params,OCCI.Template.resource,"publish");
},
"unpublish" : function(params){
OCCI.Action.simple_action(params,OCCI.Template.resource,"unpublish");
},
"instantiate" : function(params) {
var vm_name = params.data.extra_param ? params.data.extra_param : "";
var action_obj = { "vm_name" : vm_name };
OCCI.Action.simple_action(params,OCCI.Template.resource,
"instantiate",action_obj);
}
},
"Instance_type" : {
"resource" : "INSTANCE_TYPE",
"list" : function(params){
OCCI.Action.list(params,OCCI.Instance_type.resource);
},
},
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var config_tab_content =
'<form>\
<table id="config_table" style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("Self-Service UI Configuration") + '</h3>\
<div class="panel_info">\
\
<table class="info_table">\
<tr>\
<td class="key_td">' + tr("Language") + '</td>\
<td class="value_td">\
<select id="lang_sel" style="width:20em;">\
<option value="en_US">'+tr("English")+'</option>\
<option value="es_ES">'+tr("Spanish")+'</option>\
</select>\
</td>\
</tr>\
</table>\
\
</div>\
</div>\
</td>\
</tr>\
</table></form>';
var config_tab = {
title: tr("Configuration"),
content: config_tab_content
}
Sunstone.addMainTab('config_tab',config_tab);
$(document).ready(function(){
if (lang)
$('table#config_table #lang_sel option[value="'+lang+'"]').attr('selected','selected');
$('table#config_table #lang_sel').change(function(){
setLang($(this).val());
});
$('#li_config_tab a').click(function(){
hideDialog();
});
});

View File

@ -0,0 +1,200 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
var dashboard_tab_content =
'<table id="dashboard_table">\
<tr>\
<td style="width:50%">\
<table id="information_table" style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>' + dashboard_welcome_title + '</h3>\
<div class="panel_info dashboard_p">\
<img style="float:left;width:100px;" src="'+
dashboard_welcome_image+'" />'+
dashboard_welcome_html+'\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("Current resources") + '</h3>\
<div class="panel_info">\
\
<table class="info_table">\
<tr>\
<td class="key_td">'+tr("Compute")+'</td>\
<td class="value_td">'+$vm_count+'</span></td>\
</tr>\
<tr>\
<td class="key_td">' + tr("Storage") + '</td>\
<td class="value_td">'+$storage_count+'</span></td>\
</tr>\
<tr>\
<td class="key_td">' + tr("Network") + '</td>\
<td class="value_td">'+$network_count+'</span></td>\
</tr>\
</table>\
\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + tr("Useful links") + '</h3>\
<div class="panel_info dashboard_p">'+
generateDashboardLinks() +'\
</div>\
</div>\
</td>\
</tr>\
</table>\
</td>\
<td style="width:50%">\
<table id="hosts" style="width:100%">\
<tr>\
<td>\
<div class="panel">\
<h3>' + compute_box_title + '</h3>\
<div class="panel_info dashboard_p">\
<img style="float:right;width:100px;" src="'+
compute_box_image + '" />'+
compute_box_html +
'<p><span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="action_link" href="#vms_tab" action="VM.create_dialog">'+tr("Create new compute resource")+'</a><br />\
<span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="tab_link" href="#vms_tab">'+tr("See more")+'</a></p>\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + storage_box_title + '</h3>\
<div class="panel_info dashboard_p">\
<img style="float:right;width:100px;" src="'+
storage_box_image +'" />' +
storage_box_html +
'<p><span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="action_link" href="#images_tab" action="Image.create_dialog">'+tr("Create new storage resource")+'</a><br />\
<span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="tab_link" href="#images_tab">'+tr("See more")+'</a></p>\
</div>\
</div>\
</td>\
</tr>\
<tr>\
<td>\
<div class="panel">\
<h3>' + network_box_title + '</h3>\
<div class="panel_info dashboard_p">\
<p><img style="float:right;width:100px;" src="' +
network_box_image +'" />' +
network_box_html +
'<p><span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="action_link" href="#vnets_tab" action="Network.create_dialog">'+tr("Create new network resource")+'</a><br />\
<span class="ui-icon ui-icon-arrowreturnthick-1-e" style="display:inline-block;vertical-align:middle;"/><a class="tab_link" href="#vnets_tab">'+tr("See more")+'</a><br /></p>\
</div>\
</div>\
</td>\
</tr>\
</table>\
</td>\
</tr></table>';
var dashboard_tab = {
title: tr("Dashboard"),
content: dashboard_tab_content
}
Sunstone.addMainTab('dashboard_tab',dashboard_tab);
function quickstart_setup(){
$('#dashboard_table #quickstart_form input',main_tabs_context).click(function(){
Sunstone.runAction($(this).val());
});
};
function generateDashboardLinks(){
var links="<ul>";
for (var i=0; i<dashboard_links.length;i++){
links+='<li><a href="'+dashboard_links[i].href+'" target="_blank">'+dashboard_links[i].text+'</a></li>';
};
links+="</ul>";
return links;
};
$(document).ready(function(){
//Dashboard link listener
$("#dashboard_table h3 a",main_tabs_context).live("click", function (){
var tab = $(this).attr('href');
showTab(tab);
return false;
});
$('.tab_link').click(function(){
var to= $(this).attr('href');
$('.outer-west ul li.topTab a[href="'+to+'"]').trigger("click");
return false;
});
$('.action_link').click(function(){
var to= $(this).attr('href');
$('.outer-west ul li.topTab a[href="'+to+'"]').trigger("click");
var action = $(this).attr('action');
Sunstone.runAction(action);
//var to= $(this).attr('href');
//$('.outer-west ul li.topTab a[href="'+to+'"]').trigger("click");
return false;
});
emptyDashboard();
quickstart_setup();
$('#li_dashboard_tab a').click(function(){
hideDialog();
});
});
//puts the dashboard values into "retrieving"
function emptyDashboard(){
$("#dashboard_tab .value_td span",main_tabs_context).html(spinner);
}
function updateDashboard(what,json_info){
var db = $('#dashboard_tab',main_tabs_context);
switch (what){
case "vms":
var total_vms=json_info.length;
$('.vm_count',db).html(total_vms);
break;
case "vnets":
var total_vnets=json_info.length;
$('.network_count',db).html(total_vnets);
break;
case "images":
var total_images=json_info.length;
$('.storage_count',db).html(total_images);
break;
}
}

View File

@ -0,0 +1,436 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
/*Virtual networks tab plugin*/
var vnets_tab_content =
'<form id="virtualNetworks_form" action="javascript:alert(\'js error!\');">\
<div class="action_blocks">\
</div>\
<table id="datatable_vnetworks" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Name")+'</th>\
</tr>\
</thead>\
<tbody id="tbodyvnetworks">\
</tbody>\
</table>\
</form>';
var create_vn_tmpl =
'<div id="vn_tabs">\
<div id="easy">\
<form id="create_vn_form_easy" action="">\
<fieldset>\
<label for="name">'+tr("Name")+':</label>\
<input type="text" name="name" id="name" /><br />\
</fieldset>\
<div class="clear"></div>\
<div id="ranged">\
<fieldset>\
<label for="net_address">'+tr("Network Address")+':</label>\
<input type="text" name="net_address" id="net_address" /><div class="clear" />\
<label for="net_size">'+tr("Network Size")+':</label>\
<input type="text" name="net_size" id="net_size" /><br />\
</fieldset>\
</div>\
<div class="clear"></div>\
</fieldset>\
<div class="form_buttons">\
<button class="vnet_close_dialog_link"/>\
<button class="button" id="create_vn" value="vn/create" />\
<button class="button" type="reset" id="reset_vn" value="reset" />\
</div>\
</form>\
</div>\
</div>';
var vnet_dashboard = '<div class="dashboard_p">\
<img src="images/one-network.png" alt="one-network" />' +
network_dashboard_html +
'</div>';
var dataTable_vNetworks;
var $create_vn_dialog;
//Setup actions
var vnet_actions = {
"Network.create" : {
type: "create",
call: OCCI.Network.create,
callback: addVNetworkElement,
error: onError,
notify: true
},
"Network.create_dialog" : {
type: "custom",
call: popUpCreateVnetDialog
},
"Network.list" : {
type: "list",
call: OCCI.Network.list,
callback: updateVNetworksView,
error: onError
},
"Network.show" : {
type: "single",
call: OCCI.Network.show,
callback: updateVNetworkElement,
error: onError
},
"Network.showinfo" : {
type: "single",
call: OCCI.Network.show,
callback: updateVNetworkInfo,
error: onError
},
"Network.refresh" : {
type: "custom",
call: function(){
waitingNodes(dataTable_vNetworks);
Sunstone.runAction("Network.list");
}
},
"Network.autorefresh" : {
type: "custom",
call: function() {
OCCI.Network.list({timeout: true, success: updateVNetworksView, error: onError});
}
},
// "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.delete" : {
type: "multiple",
call: OCCI.Network.delete,
callback: deleteVNetworkElement,
elements: vnElements,
error: onError,
notify: true
},
};
var vnet_buttons = {
"Network.refresh" : {
type: "image",
text: tr("Refresh list"),
img: "images/Refresh-icon.png"
},
"Network.create_dialog" : {
type: "create_dialog",
text: tr("+ New")
},
// "Network.publish" : {
// type: "action",
// text: tr("Publish")
// },
// "Network.unpublish" : {
// type: "action",
// text: tr("Unpublish")
// },
"Network.delete" : {
type: "action",
text: tr("Delete")
}
}
var vnet_info_panel = {
"vnet_info_tab" : {
title: tr("Network information"),
content: ""
},
}
var vnet_create_panel = {
"vnet_create_panel" : {
title: tr("Create network"),
content: create_vn_tmpl
},
}
var vnets_tab = {
title: tr("Networks"),
content: vnets_tab_content,
buttons: vnet_buttons
}
Sunstone.addActions(vnet_actions);
Sunstone.addMainTab('vnets_tab',vnets_tab);
Sunstone.addInfoPanel('vnet_info_panel',vnet_info_panel);
Sunstone.addInfoPanel('vnet_create_panel',vnet_create_panel);
function vnElements(){
return getSelectedNodes(dataTable_vNetworks);
}
//returns an array with the VNET information fetched from the JSON object
function vNetworkElementArray(vn_json){
var network = vn_json.NETWORK;
if (network.name){
id = network.href.split("/");
id = id[id.length-1];
name = network.name;
}
else {
id = network.ID;
name = network.NAME;
};
return [
'<input class="check_item" type="checkbox" id="vnetwork_'+id+'" name="selected_items" value="'+id+'"/>',
id,
name
];
};
//Adds a listener to show the extended info when clicking on a row
function vNetworkInfoListener(){
$('#tbodyvnetworks tr',dataTable_vNetworks).live("click", function(e){
if ($(e.target).is('input')) {return true;}
popDialogLoading();
var aData = dataTable_vNetworks.fnGetData(this);
var id = $(aData[0]).val();
Sunstone.runAction("Network.showinfo",id);
return false;
});
}
//Callback to update a vnet element after an action on it
function updateVNetworkElement(request, vn_json){
id = vn_json.NETWORK.ID;
element = vNetworkElementArray(vn_json);
updateSingleElement(element,dataTable_vNetworks,'#vnetwork_'+id);
}
//Callback to delete a vnet element from the table
function deleteVNetworkElement(req){
deleteElement(dataTable_vNetworks,'#vnetwork_'+req.request.data);
}
//Callback to add a new element
function addVNetworkElement(request,vn_json){
var element = vNetworkElementArray(vn_json);
addElement(element,dataTable_vNetworks);
}
//updates the list of virtual networks
function updateVNetworksView(request, network_list){
var network_list_array = [];
$.each(network_list,function(){
network_list_array.push(vNetworkElementArray(this));
});
updateView(network_list_array,dataTable_vNetworks);
//dependency with dashboard
updateDashboard("vnets",network_list);
}
//updates the information panel tabs and pops the panel up
function updateVNetworkInfo(request,vn){
var vn_info = vn.NETWORK;
var info_tab_content =
'<table id="info_vn_table" class="info_table">\
<thead>\
<tr><th colspan="2">'+tr("Virtual Network")+' '+vn_info.ID+' '+
tr("information")+'</th></tr>\
</thead>\
<tr>\
<td class="key_td">'+tr("ID")+'</td>\
<td class="value_td">'+vn_info.ID+'</td>\
<tr>\
<tr>\
<td class="key_td">'+tr("Name")+'</td>\
<td class="value_td">'+vn_info.NAME+'</td>\
<tr>\
</table>\
<div class="form_buttons">\
<button class="vnet_close_dialog_link"/></div>';
var info_tab = {
title: tr("Virtual Network information"),
content: info_tab_content
};
Sunstone.updateInfoPanelTab("vnet_info_panel","vnet_info_tab",info_tab);
Sunstone.popUpInfoPanel("vnet_info_panel");
$('#dialog .vnet_close_dialog_link').button({
text:false,
icons: { primary: "ui-icon-closethick" }
});
}
function popUpCreateVnetDialog() {
//$create_vn_dialog.dialog('open');
//Handle submission of the easy mode
Sunstone.popUpInfoPanel("vnet_create_panel");
var dialog=$('#dialog');
$create_vn_dialog = dialog;
$('#create_vn',dialog).button({
icons: {
primary: "ui-icon-check"
},
text: false
});
$('#reset_vn',dialog).button({
icons: {
primary: "ui-icon-scissors"
},
text: false
});
$('.vnet_close_dialog_link',dialog).button({
icons: {
primary: "ui-icon-closethick"
},
text: false
});
$('#create_vn_form_easy',dialog).submit(function(){
//Fetch values
var name = $('#name',this).val();
if (!name.length){
notifyError(tr("Virtual Network name missing!"));
return false;
}
var bridge = $('#bridge',this).val();
//TODO: Name and bridge provided?!
var network_json = null;
var network_addr = $('#net_address',this).val();
var network_size = $('#net_size',this).val();
if (!network_addr.length){
notifyError(tr("Please provide a network address"));
return false;
};
//we form the object for the request
network_json = {
"SIZE" : network_size,
"ADDRESS" : network_addr,
"NAME" : name
};
Sunstone.runAction("Network.create",network_json);
popUpVNetDashboard();
return false;
});
}
function popUpVNetDashboard(){
var count = dataTable_vNetworks.fnGetNodes().length;
popDialog(vnet_dashboard);
$('#dialog .network_count').text(count);
}
function setVNetAutorefresh() {
setInterval(function(){
var checked = $('input.check_item:checked',dataTable_vNetworks);
var filter = $("#datatable_vnetworks_filter input",
dataTable_vNetworks.parents("#datatable_vnetworks_wrapper")).attr('value');
if (!checked.length && !filter.length){
Sunstone.runAction("Network.autorefresh");
}
},INTERVAL+someTime());
};
//The DOM is ready and the ready() from sunstone.js
//has been executed at this point.
$(document).ready(function(){
dataTable_vNetworks = $("#datatable_vnetworks",main_tabs_context).dataTable({
"bJQueryUI": true,
"bSortClasses": false,
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "35px", "aTargets": [1] },
],
"oLanguage": (datatable_lang != "") ?
{
sUrl: "locale/"+lang+"/"+datatable_lang
} : ""
});
dataTable_vNetworks.fnClearTable();
addElement([
spinner,
'',''],dataTable_vNetworks);
Sunstone.runAction("Network.list");
setVNetAutorefresh();
initCheckAllBoxes(dataTable_vNetworks);
tableCheckboxesListener(dataTable_vNetworks);
vNetworkInfoListener();
$('#li_vnets_tab a').click(function(){
popUpVNetDashboard();
//return false;
});
$('.vnet_close_dialog_link').live("click",function(){
popUpVNetDashboard();
return false;
});
});

View File

@ -0,0 +1,640 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OCCI.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
/*Images tab plugin*/
var images_tab_content =
'<form id="image_form" action="" action="javascript:alert(\'js error!\');">\
<div class="action_blocks">\
</div>\
<table id="datatable_images" class="display">\
<thead>\
<tr>\
<th class="check"><input type="checkbox" class="check_all" value="">'+tr("All")+'</input></th>\
<th>'+tr("ID")+'</th>\
<th>'+tr("Name")+'</th>\
</tr>\
</thead>\
<tbody id="tbodyimages">\
</tbody>\
</table>\
</form>';
var create_image_tmpl =
'<div id="img_tabs">\
<div id="img_easy">\
<form id="create_image_form_easy" method="POST" enctype="multipart/form-data" action="javascript:alert(\'js errors?!\')">\
<p style="font-size:0.8em;text-align:right;"><i>'+
tr("Fields marked with")+' <span style="display:inline-block;" class="ui-icon ui-icon-alert" /> '+
tr("are mandatory")+'</i><br />\
<fieldset>\
<div class="img_param">\
<label for="img_name">'+tr("Name")+':</label>\
<input type="text" name="img_name" id="img_name" />\
<div class="tip">'+tr("Name that the Image will get.")+'</div>\
</div>\
<div class="img_param">\
<label for="img_desc">'+tr("Description")+':</label>\
<textarea name="img_desc" id="img_desc" style="height:4em"></textarea>\
<div class="tip">'+tr("Human readable description of the image.")+'</div>\
</div>\
</fieldset>\
<fieldset>\
<div class="img_param">\
<label for="img_type">'+tr("Type")+':</label>\
<select name="img_type" id="img_type">\
<option value="OS">'+tr("OS")+'</option>\
<option value="CDROM">'+tr("CD-ROM")+'</option>\
<option value="DATABLOCK">'+tr("Datablock")+'</option>\
</select>\
<div class="tip">'+tr("Type of the image")+'</div>\
</div>\
<div class="img_param">\
<label for="img_size">'+tr("Size")+':</label>\
<input type="text" name="img_size" id="img_size" />\
<div class="tip">'+tr("Size of the datablock in MB.")+'</div>\
</div>\
<div class="img_param">\
<label for="img_fstype">'+tr("FS type")+':</label>\
<input type="text" name="img_fstype" id="img_fstype" />\
<div class="tip">'+tr("Type of file system to be built. This can be any value understood by mkfs unix command.")+'</div>\
</div>\
<div class="img_param" id="upload_div">\
<label for="file-uploader" style="width: 60px">'+tr("Upload image")+':</label>\
<div id="file-uploader">\
</div><div class="clear" />\
<label for="upload-progress">'+tr("Upload progress")+':</label>\
<div id="upload-progress"></div>\
</div>\
<!--\
<div class="img_param">\
<label for="img_public">'+tr("Public")+':</label>\
<input type="checkbox" id="img_public" name="img_public" value="YES" />\
<div class="tip">'+tr("Public scope of the image")+'</div>\
</div>\
<div class="img_param">\
<label for="img_persistent">'+tr("Persistent")+':</label>\
<input type="checkbox" id="img_persistent" name="img_persistent" value="YES" />\
<div class="tip">'+tr("Persistence of the image")+'</div>\
</div>\
<div class="img_param">\
-->\
<div class="form_buttons">\
<button class="image_close_dialog_link"/>\
<button class="button" id="create_image" value="Image.create" />\
<button class="button" type="reset" id="reset_image" value="reset" />\
</div>\
</form>\
</div>\
</div>';
var image_dashboard = '<div class="dashboard_p">\
<img src="'+storage_dashboard_image+'" alt="one-storage" />'+
storage_dashboard_html +
'</div>';
var dataTable_images;
var $create_image_dialog;
var image_actions = {
"Image.create" : {
type: "create",
call: OCCI.Image.create,
callback: addImageElement,
error: onError,
notify:true
},
"Image.create_dialog" : {
type: "custom",
call: popUpCreateImageDialog
},
"Image.list" : {
type: "list",
call: OCCI.Image.list,
callback: updateImagesView,
error: onError
},
"Image.show" : {
type : "single",
call: OCCI.Image.show,
callback: updateImageElement,
error: onError
},
"Image.showinfo" : {
type: "single",
call: OCCI.Image.show,
callback: updateImageInfo,
error: onError
},
"Image.refresh" : {
type: "custom",
call: function () {
waitingNodes(dataTable_images);
Sunstone.runAction("Image.list");
},
},
"Image.autorefresh" : {
type: "custom",
call: function() {
OCCI.Image.list({timeout: true, success: updateImagesView, error: onError});
}
},
"Image.persistent" : {
type: "multiple",
call: OCCI.Image.persistent,
elements: imageElements,
error: onError,
notify: true
},
"Image.nonpersistent" : {
type: "multiple",
call: OCCI.Image.nonpersistent,
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.delete" : {
type: "multiple",
call: OCCI.Image.delete,
callback: deleteImageElement,
elements: imageElements,
error: onError,
notify: true
},
}
var image_buttons = {
"Image.refresh" : {
type: "image",
text: tr("Refresh list"),
img: "images/Refresh-icon.png"
},
"Image.create_dialog" : {
type: "create_dialog",
text: tr('+ New')
},
"Image.persistent" : {
type: "action",
text: tr("Make 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")
}
}
var image_info_panel = {
"image_info_tab" : {
title: tr("Image information"),
content: ""
},
};
var image_create_panel = {
"image_create_panel" : {
title: tr("Add storage"),
content: create_image_tmpl
},
};
var images_tab = {
title: tr("Storage"),
content: images_tab_content,
buttons: image_buttons
}
Sunstone.addActions(image_actions);
Sunstone.addMainTab('images_tab',images_tab);
Sunstone.addInfoPanel('image_info_panel',image_info_panel);
Sunstone.addInfoPanel('image_create_panel',image_create_panel);
function imageElements() {
return getSelectedNodes(dataTable_images);
}
// Returns an array containing the values of the image_json and ready
// to be inserted in the dataTable
function imageElementArray(image_json){
//Changing this? It may affect to the is_public() and is_persistent() functions.
var image = image_json.STORAGE;
var id,name;
if (image.name){
id = image.href.split("/");
id = id[id.length-1];
name = image.name;
}
else {
id = image.ID;
name = image.NAME;
};
return [
'<input class="check_item" type="checkbox" id="image_'+id+'" name="selected_items" value="'+id+'"/>',
id,
name
];
}
// Set up the listener on the table TDs to show the info panel
function imageInfoListener(){
$('#tbodyimages tr',dataTable_images).live("click",function(e){
var target = $(e.target);
if (target.is('input') || target.is('select') || target.is('option'))
return true;
popDialogLoading();
var aData = dataTable_images.fnGetData(this);
var id = $(aData[0]).val();
Sunstone.runAction("Image.showinfo",id);
return false;
});
}
// Callback to update an element in the dataTable
function updateImageElement(request, image_json){
var id = image_json.STORAGE.ID;
var element = imageElementArray(image_json);
updateSingleElement(element,dataTable_images,'#image_'+id);
}
// Callback to remove an element from the dataTable
function deleteImageElement(req){
deleteElement(dataTable_images,'#image_'+req.request.data);
}
// Callback to add an image element
function addImageElement(request, image_json){
var element = imageElementArray(image_json);
addElement(element,dataTable_images);
}
// Callback to refresh the list of images
function updateImagesView(request, images_list){
var image_list_array = [];
$.each(images_list,function(){
image_list_array.push(imageElementArray(this));
});
updateView(image_list_array,dataTable_images);
updateDashboard("images",images_list);
}
// Callback to update the information panel tabs and pop it up
function updateImageInfo(request,img){
var img_info = img.STORAGE;
var info_tab = {
title: tr("Image information"),
content:
'<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>\
</thead>\
<tr>\
<td class="key_td">'+tr("ID")+'</td>\
<td class="value_td">'+img_info.ID+'</td>\
</tr>\
<tr>\
<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>\
</tr>\
<td class="key_td">'+tr("Persistent")+'</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>\
<td class="value_td">'+(typeof img_info.FSTYPE === "string" ? img_info.FSTYPE : "--")+'</td>\
</tr>\
<tr>\
<td class="key_td">'+tr("Size (Mb)")+'</td>\
<td class="value_td">'+img_info.SIZE+'</td>\
</tr>\
</table></form>\
<div class="form_buttons">\
<button class="image_close_dialog_link"/></div>'
};
Sunstone.updateInfoPanelTab("image_info_panel","image_info_tab",info_tab);
Sunstone.popUpInfoPanel("image_info_panel");
$('#dialog .image_close_dialog_link').button({
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(){
Sunstone.popUpInfoPanel("image_create_panel");
var dialog = $('#dialog');
$create_image_dialog = dialog;
$('#create_image',dialog).button({
icons: {
primary: "ui-icon-check"
},
text: false
});
$('#reset_image',dialog).button({
icons: {
primary: "ui-icon-scissors"
},
text: false
});
$('.image_close_dialog_link',dialog).button({
icons: {
primary: "ui-icon-closethick"
},
text: false
});
setupTips(dialog);
$('#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');
});
$('#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();
$('#img_size',$create_image_dialog).parents('div.img_param').show();
$('#upload_div',$create_image_dialog).hide();
} else {
$('#img_fstype',$create_image_dialog).parents('div.img_param').hide();
$('#img_size',$create_image_dialog).parents('div.img_param').hide();
$('#upload_div',$create_image_dialog).show();
};
});
$('#upload-progress',dialog).progressbar({value:0});
$('#upload-progress',dialog).css({
border: "1px solid #AAAAAA",
position: "relative",
// bottom: "29px",
width: "210px",
// left: "133px",
height: "15px",
display: "inline-block",
});
$('#upload-progress div',dialog).css("border","1px solid #AAAAAA");
var img_obj;
var uploader = new qq.FileUploaderBasic({
button: $('#file-uploader',$create_image_dialog)[0],
action: 'ui/upload',
multiple: false,
params: {},
showMessage: function(message){
notifyMessage(message);
},
onSubmit: function(id, fileName){
var xml = json2xml(img_obj,"STORAGE");
uploader.setParams({
occixml : xml,
file: fileName
});
$('#upload-progress',dialog).show();
},
onProgress: function(id, fileName, loaded, total){
$('#upload-progress',dialog).progressbar("option","value",Math.floor(loaded*100/total));
},
onComplete: function(id, fileName, responseJSON){
popUpImageDashboard();
notifyMessage("Image uploaded correctly");
Sunstone.runAction("Image.list");
return false;
},
onCancel: function(id, fileName){
},
});
var file_input = false;
uploader._button._options.onChange = function(input) {
file_input = input; return false;
};
$('#file-uploader input').removeAttr("style");
var processCreateImageForm = function(){
var dialog = $create_image_dialog;
var img_json = {};
var name = $('#img_name',dialog).val();
if (!name){
notifyError(tr("You must specify a name"));
return false;
};
img_json["NAME"] = name;
var desc = $('#img_desc',dialog).val();
if (desc){
img_json["DESCRIPTION"] = desc;
}
var type = $('#img_type',dialog).val();
img_json["TYPE"]= type;
if (type == "DATABLOCK"){
var fstype = $('#img_fstype',dialog).val();
var im_size = $('#img_size',dialog).val();
if (!fstype || !im_size){
notifyError(tr("You must specify size and FS type"));
return false;
};
img_json["FSTYPE"] = fstype;
img_json["SIZE"] = im_size;
} else {
if (!$('#file-uploader input').val()){
notifyError(tr("You must select a file to upload"));
return false;
};
}
//img_json["PUBLIC"] = $('#img_public:checked',this).length ? "YES" : "NO";
//img_json["PERSISTENT"] = $('#img_persistent:checked',this).length ? "YES" : "NO";
return img_json;
};
$('#create_image_form_easy',dialog).submit(function(){
var type = $('#img_type',dialog).val();
img_obj = processCreateImageForm();
if (!img_obj) return false;
if (type == "DATABLOCK"){
Sunstone.runAction("Image.create",img_obj);
popUpImageDashboard();
} else {
uploader._onInputChange(file_input);
};
return false;
});
}
function popUpImageDashboard(){
var count = dataTable_images.fnGetNodes().length;
popDialog(image_dashboard);
$('#dialog .storage_count').text(count);
};
// Set the autorefresh interval for the datatable
function setImageAutorefresh() {
setInterval(function(){
var checked = $('input.check_item:checked',dataTable_images);
var filter = $("#datatable_images_filter input",
dataTable_images.parents("#datatable_images_wrapper")).attr('value');
if (!checked.length && !filter.length){
Sunstone.runAction("Image.autorefresh");
}
},INTERVAL+someTime());
};
/*
function is_public_image(id){
var data = getElementData(id,"#image",dataTable_images)[7];
return $(data).attr('checked');
};
function is_persistent_image(id){
var data = getElementData(id,"#image",dataTable_images)[8];
return $(data).attr('checked');
};
*/
//The DOM is ready at this point
$(document).ready(function(){
dataTable_images = $("#datatable_images",main_tabs_context).dataTable({
"bJQueryUI": true,
"bSortClasses": false,
"bAutoWidth":false,
"sPaginationType": "full_numbers",
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ["check"] },
{ "sWidth": "60px", "aTargets": [0] },
{ "sWidth": "35px", "aTargets": [1] },
],
"oLanguage": (datatable_lang != "") ?
{
sUrl: "locale/"+lang+"/"+datatable_lang
} : ""
});
dataTable_images.fnClearTable();
addElement([
spinner,
'',''],dataTable_images);
Sunstone.runAction("Image.list");
setImageAutorefresh();
initCheckAllBoxes(dataTable_images);
tableCheckboxesListener(dataTable_images);
imageInfoListener();
$('#li_images_tab a').click(function(){
popUpImageDashboard();
//return false;
});
$('.image_close_dialog_link').live("click",function(){
popUpImageDashboard();
return false;
});
})

View File

@ -0,0 +1,157 @@
//Translated by
lang="en_US"
datatable_lang=""
locale={
"Additionally, OpenNebula Self-Service allows easy customization of the interface (e.g. this text) and brings multi-language support.":"",
"Additionally, you can run several operations on defined storages, such as defining their persistance. Persistent images can only be used by 1 virtual machine, and the changes made by it have effect on the base image. Non-persistent images are cloned before being used in a Virtual Machine, therefore changes are lost unless a snapshot is taken prior to Virtual Machine shutdown.":"",
"Additionally, you can take a \'snapshot\' of the storage attached to these resources. They will be saved as new resources, visible from the Storage view and re-usable.":"",
"Add storage":"",
"All":"",
"are mandatory":"",
"Cancel":"",
"Cannot contact server: is it running and reachable?":"",
"Canvas not supported.":"",
"CD-ROM":"",
"Changing language":"",
"Community":"",
"Compute":"",
"Compute resource":"",
"Compute resources are Virtual Machines attached to storage and network resources. OpenNebula Self-Service allows you to easily create, remove and manage them, including the possibility of pausing a Virtual Machine or taking a snapshot of one of their disks.":"",
"Compute resources can be attached to these networks at creation time. Virtual machines will be provided with an IP and the correct parameters to ensure connectivity.":"",
"Configuration":"",
"Confirmation of action":"",
"CPU":"",
"Create network":"",
"Create new compute resource":"",
"Create new network resource":"",
"Create new storage resource":"",
"Create Virtual Machine":"",
"Create # VMs":"",
"Current resources":"",
"Dashboard":"",
"Datablock":"",
"Delete":"",
"Description":"",
"disk id":"",
"Disks":"",
"Disks information":"",
"Documentation":"",
"Do you want to proceed?":"",
"English":"",
"Error":"",
"Fields marked with":"",
"Filesystem type":"",
"FS type":"",
"Have a cloudy experience!":"",
"Human readable description of the image.":"",
"ID":"",
"Image":"",
"Image information":"",
"Image name":"",
"images":"",
"Images":"",
"Info":"",
"information":"",
"Instance type":"",
"In this view you can easily manage OpenNebula Network resources. You can add or remove virtual networks.":"",
"IP":"",
"Language":"",
"Loading":"",
"MAC":"",
"Make non persistent":"",
"Make persistent":"",
"Memory":"",
"Monitoring information":"",
"Name":"",
"Name that the Image will get.":"",
"Network":"",
"Network Address":"",
"Network information":"",
"Network is unreachable: is OpenNebula running?":"",
"Network reception":"",
"networks":"",
"Networks":"",
"Networks information":"",
"Network Size":"",
"Network transmission":"",
"+ New":"",
"No disk id or image name specified":"",
"No disks defined":"",
"No networks defined":"",
"OK":"",
"OpenNebula Self-Service is a simplified user interface to manage OpenNebula compute, storage and network resources. It is focused on easiness and usability and features a limited set of operations directed towards end-users.":"",
"Open VNC Session":"",
"OS":"",
"Persistence of the image":"",
"Persistent":"",
"Please, choose and modify the template you want to update":"",
"Please provide a network address":"",
"Please select":"",
"Previous action":"",
"Public":"",
"Public scope of the image":"",
"Publish":"",
"Refresh list":"",
"Resume":"",
"Retrieving":"",
"Saveas for VM with ID":"",
"See more":"",
"Select a template":"",
"Select disk":"",
"Self-Service UI Configuration":"",
"Shutdown":"",
"Sign out":"",
"Size":"",
"Size (Mb)":"",
"Size of the datablock in MB.":"",
"Skipping VM ":"",
"Spanish":"",
"State":"",
"Stop":"",
"Storage":"",
"Storage pool is formed by several images. These images can contain from full operating systems to be used as base for compute resources, to simple data. OpenNebula Self-Service offers you the possibility to create or upload your own images.":"",
"String":"",
"style":"",
"Submitted":"",
"Support":"",
"Suspend":"",
"Take snapshot":"",
"Target":"",
"There are currently":"",
"The Storage view offers you an overview of your current images. Storage elements are attached to compute resources at creation time. They can also be extracted from running virtual machines by taking an snapshot.":"",
"This is a list of your current compute resources. Virtual Machines use previously defined images and networks. You can easily create a new compute element by cliking \'new\' and filling-in an easy wizard.":"",
"This will cancel selected VMs":"",
"This will delete the selected VMs from the database":"",
"This will resume the selected VMs in stopped or suspended states":"",
"This will shutdown the selected VMs":"",
"This will suspend the selected VMs":"",
"Type":"",
"Type of file system to be built. This can be any value understood by mkfs unix command.":"",
"Type of the image":"",
"Unauthorized":"",
"Unpublish":"",
"Update":"",
"Update template":"",
"Upload image":"",
"Upload progress":"",
"Useful links":"",
"Virtual Machine information":"",
"virtual machines":"",
"Virtual Network":"",
"Virtual Network information":"",
"Virtual Network name missing!":"",
"VM information":"",
"VM Name":"",
"VNC connection":"",
"VNC Disabled":"",
"Welcome":"",
"Welcome to OpenNebula Self-Service":"",
"You can add new storages by clicking \'new\'. Image files will be uploaded to OpenNebula and set ready to be used.":"",
"You can also manage compute resources and perform actions such as stop, resume, shutdown or cancel.":"",
"You have to confirm this action.":"",
"You must select a file to upload":"",
"You must specify a name":"",
"You must specify size and FS type":"",
"You need to select something.":"",
"Your compute resources connectivity is performed using pre-defined virtual networks. You can create and manage these networks using OpenNebula Self-Service.":"",
};

View File

@ -0,0 +1,157 @@
//Translated by
lang="es_ES"
datatable_lang="es_datatable.txt"
locale={
"Additionally, OpenNebula Self-Service allows easy customization of the interface (e.g. this text) and brings multi-language support.":"Además, OpenNebula Self-Service permite una fácil personalización de la interfaz (por ejemplo, de este mismo texto) y viene con soporte para múltiples lenguajes.",
"Additionally, you can run several operations on defined storages, such as defining their persistance. Persistent images can only be used by 1 virtual machine, and the changes made by it have effect on the base image. Non-persistent images are cloned before being used in a Virtual Machine, therefore changes are lost unless a snapshot is taken prior to Virtual Machine shutdown.":"Además, puede ejecutar varias operaciones en los almacenamientos presentes, como definir su persistencia. Las imágenes persistentes sólo pueden ser usadas por 1 máquina virtual, y los cambios realizados por ella tiene efecto en la imágen base. Las imágenes no persistentes son clonadas antes de ser utilizadas en una máquina virtual, por tanto los cambios se pierden a menos que se tome una instantánea antes de apagar la máquina virtual.",
"Additionally, you can take a 'snapshot' of the storage attached to these resources. They will be saved as new resources, visible from the Storage view and re-usable.":"Además, puede tomar una 'instantánea' de los almacenamientos asociado a estos recursos. Ésta será salvaguardada como un nuevo recurso, visible y reutilizable desde la vista de almacenamientos.",
"Add storage":"Añadir almacenamiento",
"All":"Todos",
"are mandatory":"son obligatorios",
"Cancel":"Cancelar",
"Cannot contact server: is it running and reachable?":"No se puede contactar con el servidor: ¿está funcionando y es alcanzable?",
"Canvas not supported.":"Canvas no soportado",
"CD-ROM":"CD-ROM",
"Changing language":"Cambiando el lenguaje",
"Community":"Comunidad",
"Compute":"Máquinas Virtuales",
"Compute resource":"máquina virtual",
"Compute resources are Virtual Machines attached to storage and network resources. OpenNebula Self-Service allows you to easily create, remove and manage them, including the possibility of pausing a Virtual Machine or taking a snapshot of one of their disks.":"Las máquinas virtuales están asociadas a recursos de almacenamiento y de red. OpenNebula Self-Service le permite crearlos, borrarlos y administrarlos fácilmente, incluyendo la posibilidad de pausar una máquina virtual o de tomar una instantánea de alguno de sus discos.",
"Compute resources can be attached to these networks at creation time. Virtual machines will be provided with an IP and the correct parameters to ensure connectivity.":"Las máquinas virtuales pueden asociarse a estas redes en el momento de su creación. Las máquinas virtuales serán provistas de una IP y de los parámetros correctos para asegurar conectividad.",
"Configuration":"Configuración",
"Confirmation of action":"Confirmar operación",
"CPU":"CPU",
"Create network":"Crear red",
"Create new compute resource":"Crear nueva máquina virtual",
"Create new network resource":"Crear nueva red",
"Create new storage resource":"Crear nuevo almacenamiento",
"Create Virtual Machine":"Crear máquina virtual",
"Create # VMs":"Crear # MVs",
"Current resources":"Recursos actuales",
"Dashboard":"Portada",
"Datablock":"Datablock",
"Delete":"Borrar",
"Description":"Descripción",
"disk id":"id del disco",
"Disks":"Discos",
"Disks information":"Información de discos",
"Documentation":"Documentación",
"Do you want to proceed?":"¿Desea continuar?",
"English":"Inglés",
"Error":"Error",
"Fields marked with":"Campos marcados con",
"Filesystem type":"Sistema de ficheros",
"FS type":"tipo de FS",
"Have a cloudy experience!":"¡Nos vemos en las nubes!",
"Human readable description of the image.":"Descripción de la imagen.",
"ID":"ID",
"Image":"Imagen",
"Image information":"Información de la imagen",
"Image name":"Nombre de la imagen",
"images":"imágenes",
"Images":"Imágenes",
"Info":"Información",
"information":"Información",
"Instance type":"Tipo de instancia",
"In this view you can easily manage OpenNebula Network resources. You can add or remove virtual networks.":"En esta vista puede gestionar fácilmente los recursos de red de OpenNebula. Puede añadir o borrar redes virtuales.",
"IP":"IP",
"Language":"Lenguaje",
"Loading":"Cargando",
"MAC":"MAC",
"Make non persistent":"Hacer no persistente",
"Make persistent":"Hacer persistente",
"Memory":"Memoria",
"Monitoring information":"Información de monitorización",
"Name":"Nombre",
"Name that the Image will get.":"Nombre para la imagen.",
"Network":"Red",
"Network Address":"Dirección de red",
"Network information":"Información de red",
"Network is unreachable: is OpenNebula running?":"No se puede alcanzar la red: ¿está OpenNebula funcionando?",
"Network reception":"Recepción de red",
"networks":"redes",
"Networks":"Redes",
"Networks information":"Información de redes",
"Network Size":"Tamaño de red",
"Network transmission":"Transmisión de red",
"+ New":"+ Nuevo",
"No disk id or image name specified":"No se ha especificado ID de disco o nombre de la imagen",
"No disks defined":"No hay discos definidos",
"No networks defined":"No hay redes definidas",
"OK":"OK",
"OpenNebula Self-Service is a simplified user interface to manage OpenNebula compute, storage and network resources. It is focused on easiness and usability and features a limited set of operations directed towards end-users.":"OpenNebula Self-Service es una interfaz de usuario simplificada para administrar máquinas virtuales, almacenamiento y red de OpenNebula. Está basada en la facilidad de uso y cuenta con un número limitado de operaciones dirigidas a los usuarios finales.",
"Open VNC Session":"Abrir sesión VNC",
"OS":"OS",
"Persistence of the image":"Persistencia de la imagen",
"Persistent":"Persistente",
"Please, choose and modify the template you want to update":"Por favor, escoja y modifique la plantilla que desea actualizar",
"Please provide a network address":"Por favor, proporcione una dirección de red",
"Please select":"Por favor escoja",
"Previous action":"Acción anterior",
"Public":"Público",
"Public scope of the image":"",
"Publish":"Publicar",
"Refresh list":"Refrescar lista",
"Resume":"Reanudar",
"Retrieving":"Cargando",
"Saveas for VM with ID":"Instantánea a MV con ID",
"See more":"Ver más",
"Select a template":"Seleccione una plantilla",
"Select disk":"Seleccione un disco",
"Self-Service UI Configuration":"Configuración de la interfaz Self-Service",
"Shutdown":"Apagar",
"Sign out":"Desconectar",
"Size":"Tamaño",
"Size (Mb)":"Tamaño (Mb)",
"Size of the datablock in MB.":"Tamaño del datablcok en MB",
"Skipping VM ":"Saltando MV",
"Spanish":"Español",
"State":"Estado",
"Stop":"Detener",
"Storage":"Almacenamiento",
"Storage pool is formed by several images. These images can contain from full operating systems to be used as base for compute resources, to simple data. OpenNebula Self-Service offers you the possibility to create or upload your own images.":"La lista de almacenamiento está formada por varias imágenes. Estas imágenes pueden contener desde sistemas operativos completos para ser usados como base en máquinas virtuales, hasta simples datos. OpenNebula Self-Service ofrece la posibilidad de crear o subir sus propias imágenes.",
"String":"String",
"style":"estilo",
"Submitted":"Hecho",
"Support":"Soporte",
"Suspend":"Suspender",
"Take snapshot":"Tomar instantánea",
"Target":"Target",
"There are currently":"Actualmente hay",
"The Storage view offers you an overview of your current images. Storage elements are attached to compute resources at creation time. They can also be extracted from running virtual machines by taking an snapshot.":"La vista de almacenamiento le ofrece la visión general de sus imágenes. Los elementos de almacenamiento se asocian a máquinas virtuales en el momento de la creación. También pueden ser extraídos de una máquina virtual en ejecución tomando una instantánea",
"This is a list of your current compute resources. Virtual Machines use previously defined images and networks. You can easily create a new compute element by cliking 'new' and filling-in an easy wizard.":"Esta es una lista de sus máquinas virtuales actuales. Las máquinas virtuales utilizan imagenes y redes definidas previamente. Puede crear fácilmente una nueva máquina virtual haciendo click en 'New' y rellenado un sencillo formulario.",
"This will cancel selected VMs":"Esto cancelará las MVs seleccionadas",
"This will delete the selected VMs from the database":"Esto borrará las MVs seleccionadas de la base de datos",
"This will resume the selected VMs in stopped or suspended states":"Esto reanudará las MVs seleccionadas paradas o suspendidas",
"This will shutdown the selected VMs":"Esto apagará las MVs seleccionadas",
"This will suspend the selected VMs":"Esto suspenderá las MVs seleccionadas",
"Type":"Tipo",
"Type of file system to be built. This can be any value understood by mkfs unix command.":"Tipo de sistema de archivos a generar. Es válido cualquier valor entendido por el comando mkfs",
"Type of the image":"Tipo de la imagen",
"Unauthorized":"No autorizado",
"Unpublish":"Despublicar",
"Update":"Actualizar",
"Update template":"Actualizar plantilla",
"Upload image":"Subir imagen",
"Upload progress":"Progreso se subida",
"Useful links":"Enlances útiles",
"Virtual Machine information":"Información de máquina virtual",
"virtual machines":"máquinas virtuales",
"Virtual Network":"Red virtual",
"Virtual Network information":"Información de red virtual",
"Virtual Network name missing!":"¡Falta el nombre de la red!",
"VM information":"Información de MV",
"VM Name":"Nombre",
"VNC connection":"Conexión VNC",
"VNC Disabled":"VNC Desabilitado",
"Welcome":"Bienvenid@",
"Welcome to OpenNebula Self-Service":"Bienvenid@ a OpenNebula Self-Service",
"You can add new storages by clicking 'new'. Image files will be uploaded to OpenNebula and set ready to be used.":"Puede añadir nuevos almacenamientos haciendo click en 'new'. Los ficheros de imagen pueden ser subidos a OpenNebula y preparados para ser usado.",
"You can also manage compute resources and perform actions such as stop, resume, shutdown or cancel.":"También puede administrar las máquinas virtuales y realizar acciones como detener, reanudar, apagar o cancelar.",
"You have to confirm this action.":"Necesita confirmar esta acción",
"You must select a file to upload":"Debe seleccionar un fichero para subir",
"You must specify a name":"Debe especificar un nombre",
"You must specify size and FS type":"Debe especificar un tamaño y un tipo de FS",
"You need to select something.":"Debe seleccionar algo",
"Your compute resources connectivity is performed using pre-defined virtual networks. You can create and manage these networks using OpenNebula Self-Service.":"La conectividad de sus máquinas virtuales se realiza usando redes virtuales pre-definidas. Puede crear y administrar estas redes usando OpenNebula Self-Service.",
};

View File

@ -0,0 +1,17 @@
{
"sProcessing": "Procesando...",
"sLengthMenu": "Número de elementos",
"sZeroRecords": "No hay elementos",
"sInfo": "Mostrando del _START_ al _END_ de _TOTAL_",
"sInfoEmpty": "No hay elementos",
"sInfoFiltered": "(filtado de un total de _MAX_)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"oPaginate": {
"sFirst": "Primero",
"sPrevious": "Anterior",
"sNext": "Siguiente",
"sLast": "Último"
}
}

View File

@ -0,0 +1,31 @@
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------- #
# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
tr_strings = `grep -h -o -R -e 'tr("[[:print:]]*")' ../js/* ../customize/* | cut -d'"' -f 2 | sort -u`
puts "//Translated by"
puts 'lang="en_US"'
puts 'datatable_lang=""'
puts "locale={"
tr_strings.each_line do | line |
puts " \"#{line.chomp}\":\"\","
end
puts "};"

View File

@ -0,0 +1,52 @@
#!/usr/bin/js
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
if (!arguments[0] || !arguments[1]){
print("Usage: upgrade_translation.js <old_translation> <empty_template> > <new_translation>");
quit();
};
var from = arguments[0];
var to = arguments[1];
load(from);
var tr="";
var locale_old= {};
for (tr in locale){
locale_old[tr] = locale[tr];
};
var lang_old = lang;
var dt_lang_old = datatable_lang
load(to);
for (tr in locale){
if (locale_old[tr]){
locale[tr] = locale_old[tr]
};
};
print("//Translated by");
print('lang="'+lang_old+'"');
print('datatable_lang="'+dt_lang_old+'"');
print("locale={");
for (tr in locale){
print(' "'+tr+'":"'+locale[tr]+'",');
};
print("};");

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>OpenNebula Self-Service Login</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<!-- Vendor Libraries -->
<script type="text/javascript" src="vendor/jQuery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="vendor/crypto-js/2.3.0-crypto-sha1.js"></script>
<!-- End Vendor Libraries -->
<script type="text/javascript" src="js/occi.js"></script>
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<div id="header">
<div id="logo">
OpenNebula Self-Service portal
</div>
</div>
<div id="wrapper">
<div id="logo_sunstone">
</div>
<div id="auth_error" class="error_message">
Invalid username or password
</div>
<div id="one_error" class="error_message">
OpenNebula is not running
</div>
<form id="login_form">
<div class="border" id="login">
<div class="content">
Username
<input type="text" size="15" name="username" id="username" class="box"/>
Password
<input type="password" size="15" name="password" id="password" class="box"/>
<br />
<input type="checkbox" id="check_remember" />
<label id="label_remember" for="check_remember">Remember me</label>
<input type="submit" id="login_btn" value="" />
</div>
</div>
</form>
</div>
</body>
</html>

View File

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html>
<head>
<title>OpenNebula Self-Service</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<!-- Vendor Libraries -->
<link rel="stylesheet" type="text/css" href="vendor/dataTables/demo_table_jui.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="vendor/jGrowl/jquery.jgrowl.css" />
<link rel="stylesheet" type="text/css" href="vendor/jQueryLayout/layout-default-latest.css" />
<script type="text/javascript" src="vendor/jQuery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="vendor/xml2json/jquery.xml2json.pack.js"></script>
<script type="text/javascript" src="vendor/jGrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="vendor/jQueryUI/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="vendor/jQueryLayout/jquery.layout-latest.min.js"></script>
<script type="text/javascript" src="vendor/dataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="vendor/fileuploader/fileuploader.js"></script>
<!-- End Vendor Libraries -->
<!--Languages-->
<script type="text/javascript" src="js/locale.js"></script>
<%if session[:lang]%>
<script type="text/javascript" src="locale/<%=session[:lang]%>/<%=session[:lang]%>.js"></script>
<%end%>
<!--endLanguages-->
<link rel="stylesheet" type="text/css" href="css/application.css" />
<link rel="stylesheet" type="text/css" href="css/layout.css" />
<script type="text/javascript" src="js/layout.js"></script>
<script type="text/javascript" src="js/occi.js"></script>
<script type="text/javascript" src="js/sunstone.js"></script>
<script type="text/javascript" src="js/sunstone-util.js"></script>
<script type="text/javascript" src="customize/custom.js"></script>
<!--Base plugins-->
<script type="text/javascript" src="js/plugins/dashboard.js"></script>
<script type="text/javascript" src="js/plugins/compute.js"></script>
<script type="text/javascript" src="js/plugins/storage.js"></script>
<script type="text/javascript" src="js/plugins/network.js"></script>
<script type="text/javascript" src="js/plugins/configuration.js"></script>
</head>
<body>
<div class="outer-center">
<div class="inner-center">
</div>
<div id="dialog" class="inner-east"></div>
</div>
<div id="menu" class="outer-west">
<ul id="navigation" class="navigation">
</ul>
</div>
<div id="header" class="ui-layout-north">
<div id="logo">
<img src="images/opennebula-selfservice-small.png"/>
</div>
<div id="login-info">
<span id="welcome">Welcome</span> <span id="user"></span>&nbsp;|&nbsp;<a href="#" id="logout">Sign Out</a>
</div>
<!--
<div id="links">
<a href="http://opennebula.org/documentation:documentation" target="_blank">Documentation</a>&nbsp;|&nbsp;
<a href="http://opennebula.org/support:support" target="_blank">Support</a>&nbsp;|&nbsp;
<a href="http://opennebula.org/community:community" target="_blank">Community</a>
</div>
-->
</div>
<div id="footer" class="ui-layout-south">
Copyright 2002-2011 &copy; OpenNebula Project Leads (<a href="http://opennebula.org" target="_blank">OpenNebula.org</a>). All Rights Reserved. OpenNebula 3.1.0
</div>
<div id="dialogs">
</div>
<div id="plots">
</div>
<div id="info_panels"></div>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 551 B

View File

@ -297,7 +297,7 @@ function initCheckAllBoxes(datatable){
//small css hack
$('input.check_all',datatable).css({"border":"2px"});
$('input.check_all',datatable).change(function(){
$('input.check_all',datatable).live("change",function(){
var table = $(this).parents('table');
var checked = $(this).attr('checked');
if (checked) { //check all
@ -498,9 +498,11 @@ function getSelectedNodes(dataTable){
function makeSelectOptions(dataTable,
id_col,name_col,
status_cols,
bad_status_values){
bad_status_values,no_empty_opt){
var nodes = dataTable.fnGetData();
var select = '<option class="empty_value" value="">'+tr("Please select")+'</option>';
var select = "";
if (!no_empty_opt)
select = '<option class="empty_value" value="">'+tr("Please select")+'</option>';
var array;
for (var j=0; j<nodes.length;j++){
var elem = nodes[j];

View File

@ -366,6 +366,12 @@ $(document).ready(function(){
$('.action_blocks .action_list:visible',main_tabs_context).hide();
});
//Close open panel
$('.close_dialog_link').live("click",function(){
hideDialog();
return false;
});
//Start with the dashboard (supposing we have one).
showTab('#dashboard_tab');
@ -397,6 +403,9 @@ function setLogin(){
case "ozones":
username = cookie["ozones-user"];
break;
case "occi":
username = cookie["occi-user"];
break;
};
@ -411,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;
});
@ -419,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(){

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
#!/usr/bin/js
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
if (!arguments[0] || !arguments[1]){
print("Usage: upgrade_translation.js <old_translation> <empty_template> > <new_translation>");
quit();
};
var from = arguments[0];
var to = arguments[1];
load(from);
var tr="";
var locale_old= {};
for (tr in locale){
locale_old[tr] = locale[tr];
};
var lang_old = lang;
var dt_lang_old = datatable_lang
load(to);
for (tr in locale){
if (locale_old[tr]){
locale[tr] = locale_old[tr]
};
};
print("//Translated by");
print('lang="'+lang_old+'"');
print('datatable_lang="'+dt_lang_old+'"');
print("locale={");
for (tr in locale){
print(' "'+tr+'":"'+locale[tr]+'",');
};
print("};");

View File

@ -0,0 +1,12 @@
/*
* Crypto-JS v2.3.0
* http://code.google.com/p/crypto-js/
* Copyright (c) 2011, Jeff Mott. All rights reserved.
* http://code.google.com/p/crypto-js/wiki/License
*/
if(typeof Crypto=="undefined"||!Crypto.util)(function(){var k=window.Crypto={},l=k.util={rotl:function(a,c){return a<<c|a>>>32-c},rotr:function(a,c){return a<<32-c|a>>>c},endian:function(a){if(a.constructor==Number)return l.rotl(a,8)&16711935|l.rotl(a,24)&4278255360;for(var c=0;c<a.length;c++)a[c]=l.endian(a[c]);return a},randomBytes:function(a){for(var c=[];a>0;a--)c.push(Math.floor(Math.random()*256));return c},bytesToWords:function(a){for(var c=[],b=0,d=0;b<a.length;b++,d+=8)c[d>>>5]|=a[b]<<24-
d%32;return c},wordsToBytes:function(a){for(var c=[],b=0;b<a.length*32;b+=8)c.push(a[b>>>5]>>>24-b%32&255);return c},bytesToHex:function(a){for(var c=[],b=0;b<a.length;b++){c.push((a[b]>>>4).toString(16));c.push((a[b]&15).toString(16))}return c.join("")},hexToBytes:function(a){for(var c=[],b=0;b<a.length;b+=2)c.push(parseInt(a.substr(b,2),16));return c},bytesToBase64:function(a){if(typeof btoa=="function")return btoa(m.bytesToString(a));for(var c=[],b=0;b<a.length;b+=3)for(var d=a[b]<<16|a[b+1]<<
8|a[b+2],e=0;e<4;e++)b*8+e*6<=a.length*8?c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>>6*(3-e)&63)):c.push("=");return c.join("")},base64ToBytes:function(a){if(typeof atob=="function")return m.stringToBytes(atob(a));a=a.replace(/[^A-Z0-9+\/]/ig,"");for(var c=[],b=0,d=0;b<a.length;d=++b%4)d!=0&&c.push(("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b-1))&Math.pow(2,-2*d+8)-1)<<d*2|"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b))>>>
6-d*2);return c}};k=k.charenc={};k.UTF8={stringToBytes:function(a){return m.stringToBytes(unescape(encodeURIComponent(a)))},bytesToString:function(a){return decodeURIComponent(escape(m.bytesToString(a)))}};var m=k.Binary={stringToBytes:function(a){for(var c=[],b=0;b<a.length;b++)c.push(a.charCodeAt(b)&255);return c},bytesToString:function(a){for(var c=[],b=0;b<a.length;b++)c.push(String.fromCharCode(a[b]));return c.join("")}}})();
(function(){var k=Crypto,l=k.util,m=k.charenc,a=m.UTF8,c=m.Binary,b=k.SHA1=function(d,e){var g=l.wordsToBytes(b._sha1(d));return e&&e.asBytes?g:e&&e.asString?c.bytesToString(g):l.bytesToHex(g)};b._sha1=function(d){if(d.constructor==String)d=a.stringToBytes(d);var e=l.bytesToWords(d),g=d.length*8;d=[];var n=1732584193,h=-271733879,i=-1732584194,j=271733878,o=-1009589776;e[g>>5]|=128<<24-g%32;e[(g+64>>>9<<4)+15]=g;for(g=0;g<e.length;g+=16){for(var q=n,r=h,s=i,t=j,u=o,f=0;f<80;f++){if(f<16)d[f]=e[g+
f];else{var p=d[f-3]^d[f-8]^d[f-14]^d[f-16];d[f]=p<<1|p>>>31}p=(n<<5|n>>>27)+o+(d[f]>>>0)+(f<20?(h&i|~h&j)+1518500249:f<40?(h^i^j)+1859775393:f<60?(h&i|h&j|i&j)-1894007588:(h^i^j)-899497514);o=j;j=i;i=h<<30|h>>>2;h=n;n=p}n+=q;h+=r;i+=s;j+=t;o+=u}return[n,h,i,j,o]};b._blocksize=16;b._digestsize=20})();

View File

@ -0,0 +1,9 @@
© 20092011 by Jeff Mott. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation or other materials provided with the distribution.
* Neither the name Crypto-JS nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS," AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,6 @@
THIRD-PARTY SOFTWARE
* Author: Jeff Mott (http://code.google.com/u/Jeff.Mott.OR/)
* Info: http://code.google.com/p/crypto-js/
* Copyright: Copyright 2009-2012 by Jeff Mott,all rights reserved.
* License: New BSD License. See NEW-BSD-LICENSE.txt

View File

@ -0,0 +1,6 @@
THIRD-PARTY SOFTWARE
* Author: Andrew Valums (http://github.com/valums)
* Info: https://github.com/valums/file-uploader
* Copyright: Copyright 2010 Andrew Valums.
* License: GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) and GNU LGPL 2 or later (http://www.gnu.org/licenses/lgpl-2.1.html)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
THIRD-PARTY SOFTWARE
* Author: Diego (diago@fyneworks.com)
* Info: http://www.fyneworks.com/jquery/xml-to-json/
* Copyright: Copyright 2008 Fyneworks.com
* License: Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL licenses (http://www.gnu.org/licenses/gpl.html)

View File

@ -0,0 +1,10 @@
/*
### jQuery XML to JSON Plugin v1.0 - 2008-07-01 ###
* http://www.fyneworks.com/ - diego@fyneworks.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
###
Website: http://www.fyneworks.com/jquery/xml-to-json/
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';5(10.M)(w($){$.N({11:w(j,k){5(!j)t{};w B(d,e){5(!d)t y;6 f=\'\',2=y,E=y;6 g=d.x,12=l(d.O||d.P);6 h=d.v||d.F||\'\';5(d.G){5(d.G.7>0){$.Q(d.G,w(n,a){6 b=a.x,u=l(a.O||a.P);6 c=a.v||a.F||\'\';5(b==8){t}z 5(b==3||b==4||!u){5(c.13(/^\\s+$/)){t};f+=c.H(/^\\s+/,\'\').H(/\\s+$/,\'\')}z{2=2||{};5(2[u]){5(!2[u].7)2[u]=p(2[u]);2[u][2[u].7]=B(a,R);2[u].7=2[u].7}z{2[u]=B(a)}}})}};5(d.I){5(d.I.7>0){E={};2=2||{};$.Q(d.I,w(a,b){6 c=l(b.14),C=b.15;E[c]=C;5(2[c]){5(!2[c].7)2[c]=p(2[c]);2[c][2[c].7]=C;2[c].7=2[c].7}z{2[c]=C}})}};5(2){2=$.N((f!=\'\'?A J(f):{}),2||{});f=(2.v)?(D(2.v)==\'16\'?2.v:[2.v||\'\']).17([f]):f;5(f)2.v=f;f=\'\'};6 i=2||f;5(k){5(f)i={};f=i.v||f||\'\';5(f)i.v=f;5(!e)i=p(i)};t i};6 l=w(s){t J(s||\'\').H(/-/g,"18")};6 m=w(s){t(D s=="19")||J((s&&D s=="K")?s:\'\').1a(/^((-)?([0-9]*)((\\.{0,1})([0-9]+))?$)/)};6 p=w(o){5(!o.7)o=[o];o.7=o.7;t o};5(D j==\'K\')j=$.S(j);5(!j.x)t;5(j.x==3||j.x==4)t j.F;6 q=(j.x==9)?j.1b:j;6 r=B(q,R);j=y;q=y;t r},S:w(a){6 b;T{6 c=($.U.V)?A 1c("1d.1e"):A 1f();c.1g=W}X(e){Y A L("Z 1h 1i 1j 1k 1l")};T{5($.U.V)b=(c.1m(a))?c:W;z b=c.1n(a,"v/1o")}X(e){Y A L("L 1p Z K")};t b}})})(M);',62,88,'||obj|||if|var|length||||||||||||||||||||||return|cnn|text|function|nodeType|null|else|new|parseXML|atv|typeof|att|nodeValue|childNodes|replace|attributes|String|string|Error|jQuery|extend|localName|nodeName|each|true|text2xml|try|browser|msie|false|catch|throw|XML|window|xml2json|nn|match|name|value|object|concat|_|number|test|documentElement|ActiveXObject|Microsoft|XMLDOM|DOMParser|async|Parser|could|not|be|instantiated|loadXML|parseFromString|xml|parsing'.split('|'),0,{}))