ui: show complete domain for accounts (#2994) (#3256)

This allows showing complete domain, ie, domain path for accounts list view and account detail.
Added a new key, domainpath, in AccountResponse.

Fixes #2994

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2019-04-10 17:18:01 +05:30 committed by Rohit Yadav
parent 491a10be0c
commit 6bb8d977ac
4 changed files with 15 additions and 4 deletions

View File

@ -110,6 +110,7 @@ public class ApiConstants {
public static final String IP6_DNS1 = "ip6dns1";
public static final String IP6_DNS2 = "ip6dns2";
public static final String DOMAIN = "domain";
public static final String DOMAIN_PATH = "domainpath";
public static final String DOMAIN_ID = "domainid";
public static final String DOMAIN__ID = "domainId";
public static final String DURATION = "duration";

View File

@ -19,8 +19,6 @@ package org.apache.cloudstack.api.response;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
@ -28,6 +26,7 @@ import org.apache.cloudstack.api.EntityReference;
import com.cloud.serializer.Param;
import com.cloud.user.Account;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = Account.class)
public class AccountResponse extends BaseResponse implements ResourceLimitAndCountResponse {
@ -63,6 +62,10 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
@Param(description = "name of the Domain the account belongs too")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@Param(description = "name of the Domain the account belongs too", since = "4.13")
private String domainPath;
@SerializedName(ApiConstants.DEFAULT_ZONE_ID)
@Param(description = "the default zone of the account")
private String defaultZoneId;
@ -294,6 +297,10 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
this.domainName = domainName;
}
public void setDomainPath(String domainPath) {
this.domainPath = domainPath;
}
public void setBytesReceived(Long bytesReceived) {
this.bytesReceived = bytesReceived;
}

View File

@ -64,6 +64,9 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
accountResponse.setAccountType(account.getType());
accountResponse.setDomainId(account.getDomainUuid());
accountResponse.setDomainName(account.getDomainName());
StringBuilder domainPath = new StringBuilder("ROOT");
(domainPath.append(account.getDomainPath())).deleteCharAt(domainPath.length() - 1);
accountResponse.setDomainPath(domainPath.toString());
accountResponse.setState(account.getState().toString());
accountResponse.setNetworkDomain(account.getNetworkDomain());
accountResponse.setDefaultZone(account.getDataCenterUuid());

View File

@ -45,7 +45,7 @@
roletype: {
label: 'label.roletype'
},
domain: {
domainpath: {
label: 'label.domain'
},
state: {
@ -697,7 +697,7 @@
roletype: {
label: 'label.roletype'
},
domain: {
domainpath: {
label: 'label.domain'
},
state: {