Skip to content

Commit b5979ba

Browse files
author
Jessica Wang
committed
LOUDSTACK-2120: mixed zone management - (1) extend listZones API to to take in networktype. (2) UI: populate Zones list page with ones whose networktype matches selected option in zone type dropdown on top menu. (3) UI: count total number of zones based on selected option in zone type dropdown on top menu.
1 parent ee02311 commit b5979ba

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public class ListZonesByCmd extends BaseListCmd {
5656
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
5757
private String name;
5858

59+
@Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, description="the network type of the zone")
60+
private String networkType;
61+
5962
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
6063
private Boolean showCapacities;
6164

@@ -79,6 +82,10 @@ public String getName(){
7982
return name;
8083
}
8184

85+
public String getNetworkType(){
86+
return networkType;
87+
}
88+
8289
public Boolean getShowCapacities() {
8390
return showCapacities;
8491
}

‎server/src/com/cloud/api/query/QueryManagerImpl.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,10 +2213,14 @@ private Pair<List<DataCenterJoinVO>, Integer> listDataCentersInternal(ListZonesB
22132213
Long id = cmd.getId();
22142214
String keyword = cmd.getKeyword();
22152215
String name = cmd.getName();
2216+
String networkType = cmd.getNetworkType();
22162217

22172218
Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
22182219
SearchCriteria<DataCenterJoinVO> sc = _dcJoinDao.createSearchCriteria();
22192220

2221+
if(networkType != null)
2222+
sc.addAnd("networkType", SearchCriteria.Op.EQ, networkType);
2223+
22202224
if (id != null) {
22212225
sc.addAnd("id", SearchCriteria.Op.EQ, id);
22222226
} else if (name != null) {

‎ui/scripts/system.js‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,16 @@
184184
dashboard: {
185185
dataProvider: function(args) {
186186
var dataFns = {
187-
zoneCount: function(data) {
187+
zoneCount: function(data) {
188+
var data = {};
189+
if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length > 0) { //Basic type or Advanced type
190+
$.extend(data, {
191+
networktype: cloudStack.context.zoneType
192+
});
193+
}
188194
$.ajax({
189195
url: createURL('listZones'),
196+
data: data,
190197
success: function(json) {
191198
dataFns.podCount($.extend(data, {
192199
zoneCount: json.listzonesresponse.count ?
@@ -4665,6 +4672,10 @@
46654672
}
46664673
}
46674674

4675+
if(args.context.zoneType != null && args.context.zoneType.length > 0) { //Basic type or Advanced type
4676+
array1.push("&networktype=" + args.context.zoneType);
4677+
}
4678+
46684679
$.ajax({
46694680
url: createURL("listZones&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
46704681
dataType: "json",
@@ -5000,8 +5011,8 @@
50005011
localstorageenabled: {
50015012
label: 'label.local.storage.enabled',
50025013
isBoolean: true,
5003-
isEditable: true,
5004-
converter:cloudStack.converters.toBooleanText
5014+
isEditable: true,
5015+
converter:cloudStack.converters.toBooleanText
50055016
}
50065017
}
50075018
],

0 commit comments

Comments
 (0)