Skip to content

Commit

Permalink
Guest OS list
Browse files Browse the repository at this point in the history
  • Loading branch information
harikrishna-patnala committed Dec 28, 2022
1 parent 81cc716 commit 0edd76a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ public class GuestOSResponse extends BaseResponse {
@Param(description = "the ID of the OS category")
private String osCategoryId;

@SerializedName(ApiConstants.OS_CATEGORY_NAME)
@Param(description = "the name of the OS category")
private String osCategoryName;

@SerializedName(ApiConstants.DESCRIPTION)
@Param(description = "the name/description of the OS type")
private String description;

@SerializedName(ApiConstants.IS_USER_DEFINED)
@Param(description = "is the guest OS user defined")
private Boolean isUserDefined;
private String isUserDefined;

public String getId() {
return id;
Expand All @@ -59,6 +63,14 @@ public void setOsCategoryId(String osCategoryId) {
this.osCategoryId = osCategoryId;
}

public String getOsCategoryName() {
return osCategoryName;
}

public void setOsCategoryName(String osCategoryName) {
this.osCategoryName = osCategoryName;
}

public String getDescription() {
return description;
}
Expand All @@ -67,11 +79,11 @@ public void setDescription(String description) {
this.description = description;
}

public Boolean getIsUserDefined() {
public String getIsUserDefined() {
return isUserDefined;
}

public void setIsUserDefined(Boolean isUserDefined) {
public void setIsUserDefined(String isUserDefined) {
this.isUserDefined = isUserDefined;
}

Expand Down
3 changes: 2 additions & 1 deletion server/src/main/java/com/cloud/api/ApiResponseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3538,10 +3538,11 @@ public GuestOSResponse createGuestOSResponse(GuestOS guestOS) {
GuestOSResponse response = new GuestOSResponse();
response.setDescription(guestOS.getDisplayName());
response.setId(guestOS.getUuid());
response.setIsUserDefined(guestOS.getIsUserDefined());
response.setIsUserDefined(String.valueOf(guestOS.getIsUserDefined()));
GuestOSCategoryVO category = ApiDBUtils.findGuestOsCategoryById(guestOS.getCategoryId());
if (category != null) {
response.setOsCategoryId(category.getUuid());
response.setOsCategoryName(category.getName());
}

response.setObjectName("ostype");
Expand Down
2 changes: 2 additions & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@
"label.guest.ip.range": "Guest IP range",
"label.guest.netmask": "Guest netmask",
"label.guest.networks": "Guest networks",
"label.guest.os": "Guest OS",
"label.guest.os.mappings": "Guest OS mappings",
"label.guest.start.ip": "Guest start IP",
"label.guest.traffic": "Guest traffic",
Expand Down Expand Up @@ -1196,6 +1197,7 @@
"label.optional": "Optional",
"label.order": "Order",
"label.oscategoryid": "OS preference",
"label.oscategoryname": "OS category name",
"label.osdisplayname": "OS name",
"label.osnameforhypervisor": "Hypervisor mapping name",
"label.ostypeid": "OS type",
Expand Down
3 changes: 3 additions & 0 deletions ui/src/components/view/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
<span v-if="$route.name === 'hypervisorcapability'">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
</span>
<span v-else-if="$route.name === 'guestos'">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
</span>
<span v-else-if="$route.name === 'guestoshypervisormapping'">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
</span>
Expand Down
20 changes: 19 additions & 1 deletion ui/src/config/section/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ export default {
}
]
},
{
name: 'guestos',
title: 'label.guest.os',
icon: 'database-outlined',
permission: ['listOsTypes'],
columns: ['description', 'oscategoryname', 'isuserdefined'],
details: ['description', 'oscategoryname', 'isuserdefined'],
searchFilters: ['description'],
actions: [
{
api: 'updateGuestOs',
icon: 'edit-outlined',
label: 'label.edit',
dataView: true,
args: ['osdisplayname']
}
]
},
{
name: 'guestoshypervisormapping',
title: 'label.guest.os.mappings',
Expand All @@ -91,7 +109,7 @@ export default {
columns: ['hypervisor', 'hypervisorversion', 'osdisplayname', 'osnameforhypervisor'],
details: ['hypervisor', 'hypervisorversion', 'osdisplayname', 'osnameforhypervisor', 'isuserdefined'],
filters: ['all', 'kvm', 'vmware', 'xenserver', 'lxc', 'ovm3'],
searchFilters: ['hypervisor', 'hypervisorversion'],
searchFilters: ['osdisplayname', 'hypervisor', 'hypervisorversion'],
actions: [
{
api: 'updateGuestOsMapping',
Expand Down
4 changes: 3 additions & 1 deletion ui/src/views/AutogenView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
:value="$route.query.filter || (projectView && $route.name === 'vm' ||
['Admin', 'DomainAdmin'].includes($store.getters.userInfo.roletype) && ['vm', 'iso', 'template'].includes($route.name)
? 'all' : ['publicip'].includes($route.name)
? 'allocated' : ['guestnetwork', 'guestvlans', 'guestoshypervisormapping'].includes($route.name) ? 'all' : 'self')"
? 'allocated' : ['guestnetwork', 'guestvlans'].includes($route.name) ? 'all' : 'self')"
style="min-width: 120px; margin-left: 10px"
@change="changeFilter"
showSearch
Expand Down Expand Up @@ -1569,6 +1569,8 @@ export default {
query.name = value
} else if (this.$route.name === 'guestoshypervisormapping') {
query.hypervisor = value
} else if (this.$route.name === 'guestos') {
query.description = value
} else {
query.keyword = value
}
Expand Down

0 comments on commit 0edd76a

Please sign in to comment.