Skip to content

Commit 4970425

Browse files
author
Jessica Wang
committed
UI - modules - replace addExtraPropertiesIfDrModuleIncluded() with cloudStack.dr.sharedFunctions.addExtraProperties().
1 parent 508a966 commit 4970425

5 files changed

Lines changed: 20 additions & 41 deletions

File tree

‎ui/scripts/instances.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,9 +1877,10 @@
18771877
else
18781878
jsonObj.xenserverToolsVersion61plus = false;
18791879
}
1880-
1881-
//if DR module is included
1882-
addExtraPropertiesIfDrModuleIncluded(jsonObj, "UserVM");
1880+
1881+
if (isModuleIncluded("dr")) {
1882+
cloudStack.dr.sharedFunctions.addExtraProperties(jsonObj, "UserVM");
1883+
}
18831884

18841885
args.response.success({
18851886
actionFilter: vmActionfilter,

‎ui/scripts/network.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,10 +1383,11 @@
13831383
success: function(json) {
13841384
var jsonObj = json.listnetworksresponse.network[0];
13851385
addExtraPropertiesToGuestNetworkObject(jsonObj);
1386-
1387-
//if DR module is included
1388-
addExtraPropertiesIfDrModuleIncluded(jsonObj, "Network");
1389-
1386+
1387+
if (isModuleIncluded("dr")) {
1388+
cloudStack.dr.sharedFunctions.addExtraProperties(jsonObj, "Network");
1389+
}
1390+
13901391
args.response.success({
13911392
actionFilter: cloudStack.actionFilter.guestNetwork,
13921393
data: jsonObj

‎ui/scripts/sharedFunctions.js‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,32 +1173,6 @@ function listViewDataProvider(args, data, options) {
11731173
return data;
11741174
}
11751175

1176-
var addExtraPropertiesIfDrModuleIncluded = function(jsonObj, resourceType) {
1177-
if (isModuleIncluded("dr")) {
1178-
$.ajax({
1179-
url: createURL("listResourceDetails"),
1180-
data: {
1181-
resourceid: jsonObj.id,
1182-
resourcetype: resourceType
1183-
},
1184-
async: false,
1185-
success: function(json) {
1186-
var drFieldNameArray = [];
1187-
var resourcedetails = json.listresourcedetailsresponse.resourcedetail;
1188-
if (resourcedetails != undefined) {
1189-
for (var i = 0; i < resourcedetails.length; i++) {
1190-
if (resourcedetails[i].key.indexOf("DR_") > -1) {
1191-
drFieldNameArray.push(resourcedetails[i].key);
1192-
jsonObj[resourcedetails[i].key] = resourcedetails[i].value;
1193-
}
1194-
}
1195-
}
1196-
jsonObj["drFieldNameArray"] = drFieldNameArray;
1197-
}
1198-
});
1199-
}
1200-
}
1201-
12021176
//used by infrastructure page and network page
12031177
var addExtraPropertiesToGuestNetworkObject = function(jsonObj) {
12041178
jsonObj.networkdomaintext = jsonObj.networkdomain;

‎ui/scripts/storage.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,8 +1499,9 @@
14991499
success: function(json) {
15001500
var jsonObj = json.listvolumesresponse.volume[0];
15011501

1502-
//if DR module is included
1503-
addExtraPropertiesIfDrModuleIncluded(jsonObj, "Volume");
1502+
if (isModuleIncluded("dr")) {
1503+
cloudStack.dr.sharedFunctions.addExtraProperties(jsonObj, "Volume");
1504+
}
15041505

15051506
args.response.success({
15061507
actionFilter: volumeActionfilter,

‎ui/scripts/system.js‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,9 +1954,10 @@
19541954
success: function (json) {
19551955
selectedGuestNetworkObj = json.listnetworksresponse.network[0];
19561956
addExtraPropertiesToGuestNetworkObject(selectedGuestNetworkObj);
1957-
1958-
//if DR module is included
1959-
addExtraPropertiesIfDrModuleIncluded(selectedGuestNetworkObj, "Network");
1957+
1958+
if (isModuleIncluded("dr")) {
1959+
cloudStack.dr.sharedFunctions.addExtraProperties(selectedGuestNetworkObj, "Network");
1960+
}
19601961

19611962
args.response.success({
19621963
actionFilter: cloudStack.actionFilter.guestNetwork,
@@ -7594,9 +7595,10 @@
75947595
}
75957596
//override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
75967597
});
7597-
7598-
//if DR module is included
7599-
addExtraPropertiesIfDrModuleIncluded(selectedZoneObj, "Zone");
7598+
7599+
if (isModuleIncluded("dr")) {
7600+
cloudStack.dr.sharedFunctions.addExtraProperties(selectedZoneObj, "Zone");
7601+
}
76007602

76017603
args.response.success({
76027604
actionFilter: zoneActionfilter,

0 commit comments

Comments
 (0)