mirror of https://github.com/apache/cloudstack.git
Support Projects in Userdata
This commit is contained in:
parent
beebeed5e2
commit
8410707f20
|
|
@ -46,6 +46,14 @@ public class UserDataResponse extends BaseResponseWithAnnotations {
|
|||
@SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the userdata owner")
|
||||
private String domain;
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT_ID)
|
||||
@Param(description = "the project id of the userdata owner")
|
||||
private String projectId;
|
||||
|
||||
@SerializedName(ApiConstants.PROJECT)
|
||||
@Param(description = "the project name of the userdata owner")
|
||||
private String projectName;
|
||||
|
||||
@SerializedName(ApiConstants.USER_DATA) @Param(description="base64 encoded userdata content")
|
||||
private String userData;
|
||||
|
||||
|
|
@ -125,4 +133,12 @@ public class UserDataResponse extends BaseResponseWithAnnotations {
|
|||
public void setDomainName(String domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4690,8 +4690,14 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
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());
|
||||
if (account.getType() == Account.Type.PROJECT) {
|
||||
Project project = ApiDBUtils.findProjectByProjectAccountIdIncludingRemoved(account.getAccountId());
|
||||
response.setProjectId(project.getUuid());
|
||||
response.setProjectName(project.getName());
|
||||
} else {
|
||||
response.setAccountName(account.getAccountName());
|
||||
response.setAccountId(account.getUuid());
|
||||
}
|
||||
Domain domain = ApiDBUtils.findDomainById(userData.getDomainId());
|
||||
response.setDomainId(domain.getUuid());
|
||||
response.setDomainName(domain.getName());
|
||||
|
|
|
|||
|
|
@ -820,11 +820,14 @@ export default {
|
|||
label: 'label.remove.user.data',
|
||||
message: 'message.please.confirm.remove.user.data',
|
||||
dataView: true,
|
||||
args: ['id', 'account', 'domainid'],
|
||||
args: ['id', 'account', 'domainid', 'projectid'],
|
||||
mapping: {
|
||||
id: {
|
||||
value: (record, params) => { return record.id }
|
||||
},
|
||||
projectid: {
|
||||
value: (record, params) => { return record.projectid }
|
||||
},
|
||||
account: {
|
||||
value: (record, params) => { return record.account }
|
||||
},
|
||||
|
|
@ -838,7 +841,10 @@ export default {
|
|||
return selection.map(x => {
|
||||
const data = record.filter(y => { return y.id === x })
|
||||
return {
|
||||
id: x, account: data[0].account, domainid: data[0].domainid
|
||||
id: x,
|
||||
account: data[0].account,
|
||||
domainid: data[0].domainid,
|
||||
projectid: data[0].projectid
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue