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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b5979ba9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b5979ba9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b5979ba9 Branch: refs/heads/ui-add-remove-nics Commit: b5979ba9b58caf0f306907e11c9a34fe36ff6ca6 Parents: ee02311 Author: Jessica Wang <jessicaw...@apache.org> Authored: Thu Apr 25 10:40:08 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Thu Apr 25 10:40:08 2013 -0700 ---------------------------------------------------------------------- .../api/command/user/zone/ListZonesByCmd.java | 7 ++++++ .../src/com/cloud/api/query/QueryManagerImpl.java | 4 +++ ui/scripts/system.js | 17 ++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b5979ba9/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java index bbfb598..d0dc736 100644 --- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java @@ -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; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b5979ba9/server/src/com/cloud/api/query/QueryManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index f92b4fc..67af7e4 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -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) { http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b5979ba9/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 3aaa830..4692b61 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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 } } ],