Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.apache.cloudstack.api.EntityReference;

@EntityReference(value = UserData.class)
public class UserDataResponse extends BaseResponseWithAnnotations {
public class UserDataResponse extends BaseResponseWithAnnotations implements ControlledEntityResponse {

@SerializedName(ApiConstants.ID)
@Param(description = "ID of the ssh keypair")
Expand All @@ -40,6 +40,14 @@ public class UserDataResponse extends BaseResponseWithAnnotations {
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the owner of the userdata")
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")
private String domainId;

Expand Down Expand Up @@ -118,6 +126,16 @@ public void setAccountName(String 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() {
return domain;
}
Expand Down
7 changes: 1 addition & 6 deletions server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -4818,12 +4818,7 @@ public SSHKeyPairResponse createSSHKeyPairResponse(SSHKeyPair sshkeyPair, boolea
@Override
public UserDataResponse createUserDataResponse(UserData userData) {
UserDataResponse response = new UserDataResponse(userData.getUuid(), userData.getName(), userData.getUserData(), userData.getParams());
Account account = ApiDBUtils.findAccountById(userData.getAccountId());
response.setAccountId(account.getUuid());
response.setAccountName(account.getAccountName());
Domain domain = ApiDBUtils.findDomainById(userData.getDomainId());
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
populateOwner(response, userData);
response.setHasAnnotation(annotationDao.hasAnnotations(userData.getUuid(), AnnotationService.EntityType.USER_DATA.name(),
_accountMgr.isRootAdmin(CallContext.current().getCallingAccount().getId())));
return response;
Expand Down
5 changes: 5 additions & 0 deletions ui/src/config/section/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,12 @@ export default {
var fields = ['name', 'id']
if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) {
fields.push('account')
if (store.getters.listAllProjects) {
fields.push('project')
}
fields.push('domain')
} else if (store.getters.listAllProjects) {
fields.push('project')
}
return fields
},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/AutogenView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ export default {
}

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',
'autoscalevmgroup', 'vnfapp'].includes(this.$route.name)

Expand Down