mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
Feature #1302: Add IE support to Ozones
* Fix javascript (cherry picked from commit 19a1f1b5c2132e6fdb7f007ccc849e588d573378)
This commit is contained in:
parent
2686903322
commit
5431376e6f
@ -140,6 +140,7 @@ div#login input#login_btn:hover {
|
||||
position: relative;
|
||||
top: 80px;
|
||||
font-size:1.0em;
|
||||
padding: 2px 15px;
|
||||
}
|
||||
|
||||
#login_spinner {
|
||||
|
@ -56,6 +56,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 Ozones is best seen with Chrome or Firefox";
|
||||
$("#error_box").text(msg);
|
||||
$("#error_box").fadeIn('slow');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#login_form").submit(function (){
|
||||
authenticate();
|
||||
@ -71,4 +97,6 @@ $(document).ready(function(){
|
||||
|
||||
$("input#username.box").focus();
|
||||
$("#login_spinner").hide();
|
||||
|
||||
checkVersion();
|
||||
});
|
||||
|
@ -332,9 +332,16 @@ var oZones = {
|
||||
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;
|
||||
@ -458,7 +465,7 @@ var oZones = {
|
||||
},
|
||||
"datastore": function(params){
|
||||
oZones.Zone.subresource(params,"datastore");
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
"VDC": {
|
||||
@ -478,7 +485,7 @@ var oZones = {
|
||||
},
|
||||
"show": function(params){
|
||||
oZones.Action.show(params,oZones.VDC.resource);
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
"ZoneHosts": {
|
||||
@ -535,5 +542,5 @@ var oZones = {
|
||||
"list": function(params){
|
||||
oZones.Action.list(params,oZones.ZoneDatastores.resource,"datastore");
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
@ -15,8 +15,8 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
var aggregated_hosts_tab_content =
|
||||
'<div class="action_blocks">\
|
||||
var aggregated_hosts_tab_content = '\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_agg_hosts" class="display">\
|
||||
<thead>\
|
||||
@ -38,8 +38,8 @@ var aggregated_hosts_tab_content =
|
||||
<tbody>\
|
||||
</tbody>\
|
||||
</table>';
|
||||
var aggregated_vms_tab_content =
|
||||
'<div class="action_blocks">\
|
||||
var aggregated_vms_tab_content = '\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_agg_vms" class="display">\
|
||||
<thead>\
|
||||
@ -406,71 +406,70 @@ var agg_actions = {
|
||||
success: datastoresListCB,
|
||||
error: onError})
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var hosts_buttons = {
|
||||
"ZoneHosts.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var vms_buttons = {
|
||||
"ZoneVMs.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var vns_buttons = {
|
||||
"ZoneVNs.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var images_buttons = {
|
||||
"ZoneImages.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var users_buttons = {
|
||||
"ZoneUsers.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var templates_buttons = {
|
||||
"ZoneTemplates.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var clusters_buttons = {
|
||||
"ZoneClusters.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
var datastores_buttons = {
|
||||
"ZoneDatastores.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
}
|
||||
};
|
||||
|
||||
@ -601,7 +600,7 @@ function vnsListCB(req,list){
|
||||
|
||||
function imagesListCB(req,list){
|
||||
dataTable_agg_images.fnClearTable();
|
||||
total_images = [];
|
||||
var total_images = [];
|
||||
$.each(list,function(){
|
||||
if (this.ZONE.error){
|
||||
notifyError(this.ZONE.error.message);
|
||||
|
@ -167,7 +167,7 @@ var vdc_actions = {
|
||||
type: "list",
|
||||
call: oZones.VDC.list,
|
||||
callback: updateVDCsView,
|
||||
error: onError,
|
||||
error: onError
|
||||
},
|
||||
|
||||
"VDC.refresh" : {
|
||||
@ -183,7 +183,7 @@ var vdc_actions = {
|
||||
type: "custom",
|
||||
call: function(){
|
||||
oZones.VDC.list({timeout: true, success: updateVDCsView, error: onError});
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
"VDC.delete" : {
|
||||
@ -248,24 +248,23 @@ var vdc_actions = {
|
||||
$('div#create_vdc_dialog select#clusterid').html(options);
|
||||
},
|
||||
error: onError
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var vdc_buttons = {
|
||||
"VDC.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
},
|
||||
"VDC.create_dialog" : {
|
||||
type: "action",
|
||||
text: "+ New",
|
||||
alwaysActive:true
|
||||
alwaysActive: true
|
||||
},
|
||||
"VDC.update_dialog" : {
|
||||
type: "action",
|
||||
text: "Update VDC resources",
|
||||
text: "Update VDC resources"
|
||||
},
|
||||
"VDC.delete" : {
|
||||
type: "action",
|
||||
@ -711,8 +710,8 @@ function setupCreateVDCDialog(){
|
||||
"RESOURCES" : {
|
||||
"HOSTS" : hosts,
|
||||
"DATASTORES" : datastores,
|
||||
"NETWORKS" : vnets,
|
||||
},
|
||||
"NETWORKS" : vnets
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -864,9 +863,9 @@ function setupUpdateVDCDialog(){
|
||||
"RESOURCES": {
|
||||
"HOSTS": hosts,
|
||||
"NETWORKS": vnets,
|
||||
"DATASTORES": datastores,
|
||||
"DATASTORES": datastores
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Sunstone.runAction("VDC.update",id,vdc_json);
|
||||
|
@ -14,8 +14,8 @@
|
||||
/* limitations under the License. */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
var zones_tab_content =
|
||||
'<form id="form_zones" action="javascript:alert(\'js errors?!\')">\
|
||||
var zones_tab_content = '\
|
||||
<form id="form_zones" action="javascript:alert(\'js errors?!\')">\
|
||||
<div class="action_blocks">\
|
||||
</div>\
|
||||
<table id="datatable_zones" class="display">\
|
||||
@ -33,8 +33,8 @@ var zones_tab_content =
|
||||
</form>';
|
||||
|
||||
|
||||
var create_zone_tmpl =
|
||||
'<form id="create_zone_form" action="">\
|
||||
var create_zone_tmpl = '\
|
||||
<form id="create_zone_form" action="">\
|
||||
<fieldset>\
|
||||
<div>\
|
||||
<label for="name">Name:</label>\
|
||||
@ -194,14 +194,14 @@ var zone_actions = {
|
||||
updateDatastoresList(req,json,'#datatable_zone_datastores');
|
||||
},
|
||||
error: onError
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var zone_buttons = {
|
||||
"Zone.refresh" : {
|
||||
type: "image",
|
||||
text: "Refresh list",
|
||||
img: "images/Refresh-icon.png"
|
||||
type: "action",
|
||||
text: '<i class="icon-refresh icon-large">',
|
||||
alwaysActive: true
|
||||
},
|
||||
"Zone.create_dialog" : {
|
||||
type: "action",
|
||||
@ -257,7 +257,7 @@ var zone_info_panel = {
|
||||
"zone_vnets_tab" : {
|
||||
title : "Virtual Networks",
|
||||
content : ""
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Sunstone.addActions(zone_actions);
|
||||
@ -346,8 +346,8 @@ function updateZoneInfo(req,zone_json){
|
||||
};
|
||||
var hosts_tab = {
|
||||
title : "Hosts",
|
||||
content :
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_hosts" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -370,8 +370,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var templates_tab = {
|
||||
title: "Templates",
|
||||
content :
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_templates" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -389,8 +389,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var vms_tab = {
|
||||
title : "Virtual Machines",
|
||||
content :
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_vms" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -413,8 +413,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var vnets_tab = {
|
||||
title : "Virtual Networks",
|
||||
content :
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_vnets" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -435,8 +435,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var images_tab = {
|
||||
title : "Images",
|
||||
content :
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content : '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_images" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -461,8 +461,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var users_tab = {
|
||||
title: "Users",
|
||||
content:
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content: '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_users" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -484,8 +484,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var clusters_tab = {
|
||||
title: "Clusters",
|
||||
content:
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content: '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_clusters" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -504,8 +504,8 @@ function updateZoneInfo(req,zone_json){
|
||||
|
||||
var datastores_tab = {
|
||||
title: "Datastores",
|
||||
content:
|
||||
'<div style="padding: 10px 10px;">\
|
||||
content: '\
|
||||
<div style="padding: 10px 10px;">\
|
||||
<table id="datatable_zone_datastores" class="display">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
@ -631,7 +631,7 @@ function updateZoneInfo(req,zone_json){
|
||||
"sDom" : '<"H"lfrC>t<"F"ip>',
|
||||
"sPaginationType": "full_numbers",
|
||||
"aoColumnDefs": [
|
||||
{ "sWidth": "35px", "aTargets": [0,2,3,4] },
|
||||
{ "sWidth": "35px", "aTargets": [0,2,3,4] }
|
||||
]
|
||||
});
|
||||
|
||||
@ -715,7 +715,7 @@ function setupCreateZoneDialog(){
|
||||
"ONENAME": onename,
|
||||
"ONEPASS": onepass,
|
||||
"SUNSENDPOINT" : se,
|
||||
"SELFENDPOINT" : ss,
|
||||
"SELFENDPOINT" : ss
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,10 @@
|
||||
<link rel="stylesheet" type="text/css" href="vendor/jQueryUI/jquery-ui-1.8.16.custom.css" />
|
||||
<!-- Vendor Libraries -->
|
||||
<script type="text/javascript" src="vendor/jQuery/jquery-1.7.2.min.js"></script>
|
||||
<!--[if IE]>
|
||||
<script type="text/javascript" src="vendor/crypto-js/core-min.js"></script>
|
||||
<script type="text/javascript" src="vendor/crypto-js/enc-base64-min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- End Vendor Libraries -->
|
||||
<script type="text/javascript" src="js/ozones.js"></script>
|
||||
<script type="text/javascript" src="js/login.js"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user