Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
@ -25,6 +25,7 @@ import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.response.ServiceOfferingResponse;
|
||||
import com.cloud.offering.NetworkOffering.GuestIpType;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
|
||||
@Implementation(method="createServiceOffering", manager=Manager.ConfigManager, description="Creates a service offering.")
|
||||
@ -127,6 +128,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
||||
response.setOfferHa(offering.getOfferHA());
|
||||
response.setStorageType(offering.getUseLocalStorage() ? "local" : "shared");
|
||||
response.setTags(offering.getTags());
|
||||
response.setUseVirtualNetwork(offering.getGuestIpType().equals(GuestIpType.Virtualized));
|
||||
|
||||
response.setResponseName(getName());
|
||||
return response;
|
||||
|
||||
@ -141,6 +141,7 @@ public class ListHostsCmd extends BaseListCmd {
|
||||
hostResponse.setState(host.getStatus());
|
||||
hostResponse.setIpAddress(host.getPrivateIpAddress());
|
||||
hostResponse.setVersion(host.getVersion());
|
||||
hostResponse.setCreated(host.getCreated());
|
||||
|
||||
GuestOSCategoryVO guestOSCategory = ApiDBUtils.getHostGuestOSCategory(host.getId());
|
||||
if (guestOSCategory != null) {
|
||||
|
||||
@ -110,7 +110,7 @@ public class ListResourceLimitsCmd extends BaseListCmd {
|
||||
}
|
||||
}
|
||||
|
||||
resourceLimitResponse.setResourceType(limit.getType().ordinal());
|
||||
resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().ordinal()).toString());
|
||||
resourceLimitResponse.setMax(limit.getMax());
|
||||
|
||||
resourceLimitResponse.setResponseName("resourcelimit");
|
||||
|
||||
@ -22,12 +22,10 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.BaseAsyncCmd;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.api.response.DomainRouterResponse;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
@ -82,16 +80,45 @@ public class RebootRouterCmd extends BaseAsyncCmd {
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
public SuccessResponse getResponse() {
|
||||
SuccessResponse response = new SuccessResponse();
|
||||
Boolean responseObject = (Boolean)getResponseObject();
|
||||
public DomainRouterResponse getResponse() {
|
||||
DomainRouterResponse response = new DomainRouterResponse();
|
||||
DomainRouterVO router = (DomainRouterVO)getResponseObject();
|
||||
|
||||
if (responseObject != null) {
|
||||
response.setSuccess(responseObject);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router");
|
||||
}
|
||||
response.setId(router.getId());
|
||||
response.setZoneId(router.getDataCenterId());
|
||||
response.setZoneName(ApiDBUtils.findZoneById(router.getDataCenterId()).getName());
|
||||
response.setDns1(router.getDns1());
|
||||
response.setDns2(router.getDns2());
|
||||
response.setNetworkDomain(router.getDomain());
|
||||
response.setGateway(router.getGateway());
|
||||
response.setName(router.getName());
|
||||
response.setPodId(router.getPodId());
|
||||
|
||||
if (router.getHostId() != null) {
|
||||
response.setHostId(router.getHostId());
|
||||
response.setHostName(ApiDBUtils.findHostById(router.getHostId()).getName());
|
||||
}
|
||||
|
||||
response.setPrivateIp(router.getPrivateIpAddress());
|
||||
response.setPrivateMacAddress(router.getPrivateMacAddress());
|
||||
response.setPrivateNetmask(router.getPrivateNetmask());
|
||||
response.setPublicIp(router.getPublicIpAddress());
|
||||
response.setPublicMacAddress(router.getPublicMacAddress());
|
||||
response.setPublicNetmask(router.getPublicNetmask());
|
||||
response.setGuestIpAddress(router.getGuestIpAddress());
|
||||
response.setGuestMacAddress(router.getGuestMacAddress());
|
||||
response.setGuestNetmask(router.getGuestNetmask());
|
||||
response.setTemplateId(router.getTemplateId());
|
||||
response.setCreated(router.getCreated());
|
||||
response.setState(router.getState());
|
||||
|
||||
Account accountTemp = ApiDBUtils.findAccountById(router.getAccountId());
|
||||
if (accountTemp != null) {
|
||||
response.setAccountName(accountTemp.getAccountName());
|
||||
response.setDomainId(accountTemp.getDomainId());
|
||||
response.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
|
||||
}
|
||||
|
||||
response.setResponseName(getName());
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public class RegisterIsoCmd extends BaseCmd {
|
||||
templateResponse.setFeatured(template.isFeatured());
|
||||
templateResponse.setBootable(template.isBootable());
|
||||
templateResponse.setOsTypeId(template.getGuestOSId());
|
||||
templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getName());
|
||||
templateResponse.setOsTypeName(ApiDBUtils.findGuestOSById(template.getGuestOSId()).getDisplayName());
|
||||
|
||||
Account owner = ApiDBUtils.findAccountById(template.getAccountId());
|
||||
if (owner != null) {
|
||||
|
||||
@ -69,6 +69,7 @@ public class UpdateCfgCmd extends BaseCmd {
|
||||
|
||||
if (responseObject != null) {
|
||||
response.setSuccess(responseObject);
|
||||
response.setDisplayText("Successfully updated configuration value.");
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
|
||||
}
|
||||
|
||||
@ -19,13 +19,12 @@
|
||||
package com.cloud.api.commands;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.BaseCmd;
|
||||
import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.DiskOfferingResponse;
|
||||
import com.cloud.api.response.SuccessResponse;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
|
||||
@Implementation(method="updateDiskOffering", manager=Manager.ConfigManager, description="Updates a disk offering.")
|
||||
@ -80,19 +79,11 @@ public class UpdateDiskOfferingCmd extends BaseCmd{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DiskOfferingResponse getResponse() {
|
||||
DiskOfferingResponse response = new DiskOfferingResponse();
|
||||
public SuccessResponse getResponse() {
|
||||
SuccessResponse response = new SuccessResponse();
|
||||
DiskOfferingVO responseObject = (DiskOfferingVO)getResponseObject();
|
||||
if (responseObject != null) {
|
||||
response.setId(responseObject.getId());
|
||||
response.setCreated(responseObject.getCreated());
|
||||
response.setDiskSize(responseObject.getDiskSize());
|
||||
response.setDisplayText(responseObject.getDisplayText());
|
||||
response.setDomainId(responseObject.getDomainId());
|
||||
response.setName(responseObject.getName());
|
||||
response.setTags(responseObject.getTags());
|
||||
response.setDomainId(ApiDBUtils.findDomainById(responseObject.getDomainId()).getId());
|
||||
response.setDomain(ApiDBUtils.findDomainById(responseObject.getDomainId()).getName());
|
||||
response.setSuccess(Boolean.TRUE);
|
||||
} else {
|
||||
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering");
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
|
||||
response.setDomainName(ApiDBUtils.findDomainById(accountTemp.getDomainId()).getName());
|
||||
}
|
||||
}
|
||||
response.setResourceType(limit.getType().ordinal());
|
||||
response.setResourceType(Integer.valueOf(limit.getType().ordinal()).toString());
|
||||
response.setMax(limit.getMax());
|
||||
|
||||
response.setResponseName(getName());
|
||||
|
||||
@ -101,6 +101,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
||||
response.setDisplayText(offering.getDisplayText());
|
||||
response.setCpuNumber(offering.getCpu());
|
||||
response.setCpuSpeed(offering.getSpeed());
|
||||
response.setMemory(offering.getRamSize());
|
||||
response.setCreated(offering.getCreated());
|
||||
String storageType = offering.getUseLocalStorage() ? "local" : "shared";
|
||||
response.setStorageType(storageType);
|
||||
|
||||
@ -43,7 +43,7 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
||||
private Long id;
|
||||
|
||||
@Parameter(name="name", type=CommandType.STRING, description="the name of the image file")
|
||||
private String isoName;
|
||||
private String templateName;
|
||||
|
||||
@Parameter(name="ostypeid", type=CommandType.LONG, description="the ID of the OS type that best represents the OS of this image.")
|
||||
private Long osTypeId;
|
||||
@ -70,8 +70,8 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String isoName() {
|
||||
return isoName;
|
||||
public String getTemplateName() {
|
||||
return templateName;
|
||||
}
|
||||
|
||||
public Long getOsTypeId() {
|
||||
@ -85,5 +85,4 @@ public abstract class UpdateTemplateOrIsoCmd extends BaseCmd {
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,8 @@
|
||||
*/
|
||||
package com.cloud.api.commands;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
@ -25,7 +27,7 @@ import com.cloud.api.BaseCmd.Manager;
|
||||
import com.cloud.api.Implementation;
|
||||
import com.cloud.api.Parameter;
|
||||
import com.cloud.api.ServerApiException;
|
||||
import com.cloud.api.response.UpgradeVmResponse;
|
||||
import com.cloud.api.response.UserVmResponse;
|
||||
import com.cloud.offering.ServiceOffering;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
@ -76,13 +78,14 @@ public class UpgradeVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
@Override @SuppressWarnings("unchecked")
|
||||
public UpgradeVmResponse getResponse() {
|
||||
public UserVmResponse getResponse() {
|
||||
UserVmVO userVm = (UserVmVO)getResponseObject();
|
||||
|
||||
UpgradeVmResponse response = new UpgradeVmResponse();
|
||||
UserVmResponse response = new UserVmResponse();
|
||||
if (userVm != null) {
|
||||
Account acct = ApiDBUtils.findAccountById(userVm.getAccountId());
|
||||
response.setAccount(acct.getAccountName());
|
||||
response.setId(userVm.getId());
|
||||
response.setAccountName(acct.getAccountName());
|
||||
|
||||
ServiceOffering offering = ApiDBUtils.findServiceOfferingById(userVm.getServiceOfferingId());
|
||||
response.setCpuSpeed(offering.getSpeed());
|
||||
@ -94,17 +97,26 @@ public class UpgradeVMCmd extends BaseCmd {
|
||||
}
|
||||
|
||||
response.setServiceOfferingId(userVm.getServiceOfferingId());
|
||||
|
||||
|
||||
//stats calculation
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.##");
|
||||
String cpuUsed = null;
|
||||
VmStats vmStats = ApiDBUtils.getVmStatistics(userVm.getId());
|
||||
if (vmStats != null) {
|
||||
response.setCpuUsed((long) vmStats.getCPUUtilization());
|
||||
response.setNetworkKbsRead((long) vmStats.getNetworkReadKBs());
|
||||
response.setNetworkKbsWrite((long) vmStats.getNetworkWriteKBs());
|
||||
float cpuUtil = (float) vmStats.getCPUUtilization();
|
||||
cpuUsed = decimalFormat.format(cpuUtil) + "%";
|
||||
response.setCpuUsed(cpuUsed);
|
||||
|
||||
long networkKbRead = (long)vmStats.getNetworkReadKBs();
|
||||
response.setNetworkKbsRead(networkKbRead);
|
||||
|
||||
long networkKbWrite = (long)vmStats.getNetworkWriteKBs();
|
||||
response.setNetworkKbsWrite(networkKbWrite);
|
||||
}
|
||||
|
||||
response.setCreated(userVm.getCreated());
|
||||
response.setDisplayName(userVm.getDisplayName());
|
||||
response.setDomain(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
|
||||
response.setDomainName(ApiDBUtils.findDomainById(acct.getDomainId()).getName());
|
||||
response.setDomainId(acct.getDomainId());
|
||||
response.setHaEnable(userVm.isHaEnabled());
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ public class DomainRouterResponse extends BaseResponse {
|
||||
@SerializedName("guestipaddress") @Param(description="the guest IP address for the router")
|
||||
private String guestIpAddress;
|
||||
|
||||
@SerializedName("guestmacaddress") @Param(description="the guest MAC address for the router")
|
||||
@SerializedName("macaddress") @Param(description="the guest MAC address for the router")
|
||||
private String guestMacAddress;
|
||||
|
||||
@SerializedName("guestnetmask") @Param(description="the guest netmask for the router")
|
||||
|
||||
@ -31,7 +31,7 @@ public class ResourceLimitResponse extends BaseResponse {
|
||||
private String domainName;
|
||||
|
||||
@SerializedName("resourcetype") @Param(description="resource type. Values include 0, 1, 2, 3, 4. See the resourceType parameter for more information on these values.")
|
||||
private Integer resourceType;
|
||||
private String resourceType;
|
||||
|
||||
@SerializedName("max") @Param(description="the maximum number of the resource. A -1 means the resource currently has no limit.")
|
||||
private Long max;
|
||||
@ -60,11 +60,11 @@ public class ResourceLimitResponse extends BaseResponse {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
|
||||
public Integer getResourceType() {
|
||||
public String getResourceType() {
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
public void setResourceType(Integer resourceType) {
|
||||
public void setResourceType(String resourceType) {
|
||||
this.resourceType = resourceType;
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,9 @@ public class SuccessResponse extends BaseResponse {
|
||||
@SerializedName("success") @Param(description="true if operation is executed successfully")
|
||||
private Boolean success;
|
||||
|
||||
@SerializedName("displaytext") @Param(description="any text associated with the success or failure")
|
||||
private String displayText;
|
||||
|
||||
public Boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
@ -14,4 +17,12 @@ public class SuccessResponse extends BaseResponse {
|
||||
public void setSuccess(Boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
}
|
||||
|
||||
public void setDisplayText(String displayText) {
|
||||
this.displayText = displayText;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1099,7 +1099,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||
public ServiceOfferingVO updateServiceOffering(UpdateServiceOfferingCmd cmd) {
|
||||
String displayText = cmd.getDisplayText();
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String name = cmd.getServiceOfferingName();
|
||||
Boolean ha = cmd.getOfferHa();
|
||||
String tags = cmd.getTags();
|
||||
Boolean useVirtualNetwork = cmd.getUseVirtualNetwork();
|
||||
|
||||
@ -144,10 +144,10 @@ public interface NetworkManager extends Manager {
|
||||
/**
|
||||
* Reboots domain router
|
||||
* @param cmd the command specifying router's id
|
||||
* @return success or failure
|
||||
* @return the rebooted router
|
||||
* @throws InvalidParameterValueException, PermissionDeniedException
|
||||
*/
|
||||
boolean rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
DomainRouterVO rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
/**
|
||||
* @param hostId get all of the virtual machine routers on a host.
|
||||
* @return collection of VirtualMachineRouter
|
||||
|
||||
@ -422,16 +422,16 @@ public class NetworkManagerImpl implements NetworkManager, DomainRouterService {
|
||||
public boolean rebootRouter(final long routerId, long startEventId) {
|
||||
return _routerMgr.rebootRouter(routerId, startEventId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException{
|
||||
return _routerMgr.rebootRouter(cmd);
|
||||
public DomainRouterVO rebootRouter(RebootRouterCmd cmd) throws InvalidParameterValueException, PermissionDeniedException{
|
||||
_routerMgr.rebootRouter(cmd);
|
||||
return _routerMgr.getRouter(cmd.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean associateIP(final DomainRouterVO router, final List<String> ipAddrList, final boolean add, long vmId) {
|
||||
Commands cmds = new Commands(OnError.Continue);
|
||||
int i=0;
|
||||
boolean sourceNat = false;
|
||||
for (final String ipAddress: ipAddrList) {
|
||||
if (ipAddress.equalsIgnoreCase(router.getPublicIpAddress()))
|
||||
|
||||
@ -89,8 +89,10 @@ import com.cloud.api.commands.StopSystemVmCmd;
|
||||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.api.commands.UpdateDomainCmd;
|
||||
import com.cloud.api.commands.UpdateIPForwardingRuleCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplatePermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateUserCmd;
|
||||
import com.cloud.api.commands.UpdateVMGroupCmd;
|
||||
import com.cloud.api.commands.UploadCustomCertificateCmd;
|
||||
@ -595,10 +597,11 @@ public interface ManagementServer {
|
||||
/**
|
||||
* Creates a new template
|
||||
* @param cmd
|
||||
* @return success/failure
|
||||
* @return updated template
|
||||
* @throws InvalidParameterValueException, PermissionDeniedException
|
||||
*/
|
||||
boolean updateTemplate(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
VMTemplateVO updateTemplate(UpdateIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
VMTemplateVO updateTemplate(UpdateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException;
|
||||
|
||||
/**
|
||||
* Copies a template from one secondary storage server to another
|
||||
@ -1173,7 +1176,8 @@ public interface ManagementServer {
|
||||
boolean checkLocalStorageConfigVal();
|
||||
|
||||
boolean updateUser(UpdateUserCmd cmd) throws InvalidParameterValueException;
|
||||
boolean updateTemplatePermissions(UpdateTemplateOrIsoPermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
boolean updateTemplatePermissions(UpdateTemplatePermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
boolean updateTemplatePermissions(UpdateIsoPermissionsCmd cmd)throws InvalidParameterValueException, PermissionDeniedException,InternalErrorException;
|
||||
String[] createApiKeyAndSecretKey(RegisterCmd cmd);
|
||||
|
||||
VolumeVO findVolumeByInstanceAndDeviceId(long instanceId, long deviceId);
|
||||
|
||||
@ -128,7 +128,9 @@ import com.cloud.api.commands.StopSystemVmCmd;
|
||||
import com.cloud.api.commands.UpdateAccountCmd;
|
||||
import com.cloud.api.commands.UpdateDomainCmd;
|
||||
import com.cloud.api.commands.UpdateIPForwardingRuleCmd;
|
||||
import com.cloud.api.commands.UpdateIsoCmd;
|
||||
import com.cloud.api.commands.UpdateIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoCmd;
|
||||
import com.cloud.api.commands.UpdateTemplateOrIsoPermissionsCmd;
|
||||
import com.cloud.api.commands.UpdateTemplatePermissionsCmd;
|
||||
@ -222,8 +224,6 @@ import com.cloud.storage.GuestOSCategoryVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.LaunchPermissionVO;
|
||||
import com.cloud.storage.Snapshot;
|
||||
import com.cloud.storage.Upload;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.Snapshot.SnapshotType;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.SnapshotVO;
|
||||
@ -236,7 +236,7 @@ import com.cloud.storage.StorageStats;
|
||||
import com.cloud.storage.Upload.Type;
|
||||
import com.cloud.storage.UploadVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.Volume.VolumeType;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.VolumeStats;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.DiskOfferingDao;
|
||||
@ -252,7 +252,6 @@ import com.cloud.storage.dao.UploadDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao.TemplateFilter;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.download.DownloadMonitor;
|
||||
import com.cloud.storage.preallocatedlun.PreallocatedLunVO;
|
||||
import com.cloud.storage.preallocatedlun.dao.PreallocatedLunDao;
|
||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||
@ -3423,9 +3422,18 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateTemplate(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
public VMTemplateVO updateTemplate(UpdateIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
return updateTemplateOrIso(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO updateTemplate(UpdateTemplateCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
return updateTemplateOrIso(cmd);
|
||||
}
|
||||
|
||||
private VMTemplateVO updateTemplateOrIso(UpdateTemplateOrIsoCmd cmd) throws InvalidParameterValueException, PermissionDeniedException {
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getName();
|
||||
String name = cmd.getTemplateName();
|
||||
String displayText = cmd.getDisplayText();
|
||||
String format = cmd.getFormat();
|
||||
Long guestOSId = cmd.getOsTypeId();
|
||||
@ -3462,7 +3470,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
|
||||
boolean updateNeeded = !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null);
|
||||
if (!updateNeeded) {
|
||||
return true;
|
||||
return template;
|
||||
}
|
||||
|
||||
template = _templateDao.createForUpdate(id);
|
||||
@ -3504,7 +3512,9 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
template.setBootable(bootable);
|
||||
}
|
||||
|
||||
return _templateDao.update(id, template);
|
||||
_templateDao.update(id, template);
|
||||
|
||||
return _templateDao.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -5178,7 +5188,7 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
sc.setParameters("accountId", accountId);
|
||||
} else if (domainId != null) {
|
||||
DomainVO domain = _domainDao.findById((Long)domainId);
|
||||
SearchCriteria joinSearch = sc.getJoin("accountSearch");
|
||||
SearchCriteria<?> joinSearch = sc.getJoin("accountSearch");
|
||||
joinSearch.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
||||
}
|
||||
|
||||
@ -5216,9 +5226,20 @@ public class ManagementServerImpl implements ManagementServer {
|
||||
(accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override @DB
|
||||
public boolean updateTemplatePermissions(UpdateTemplatePermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
return updateTemplateOrIsoPermissions(cmd);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public boolean updateTemplatePermissions(UpdateIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
return updateTemplateOrIsoPermissions(cmd);
|
||||
}
|
||||
|
||||
@DB
|
||||
public boolean updateTemplatePermissions(UpdateTemplateOrIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
protected boolean updateTemplateOrIsoPermissions(UpdateTemplateOrIsoPermissionsCmd cmd) throws InvalidParameterValueException,
|
||||
PermissionDeniedException, InternalErrorException {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
||||
|
||||
@ -410,6 +410,7 @@ public class AccountManagerImpl implements AccountManager {
|
||||
public ResourceLimitVO updateResourceLimit(UpdateResourceLimitCmd cmd) throws InvalidParameterValueException {
|
||||
|
||||
Account account = (Account)UserContext.current().getAccount();
|
||||
String accountName = cmd.getAccountName();
|
||||
Long domainId = cmd.getDomainId();
|
||||
Long max = cmd.getMax();
|
||||
Integer type = cmd.getResourceType();
|
||||
@ -447,9 +448,9 @@ public class AccountManagerImpl implements AccountManager {
|
||||
}
|
||||
|
||||
if (account.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) {
|
||||
if ((domainId != null) && (account.getAccountName() == null) && domainId.equals(account.getDomainId())) {
|
||||
if ((domainId != null) && (accountName == null) && domainId.equals(account.getDomainId())) {
|
||||
// if the admin is trying to update their own domain, disallow...
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update resource limit for " + ((account.getAccountName() == null) ? "" : "account " + account.getAccountName() + " in ") + "domain " + domainId + ", permission denied");
|
||||
throw new ServerApiException(BaseCmd.ACCOUNT_ERROR, "Unable to update resource limit for domain " + domainId + ", permission denied");
|
||||
}
|
||||
|
||||
// If there is an existing ROOT domain limit, make sure its max isn't being exceeded
|
||||
@ -471,15 +472,12 @@ public class AccountManagerImpl implements AccountManager {
|
||||
|
||||
if (domainId == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "Unable to update resource limit, unable to determine domain in which to update limit.");
|
||||
} else if (account != null) {
|
||||
if (account.getAccountName() != null) {
|
||||
Account userAccount = _accountDao.findActiveAccount(account.getAccountName(), domainId);
|
||||
if (userAccount == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account by name " + account.getAccountName() + " in domain with id " + domainId);
|
||||
}
|
||||
accountId = userAccount.getId();
|
||||
domainId = userAccount.getDomainId();
|
||||
} else if (accountName != null) {
|
||||
Account userAccount = _accountDao.findActiveAccount(accountName, domainId);
|
||||
if (userAccount == null) {
|
||||
throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find account by name " + account.getAccountName() + " in domain with id " + domainId);
|
||||
}
|
||||
accountId = userAccount.getId();
|
||||
}
|
||||
|
||||
if (accountId != null) domainId = null;
|
||||
|
||||
2
ui/new/css/jquery-ui-1.8.2.custom.css
vendored
@ -34,7 +34,7 @@
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index:1007;}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
html,body{
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-size:11px;
|
||||
color:#717171;
|
||||
color:#333;
|
||||
height:auto;
|
||||
font-weight:normal;
|
||||
background:#00374e url(../images/login_bg.gif) repeat-x top left;
|
||||
@ -270,7 +270,7 @@ a:hover {
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
width: 100%;
|
||||
min-height: 1070px;
|
||||
min-height: 1000px;
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
z-index:1001;
|
||||
@ -280,6 +280,8 @@ a:hover {
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.vmpopup_container {
|
||||
width:737px;
|
||||
height:505px;
|
||||
@ -2153,6 +2155,27 @@ a:hover.search_button {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.midmenu_itemheader {
|
||||
width:220px;
|
||||
height:auto;
|
||||
float:left;
|
||||
background:#989898 url(../images/midmenu_titlebg.gif) repeat-x top left;
|
||||
margin:0;
|
||||
padding:0 0 4px 0;
|
||||
}
|
||||
|
||||
.midmenu_titlebox p{
|
||||
width:220px;
|
||||
height:auto;
|
||||
float:left;
|
||||
color:#333;
|
||||
text-align:left;
|
||||
font-weight:bold;
|
||||
font-size:11px;
|
||||
margin:3px 0 0 10px;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.midmenu_content{
|
||||
width:220px;
|
||||
height:auto;
|
||||
@ -2167,9 +2190,10 @@ a:hover.search_button {
|
||||
padding:0 0 4px 0;
|
||||
}
|
||||
|
||||
.midmenu_content.selected{
|
||||
background:#626262 url(../images/leftmenu_selected.gif) repeat-x top left;7497ae url(../images/mid_addingbg.gif) repeat-x top left;
|
||||
color:#FFF;
|
||||
.midmenu_content.selected {
|
||||
background:#626262 url(../images/leftmenu_selected.gif) repeat-x top left;
|
||||
color:#FFF !important;
|
||||
|
||||
}
|
||||
|
||||
.midmenu_content.inaction{
|
||||
@ -2205,6 +2229,17 @@ a:hover.search_button {
|
||||
}
|
||||
|
||||
.midmenu_textbox p {
|
||||
width:165px;
|
||||
height:auto;
|
||||
float:left;
|
||||
text-align:left;
|
||||
font-weight:normal;
|
||||
font-size:11px;
|
||||
margin:3px 0 0 0;
|
||||
padding:0;
|
||||
|
||||
}
|
||||
.midmenu_textbox span {
|
||||
width:165px;
|
||||
height:auto;
|
||||
float:left;
|
||||
@ -2213,6 +2248,7 @@ a:hover.search_button {
|
||||
font-size:10px;
|
||||
margin:3px 0 0 0;
|
||||
padding:0;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
|
||||
@ -2222,14 +2258,16 @@ a:hover.search_button {
|
||||
height:auto;
|
||||
margin:0 0 0 221px;
|
||||
padding:0;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.main_contentarea_without_midmenu {
|
||||
width:auto;
|
||||
min-height:1000px;
|
||||
height:auto;
|
||||
margin:0 0 0 10px;
|
||||
margin:0 0 0 0;
|
||||
padding:0;
|
||||
position:relative;
|
||||
}
|
||||
|
||||
.main_title {
|
||||
@ -2309,6 +2347,41 @@ a:hover.search_button {
|
||||
cursor:hand;
|
||||
}
|
||||
|
||||
.rightpanel_mainloaderbox {
|
||||
width:auto;
|
||||
height:auto;
|
||||
position:absolute;
|
||||
top:30%;
|
||||
left:40%;
|
||||
background:#FFF;
|
||||
border:1px solid #CCC;
|
||||
margin:0;
|
||||
padding:0;
|
||||
z-index:1008;
|
||||
}
|
||||
|
||||
.rightpanel_mainloaderbox p{
|
||||
width:auto;
|
||||
height:auto;
|
||||
float:left;
|
||||
color:#333;
|
||||
font-size:16px;
|
||||
font-weight:normal;
|
||||
margin:15px 10px 0 10px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
.rightpanel_mainloader_animatedicon {
|
||||
width:40px;
|
||||
height:40px;
|
||||
float:left;
|
||||
background:url(../images/big_loading.gif) no-repeat top left;
|
||||
margin:3px 0 0 5px;
|
||||
display:inline;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
|
||||
.text_container {
|
||||
width:100%;
|
||||
height:auto;
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
ui/new/images/midmenu_titlebg.gif
Normal file
|
After Width: | Height: | Size: 195 B |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 3.3 KiB |
@ -225,6 +225,14 @@ long milliseconds = new Date().getTime();
|
||||
<%=t.t("add")%></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_add3_link" style="display: none;">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button_icons">
|
||||
<img src="images/addvm_actionicon.png" alt="Add" /></div>
|
||||
<div class="actionpanel_button_links" id="label">
|
||||
<%=t.t("add")%></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_startvm_link" style="display: none;">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button_icons">
|
||||
@ -308,6 +316,7 @@ long milliseconds = new Date().getTime();
|
||||
<!-- Mid Menu starts here-->
|
||||
<div class="midmenu_panel" id="middle_menu">
|
||||
<div class="midmenu_box" id="midmenu_container">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Mid Menu ends here-->
|
||||
@ -668,18 +677,19 @@ long milliseconds = new Date().getTime();
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="midmenu_itemheader" style="display:none;"><p>(type)</p></div>
|
||||
<div class="midmenu_list" id="midmenu_item" style="display: none;">
|
||||
<div class="midmenu_content" id="content">
|
||||
<div class="midmenu_icons" id="icon_container" style="display: none">
|
||||
<img id="icon" /></div>
|
||||
<div class="midmenu_textbox">
|
||||
<p style="font-size: 11px;">
|
||||
<p>
|
||||
<strong id="first_row"> </strong>
|
||||
</p>
|
||||
<p id="second_row_container">
|
||||
<span id="second_row_container">
|
||||
<span id="second_row"> </span>
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
<div class="midmenu_inactionloader" id="spinning_wheel" style="display: none;">
|
||||
</div>
|
||||
|
||||
@ -7,6 +7,15 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
<!-- account detail panel (begin) -->
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_accountsicon.gif" alt="Accounts" /></div>
|
||||
@ -14,6 +23,7 @@
|
||||
Accounts</h1>
|
||||
</div>
|
||||
<div class="contentbox" id="right_panel_content">
|
||||
|
||||
<div class="info_detailbox errorbox" id="after_action_info_container_on_top" style="display: none">
|
||||
<p id="after_action_info">
|
||||
</p>
|
||||
|
||||
@ -6,6 +6,15 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- alert detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
|
||||
@ -6,6 +6,16 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
<!--Loading-->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
<img src="images/title_dashboardicon.gif" alt="Dashboard" /></div>
|
||||
|
||||
@ -7,6 +7,16 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,16 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- domain detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
|
||||
@ -5,6 +5,15 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- event detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
@ -7,6 +7,16 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VM detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IP Address detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ISO detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- domain detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
@ -996,16 +1007,28 @@
|
||||
</ol>
|
||||
</form>
|
||||
</div>
|
||||
<!--Loading box-->
|
||||
<div id="spinning_wheel" class="ui_dialog_loaderbox" style="display:none;">
|
||||
<div class="ui_dialog_loader"></div>
|
||||
<p>Adding....</p>
|
||||
</div>
|
||||
|
||||
<!--Confirmation msg box-->
|
||||
<!--Note: for error msg, just have to add error besides everything for eg. add error(class) next to ui_dialog_messagebox error, ui_dialog_msgicon error, ui_dialog_messagebox_text error. -->
|
||||
<div id="info_container" class="ui_dialog_messagebox error" style="display:none;">
|
||||
<div id="icon" class="ui_dialog_msgicon error"></div>
|
||||
<div id="info" class="ui_dialog_messagebox_text error">(info)</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add VLAN IP Range Dialog for zone (end) -->
|
||||
|
||||
<!-- Add VLAN IP Range button -->
|
||||
<div class="networkswitch_vlanadd">
|
||||
<div class="networkswitch_vlan_addbutton"></div>
|
||||
</div>
|
||||
<div id="add_vlan_button" class="networkswitch_vlanadd" style="display:none">
|
||||
<div class="networkswitch_vlan_addbutton"></div>
|
||||
</div>
|
||||
|
||||
<!-- Direct VLAN Template (begin) -->
|
||||
<div class="networkswitch_vlanpanel" id="direct_vlan_template" style="display: block;">
|
||||
<!-- VLAN Template (begin) -->
|
||||
<div class="networkswitch_vlanpanel" id="vlan_template" style="display:none;">
|
||||
|
||||
<div class="networkswitch_vlanconnect">
|
||||
<div class="networkswitch_closeicon"></div>
|
||||
@ -1035,35 +1058,12 @@
|
||||
<span id="ip_range">n.n.n.n - m.m.m.m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="networkswitch_typeicon direct">
|
||||
</div>
|
||||
|
||||
<div id="vlan_type_icon" class="networkswitch_typeicon">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Direct VLAN Template (end) -->
|
||||
<!-- Public VLAN Template (begin) -->
|
||||
<div class="networkswitch_vlanpanel" id="virtual_vlan_template" style="display: none">
|
||||
<div class="networkswitch_vlanconnect">
|
||||
<div class="networkswitch_vlan_infoicon">
|
||||
</div>
|
||||
<div class="networkswitch_vlan_detailsbox">
|
||||
<div class="networkswitch_vlan_detailsbox_textbox">
|
||||
<div class="networkswitch_vlan_detailsbox_textbox_label">
|
||||
VLAN:</div>
|
||||
<span id="vlan_id">n</span>
|
||||
</div>
|
||||
<div class="networkswitch_vlan_detailsbox_textbox">
|
||||
<div class="networkswitch_vlan_detailsbox_textbox_label">
|
||||
<%=t.t("ip.address.range")%>:</div>
|
||||
<span id="ip_range">n.n.n.n - m.m.m.m</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="networkswitch_typeicon virtual">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Public VLAN Template (begin) -->
|
||||
<!-- VLAN Template (end) -->
|
||||
|
||||
|
||||
<!-- secondary storage tab template (begin) -->
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- router detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
|
||||
@ -7,6 +7,16 @@
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- snapshot detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,18 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- template detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
<div class="main_titleicon">
|
||||
|
||||
@ -6,6 +6,17 @@
|
||||
Locale browserLocale = request.getLocale();
|
||||
CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale);
|
||||
%>
|
||||
|
||||
<!-- Loading -->
|
||||
<div style="display:none;">
|
||||
<div class="ui-widget-overlay">
|
||||
</div>
|
||||
<div class="rightpanel_mainloaderbox" >
|
||||
<div class="rightpanel_mainloader_animatedicon"></div>
|
||||
<p>Loading … </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- volume detail panel (begin) -->
|
||||
<div class="main_title" id="right_panel_header">
|
||||
|
||||
|
||||
@ -516,7 +516,8 @@ function clearMiddleMenu() {
|
||||
$("#midmenu_container").empty();
|
||||
$("#midmenu_action_link").hide();
|
||||
$("#midmenu_add_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
$("#midmenu_startvm_link").unbind("click").hide();
|
||||
$("#midmenu_stopvm_link").unbind("click").hide();
|
||||
$("#midmenu_rebootvm_link").unbind("click").hide();
|
||||
@ -872,6 +873,25 @@ function bindAndListMidMenuItems($leftmenu, commandString, jsonResponse1, jsonRe
|
||||
});
|
||||
}
|
||||
|
||||
function handleErrorInDialog(XMLHttpResponse, $thisDialog) {
|
||||
var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
|
||||
var end = XMLHttpResponse.responseText.indexOf("</h1");
|
||||
var errorMsg = XMLHttpResponse.responseText.substring(start, end);
|
||||
var $infoContainer = $thisDialog.find("#info_container");
|
||||
|
||||
if(errorMsg != null && errorMsg.length > 0)
|
||||
$infoContainer.find("#info").text(fromdb(errorMsg));
|
||||
else
|
||||
$infoContainer.find("#info").text("action failed");
|
||||
|
||||
$thisDialog.find("#spinning_wheel").fadeOut("slow");
|
||||
$infoContainer.fadeIn("slow");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -237,40 +237,43 @@ function showPage2($pageToShow, $menuItem1) {
|
||||
if($pageToShow.attr("id") == "resource_page") {
|
||||
initAddZoneButton($("#midmenu_add_link"));
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
initDialog("dialog_add_zone");
|
||||
}
|
||||
else if($pageToShow.attr("id") == "zone_page") {
|
||||
initDialog("dialog_add_pod", 320);
|
||||
else if($pageToShow.attr("id") == "zone_page") {
|
||||
initAddPodButton($("#midmenu_add_link"));
|
||||
//$("#midmenu_add2_link").unbind("click").hide(); //afterSwitchFnArray[] in switchBetweenDifferentTabs() has taken care of this line. So, this line is commented out.
|
||||
|
||||
initAddVLANButton($("#midmenu_add2_link"));
|
||||
initAddSecondaryStorageButton($("#midmenu_add3_link"));
|
||||
|
||||
initDialog("dialog_add_pod", 320);
|
||||
initDialog("dialog_add_vlan_for_zone");
|
||||
initDialog("dialog_add_secondarystorage");
|
||||
initDialog("dialog_confirmation_delete_secondarystorage");
|
||||
|
||||
// If the network type is vnet, don't show any vlan stuff.
|
||||
if (getNetworkType() == "vnet")
|
||||
$("#dialog_add_vlan_for_zone").attr("title", "Add Public IP Range");
|
||||
bindEventHandlerToDialogAddVlanForZone();
|
||||
|
||||
initDialog("dialog_add_secondarystorage");
|
||||
initDialog("dialog_confirmation_delete_secondarystorage");
|
||||
bindEventHandlerToDialogAddVlanForZone();
|
||||
|
||||
//switch between different tabs in zone page
|
||||
var $zonePage = $pageToShow;
|
||||
var tabArray = [$zonePage.find("#tab_details"), $zonePage.find("#tab_network"), $zonePage.find("#tab_secondarystorage")];
|
||||
var tabContentArray = [$zonePage.find("#tab_content_details"), $zonePage.find("#tab_content_network"), $zonePage.find("#tab_content_secondarystorage")];
|
||||
var afterSwitchFnArray = [afterSwitchToDetailsTab, afterSwitchToNetworkTab, afterSwitchToSecondaryStorageTab];
|
||||
switchBetweenDifferentTabs(tabArray, tabContentArray, afterSwitchFnArray);
|
||||
//var afterSwitchFnArray = [afterSwitchToDetailsTab, afterSwitchToNetworkTab, afterSwitchToSecondaryStorageTab];
|
||||
switchBetweenDifferentTabs(tabArray, tabContentArray);
|
||||
$zonePage.find("#tab_details").click();
|
||||
|
||||
hideMiddleMenu();
|
||||
zoneJsonToRightPanel($menuItem1);
|
||||
}
|
||||
else if($pageToShow.attr("id") == "pod_page") {
|
||||
initDialog("dialog_add_host");
|
||||
initAddHostButton($("#midmenu_add_link"));
|
||||
else if($pageToShow.attr("id") == "pod_page") {
|
||||
initAddHostButton($("#midmenu_add_link"));
|
||||
initAddPrimaryStorageButton($("#midmenu_add2_link"));
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
initDialog("dialog_add_host");
|
||||
initDialog("dialog_add_pool");
|
||||
initAddPrimaryStorageButton($("#midmenu_add2_link"));
|
||||
|
||||
// if hypervisor is KVM, limit the server option to NFS for now
|
||||
if (getHypervisorType() == 'kvm')
|
||||
@ -288,7 +291,8 @@ function showPage2($pageToShow, $menuItem1) {
|
||||
else if($pageToShow.attr("id") == "cluster_page") {
|
||||
$("#midmenu_add_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
showMiddleMenu();
|
||||
clusterJsonToRightPanel($menuItem1);
|
||||
|
||||
@ -298,8 +302,9 @@ function showPage2($pageToShow, $menuItem1) {
|
||||
listMidMenuItems2(("listStoragePools&clusterid="+clusterId), "liststoragepoolsresponse", "storagepool", primarystorageToMidmenu, primarystorageToRightPanel, primarystorageGetMidmenuId, false, false);
|
||||
}
|
||||
else if($pageToShow.attr("id") == "host_page") {
|
||||
$("#midmenu_add_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
initAddHostButton($("#midmenu_add_link"));
|
||||
initAddPrimaryStorageButton($("#midmenu_add2_link"));
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
initDialog("dialog_confirmation_enable_maintenance");
|
||||
initDialog("dialog_confirmation_cancel_maintenance");
|
||||
@ -308,14 +313,16 @@ function showPage2($pageToShow, $menuItem1) {
|
||||
initDialog("dialog_update_os");
|
||||
}
|
||||
else if($pageToShow.attr("id") == "primarystorage_page") {
|
||||
$("#midmenu_add_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
initAddHostButton($("#midmenu_add_link"));
|
||||
initAddPrimaryStorageButton($("#midmenu_add2_link"));
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
initDialog("dialog_confirmation_delete_primarystorage");
|
||||
}
|
||||
else if($pageToShow.attr("id") == "systemvm_page") {
|
||||
$("#midmenu_add_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
$("#midmenu_add3_link").unbind("click").hide();
|
||||
|
||||
hideMiddleMenu();
|
||||
systemvmJsonToRightPanel($menuItem1);
|
||||
@ -402,11 +409,11 @@ function zoneJsonToNetworkTab(jsonObj) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var item = items[i];
|
||||
|
||||
var $template1;
|
||||
if(item.forvirtualnetwork == "false")
|
||||
$template1 = $("#direct_vlan_template").clone();
|
||||
else
|
||||
$template1 = $("#virtual_vlan_template").clone();
|
||||
var $template1 = $("#vlan_template").clone();
|
||||
if(item.forvirtualnetwork == false) //direct
|
||||
$template1.find("#vlan_type_icon").removeClass("virtual").addClass("direct");
|
||||
else //virtual
|
||||
$template1.find("#vlan_type_icon").removeClass("direct").addClass("virtual");
|
||||
|
||||
vlanJsonToTemplate(item, $template1);
|
||||
$vlanContainer.append($template1.show());
|
||||
@ -778,20 +785,11 @@ function toSystemVMTypeText(value) {
|
||||
}
|
||||
//***** systemVM page (end) ***************************************************************************************************
|
||||
|
||||
function afterSwitchToDetailsTab() {
|
||||
$("#midmenu_add2_link").unbind("click").hide();
|
||||
}
|
||||
function afterSwitchToNetworkTab() {
|
||||
initAddVLANButton($("#midmenu_add2_link"));
|
||||
}
|
||||
function afterSwitchToSecondaryStorageTab() {
|
||||
initAddSecondaryStorageButton($("#midmenu_add2_link"));
|
||||
}
|
||||
|
||||
function initAddVLANButton($midmenuAdd2Link) {
|
||||
$midmenuAdd2Link.find("#label").text("Add VLAN IP Range");
|
||||
$midmenuAdd2Link.show();
|
||||
$midmenuAdd2Link.unbind("click").bind("click", function(event) {
|
||||
function initAddVLANButton($addButton) {
|
||||
$addButton.find("#label").text("Add VLAN");
|
||||
$addButton.show();
|
||||
$addButton.unbind("click").bind("click", function(event) {
|
||||
$("#zone_page").find("#tab_network").click();
|
||||
var zoneObj = $("#zone_page").find("#tab_content_details").data("jsonObj");
|
||||
var dialogAddVlanForZone = $("#dialog_add_vlan_for_zone");
|
||||
dialogAddVlanForZone.find("#zone_name").text(fromdb(zoneObj.name));
|
||||
@ -841,31 +839,33 @@ function initAddVLANButton($midmenuAdd2Link) {
|
||||
dialogAddVlanForZone
|
||||
.dialog('option', 'buttons', {
|
||||
"Add": function() {
|
||||
var thisDialog = $(this);
|
||||
var $thisDialog = $(this);
|
||||
$thisDialog.find("#info_container").hide();
|
||||
|
||||
// validate values
|
||||
var isValid = true;
|
||||
var isTagged = false;
|
||||
var isDirect = false;
|
||||
if (getNetworkType() == "vlan") {
|
||||
isDirect = thisDialog.find("#add_publicip_vlan_type").val() == "false";
|
||||
isTagged = thisDialog.find("#add_publicip_vlan_tagged").val() == "tagged";
|
||||
isDirect = $thisDialog.find("#add_publicip_vlan_type").val() == "false";
|
||||
isTagged = $thisDialog.find("#add_publicip_vlan_tagged").val() == "tagged";
|
||||
}
|
||||
|
||||
isValid &= validateString("Account", thisDialog.find("#add_publicip_vlan_account"), thisDialog.find("#add_publicip_vlan_account_errormsg"), true); //optional
|
||||
isValid &= validateString("Account", $thisDialog.find("#add_publicip_vlan_account"), $thisDialog.find("#add_publicip_vlan_account_errormsg"), true); //optional
|
||||
|
||||
if (isTagged) {
|
||||
isValid &= validateNumber("VLAN", thisDialog.find("#add_publicip_vlan_vlan"), thisDialog.find("#add_publicip_vlan_vlan_errormsg"), 2, 4095);
|
||||
isValid &= validateNumber("VLAN", $thisDialog.find("#add_publicip_vlan_vlan"), $thisDialog.find("#add_publicip_vlan_vlan_errormsg"), 2, 4095);
|
||||
}
|
||||
isValid &= validateIp("Gateway", thisDialog.find("#add_publicip_vlan_gateway"), thisDialog.find("#add_publicip_vlan_gateway_errormsg"));
|
||||
isValid &= validateIp("Netmask", thisDialog.find("#add_publicip_vlan_netmask"), thisDialog.find("#add_publicip_vlan_netmask_errormsg"));
|
||||
isValid &= validateIp("Start IP Range", thisDialog.find("#add_publicip_vlan_startip"), thisDialog.find("#add_publicip_vlan_startip_errormsg")); //required
|
||||
isValid &= validateIp("End IP Range", thisDialog.find("#add_publicip_vlan_endip"), thisDialog.find("#add_publicip_vlan_endip_errormsg"), true); //optional
|
||||
isValid &= validateIp("Gateway", $thisDialog.find("#add_publicip_vlan_gateway"), $thisDialog.find("#add_publicip_vlan_gateway_errormsg"));
|
||||
isValid &= validateIp("Netmask", $thisDialog.find("#add_publicip_vlan_netmask"), $thisDialog.find("#add_publicip_vlan_netmask_errormsg"));
|
||||
isValid &= validateIp("Start IP Range", $thisDialog.find("#add_publicip_vlan_startip"), $thisDialog.find("#add_publicip_vlan_startip_errormsg")); //required
|
||||
isValid &= validateIp("End IP Range", $thisDialog.find("#add_publicip_vlan_endip"), $thisDialog.find("#add_publicip_vlan_endip_errormsg"), true); //optional
|
||||
if (!isValid)
|
||||
return;
|
||||
|
||||
thisDialog.dialog("close");
|
||||
//$thisDialog.dialog("close"); //only close dialog when this action succeeds
|
||||
|
||||
var vlan = trim(thisDialog.find("#add_publicip_vlan_vlan").val());
|
||||
var vlan = trim($thisDialog.find("#add_publicip_vlan_vlan").val());
|
||||
if (isTagged) {
|
||||
vlan = "&vlan="+vlan;
|
||||
} else {
|
||||
@ -874,37 +874,37 @@ function initAddVLANButton($midmenuAdd2Link) {
|
||||
|
||||
var scopeParams = "";
|
||||
if(dialogAddVlanForZone.find("#add_publicip_vlan_scope").val()=="account-specific")
|
||||
scopeParams = "&domainId="+trim(thisDialog.find("#add_publicip_vlan_domain").val())+"&account="+trim(thisDialog.find("#add_publicip_vlan_account").val());
|
||||
scopeParams = "&domainId="+trim($thisDialog.find("#add_publicip_vlan_domain").val())+"&account="+trim($thisDialog.find("#add_publicip_vlan_account").val());
|
||||
|
||||
var type = "true";
|
||||
if (getNetworkType() == "vlan")
|
||||
type = trim(thisDialog.find("#add_publicip_vlan_type").val());
|
||||
type = trim($thisDialog.find("#add_publicip_vlan_type").val());
|
||||
|
||||
var gateway = trim(thisDialog.find("#add_publicip_vlan_gateway").val());
|
||||
var netmask = trim(thisDialog.find("#add_publicip_vlan_netmask").val());
|
||||
var startip = trim(thisDialog.find("#add_publicip_vlan_startip").val());
|
||||
var endip = trim(thisDialog.find("#add_publicip_vlan_endip").val());
|
||||
|
||||
var $template1;
|
||||
if(type == "false") //direct
|
||||
$template1 = $("#direct_vlan_template").clone();
|
||||
else //public
|
||||
$template1 = $("#virtual_vlan_template").clone();
|
||||
|
||||
if($vlanContainer != null)
|
||||
$vlanContainer.prepend($template1.show());
|
||||
|
||||
var gateway = trim($thisDialog.find("#add_publicip_vlan_gateway").val());
|
||||
var netmask = trim($thisDialog.find("#add_publicip_vlan_netmask").val());
|
||||
var startip = trim($thisDialog.find("#add_publicip_vlan_startip").val());
|
||||
var endip = trim($thisDialog.find("#add_publicip_vlan_endip").val());
|
||||
|
||||
$thisDialog.find("#spinning_wheel").fadeIn("slow");
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=createVlanIpRange&forVirtualNetwork="+type+"&zoneId="+zoneObj.id+vlan+scopeParams+"&gateway="+encodeURIComponent(gateway)+"&netmask="+encodeURIComponent(netmask)+"&startip="+encodeURIComponent(startip)+"&endip="+encodeURIComponent(endip)),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
vlanJsonToTemplate(json.createvlaniprangeresponse, $template1);
|
||||
success: function(json) {
|
||||
$thisDialog.dialog("close");
|
||||
|
||||
var $template1 = $("#vlan_template").clone();
|
||||
if(type == "false") //direct
|
||||
$template1.find("#vlan_type_icon").removeClass("virtual").addClass("direct");
|
||||
else //virtual
|
||||
$template1.find("#vlan_type_icon").removeClass("direct").addClass("virtual");
|
||||
|
||||
vlanJsonToTemplate(json.createvlaniprangeresponse, $template1);
|
||||
$vlanContainer.prepend($template1);
|
||||
$template1.fadeIn("slow");
|
||||
},
|
||||
error: function(XMLHttpResponse) {
|
||||
handleError(XMLHttpResponse);
|
||||
$template1.slideUp(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
handleErrorInDialog(XMLHttpResponse, $thisDialog);
|
||||
}
|
||||
});
|
||||
|
||||
@ -917,10 +917,11 @@ function initAddVLANButton($midmenuAdd2Link) {
|
||||
});
|
||||
}
|
||||
|
||||
function initAddSecondaryStorageButton($midmenuAdd2Link) {
|
||||
$midmenuAdd2Link.find("#label").text("Add Secondary Storage");
|
||||
$midmenuAdd2Link.show();
|
||||
$midmenuAdd2Link.unbind("click").bind("click", function(event) {
|
||||
function initAddSecondaryStorageButton($addButton) {
|
||||
$addButton.find("#label").text("Add Secondary Storage");
|
||||
$addButton.show();
|
||||
$addButton.unbind("click").bind("click", function(event) {
|
||||
$("#zone_page").find("#tab_secondarystorage").click();
|
||||
var zoneObj = $("#zone_page").find("#tab_content_details").data("jsonObj");
|
||||
$("#dialog_add_secondarystorage").find("#zone_name").text(fromdb(zoneObj.name));
|
||||
|
||||
|
||||
@ -343,15 +343,9 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
||||
}
|
||||
|
||||
if (joins != null) {
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
for (final Pair<Attribute, Object> value : join.getT().getValues()) {
|
||||
prepareAttribute(++i, pstmt, value.first(), value.second());
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("join search statement is " + pstmt.toString());
|
||||
}
|
||||
i = addJoinAttributes(i, pstmt, joins);
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled() && lock != null) {
|
||||
txn.registerLock(pstmt.toString());
|
||||
}
|
||||
@ -404,14 +398,7 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
||||
}
|
||||
|
||||
if (joins != null) {
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
for (final Pair<Attribute, Object> value : join.getT().getValues()) {
|
||||
prepareAttribute(++i, pstmt, value.first(), value.second());
|
||||
}
|
||||
}
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("join search statement is " + pstmt.toString());
|
||||
}
|
||||
i = addJoinAttributes(i, pstmt, joins);
|
||||
}
|
||||
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
@ -636,19 +623,21 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
||||
return (M)rs.getObject(index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@DB(txn=false)
|
||||
protected int addJoinAttributes(int count, PreparedStatement pstmt, List<Ternary<SearchCriteria<?>, Attribute, Attribute>> joins) throws SQLException {
|
||||
for (Ternary<SearchCriteria<?>, Attribute, Attribute> join : joins) {
|
||||
for (final Pair<Attribute, Object> value : join.first().getValues()) {
|
||||
protected int addJoinAttributes(int count, PreparedStatement pstmt, Collection<JoinBuilder<SearchCriteria<?>>> joins) throws SQLException {
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
for (final Pair<Attribute, Object> value : join.getT().getValues()) {
|
||||
prepareAttribute(++count, pstmt, value.first(), value.second());
|
||||
}
|
||||
}
|
||||
for (Ternary<SearchCriteria<?>, Attribute, Attribute> join : joins) {
|
||||
if (join.first().getJoins() != null) {
|
||||
count = addJoinAttributes(count, pstmt, joins);
|
||||
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
if (join.getT().getJoins() != null) {
|
||||
count = addJoinAttributes(count, pstmt, join.getT().getJoins());
|
||||
}
|
||||
}
|
||||
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("join search statement is " + pstmt.toString());
|
||||
}
|
||||
@ -1015,31 +1004,38 @@ public abstract class GenericDaoBase<T, ID extends Serializable> implements Gene
|
||||
return sql;
|
||||
}
|
||||
|
||||
@DB(txn=false)
|
||||
|
||||
@DB(txn = false)
|
||||
protected void addJoins(StringBuilder str, Collection<JoinBuilder<SearchCriteria<?>>> joins) {
|
||||
int fromIndex = str.lastIndexOf("WHERE");
|
||||
if (fromIndex == -1) {
|
||||
fromIndex = str.length();
|
||||
fromIndex = str.length();
|
||||
str.append(" WHERE ");
|
||||
} else {
|
||||
str.append(" AND ");
|
||||
}
|
||||
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
StringBuilder onClause = new StringBuilder();
|
||||
onClause.append(" ").append(join.getType().getName()).append(" ").append(join.getSecondAttribute().table).append(" ON ").append(join.getFirstAttribute().table).append(".").append(join.getFirstAttribute().columnName).append("=").append(join.getSecondAttribute().table).append(".").append(join.getSecondAttribute().columnName).append(" ");
|
||||
str.insert(fromIndex, onClause);
|
||||
str.append(" (").append(join.getT().getWhereClause()).append(") AND ");
|
||||
fromIndex+=onClause.length();
|
||||
}
|
||||
|
||||
str.delete(str.length() - 4, str.length());
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
StringBuilder onClause = new StringBuilder();
|
||||
onClause.append(" ").append(join.getType().getName()).append(" ").append(join.getSecondAttribute().table)
|
||||
.append(" ON ").append(join.getFirstAttribute().table).append(".").append(join.getFirstAttribute().columnName)
|
||||
.append("=").append(join.getSecondAttribute().table).append(".").append(join.getSecondAttribute().columnName)
|
||||
.append(" ");
|
||||
str.insert(fromIndex, onClause);
|
||||
String whereClause = join.getT().getWhereClause();
|
||||
if ((whereClause != null) && !"".equals(whereClause)) {
|
||||
str.append(" (").append(whereClause).append(") AND");
|
||||
}
|
||||
fromIndex += onClause.length();
|
||||
}
|
||||
|
||||
str.delete(str.length() - 4, str.length());
|
||||
|
||||
for (JoinBuilder<SearchCriteria<?>> join : joins) {
|
||||
if (join.getT().getJoins() != null) {
|
||||
addJoins(str, join.getT().getJoins());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override @DB(txn=false)
|
||||
|
||||