[GitHub] [cloudstack] ustcweizhou commented on a change in pull request #3331: api/server: Add option 'details' to listProjects and listAccounts

2019-06-20 Thread GitBox
ustcweizhou commented on a change in pull request #3331: api/server: Add option 
'details' to listProjects and listAccounts
URL: https://github.com/apache/cloudstack/pull/3331#discussion_r295975253
 
 

 ##
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
 ##
 @@ -55,6 +61,12 @@
 @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, 
description = "list accounts by state. Valid states are enabled, disabled, and 
locked.")
 private String state;
 
+@Parameter(name = ApiConstants.DETAILS,
+   type = CommandType.LIST,
+   collectionType = CommandType.STRING,
+   description = "comma separated list of account details 
requested, value can be a list of [ all, resource, min]")
+private List viewDetails;
 
 Review comment:
   @DaanHoogland good
   
   > @ustcweizhou can you fix the merge conflict? Thanks.
   
   @rhtyd rebased with latest master


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] ustcweizhou commented on a change in pull request #3331: api/server: Add option 'details' to listProjects and listAccounts

2019-05-27 Thread GitBox
ustcweizhou commented on a change in pull request #3331: api/server: Add option 
'details' to listProjects and listAccounts
URL: https://github.com/apache/cloudstack/pull/3331#discussion_r287857448
 
 

 ##
 File path: 
api/src/main/java/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
 ##
 @@ -55,6 +61,12 @@
 @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, 
description = "list accounts by state. Valid states are enabled, disabled, and 
locked.")
 private String state;
 
+@Parameter(name = ApiConstants.DETAILS,
+   type = CommandType.LIST,
+   collectionType = CommandType.STRING,
+   description = "comma separated list of account details 
requested, value can be a list of [ all, resource, min]")
+private List viewDetails;
 
 Review comment:
   @rhtyd @DaanHoogland 
   this is same as viewDetails in ListVMsCmd and ListHostsCmd.java
   In some other API, details are in key/value pairs.
   
   I agree 'view' or 'listdetails' make more sense.
   I am afraid of backward compatibility.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [cloudstack] ustcweizhou commented on a change in pull request #3331: api/server: Add option 'details' to listProjects and listAccounts

2019-05-16 Thread GitBox
ustcweizhou commented on a change in pull request #3331: api/server: Add option 
'details' to listProjects and listAccounts
URL: https://github.com/apache/cloudstack/pull/3331#discussion_r284835590
 
 

 ##
 File path: server/src/main/java/com/cloud/api/query/dao/ProjectJoinDaoImpl.java
 ##
 @@ -91,9 +94,11 @@ public ProjectResponse newProjectResponse(ProjectJoinVO 
proj) {
 
 //set resource limit/count information for the project (by getting the 
info of the project's account)
 Account account = 
_accountDao.findByIdIncludingRemoved(proj.getProjectAccountId());
-AccountJoinVO accountJn = ApiDBUtils.newAccountView(account);
-_accountJoinDao.setResourceLimits(accountJn, false, response);
-response.setProjectAccountName(accountJn.getAccountName());
+if (details.contains(DomainDetails.all) || 
details.contains(DomainDetails.resource)) {
+AccountJoinVO accountJn = ApiDBUtils.newAccountView(account);
 
 Review comment:
   line 98 takes around 0.2 seconds for each project in my testing environment.
   The actual time depends on how many accounts in your system.
   ```
   AccountJoinVO accountJn = ApiDBUtils.newAccountView(account);
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services