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.

This commit is contained in:
Jessica Wang 2013-04-25 10:40:08 -07:00
parent ee02311fae
commit b5979ba9b5
3 changed files with 25 additions and 3 deletions

View File

@ -56,6 +56,9 @@ public class ListZonesByCmd extends BaseListCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the zone")
private String name;
@Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, description="the network type of the zone")
private String networkType;
@Parameter(name=ApiConstants.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the zones")
private Boolean showCapacities;
@ -79,6 +82,10 @@ public class ListZonesByCmd extends BaseListCmd {
return name;
}
public String getNetworkType(){
return networkType;
}
public Boolean getShowCapacities() {
return showCapacities;
}

View File

@ -2213,10 +2213,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
Long id = cmd.getId();
String keyword = cmd.getKeyword();
String name = cmd.getName();
String networkType = cmd.getNetworkType();
Filter searchFilter = new Filter(DataCenterJoinVO.class, null, false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchCriteria<DataCenterJoinVO> sc = _dcJoinDao.createSearchCriteria();
if(networkType != null)
sc.addAnd("networkType", SearchCriteria.Op.EQ, networkType);
if (id != null) {
sc.addAnd("id", SearchCriteria.Op.EQ, id);
} else if (name != null) {

View File

@ -184,9 +184,16 @@
dashboard: {
dataProvider: function(args) {
var dataFns = {
zoneCount: function(data) {
zoneCount: function(data) {
var data = {};
if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length > 0) { //Basic type or Advanced type
$.extend(data, {
networktype: cloudStack.context.zoneType
});
}
$.ajax({
url: createURL('listZones'),
data: data,
success: function(json) {
dataFns.podCount($.extend(data, {
zoneCount: json.listzonesresponse.count ?
@ -4665,6 +4672,10 @@
}
}
if(args.context.zoneType != null && args.context.zoneType.length > 0) { //Basic type or Advanced type
array1.push("&networktype=" + args.context.zoneType);
}
$.ajax({
url: createURL("listZones&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
dataType: "json",
@ -5000,8 +5011,8 @@
localstorageenabled: {
label: 'label.local.storage.enabled',
isBoolean: true,
isEditable: true,
converter:cloudStack.converters.toBooleanText
isEditable: true,
converter:cloudStack.converters.toBooleanText
}
}
],