mirror of https://github.com/apache/cloudstack.git
api,server,ui: add project ID and name to UserDataResponse (#8656)
* api,server,ui: add project ID and name to UserDataResponse * Update: add since
This commit is contained in:
parent
f4058705d7
commit
08d9d06d45
|
|
@ -24,7 +24,7 @@ import org.apache.cloudstack.api.BaseResponseWithAnnotations;
|
||||||
import org.apache.cloudstack.api.EntityReference;
|
import org.apache.cloudstack.api.EntityReference;
|
||||||
|
|
||||||
@EntityReference(value = UserData.class)
|
@EntityReference(value = UserData.class)
|
||||||
public class UserDataResponse extends BaseResponseWithAnnotations {
|
public class UserDataResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse {
|
||||||
|
|
||||||
@SerializedName(ApiConstants.ID)
|
@SerializedName(ApiConstants.ID)
|
||||||
@Param(description = "ID of the ssh keypair")
|
@Param(description = "ID of the ssh keypair")
|
||||||
|
|
@ -40,6 +40,14 @@ public class UserDataResponse extends BaseResponseWithAnnotations {
|
||||||
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the userdata")
|
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the userdata")
|
||||||
private String accountName;
|
private String accountName;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.PROJECT_ID)
|
||||||
|
@Param(description = "the project id of the userdata", since = "4.19.1")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.PROJECT)
|
||||||
|
@Param(description = "the project name of the userdata", since = "4.19.1")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the userdata owner")
|
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain id of the userdata owner")
|
||||||
private String domainId;
|
private String domainId;
|
||||||
|
|
||||||
|
|
@ -118,6 +126,16 @@ public class UserDataResponse extends BaseResponseWithAnnotations {
|
||||||
this.accountName = accountName;
|
this.accountName = accountName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProjectId(String projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProjectName(String projectName) {
|
||||||
|
this.projectName = projectName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDomainName() {
|
public String getDomainName() {
|
||||||
return domain;
|
return domain;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4818,12 +4818,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
||||||
@Override
|
@Override
|
||||||
public UserDataResponse createUserDataResponse(UserData userData) {
|
public UserDataResponse createUserDataResponse(UserData userData) {
|
||||||
UserDataResponse response = new UserDataResponse(userData.getUuid(), userData.getName(), userData.getUserData(), userData.getParams());
|
UserDataResponse response = new UserDataResponse(userData.getUuid(), userData.getName(), userData.getUserData(), userData.getParams());
|
||||||
Account account = ApiDBUtils.findAccountById(userData.getAccountId());
|
populateOwner(response, userData);
|
||||||
response.setAccountId(account.getUuid());
|
|
||||||
response.setAccountName(account.getAccountName());
|
|
||||||
Domain domain = ApiDBUtils.findDomainById(userData.getDomainId());
|
|
||||||
response.setDomainId(domain.getUuid());
|
|
||||||
response.setDomainName(domain.getName());
|
|
||||||
response.setHasAnnotation(annotationDao.hasAnnotations(userData.getUuid(), AnnotationService.EntityType.USER_DATA.name(),
|
response.setHasAnnotation(annotationDao.hasAnnotations(userData.getUuid(), AnnotationService.EntityType.USER_DATA.name(),
|
||||||
_accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
|
_accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
|
|
@ -898,7 +898,12 @@ export default {
|
||||||
var fields = ['name', 'id']
|
var fields = ['name', 'id']
|
||||||
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
|
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
|
||||||
fields.push('account')
|
fields.push('account')
|
||||||
|
if (store.getters.listAllProjects) {
|
||||||
|
fields.push('project')
|
||||||
|
}
|
||||||
fields.push('domain')
|
fields.push('domain')
|
||||||
|
} else if (store.getters.listAllProjects) {
|
||||||
|
fields.push('project')
|
||||||
}
|
}
|
||||||
return fields
|
return fields
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -793,7 +793,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.projectView = Boolean(store.getters.project && store.getters.project.id)
|
this.projectView = Boolean(store.getters.project && store.getters.project.id)
|
||||||
this.hasProjectId = ['vm', 'vmgroup', 'ssh', 'affinitygroup', 'volume', 'snapshot', 'vmsnapshot', 'guestnetwork',
|
this.hasProjectId = ['vm', 'vmgroup', 'ssh', 'affinitygroup', 'userdata', 'volume', 'snapshot', 'vmsnapshot', 'guestnetwork',
|
||||||
'vpc', 'securitygroups', 'publicip', 'vpncustomergateway', 'template', 'iso', 'event', 'kubernetes',
|
'vpc', 'securitygroups', 'publicip', 'vpncustomergateway', 'template', 'iso', 'event', 'kubernetes',
|
||||||
'autoscalevmgroup', 'vnfapp'].includes(this.$route.name)
|
'autoscalevmgroup', 'vnfapp'].includes(this.$route.name)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue