mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-2120: mixed zone management - (1) extend listStoragePools API to to take in zonetype. (2) UI: populate Primary Storages list page with ones whose zonetype matches selected option in zone type dropdown on top menu.
This commit is contained in:
parent
8f5d8d5052
commit
48b82a6f91
@ -60,6 +60,9 @@ public class ListStoragePoolsCmd extends BaseListCmd {
|
|||||||
description="the Zone ID for the storage pool")
|
description="the Zone ID for the storage pool")
|
||||||
private Long zoneId;
|
private Long zoneId;
|
||||||
|
|
||||||
|
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
|
||||||
|
private String zoneType;
|
||||||
|
|
||||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = StoragePoolResponse.class,
|
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = StoragePoolResponse.class,
|
||||||
description="the ID of the storage pool")
|
description="the ID of the storage pool")
|
||||||
private Long id;
|
private Long id;
|
||||||
@ -92,6 +95,10 @@ public class ListStoragePoolsCmd extends BaseListCmd {
|
|||||||
return zoneId;
|
return zoneId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getZoneType() {
|
||||||
|
return zoneType;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1859,6 +1859,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||||||
private Pair<List<StoragePoolJoinVO>, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) {
|
private Pair<List<StoragePoolJoinVO>, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) {
|
||||||
|
|
||||||
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
|
Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
|
||||||
|
String zoneType = cmd.getZoneType();
|
||||||
Object id = cmd.getId();
|
Object id = cmd.getId();
|
||||||
Object name = cmd.getStoragePoolName();
|
Object name = cmd.getStoragePoolName();
|
||||||
Object path = cmd.getPath();
|
Object path = cmd.getPath();
|
||||||
@ -1878,6 +1879,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||||||
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
|
||||||
sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ);
|
sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ);
|
||||||
sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
|
sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
|
||||||
|
sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
|
||||||
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||||
sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
|
sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||||
sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ);
|
sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ);
|
||||||
@ -1908,6 +1910,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||||||
if (zoneId != null) {
|
if (zoneId != null) {
|
||||||
sc.setParameters("dataCenterId", zoneId);
|
sc.setParameters("dataCenterId", zoneId);
|
||||||
}
|
}
|
||||||
|
if (zoneType != null) {
|
||||||
|
sc.setParameters("dataCenterType", zoneType);
|
||||||
|
}
|
||||||
if (pod != null) {
|
if (pod != null) {
|
||||||
sc.setParameters("podId", pod);
|
sc.setParameters("podId", pod);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -258,24 +258,15 @@
|
|||||||
primaryStorageCount: function(data) {
|
primaryStorageCount: function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listStoragePools'),
|
url: createURL('listStoragePools'),
|
||||||
data: {
|
data: {
|
||||||
page: 1,
|
page: 1,
|
||||||
pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property.
|
pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property.
|
||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
dataFns.secondaryStorageCount($.extend(data, {
|
dataFns.secondaryStorageCount($.extend(data, {
|
||||||
primaryStorageCount: json.liststoragepoolsresponse.count ?
|
primaryStorageCount: json.liststoragepoolsresponse.count ?
|
||||||
json.liststoragepoolsresponse.count : 0
|
json.liststoragepoolsresponse.count : 0
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//comment the 4 lines above and uncomment the following 4 lines if listHosts API still responds slowly.
|
|
||||||
|
|
||||||
/*
|
|
||||||
dataFns.systemVmCount($.extend(data, {
|
|
||||||
primaryStorageCount: json.liststoragepoolsresponse.count ?
|
|
||||||
json.liststoragepoolsresponse.count : 0
|
|
||||||
}));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -5585,9 +5576,19 @@
|
|||||||
var searchByArgs = args.filterBy.search.value.length ?
|
var searchByArgs = args.filterBy.search.value.length ?
|
||||||
'&name=' + args.filterBy.search.value : '';
|
'&name=' + args.filterBy.search.value : '';
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
page: args.page,
|
||||||
|
pageSize: pageSize,
|
||||||
|
listAll: true
|
||||||
|
};
|
||||||
|
if(args.context.zoneType != null && args.context.zoneType.length > 0) { //Basic type or Advanced type
|
||||||
|
$.extend(data, {
|
||||||
|
zonetype: args.context.zoneType
|
||||||
|
});
|
||||||
|
}
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listStoragePools' + searchByArgs),
|
url: createURL('listStoragePools' + searchByArgs),
|
||||||
data: { page: args.page, pageSize: pageSize, listAll: true },
|
data: data,
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
args.response.success({ data: json.liststoragepoolsresponse.storagepool });
|
args.response.success({ data: json.liststoragepoolsresponse.storagepool });
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user