Skip to content

Commit 3a3a390

Browse files
author
Jessica Wang
committed
UI - modules - replace addExtraPropertiesIfDrModuleIncluded() with cloudStack.dr.sharedFunctions.addExtraProperties().
1 parent 3acebf2 commit 3a3a390

5 files changed

Lines changed: 18 additions & 39 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
@@ -1502,8 +1502,9 @@
15021502
success: function(json) {
15031503
var jsonObj = json.listvolumesresponse.volume[0];
15041504

1505-
//if DR module is included
1506-
addExtraPropertiesIfDrModuleIncluded(jsonObj, "Volume");
1505+
if (isModuleIncluded("dr")) {
1506+
cloudStack.dr.sharedFunctions.addExtraProperties(jsonObj, "Volume");
1507+
}
15071508

15081509
args.response.success({
15091510
actionFilter: volumeActionfilter,

ui/scripts/system.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,8 +1955,9 @@
19551955
selectedGuestNetworkObj = json.listnetworksresponse.network[0];
19561956
addExtraPropertiesToGuestNetworkObject(selectedGuestNetworkObj);
19571957

1958-
//if DR module is included
1959-
addExtraPropertiesIfDrModuleIncluded(selectedGuestNetworkObj, "Network");
1958+
if (isModuleIncluded("dr")) {
1959+
cloudStack.dr.sharedFunctions.addExtraProperties(selectedGuestNetworkObj, "Network");
1960+
}
19601961

19611962
args.response.success({
19621963
actionFilter: cloudStack.actionFilter.guestNetwork,
@@ -7595,8 +7596,9 @@
75957596
//override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
75967597
});
75977598

7598-
//if DR module is included
7599-
addExtraPropertiesIfDrModuleIncluded(selectedZoneObj, "Zone");
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)