From b3c7821b441021f87b0abf9ba0540ae3ea323e4b Mon Sep 17 00:00:00 2001 From: Kris McQueen Date: Mon, 25 Oct 2010 17:32:14 -0700 Subject: [PATCH 1/2] bug 6752: fix updating resource limits for a domain by looking at the given accountName/domainId parameters rather than looking at the caller's account. If updating limits for an account, e.g. account 'foo' in domain 4, then execute updateResourceLimit&account=foo&domainid=4&..., but if updating the limit for a domain, don't specify the account parameter. When processing the command, if accountName is null, the limit for the domain will be properly updated. status 6752: resolved fixed --- .../api/commands/ListResourceLimitsCmd.java | 2 +- .../api/commands/UpdateResourceLimitCmd.java | 2 +- .../api/response/ResourceLimitResponse.java | 6 +++--- .../src/com/cloud/user/AccountManagerImpl.java | 18 ++++++++---------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java index 742934b34dd..bf69e45aa47 100644 --- a/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java +++ b/server/src/com/cloud/api/commands/ListResourceLimitsCmd.java @@ -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"); diff --git a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java index 361b66f2cd9..df7b12f75cc 100644 --- a/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java +++ b/server/src/com/cloud/api/commands/UpdateResourceLimitCmd.java @@ -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()); diff --git a/server/src/com/cloud/api/response/ResourceLimitResponse.java b/server/src/com/cloud/api/response/ResourceLimitResponse.java index 5b4ba74a4df..3c501397201 100644 --- a/server/src/com/cloud/api/response/ResourceLimitResponse.java +++ b/server/src/com/cloud/api/response/ResourceLimitResponse.java @@ -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; } diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 0759115fc98..b7282e96750 100644 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -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; From a2e5b7d849ee48232e619f885572376a951830be Mon Sep 17 00:00:00 2001 From: NIKITA Date: Mon, 25 Oct 2010 17:58:19 -0700 Subject: [PATCH 2/2] middle list the subject and first line description made more prominent --- ui/new/css/main.css | 21 +++++++++++++++++---- ui/new/index.jsp | 6 +++--- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ui/new/css/main.css b/ui/new/css/main.css index 15a2a60193e..2c28a9c1158 100644 --- a/ui/new/css/main.css +++ b/ui/new/css/main.css @@ -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; @@ -2190,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{ @@ -2228,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; @@ -2236,6 +2248,7 @@ a:hover.search_button { font-size:10px; margin:3px 0 0 0; padding:0; + color:#999; } diff --git a/ui/new/index.jsp b/ui/new/index.jsp index 3c680df2531..bee9823d813 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -684,12 +684,12 @@ long milliseconds = new Date().getTime();
-

+

 

-

+   -

+