new UI - apply noNull() or fromdb() to all fields that get value from API.

This commit is contained in:
Jessica Wang 2010-11-15 14:05:39 -08:00
parent 0778c13b79
commit 8b106c7271
17 changed files with 94 additions and 108 deletions

View File

@ -46,8 +46,8 @@ function alertJsonToDetailsTab() {
var jsonObj = $midmenuItem1.data("jsonObj"); var jsonObj = $midmenuItem1.data("jsonObj");
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$thisTab.find("#type").text(jsonObj.type); $thisTab.find("#type").text(fromdb(jsonObj.type));
$thisTab.find("#description").text(jsonObj.description); $thisTab.find("#description").text(fromdb(jsonObj.description));
setDateField(jsonObj.sent, $thisTab.find("#sent")); setDateField(jsonObj.sent, $thisTab.find("#sent"));
$thisTab.find("#tab_spinning_wheel").hide(); $thisTab.find("#tab_spinning_wheel").hide();

View File

@ -49,7 +49,8 @@ function clusterJsonToRightPanel($leftmenuItem1) {
function clusterJsonToDetailsTab($leftmenuItem1) { function clusterJsonToDetailsTab($leftmenuItem1) {
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
var $detailsTab = $("#tab_content_details"); var $detailsTab = $("#tab_content_details");
$detailsTab.data("jsonObj", jsonObj); $detailsTab.data("jsonObj", jsonObj);
$detailsTab.find("#id").text(fromdb(jsonObj.id)); $detailsTab.find("#id").text(fromdb(jsonObj.id));
$detailsTab.find("#name").text(fromdb(jsonObj.name)); $detailsTab.find("#name").text(fromdb(jsonObj.name));
$detailsTab.find("#zonename").text(fromdb(jsonObj.zonename)); $detailsTab.find("#zonename").text(fromdb(jsonObj.zonename));

View File

@ -206,7 +206,7 @@ function diskOfferingJsonToDetailsTab() {
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$midmenuItem1.data("jsonObj", jsonObj); $midmenuItem1.data("jsonObj", jsonObj);
$thisTab.find("#id").text(jsonObj.id); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));

View File

@ -69,12 +69,12 @@ function drawNode(json, level, container) {
var template = $("#domain_tree_node_template").clone(true); var template = $("#domain_tree_node_template").clone(true);
template.find("#domain_indent").css("marginLeft", (30*(level+1))); template.find("#domain_indent").css("marginLeft", (30*(level+1)));
template.attr("id", "domain_"+json.id); template.attr("id", "domain_"+noNull(json.id));
template.data("jsonObj", json).data("domainLevel", level); template.data("jsonObj", json).data("domainLevel", level);
template.find("#domain_title_container").attr("id", "domain_title_container_"+json.id); template.find("#domain_title_container").attr("id", "domain_title_container_"+noNull(json.id));
template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+json.id); template.find("#domain_expand_icon").attr("id", "domain_expand_icon_"+noNull(json.id));
template.find("#domain_name").attr("id", "domain_name_"+json.id).text(json.name); template.find("#domain_name").attr("id", "domain_name_"+noNull(json.id)).text(fromdb(json.name));
template.find("#domain_children_container").attr("id", "domain_children_container_"+json.id); template.find("#domain_children_container").attr("id", "domain_children_container_"+noNull(json.id));
container.append(template.show()); container.append(template.show());
return template; return template;
} }

View File

@ -32,8 +32,8 @@ function eventToMidmenu(jsonObj, $midmenuItem1) {
else if(jsonObj.level == "WARN") else if(jsonObj.level == "WARN")
$iconContainer.find("#icon").attr("src", "images/midmenuicon_events_warning.png"); $iconContainer.find("#icon").attr("src", "images/midmenuicon_events_warning.png");
$midmenuItem1.find("#first_row").text(jsonObj.description.substring(0,25)); $midmenuItem1.find("#first_row").text(fromdb(jsonObj.description).substring(0,25));
$midmenuItem1.find("#second_row").text(jsonObj.type.substring(0,25)); $midmenuItem1.find("#second_row").text(fromdb(jsonObj.type).substring(0,25));
} }
function eventToRightPanel($midmenuItem1) { function eventToRightPanel($midmenuItem1) {
@ -51,13 +51,13 @@ function eventJsonToDetailsTab() {
var jsonObj = $midmenuItem1.data("jsonObj"); var jsonObj = $midmenuItem1.data("jsonObj");
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#username").text(fromdb(jsonObj.username)); $thisTab.find("#username").text(fromdb(jsonObj.username));
$thisTab.find("#account").text(fromdb(jsonObj.account)); $thisTab.find("#account").text(fromdb(jsonObj.account));
$thisTab.find("#type").text(jsonObj.type); $thisTab.find("#type").text(fromdb(jsonObj.type));
$thisTab.find("#level").text(jsonObj.level); $thisTab.find("#level").text(fromdb(jsonObj.level));
$thisTab.find("#description").text(fromdb(jsonObj.description)); $thisTab.find("#description").text(fromdb(jsonObj.description));
$thisTab.find("#state").text(jsonObj.state); $thisTab.find("#state").text(fromdb(jsonObj.state));
setDateField(jsonObj.created, $thisTab.find("#created")); setDateField(jsonObj.created, $thisTab.find("#created"));
$thisTab.find("#tab_spinning_wheel").hide(); $thisTab.find("#tab_spinning_wheel").hide();

View File

@ -66,7 +66,7 @@ function hostJsonToDetailsTab() {
var jsonObj = $midmenuItem1.data("jsonObj"); var jsonObj = $midmenuItem1.data("jsonObj");
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));

View File

@ -1322,7 +1322,7 @@ function vmJsonToDetailsTab(){
resetViewConsoleAction(jsonObj, $thisTab); resetViewConsoleAction(jsonObj, $thisTab);
setVmStateInRightPanel(jsonObj.state, $thisTab.find("#state")); setVmStateInRightPanel(jsonObj.state, $thisTab.find("#state"));
$thisTab.find("#ipAddress").text(jsonObj.ipaddress); $thisTab.find("#ipAddress").text(noNull(jsonObj.ipaddress));
$thisTab.find("#zoneName").text(fromdb(jsonObj.zonename)); $thisTab.find("#zoneName").text(fromdb(jsonObj.zonename));
@ -1347,7 +1347,6 @@ function vmJsonToDetailsTab(){
setBooleanReadField(jsonObj.haenable, $thisTab.find("#haenable")); setBooleanReadField(jsonObj.haenable, $thisTab.find("#haenable"));
setBooleanEditField(jsonObj.haenable, $thisTab.find("#haenable_edit")); setBooleanEditField(jsonObj.haenable, $thisTab.find("#haenable_edit"));
//$thisTab.find("#haenable_edit").val(jsonObj.haenable);
setBooleanReadField((jsonObj.isoid != null), $thisTab.find("#iso")); setBooleanReadField((jsonObj.isoid != null), $thisTab.find("#iso"));
@ -1533,15 +1532,15 @@ var vmVolumeActionMap = {
} }
function vmVolumeJSONToTemplate(json, $template) { function vmVolumeJSONToTemplate(json, $template) {
$template.attr("id","vm_volume_"+json.id); $template.attr("id","vm_volume_"+noNull(json.id));
$template.data("jsonObj", json); $template.data("jsonObj", json);
$template.find("#title").text(fromdb(json.name)); $template.find("#title").text(fromdb(json.name));
$template.find("#id").text(json.id); $template.find("#id").text(noNull(json.id));
$template.find("#name").text(fromdb(json.name)); $template.find("#name").text(fromdb(json.name));
if (json.storagetype == "shared") if (json.storagetype == "shared")
$template.find("#type").text(json.type + " (shared storage)"); $template.find("#type").text(fromdb(json.type) + " (shared storage)");
else else
$template.find("#type").text(json.type + " (local storage)"); $template.find("#type").text(fromdb(json.type) + " (local storage)");
$template.find("#size").text((json.size == "0") ? "" : convertBytes(json.size)); $template.find("#size").text((json.size == "0") ? "" : convertBytes(json.size));
setDateField(json.created, $template.find("#created")); setDateField(json.created, $template.find("#created"));
@ -1591,8 +1590,8 @@ function vmRouterJSONToTemplate(jsonObj, $template) {
$template.find("#title").text(fromdb(jsonObj.name)); $template.find("#title").text(fromdb(jsonObj.name));
resetViewConsoleAction(jsonObj, $template); resetViewConsoleAction(jsonObj, $template);
setVmStateInRightPanel(jsonObj.state, $template.find("#state")); setVmStateInRightPanel(fromdb(jsonObj.state), $template.find("#state"));
$template.find("#ipAddress").text(jsonObj.publicip); $template.find("#ipAddress").text(noNull(jsonObj.publicip));
$template.find("#zonename").text(fromdb(jsonObj.zonename)); $template.find("#zonename").text(fromdb(jsonObj.zonename));
$template.find("#name").text(fromdb(jsonObj.name)); $template.find("#name").text(fromdb(jsonObj.name));

View File

@ -223,28 +223,18 @@ function ipToRightPanel($midmenuItem1) {
copyActionInfoFromMidMenuToRightPanel($midmenuItem1); copyActionInfoFromMidMenuToRightPanel($midmenuItem1);
$("#right_panel_content").data("$midmenuItem1", $midmenuItem1); $("#right_panel_content").data("$midmenuItem1", $midmenuItem1);
$("#tab_details").click(); $("#tab_details").click();
//Details tab
//ipJsonToDetailsTab($midmenuItem1);
//ipJsonToDetailsTab();
//Port Forwarding tab, Load Balancer tab //Port Forwarding tab, Load Balancer tab
if(isIpManageable(ipObj.domainid, ipObj.account) == true) { if(isIpManageable(ipObj.domainid, ipObj.account) == true) {
$("#tab_port_forwarding, #tab_load_balancer").show(); $("#tab_port_forwarding, #tab_load_balancer").show();
// Only show VPN tab if the IP is the source nat IP // Only show VPN tab if the IP is the source nat IP
if (ipObj.issourcenat == true) { if (ipObj.issourcenat == true) {
$("#tab_vpn").show(); $("#tab_vpn").show();
} }
//ipJsonToPortForwardingTab();
//ipJsonToLoadBalancerTab();
} }
else { else {
$("#tab_port_forwarding, #tab_load_balancer, #tab_vpn").hide(); $("#tab_port_forwarding, #tab_load_balancer, #tab_vpn").hide();
//ipClearPortForwardingTab();
//ipClearLoadBalancerTab();
//$("#tab_details").click();
} }
} }
@ -258,8 +248,8 @@ function ipJsonToPortForwardingTab() {
refreshCreatePortForwardingRow(); refreshCreatePortForwardingRow();
var ipAddress = ipObj.ipaddress; var ipAddress = noNull(ipObj.ipaddress);
if(ipAddress == null || ipAddress.length == 0) if(ipAddress.length == 0)
return; return;
$.ajax({ $.ajax({
data: createURL("command=listPortForwardingRules&ipaddress=" + ipAddress), data: createURL("command=listPortForwardingRules&ipaddress=" + ipAddress),
@ -291,8 +281,8 @@ function ipJsonToLoadBalancerTab() {
refreshCreateLoadBalancerRow(); refreshCreateLoadBalancerRow();
var ipAddress = ipObj.ipaddress; var ipAddress = noNull(ipObj.ipaddress);
if(ipAddress == null || ipAddress.length == 0) if(ipAddress.length == 0)
return; return;
$.ajax({ $.ajax({
data: createURL("command=listLoadBalancerRules&publicip="+ipAddress), data: createURL("command=listLoadBalancerRules&publicip="+ipAddress),
@ -699,7 +689,7 @@ function ipJsonToDetailsTab() {
$thisTab.find("#tab_spinning_wheel").show(); $thisTab.find("#tab_spinning_wheel").show();
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1"); var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
var ipaddress = $midmenuItem1.data("jsonObj").ipaddress; var ipaddress = noNull($midmenuItem1.data("jsonObj").ipaddress);
var ipObj; var ipObj;
$.ajax({ $.ajax({
@ -714,8 +704,9 @@ function ipJsonToDetailsTab() {
}); });
$thisTab.data("jsonObj", ipObj); $thisTab.data("jsonObj", ipObj);
$midmenuItem1.data("jsonObj", ipObj); $midmenuItem1.data("jsonObj", ipObj);
$thisTab.find("#ipaddress").text(fromdb(ipObj.ipaddress)); $thisTab.find("#grid_header_title").text(noNull(ipObj.ipaddress));
$thisTab.find("#ipaddress").text(noNull(ipObj.ipaddress));
$thisTab.find("#zonename").text(fromdb(ipObj.zonename)); $thisTab.find("#zonename").text(fromdb(ipObj.zonename));
$thisTab.find("#vlanname").text(fromdb(ipObj.vlanname)); $thisTab.find("#vlanname").text(fromdb(ipObj.vlanname));
setSourceNatField(ipObj.issourcenat, $thisTab.find("#source_nat")); setSourceNatField(ipObj.issourcenat, $thisTab.find("#source_nat"));
@ -820,29 +811,27 @@ function ipClearPortForwardingTab() {
refreshCreatePortForwardingRow(); refreshCreatePortForwardingRow();
} }
//var portForwardingIndex = 0;
function portForwardingJsonToTemplate(jsonObj, $template) { function portForwardingJsonToTemplate(jsonObj, $template) {
//(portForwardingIndex++ % 2 == 0)? $template.find("#row_container").addClass("smallrow_even"): $template.find("#row_container").addClass("smallrow_odd"); $template.attr("id", "portForwarding_" + noNull(jsonObj.id)).data("portForwardingId", noNull(jsonObj.id));
$template.attr("id", "portForwarding_" + jsonObj.id).data("portForwardingId", jsonObj.id);
$template.find("#row_container #public_port").text(jsonObj.publicport); $template.find("#row_container #public_port").text(noNull(jsonObj.publicport));
$template.find("#row_container_edit #public_port").text(jsonObj.publicport); $template.find("#row_container_edit #public_port").text(noNull(jsonObj.publicport));
$template.find("#row_container #private_port").text(jsonObj.privateport); $template.find("#row_container #private_port").text(noNull(jsonObj.privateport));
$template.find("#row_container_edit #private_port").val(jsonObj.privateport); $template.find("#row_container_edit #private_port").val(noNull(jsonObj.privateport));
$template.find("#row_container #protocol").text(jsonObj.protocol); $template.find("#row_container #protocol").text(fromdb(jsonObj.protocol));
$template.find("#row_container_edit #protocol").text(jsonObj.protocol); $template.find("#row_container_edit #protocol").text(fromdb(jsonObj.protocol));
var vmName = getVmName(jsonObj.vmname, jsonObj.vmdisplayname); //jsonObj doesn't include vmdisplayname property(incorrect). Waiting for Bug 6241 to be fixed.... var vmName = getVmName(jsonObj.vmname, jsonObj.vmdisplayname); //jsonObj doesn't include vmdisplayname property(incorrect). Waiting for Bug 6241 to be fixed....
$template.find("#row_container #vm_name").text(vmName); $template.find("#row_container #vm_name").text(vmName);
var virtualMachineId = jsonObj.virtualmachineid; var virtualMachineId = noNull(jsonObj.virtualmachineid);
var $detailsTab = $("#right_panel_content #tab_content_details"); var $detailsTab = $("#right_panel_content #tab_content_details");
var ipObj = $detailsTab.data("jsonObj"); var ipObj = $detailsTab.data("jsonObj");
var ipAddress = ipObj.ipaddress; var ipAddress = noNull(ipObj.ipaddress);
var IpDomainid = ipObj.domainid; var IpDomainid = noNull(ipObj.domainid);
var IpAccount = ipObj.account; var IpAccount = fromdb(ipObj.account);
$.ajax({ $.ajax({
data: createURL("command=listVirtualMachines&domainid="+IpDomainid+"&account="+IpAccount), data: createURL("command=listVirtualMachines&domainid="+IpDomainid+"&account="+IpAccount),
@ -852,7 +841,7 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
var vmSelect = $template.find("#row_container_edit #vm").empty(); var vmSelect = $template.find("#row_container_edit #vm").empty();
if (instances != null && instances.length > 0) { if (instances != null && instances.length > 0) {
for (var i = 0; i < instances.length; i++) { for (var i = 0; i < instances.length; i++) {
var html = $("<option value='" + instances[i].id + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>"); var html = $("<option value='" + noNull(instances[i].id) + "'>" + getVmName(instances[i].name, instances[i].displayname) + "</option>");
vmSelect.append(html); vmSelect.append(html);
} }
vmSelect.val(virtualMachineId); vmSelect.val(virtualMachineId);
@ -868,7 +857,7 @@ function portForwardingJsonToTemplate(jsonObj, $template) {
$spinningWheel.find("#description").text("Deleting...."); $spinningWheel.find("#description").text("Deleting....");
$spinningWheel.show(); $spinningWheel.show();
$.ajax({ $.ajax({
data: createURL("command=deletePortForwardingRule&id="+jsonObj.id), data: createURL("command=deletePortForwardingRule&id="+noNull(jsonObj.id)),
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
$template.slideUp("slow", function(){ $template.slideUp("slow", function(){
@ -997,22 +986,20 @@ function ipClearLoadBalancerTab() {
} }
function loadBalancerJsonToTemplate(jsonObj, $template) { function loadBalancerJsonToTemplate(jsonObj, $template) {
//(loadBalancerIndex++ % 2 == 0)? $template.find("#row_container").addClass("smallrow_even"): $template.find("#row_container").addClass("smallrow_odd"); var loadBalancerId = noNull(jsonObj.id);
var loadBalancerId = jsonObj.id;
$template.attr("id", "loadBalancer_" + loadBalancerId).data("loadBalancerId", loadBalancerId); $template.attr("id", "loadBalancer_" + loadBalancerId).data("loadBalancerId", loadBalancerId);
$template.find("#row_container #name").text(fromdb(jsonObj.name)); $template.find("#row_container #name").text(fromdb(jsonObj.name));
$template.find("#row_container_edit #name").val(fromdb(jsonObj.name)); $template.find("#row_container_edit #name").val(fromdb(jsonObj.name));
$template.find("#row_container #public_port").text(jsonObj.publicport); $template.find("#row_container #public_port").text(noNull(jsonObj.publicport));
$template.find("#row_container_edit #public_port").text(jsonObj.publicport); $template.find("#row_container_edit #public_port").text(noNull(jsonObj.publicport));
$template.find("#row_container #private_port").text(jsonObj.privateport); $template.find("#row_container #private_port").text(noNull(jsonObj.privateport));
$template.find("#row_container_edit #private_port").val(jsonObj.privateport); $template.find("#row_container_edit #private_port").val(noNull(jsonObj.privateport));
$template.find("#row_container #algorithm").text(jsonObj.algorithm); $template.find("#row_container #algorithm").text(fromdb(jsonObj.algorithm));
$template.find("#row_container_edit #algorithm").val(jsonObj.algorithm); $template.find("#row_container_edit #algorithm").val(fromdb(jsonObj.algorithm));
$template.find("#manage_link").unbind("click").bind("click", function(event){ $template.find("#manage_link").unbind("click").bind("click", function(event){
var $managementArea = $template.find("#management_area"); var $managementArea = $template.find("#management_area");
@ -1259,13 +1246,13 @@ function refreshCreateLoadBalancerRow() {
function lbVmObjToTemplate(obj, $template) { function lbVmObjToTemplate(obj, $template) {
$template.find("#vm_name").text(obj.vmName); $template.find("#vm_name").text(obj.vmName);
$template.find("#vm_private_ip").text(obj.vmPrivateIp); $template.find("#vm_private_ip").text(noNull(obj.vmPrivateIp));
$template.find("#remove_link").bind("click", function(event){ $template.find("#remove_link").bind("click", function(event){
var $spinningWheel = $template.find("#spinning_wheel"); var $spinningWheel = $template.find("#spinning_wheel");
$spinningWheel.show(); $spinningWheel.show();
$.ajax({ $.ajax({
data: createURL("command=removeFromLoadBalancerRule&id="+obj.loadBalancerId+"&virtualmachineid="+obj.vmId), data: createURL("command=removeFromLoadBalancerRule&id="+noNull(obj.loadBalancerId)+"&virtualmachineid="+noNull(obj.vmId)),
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
var lbJSON = json.removefromloadbalancerruleresponse; var lbJSON = json.removefromloadbalancerruleresponse;

View File

@ -217,7 +217,7 @@ function isoJsonToDetailsTab() {
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename)); $thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));
@ -226,7 +226,7 @@ function isoJsonToDetailsTab() {
$thisTab.find("#displaytext").text(fromdb(jsonObj.displaytext)); $thisTab.find("#displaytext").text(fromdb(jsonObj.displaytext));
$thisTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext)); $thisTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext));
$thisTab.find("#ostypename").text(fromdb(jsonObj.ostypename)); $thisTab.find("#ostypename").text(fromdb(jsonObj.ostypename));
$thisTab.find("#ostypename_edit").val(jsonObj.ostypeid); $thisTab.find("#ostypename_edit").val(noNull(jsonObj.ostypeid));
$thisTab.find("#account").text(fromdb(jsonObj.account)); $thisTab.find("#account").text(fromdb(jsonObj.account));
$thisTab.find("#domain").text(fromdb(jsonObj.domain)); $thisTab.find("#domain").text(fromdb(jsonObj.domain));

View File

@ -53,7 +53,7 @@ function podJsonToDetailsTab() {
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));
@ -73,7 +73,7 @@ function podJsonToDetailsTab() {
// hide network tab upon zone vlan // hide network tab upon zone vlan
var zoneVlan; var zoneVlan;
$.ajax({ $.ajax({
data: createURL("command=listZones&id="+jsonObj.zoneid), data: createURL("command=listZones&id="+noNull(jsonObj.zoneid)),
dataType: "json", dataType: "json",
async: false, async: false,
success: function(json) { success: function(json) {
@ -125,7 +125,7 @@ function podJsonToNetworkTab() {
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
$.ajax({ $.ajax({
data: createURL("command=listVlanIpRanges&zoneid="+jsonObj.zoneid+"&podid="+jsonObj.id), data: createURL("command=listVlanIpRanges&zoneid="+noNull(jsonObj.zoneid)+"&podid="+noNull(jsonObj.id)),
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
var items = json.listvlaniprangesresponse.vlaniprange; var items = json.listvlaniprangesresponse.vlaniprange;
@ -146,13 +146,13 @@ function podJsonToNetworkTab() {
function podNetworkJsonToTemplate(jsonObj, template) { function podNetworkJsonToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj); template.data("jsonObj", jsonObj);
template.attr("id", "pod_VLAN_"+jsonObj.id).data("podVLANId", jsonObj.id); template.attr("id", "pod_VLAN_"+noNull(jsonObj.id)).data("podVLANId", noNull(jsonObj.id));
template.find("#grid_header_title").text(fromdb(jsonObj.description)); template.find("#grid_header_title").text(fromdb(jsonObj.description));
template.find("#id").text(jsonObj.id); template.find("#id").text(noNull(jsonObj.id));
template.find("#iprange").text(jsonObj.description); template.find("#iprange").text(fromdb(jsonObj.description));
template.find("#netmask").text(jsonObj.netmask); template.find("#netmask").text(noNull(jsonObj.netmask));
template.find("#gateway").text(jsonObj.gateway); template.find("#gateway").text(noNull(jsonObj.gateway));
template.find("#podname").text(jsonObj.podname); template.find("#podname").text(fromdb(jsonObj.podname));
var $actionLink = template.find("#network_action_link"); var $actionLink = template.find("#network_action_link");
$actionLink.bind("mouseover", function(event) { $actionLink.bind("mouseover", function(event) {

View File

@ -52,8 +52,9 @@ function primarystorageToRightPanel($midmenuItem1) {
function primarystorageJsonToDetailsTab($midmenuItem1) { function primarystorageJsonToDetailsTab($midmenuItem1) {
var jsonObj = $midmenuItem1.data("jsonObj"); var jsonObj = $midmenuItem1.data("jsonObj");
var $detailsTab = $("#tab_content_details"); var $detailsTab = $("#tab_content_details");
$detailsTab.data("jsonObj", jsonObj); $detailsTab.data("jsonObj", jsonObj);
$detailsTab.find("#id").text(fromdb(jsonObj.id));
$detailsTab.find("#id").text(noNull(jsonObj.id));
$detailsTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $detailsTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$detailsTab.find("#name").text(fromdb(jsonObj.name)); $detailsTab.find("#name").text(fromdb(jsonObj.name));
@ -63,9 +64,10 @@ function primarystorageJsonToDetailsTab($midmenuItem1) {
$detailsTab.find("#podname").text(fromdb(jsonObj.podname)); $detailsTab.find("#podname").text(fromdb(jsonObj.podname));
$detailsTab.find("#clustername").text(fromdb(jsonObj.clustername)); $detailsTab.find("#clustername").text(fromdb(jsonObj.clustername));
var storageType = "ISCSI Share"; var storageType = "ISCSI Share";
if (jsonObj.type == 'NetworkFilesystem') storageType = "NFS Share"; if (jsonObj.type == 'NetworkFilesystem')
$detailsTab.find("#type").text(storageType); storageType = "NFS Share";
$detailsTab.find("#ipaddress").text(fromdb(jsonObj.ipaddress)); $detailsTab.find("#type").text(fromdb(storageType));
$detailsTab.find("#ipaddress").text(noNull(jsonObj.ipaddress));
$detailsTab.find("#path").text(fromdb(jsonObj.path)); $detailsTab.find("#path").text(fromdb(jsonObj.path));
$detailsTab.find("#disksizetotal").text(convertBytes(jsonObj.disksizetotal)); $detailsTab.find("#disksizetotal").text(convertBytes(jsonObj.disksizetotal));
$detailsTab.find("#disksizeallocated").text(convertBytes(jsonObj.disksizeallocated)); $detailsTab.find("#disksizeallocated").text(convertBytes(jsonObj.disksizeallocated));

View File

@ -25,8 +25,7 @@ function routerToMidmenu(jsonObj, $midmenuItem1) {
$midmenuItem1.data("jsonObj", jsonObj); $midmenuItem1.data("jsonObj", jsonObj);
$midmenuItem1.find("#first_row").text(jsonObj.name.substring(0,25)); $midmenuItem1.find("#first_row").text(jsonObj.name.substring(0,25));
if(jsonObj.publicip != null) //jsonObj.publicip is null while router state is Stopped $midmenuItem1.find("#second_row").text(fromdb(jsonObj.publicip).substring(0,25));
$midmenuItem1.find("#second_row").text(jsonObj.publicip.substring(0,25));
updateVmStateInMidMenu(jsonObj, $midmenuItem1); updateVmStateInMidMenu(jsonObj, $midmenuItem1);
} }

View File

@ -216,7 +216,7 @@ function serviceOfferingJsonToDetailsTab() {
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$midmenuItem1.data("jsonObj", jsonObj); $midmenuItem1.data("jsonObj", jsonObj);
$thisTab.find("#id").text(jsonObj.id); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));
@ -225,7 +225,7 @@ function serviceOfferingJsonToDetailsTab() {
$thisTab.find("#displaytext").text(fromdb(jsonObj.displaytext)); $thisTab.find("#displaytext").text(fromdb(jsonObj.displaytext));
$thisTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext)); $thisTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext));
$thisTab.find("#storagetype").text(jsonObj.storagetype); $thisTab.find("#storagetype").text(fromdb(jsonObj.storagetype));
$thisTab.find("#cpu").text(jsonObj.cpunumber + " x " + convertHz(jsonObj.cpuspeed)); $thisTab.find("#cpu").text(jsonObj.cpunumber + " x " + convertHz(jsonObj.cpuspeed));
$thisTab.find("#memory").text(convertBytes(parseInt(jsonObj.memory)*1024*1024)); $thisTab.find("#memory").text(convertBytes(parseInt(jsonObj.memory)*1024*1024));

View File

@ -56,10 +56,10 @@ function systemvmJsonToDetailsTab() {
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
resetViewConsoleAction(jsonObj, $thisTab); resetViewConsoleAction(jsonObj, $thisTab);
setVmStateInRightPanel(jsonObj.state, $thisTab.find("#state")); setVmStateInRightPanel(fromdb(jsonObj.state), $thisTab.find("#state"));
$thisTab.find("#ipAddress").text(jsonObj.publicip); $thisTab.find("#ipAddress").text(noNull(jsonObj.publicip));
$thisTab.find("#state").text(jsonObj.state); $thisTab.find("#state").text(fromdb(jsonObj.state));
$thisTab.find("#systemvmtype").text(toSystemVMTypeText(jsonObj.systemvmtype)); $thisTab.find("#systemvmtype").text(toSystemVMTypeText(jsonObj.systemvmtype));
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename)); $thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(fromdb(jsonObj.id));

View File

@ -243,7 +243,7 @@ function templateJsonToDetailsTab() {
$thisTab.find("#grid_header_title").text(fromdb(jsonObj.name)); $thisTab.find("#grid_header_title").text(fromdb(jsonObj.name));
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename)); $thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));
@ -264,15 +264,12 @@ function templateJsonToDetailsTab() {
setBooleanReadField(jsonObj.passwordenabled, $thisTab.find("#passwordenabled")); setBooleanReadField(jsonObj.passwordenabled, $thisTab.find("#passwordenabled"));
setBooleanEditField(jsonObj.passwordenabled, $thisTab.find("#passwordenabled_edit")); setBooleanEditField(jsonObj.passwordenabled, $thisTab.find("#passwordenabled_edit"));
//$thisTab.find("#passwordenabled_edit").val(jsonObj.passwordenabled);
setBooleanReadField(jsonObj.ispublic, $thisTab.find("#ispublic")); setBooleanReadField(jsonObj.ispublic, $thisTab.find("#ispublic"));
setBooleanEditField(jsonObj.ispublic, $thisTab.find("#ispublic_edit")); setBooleanEditField(jsonObj.ispublic, $thisTab.find("#ispublic_edit"));
//$thisTab.find("#ispublic_edit").val(jsonObj.ispublic);
setBooleanReadField(jsonObj.isfeatured, $thisTab.find("#isfeatured")); setBooleanReadField(jsonObj.isfeatured, $thisTab.find("#isfeatured"));
setBooleanEditField(jsonObj.isfeatured, $thisTab.find("#isfeatured_edit")); setBooleanEditField(jsonObj.isfeatured, $thisTab.find("#isfeatured_edit"));
//$thisTab.find("#isfeatured_edit").val(jsonObj.isfeatured);
setBooleanReadField(jsonObj.crossZones, $thisTab.find("#crossZones")); setBooleanReadField(jsonObj.crossZones, $thisTab.find("#crossZones"));

View File

@ -309,7 +309,7 @@ function volumeJsonToDetailsTab(){
$thisTab.find("#tab_spinning_wheel").show(); $thisTab.find("#tab_spinning_wheel").show();
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1"); var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
var id = $midmenuItem1.data("jsonObj").id; var id = noNull($midmenuItem1.data("jsonObj").id);
var jsonObj; var jsonObj;
$.ajax({ $.ajax({
@ -325,7 +325,7 @@ function volumeJsonToDetailsTab(){
$thisTab.data("jsonObj", jsonObj); $thisTab.data("jsonObj", jsonObj);
$midmenuItem1.data("jsonObj", jsonObj); $midmenuItem1.data("jsonObj", jsonObj);
$thisTab.find("#id").text(fromdb(jsonObj.id)); $thisTab.find("#id").text(noNull(jsonObj.id));
$thisTab.find("#name").text(fromdb(jsonObj.name)); $thisTab.find("#name").text(fromdb(jsonObj.name));
$thisTab.find("#zonename").text(fromdb(jsonObj.zonename)); $thisTab.find("#zonename").text(fromdb(jsonObj.zonename));
$thisTab.find("#device_id").text(fromdb(jsonObj.deviceid)); $thisTab.find("#device_id").text(fromdb(jsonObj.deviceid));
@ -374,7 +374,7 @@ function volumeJsonToDetailsTab(){
$thisTab.find("#tab_container").show(); $thisTab.find("#tab_container").show();
} }
function volumeJsonToSnapshotTab() { function volumeJsonToSnapshotTab() {
var $thisTab = $("#right_panel_content #tab_content_snapshot"); var $thisTab = $("#right_panel_content #tab_content_snapshot");
$thisTab.find("#tab_container").hide(); $thisTab.find("#tab_container").hide();
$thisTab.find("#tab_spinning_wheel").show(); $thisTab.find("#tab_spinning_wheel").show();
@ -384,7 +384,7 @@ function volumeJsonToSnapshotTab() {
$.ajax({ $.ajax({
cache: false, cache: false,
data: createURL("command=listSnapshots&volumeid="+jsonObj.id+maxPageSize), data: createURL("command=listSnapshots&volumeid="+noNull(jsonObj.id)),
dataType: "json", dataType: "json",
success: function(json) { success: function(json) {
var items = json.listsnapshotsresponse.snapshot; var items = json.listsnapshotsresponse.snapshot;
@ -405,12 +405,12 @@ function volumeJsonToSnapshotTab() {
function volumeSnapshotJSONToTemplate(jsonObj, template) { function volumeSnapshotJSONToTemplate(jsonObj, template) {
template.data("jsonObj", jsonObj); template.data("jsonObj", jsonObj);
template.attr("id", "volume_snapshot_"+jsonObj.id).data("volumeSnapshotId", jsonObj.id); template.attr("id", "volume_snapshot_"+noNull(jsonObj.id)).data("volumeSnapshotId", noNull(jsonObj.id));
template.find("#grid_header_title").text(fromdb(jsonObj.name)); template.find("#grid_header_title").text(fromdb(jsonObj.name));
template.find("#id").text(jsonObj.id); template.find("#id").text(noNull(jsonObj.id));
template.find("#name").text(fromdb(jsonObj.name)); template.find("#name").text(fromdb(jsonObj.name));
template.find("#volumename").text(fromdb(jsonObj.volumename)); template.find("#volumename").text(fromdb(jsonObj.volumename));
template.find("#intervaltype").text(jsonObj.intervaltype); template.find("#intervaltype").text(fromdb(jsonObj.intervaltype));
template.find("#account").text(fromdb(jsonObj.account)); template.find("#account").text(fromdb(jsonObj.account));
template.find("#domain").text(fromdb(jsonObj.domain)); template.find("#domain").text(fromdb(jsonObj.domain));
setDateField(jsonObj.created, template.find("#created")); setDateField(jsonObj.created, template.find("#created"));

View File

@ -61,8 +61,9 @@ function zoneJsonClearRightPanel() {
function zoneJsonToDetailsTab($leftmenuItem1) { function zoneJsonToDetailsTab($leftmenuItem1) {
var jsonObj = $leftmenuItem1.data("jsonObj"); var jsonObj = $leftmenuItem1.data("jsonObj");
var $detailsTab = $("#tab_content_details"); var $detailsTab = $("#tab_content_details");
$detailsTab.data("jsonObj", jsonObj); $detailsTab.data("jsonObj", jsonObj);
$detailsTab.find("#id").text(jsonObj.id);
$detailsTab.find("#id").text(noNull(jsonObj.id));
$detailsTab.find("#title").text(fromdb(jsonObj.name)); $detailsTab.find("#title").text(fromdb(jsonObj.name));
$detailsTab.find("#name").text(fromdb(jsonObj.name)); $detailsTab.find("#name").text(fromdb(jsonObj.name));