diff --git a/install.sh b/install.sh index fd161239ad..64ea77a958 100755 --- a/install.sh +++ b/install.sh @@ -266,6 +266,7 @@ SUNSTONE_DIRS="$SUNSTONE_LOCATION/models \ $SUNSTONE_LOCATION/public/locale/zh_TW \ $SUNSTONE_LOCATION/public/vendor \ $SUNSTONE_LOCATION/public/vendor/crypto-js \ + $SUNSTONE_LOCATION/public/vendor/explorercanvas \ $SUNSTONE_LOCATION/public/vendor/jQueryLayout \ $SUNSTONE_LOCATION/public/vendor/dataTables \ $SUNSTONE_LOCATION/public/vendor/jQueryUI \ @@ -489,6 +490,7 @@ INSTALL_SUNSTONE_FILES=( SUNSTONE_PUBLIC_JS_PLUGINS_FILES:$SUNSTONE_LOCATION/public/js/plugins SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css SUNSTONE_PUBLIC_VENDOR_CRYPTOJS:$SUNSTONE_LOCATION/public/vendor/crypto-js + SUNSTONE_PUBLIC_VENDOR_EXPLORERCANVAS:$SUNSTONE_LOCATION/public/vendor/explorercanvas SUNSTONE_PUBLIC_VENDOR_DATATABLES:$SUNSTONE_LOCATION/public/vendor/dataTables SUNSTONE_PUBLIC_VENDOR_JGROWL:$SUNSTONE_LOCATION/public/vendor/jGrowl SUNSTONE_PUBLIC_VENDOR_JQUERY:$SUNSTONE_LOCATION/public/vendor/jQuery @@ -1345,6 +1347,11 @@ src/sunstone/public/vendor/crypto-js/core-min.js \ src/sunstone/public/vendor/crypto-js/enc-base64-min.js \ src/sunstone/public/vendor/crypto-js/NEW-BSD-LICENSE.txt" +SUNSTONE_PUBLIC_VENDOR_EXPLORERCANVAS="\ +src/sunstone/public/vendor/explorercanvas/excanvas.compiled.js \ +src/sunstone/public/vendor/explorercanvas/NOTICE \ +src/sunstone/public/vendor/explorercanvas/LICENSE.txt" + SUNSTONE_PUBLIC_VENDOR_FILEUPLOADER="\ src/sunstone/public/vendor/fileuploader/NOTICE \ src/sunstone/public/vendor/fileuploader/fileuploader.js" diff --git a/src/sunstone/public/js/locale.js b/src/sunstone/public/js/locale.js index fedfc42cc6..b53137fc6a 100644 --- a/src/sunstone/public/js/locale.js +++ b/src/sunstone/public/js/locale.js @@ -63,7 +63,7 @@ function setLang(lang_str){ $.post('config',JSON.stringify({lang:lang_tmp}),function(){ window.location.href = "."; }); - }, + } }; OpenNebula.User.update(obj); @@ -74,7 +74,7 @@ function setLang(lang_str){ if (whichUI() == "sunstone"){ var obj = { data : { - id: uid, + id: uid }, success: updateUserTemplate }; diff --git a/src/sunstone/public/js/login.js b/src/sunstone/public/js/login.js index 6b460d35c0..a1012c14e6 100644 --- a/src/sunstone/public/js/login.js +++ b/src/sunstone/public/js/login.js @@ -55,6 +55,32 @@ function authenticate(){ }); } +function getInternetExplorerVersion(){ +// Returns the version of Internet Explorer or a -1 +// (indicating the use of another browser). + var rv = -1; // Return value assumes failure. + if (navigator.appName == 'Microsoft Internet Explorer') + { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat( RegExp.$1 ); + } + return rv; +} + +function checkVersion(){ + var ver = getInternetExplorerVersion(); + + if ( ver > -1 ){ + msg = ver <= 7.0 ? "You are using an old version of IE. \ +Please upgrade or use Firefox or Chrome for full compatibility." : + "OpenNebula Sunstone is best seen with Chrome or Firefox"; + $("#error_box").text(msg); + $("#error_box").fadeIn('slow'); + } +} + $(document).ready(function(){ $("#login_form").submit(function (){ authenticate(); @@ -70,4 +96,6 @@ $(document).ready(function(){ $("input#username.box").focus(); $("#login_spinner").hide(); + + checkVersion(); }); diff --git a/src/sunstone/public/js/monitoring.js b/src/sunstone/public/js/monitoring.js index e2efa88563..98244595e7 100644 --- a/src/sunstone/public/js/monitoring.js +++ b/src/sunstone/public/js/monitoring.js @@ -222,7 +222,7 @@ var SunstoneMonitoring = { var data = partitions[partition] var color = config.colorize ? config.colorize(partition) : null series.push({ label: partition, - data: data, + data: data }) } return series @@ -261,7 +261,7 @@ var SunstoneMonitoring = { data: [[totals[i],0]], //we paint on 0 value of y axis // y axis labels will be hidden label: paths[i], - color: config.colorize? config.colorize(paths[i]) : null, + color: config.colorize? config.colorize(paths[i]) : null }) } return series diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 1e4ac8a512..2e85940675 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -389,9 +389,16 @@ var OpenNebula = { type: "POST", data: {remember: remember}, beforeSend : function(req) { - req.setRequestHeader( "Authorization", - "Basic " + btoa(username + ":" + password) - ) + var token = username + ':' + password; + var authString = 'Basic '; + if (typeof(btoa) === 'function') + authString += btoa(token) + else { + token = CryptoJS.enc.Utf8.parse(token); + authString += CryptoJS.enc.Base64.stringify(token) + } + + req.setRequestHeader( "Authorization", authString); }, success: function(response){ return callback ? callback(request, response) : null; @@ -484,7 +491,7 @@ var OpenNebula = { }, "monitor" : function(params){ OpenNebula.Action.monitor(params,OpenNebula.Host.resource,false); - }, + } }, "Network": { @@ -558,7 +565,7 @@ var OpenNebula = { }, "fetch_template" : function(params){ OpenNebula.Action.show(params,OpenNebula.Network.resource,"template"); - }, + } }, "VM": { @@ -753,7 +760,7 @@ var OpenNebula = { "set_quota" : function(params){ var action_obj = { quotas : params.data.extra_param }; OpenNebula.Action.simple_action(params,OpenNebula.User.resource,"set_quota",action_obj); - }, + } // "addgroup" : function(params){ // var action_obj = {"group_id": params.data.extra_param }; @@ -995,7 +1002,7 @@ var OpenNebula = { }, "fetch_template" : function(params){ OpenNebula.Action.show(params,OpenNebula.Datastore.resource,"template"); - }, + } }, "Marketplace" : { @@ -1023,8 +1030,8 @@ var OpenNebula = { }, error: function(res){ return callback_error ? callback_error(request, OpenNebula.Error(res)) : null; - }, + } }); - }, - }, + } + } } diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 2189989d69..fc08166d59 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -150,7 +150,7 @@ var acl_actions = { hideDialog(); $('div#acls_tab div.legend_div').slideToggle(); } - }, + } } var acl_buttons = { @@ -172,7 +172,6 @@ var acl_buttons = { text: '?', alwaysActive: true } - } var acls_tab = { @@ -192,7 +191,7 @@ SunstoneMonitoringConfig['ACL'] = { "totalAcls" : { operation: SunstoneMonitoring.ops.totalize } - }, + } } diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index ddae85b026..57baa73a5d 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -120,7 +120,7 @@ var cluster_actions = { callback : function (req) { Sunstone.runAction("Host.show",req.request.data[0][1].host_id); }, - error : onError, + error : onError }, "Cluster.delhost" : { @@ -138,7 +138,7 @@ var cluster_actions = { callback : function (req) { Sunstone.runAction("Datastore.show",req.request.data[0][1].ds_id); }, - error : onError, + error : onError }, "Cluster.deldatastore" : { @@ -147,7 +147,7 @@ var cluster_actions = { callback : function (req) { Sunstone.runAction("Datastore.show",req.request.data[0][1].ds_id); }, - error : onError, + error : onError }, "Cluster.addvnet" : { @@ -156,7 +156,7 @@ var cluster_actions = { callback : function (req) { Sunstone.runAction("Network.show",req.request.data[0][1].vnet_id); }, - error : onError, + error : onError }, "Cluster.delvnet" : { @@ -165,7 +165,7 @@ var cluster_actions = { callback : function (req) { Sunstone.runAction("Network.show",req.request.data[0][1].vnet_id); }, - error : onError, + error : onError }, "Cluster.delete" : { @@ -205,8 +205,8 @@ var cluster_actions = { [], []), clusterElements()); - }, - }, + } + } }; var cluster_buttons = { @@ -255,7 +255,7 @@ var clusters_tab = { buttons: cluster_buttons, showOnTopMenu: false, tabClass: "topTab subTab", - parentTab: "infra_tab", + parentTab: "infra_tab" }; @@ -311,7 +311,7 @@ SunstoneMonitoringConfig['CLUSTER_HOST'] = { dataType: "pie", operation: SunstoneMonitoring.ops.hostCpuUsagePartition, plotOptions: { - series: { pie: { show: true } }, + series: { pie: { show: true } } } }, "cpuUsageBar" : { @@ -364,7 +364,7 @@ SunstoneMonitoringConfig['CLUSTER_HOST'] = { } } } - }, + } } } @@ -907,7 +907,7 @@ function setupCreateClusterDialog(){ var cluster_json = { "cluster": { - "name": $('#name',this).val(), + "name": $('#name',this).val() } }; @@ -990,7 +990,7 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0] }, - { "sWidth": "35px", "aTargets": [1,3,4,5] }, + { "sWidth": "35px", "aTargets": [1,3,4,5] } ], "oLanguage": (datatable_lang != "") ? { diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index c8c1008806..ed49cb8b5e 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -70,14 +70,14 @@ var config_actions = { call: OpenNebula.Config.list, callback: updateConfig, error: onError - }, + } }; var config_tab = { title: tr("Configuration"), content: config_tab_content, tabClass: "subTab", - parentTab: "dashboard_tab", + parentTab: "dashboard_tab" }; Sunstone.addActions(config_actions); @@ -103,7 +103,7 @@ function updateConfig(request,response){ function updateWss(){ var user_info_req = { data : { - id: uid, + id: uid }, success: function(req,user_json) { var template = user_json.USER.TEMPLATE; @@ -123,7 +123,7 @@ function updateWss(){ error: onError }; OpenNebula.User.update(request); - }, + } }; OpenNebula.User.show(user_info_req); $.post('config',JSON.stringify({wss : ($('#config_table #wss_checkbox').is(':checked') ? "yes" : "no")})); diff --git a/src/sunstone/public/js/plugins/dashboard-tab.js b/src/sunstone/public/js/plugins/dashboard-tab.js index 5993d5b06a..42cc399ab2 100644 --- a/src/sunstone/public/js/plugins/dashboard-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-tab.js @@ -181,7 +181,7 @@ var dashboard_tab_content = var dashboard_tab = { title: ''+tr("Dashboard"), content: dashboard_tab_content, - showOnTopMenu: false, + showOnTopMenu: false } Sunstone.addMainTab('dashboard_tab',dashboard_tab); diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 3b5f79a5df..6e9f886618 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -207,7 +207,7 @@ var datastore_actions = { "Datastore.update_dialog" : { type: "custom", - call: popUpDatastoreTemplateUpdateDialog, + call: popUpDatastoreTemplateUpdateDialog }, "Datastore.update" : { @@ -284,7 +284,7 @@ var datastore_actions = { Sunstone.runAction("Cluster.adddatastore",cluster,ds); }, elements: datastoreElements, - notify:true, + notify:true }, "Datastore.help" : { @@ -293,8 +293,7 @@ var datastore_actions = { hideDialog(); $('div#datastores_tab div.legend_div').slideToggle(); } - }, - + } }; var datastore_buttons = { @@ -306,20 +305,20 @@ var datastore_buttons = { "Datastore.create_dialog" : { type: "create_dialog", text: tr("+ New"), - condition: mustBeAdmin, + condition: mustBeAdmin }, "Datastore.update_dialog" : { type: "action", text: tr("Update properties"), alwaysActive: true, - condition: mustBeAdmin, + condition: mustBeAdmin }, "Datastore.addtocluster" : { type: "confirm_with_select", text: tr("Select cluster"), select: clusters_sel, tip: tr("Select the destination cluster:"), - condition: mustBeAdmin, + condition: mustBeAdmin }, "Datastore.chown" : { type: "confirm_with_select", @@ -356,7 +355,7 @@ var datastore_info_panel = { "datastore_template_tab" : { title: tr("Datastore template"), content: "" - }, + } } var datastores_tab = { @@ -365,7 +364,7 @@ var datastores_tab = { buttons: datastore_buttons, tabClass: "subTab", parentTab: "infra_tab", - showOnTopMenu: false, + showOnTopMenu: false } Sunstone.addActions(datastore_actions); @@ -608,7 +607,7 @@ function setupDatastoreTemplateUpdateDialog(){ width:500, modal:true, height:height, - resizable:true, + resizable:true }); $('button',dialog).button(); diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 5b23eb9a5b..37aeaf0390 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -139,7 +139,7 @@ var group_actions = { type: "list", call: OpenNebula.Group.list, callback: updateGroupsView, - error: onError, + error: onError }, "Group.show" : { @@ -223,7 +223,7 @@ var group_actions = { hideDialog(); $('div#groups_tab div.legend_div').slideToggle(); } - }, + } } var group_buttons = { @@ -247,7 +247,7 @@ var group_buttons = { "Group.quotas_dialog" : { type : "action", text : tr("Update quotas"), - condition: mustBeAdmin, + condition: mustBeAdmin }, "Group.delete" : { type: "confirm", @@ -265,7 +265,7 @@ var group_info_panel = { "group_info_tab" : { title: tr("Group information"), content:"" - }, + } }; var groups_tab = { @@ -296,7 +296,7 @@ SunstoneMonitoringConfig['GROUP'] = { "totalGroups" : { operation: SunstoneMonitoring.ops.totalize } - }, + } } Sunstone.addActions(group_actions); diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 4c18260eb3..4849013234 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -290,7 +290,7 @@ var host_actions = { }, callback: null, elements: hostElements, - notify:true, + notify:true }, "Host.help" : { @@ -372,7 +372,7 @@ var hosts_tab = { buttons: host_buttons, tabClass: "subTab", parentTab: "infra_tab", - showOnTopMenu: false, + showOnTopMenu: false }; @@ -473,7 +473,7 @@ SunstoneMonitoringConfig['HOST'] = { dataType: "pie", operation: SunstoneMonitoring.ops.hostCpuUsagePartition, plotOptions: { - series: { pie: { show: true } }, + series: { pie: { show: true } } } }, "totalHosts" : { //count number of hosts @@ -530,7 +530,7 @@ SunstoneMonitoringConfig['HOST'] = { } } } - }, + } } } diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index ef49c60c70..3d99b58206 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -282,7 +282,7 @@ var image_actions = { call: function () { waitingNodes(dataTable_images); Sunstone.runAction("Image.list"); - }, + } }, "Image.autorefresh" : { @@ -314,7 +314,7 @@ var image_actions = { "Image.update_dialog" : { type: "custom", - call: popUpImageTemplateUpdateDialog, + call: popUpImageTemplateUpdateDialog }, "Image.update" : { @@ -491,7 +491,7 @@ var image_buttons = { }, "Image.clone_dialog" : { type: "action", - text: tr("Clone"), + text: tr("Clone") }, "Image.delete" : { type: "confirm", @@ -787,7 +787,7 @@ function setupCreateImageDialog(){ width: "258px", // left: "133px", height: "15px", - display: "inline-block", + display: "inline-block" }); $('#upload-progress div',dialog).css("border","1px solid #AAAAAA"); @@ -841,7 +841,7 @@ function setupCreateImageDialog(){ return false; }, onCancel: function(id, fileName){ - }, + } }); var file_input = false; @@ -947,7 +947,7 @@ function setupCreateImageDialog(){ "image" : { "image_raw" : template }, - "ds_id" : ds_id, + "ds_id" : ds_id }; Sunstone.runAction("Image.create",img_obj); $create_image_dialog.dialog('close'); @@ -983,7 +983,7 @@ function setupImageTemplateUpdateDialog(){ width:700, modal:true, height:height, - resizable:false, + resizable:false }); $('button',dialog).button(); @@ -1152,7 +1152,7 @@ function setupImageCloneDialog(){ autoOpen:false, width:375, modal:true, - resizable:false, + resizable:false }); $('button',dialog).button(); diff --git a/src/sunstone/public/js/plugins/marketplace-tab.js b/src/sunstone/public/js/plugins/marketplace-tab.js index 3ffb249040..1a5fd382c8 100644 --- a/src/sunstone/public/js/plugins/marketplace-tab.js +++ b/src/sunstone/public/js/plugins/marketplace-tab.js @@ -115,7 +115,7 @@ var marketplace_tab_content = '\ var marketplace_tab = { title: '' + tr("Marketplace"), content: marketplace_tab_content, - buttons: market_buttons, + buttons: market_buttons }; Sunstone.addMainTab('marketplace_tab', marketplace_tab); @@ -130,7 +130,7 @@ var marketplace_info_panel = { "marketplace_info_tab" : { title: tr("Appliance information"), content:"" - }, + } }; Sunstone.addInfoPanel("marketplace_info_panel", marketplace_info_panel); diff --git a/src/sunstone/public/js/plugins/system-tab.js b/src/sunstone/public/js/plugins/system-tab.js index fd0bbe78f9..8dc7e4519a 100644 --- a/src/sunstone/public/js/plugins/system-tab.js +++ b/src/sunstone/public/js/plugins/system-tab.js @@ -14,8 +14,8 @@ /* limitations under the License. */ /* -------------------------------------------------------------------------- */ -var system_tab_content = -'
\
|