mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
new UI - Snapshot page - fix a bug that JS error "$midmenuItem1 is null or not an object ", "jsonObj is null or not an object" when switching between tabs on an empty page.
This commit is contained in:
parent
bd8adbf5ca
commit
700ec25802
@ -25,7 +25,7 @@ function buildActionLinkForTab(label, actionMap, $actionMenu, $midmenuItem1, $th
|
||||
$listItem.data("label", label);
|
||||
$listItem.data("apiInfo", apiInfo);
|
||||
|
||||
var id = $thisTab.data("jsonObj").id;
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
|
||||
$listItem.bind("click", function(event) {
|
||||
$actionMenu.hide();
|
||||
|
||||
@ -57,27 +57,34 @@ function snapshotToRightPanel($midmenuItem1) {
|
||||
}
|
||||
|
||||
function snapshotJsonToDetailsTab() {
|
||||
var $thisTab = $("#right_panel_content #tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_details");
|
||||
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
if($midmenuItem1 == null)
|
||||
return;
|
||||
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
if(jsonObj == null)
|
||||
return;
|
||||
|
||||
var jsonObj;
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
var id = jsonObj.id;
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=listSnapshots&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listsnapshotsresponse.snapshot;
|
||||
if(items != null && items.length > 0)
|
||||
if(items != null && items.length > 0) {
|
||||
jsonObj = items[0];
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
}
|
||||
}
|
||||
});
|
||||
$thisTab.data("jsonObj", jsonObj);
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
|
||||
|
||||
$thisTab.find("#id").text(noNull(jsonObj.id));
|
||||
$thisTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$thisTab.find("#volume_name").text(fromdb(jsonObj.volumename));
|
||||
@ -150,7 +157,7 @@ function doSnapshotDelete($actionLink, $thisTab, $midmenuItem1) {
|
||||
.dialog('option', 'buttons', {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
var id = $thisTab.data("jsonObj").id;
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
var apiCommand = "command=deleteSnapshot&id="+id;
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $thisTab);
|
||||
},
|
||||
@ -162,7 +169,7 @@ function doSnapshotDelete($actionLink, $thisTab, $midmenuItem1) {
|
||||
}
|
||||
|
||||
function doCreateVolumeFromSnapshotInSnapshotPage($actionLink, $detailsTab, $midmenuItem1){
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
|
||||
$("#dialog_add_volume_from_snapshot")
|
||||
.dialog("option", "buttons", {
|
||||
@ -188,7 +195,7 @@ function doCreateVolumeFromSnapshotInSnapshotPage($actionLink, $detailsTab, $mid
|
||||
}
|
||||
|
||||
function doCreateTemplateFromSnapshotInSnapshotPage($actionLink, $detailsTab, $midmenuItem1){
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
|
||||
$("#dialog_create_template_from_snapshot")
|
||||
.dialog("option", "buttons", {
|
||||
|
||||
@ -301,11 +301,7 @@ function volumeToRightPanel($midmenuItem1) {
|
||||
$("#tab_details").click();
|
||||
}
|
||||
|
||||
function volumeJsonToDetailsTab(){
|
||||
var $thisTab = $("#right_panel_content #tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
function volumeJsonToDetailsTab(){
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
if($midmenuItem1 == null)
|
||||
return;
|
||||
@ -313,6 +309,10 @@ function volumeJsonToDetailsTab(){
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
if(jsonObj == null)
|
||||
return;
|
||||
|
||||
var $thisTab = $("#right_panel_content #tab_content_details");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
var id = jsonObj.id;
|
||||
|
||||
@ -324,8 +324,7 @@ function volumeJsonToDetailsTab(){
|
||||
var items = json.listvolumesresponse.volume;
|
||||
if(items != null && items.length > 0) {
|
||||
jsonObj = items[0];
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
$thisTab.data("jsonObj", jsonObj);
|
||||
$midmenuItem1.data("jsonObj", jsonObj);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -380,9 +379,7 @@ function volumeJsonToDetailsTab(){
|
||||
$thisTab.find("#tab_container").show();
|
||||
}
|
||||
|
||||
function volumeJsonToSnapshotTab() {
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_snapshot");
|
||||
|
||||
function volumeJsonToSnapshotTab() {
|
||||
var $midmenuItem1 = $("#right_panel_content").data("$midmenuItem1");
|
||||
if($midmenuItem1 == null)
|
||||
return;
|
||||
@ -390,7 +387,8 @@ function volumeJsonToSnapshotTab() {
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
if(jsonObj == null)
|
||||
return;
|
||||
|
||||
|
||||
var $thisTab = $("#right_panel_content").find("#tab_content_snapshot");
|
||||
$thisTab.find("#tab_container").hide();
|
||||
$thisTab.find("#tab_spinning_wheel").show();
|
||||
|
||||
@ -515,7 +513,7 @@ var volumeActionMap = {
|
||||
}
|
||||
|
||||
function doCreateTemplateFromVolume($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
$("#dialog_create_template").find("#volume_name").text(jsonObj.name);
|
||||
|
||||
$("#dialog_create_template")
|
||||
@ -536,7 +534,7 @@ function doCreateTemplateFromVolume($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var isPublic = thisDialog.find("#create_template_public").val();
|
||||
var password = thisDialog.find("#create_template_password").val();
|
||||
|
||||
var id = $detailsTab.data("jsonObj").id;
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
var apiCommand = "command=createTemplate&volumeId="+id+"&name="+todb(name)+"&displayText="+todb(desc)+"&osTypeId="+osType+"&isPublic="+isPublic+"&passwordEnabled="+password;
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
@ -552,7 +550,7 @@ function doTakeSnapshot($actionLink, $detailsTab, $midmenuItem1) {
|
||||
"Confirm": function() {
|
||||
$(this).dialog("close");
|
||||
|
||||
var id = $detailsTab.data("jsonObj").id;
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
var apiCommand = "command=createSnapshot&volumeid="+id;
|
||||
doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $detailsTab);
|
||||
},
|
||||
@ -614,9 +612,8 @@ function clearBottomPanel() {
|
||||
cleanErrMsg(dialogBox.find("#edit_day_of_month"), dialogBox.find("#edit_day_of_month_errormsg"));
|
||||
}
|
||||
|
||||
function doRecurringSnapshot($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
var volumeId = $detailsTab.data("jsonObj").id;
|
||||
function doRecurringSnapshot($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var volumeId = $midmenuItem1.data("jsonObj").id;
|
||||
|
||||
var dialogBox = $("#dialog_recurring_snapshot");
|
||||
clearTopPanel();
|
||||
@ -799,7 +796,7 @@ function populateVirtualMachineField(domainId, account, zoneId) {
|
||||
}
|
||||
|
||||
function doAttachDisk($actionLink, $detailsTab, $midmenuItem1) {
|
||||
var jsonObj = $detailsTab.data("jsonObj");
|
||||
var jsonObj = $midmenuItem1.data("jsonObj");
|
||||
populateVirtualMachineField(jsonObj.domainid, jsonObj.account, jsonObj.zoneid);
|
||||
|
||||
$("#dialog_attach_volume")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user