From c6762f1a41d8076b26a36cb4123c5538decf93fa Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 23 May 2024 16:04:32 +0530 Subject: [PATCH 1/4] ui: fix projectrolepermissions listing with description (#9091) Signed-off-by: Abhishek Kumar --- ui/src/views/project/iam/ProjectRolePermissionTab.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/project/iam/ProjectRolePermissionTab.vue b/ui/src/views/project/iam/ProjectRolePermissionTab.vue index 7b24098a5e9..dd628d780e6 100644 --- a/ui/src/views/project/iam/ProjectRolePermissionTab.vue +++ b/ui/src/views/project/iam/ProjectRolePermissionTab.vue @@ -78,7 +78,7 @@
{{ $t('message.no.description') }} From daf6b9d1030188bb129e44e2cdd7a4f65a2bbb0f Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 24 May 2024 21:09:52 +0530 Subject: [PATCH 2/4] api,ui: vm template format, fix vm info link (#9094) --- .../apache/cloudstack/api/ApiConstants.java | 1 + .../api/response/UserVmResponse.java | 12 ++++++ .../META-INF/db/views/cloud.user_vm_view.sql | 1 + .../api/query/dao/UserVmJoinDaoImpl.java | 1 + .../com/cloud/api/query/vo/UserVmJoinVO.java | 8 ++++ .../api/query/dao/UserVmJoinDaoImplTest.java | 38 ++++++++++--------- ui/src/components/view/InfoCard.vue | 2 +- 7 files changed, 44 insertions(+), 19 deletions(-) diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java index b5fab14ccb6..7565b679e58 100644 --- a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java @@ -448,6 +448,7 @@ public class ApiConstants { public static final String TEMPLATE_IDS = "templateids"; public static final String TEMPLATE_NAME = "templatename"; public static final String TEMPLATE_TYPE = "templatetype"; + public static final String TEMPLATE_FORMAT = "templateformat"; public static final String TIMEOUT = "timeout"; public static final String TIMEZONE = "timezone"; public static final String TIMEZONEOFFSET = "timezoneoffset"; diff --git a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java index 763265e109d..5a0ea77a4e7 100644 --- a/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java @@ -137,6 +137,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co @Param(description = "the type of the template for the virtual machine", since = "4.19.0") private String templateType; + @SerializedName(ApiConstants.TEMPLATE_FORMAT) + @Param(description = "the format of the template for the virtual machine", since = "4.19.1") + private String templateFormat; + @SerializedName("templatedisplaytext") @Param(description = " an alternate display text of the template for the virtual machine") private String templateDisplayText; @@ -1076,6 +1080,14 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co this.templateType = templateType; } + public String getTemplateFormat() { + return templateFormat; + } + + public void setTemplateFormat(String templateFormat) { + this.templateFormat = templateFormat; + } + public List getVnfNics() { return vnfNics; } diff --git a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql index 7a057dc0330..25f95709721 100644 --- a/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql +++ b/engine/schema/src/main/resources/META-INF/db/views/cloud.user_vm_view.sql @@ -74,6 +74,7 @@ SELECT `vm_template`.`uuid` AS `template_uuid`, `vm_template`.`name` AS `template_name`, `vm_template`.`type` AS `template_type`, + `vm_template`.`format` AS `template_format`, `vm_template`.`display_text` AS `template_display_text`, `vm_template`.`enable_password` AS `password_enabled`, `iso`.`id` AS `iso_id`, diff --git a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index e5cc9ee7234..828cafd7d50 100644 --- a/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java +++ b/server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java @@ -198,6 +198,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation { @@ -109,6 +110,7 @@ public class UserVmJoinDaoImplTest extends GenericDaoBaseWithTagInformationBaseT Mockito.when(userVmMock.getId()).thenReturn(vmId); Mockito.when(userVmMock.getTemplateId()).thenReturn(templateId); Mockito.when(userVmMock.getTemplateType()).thenReturn(Storage.TemplateType.VNF); + Mockito.when(userVmMock.getTemplateFormat()).thenReturn(Storage.ImageFormat.OVA); Mockito.when(caller.getId()).thenReturn(2L); Mockito.when(accountMgr.isRootAdmin(nullable(Long.class))).thenReturn(true); diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue index 66c878da0f8..a4fa1191d13 100644 --- a/ui/src/components/view/InfoCard.vue +++ b/ui/src/components/view/InfoCard.vue @@ -524,7 +524,7 @@
- {{ resource.templatedisplaytext || resource.templatename || resource.templateid }} + {{ resource.templatedisplaytext || resource.templatename || resource.templateid }}
From 2d4d370be802e4363326932b8741e0bd6743ff5e Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Fri, 24 May 2024 21:18:27 +0530 Subject: [PATCH 3/4] ui: support isdynamicallyscalable param for iso (#9092) Register/List/Update iso APIs already support isdynamicallyscalable parama. This PR makes them available in the UI. Signed-off-by: Abhishek Kumar --- ui/src/config/section/image.js | 2 +- ui/src/views/image/RegisterOrUploadIso.vue | 59 +++++++++++++--------- ui/src/views/image/UpdateISO.vue | 8 ++- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/ui/src/config/section/image.js b/ui/src/config/section/image.js index 7a5d52d1b89..aa21b262037 100644 --- a/ui/src/config/section/image.js +++ b/ui/src/config/section/image.js @@ -231,7 +231,7 @@ export default { } return fields }, - details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'crosszones', 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy', 'url'], + details: ['name', 'id', 'displaytext', 'checksum', 'ostypename', 'size', 'bootable', 'isready', 'directdownload', 'isextractable', 'ispublic', 'isfeatured', 'isdynamicallyscalable', 'crosszones', 'account', 'domain', 'created', 'userdatadetails', 'userdatapolicy', 'url'], searchFilters: () => { var filters = ['name', 'zoneid', 'tags'] if (['Admin', 'DomainAdmin'].includes(store.getters.userInfo.roletype)) { diff --git a/ui/src/views/image/RegisterOrUploadIso.vue b/ui/src/views/image/RegisterOrUploadIso.vue index 1a461ee6bf6..f27676b8e7f 100644 --- a/ui/src/views/image/RegisterOrUploadIso.vue +++ b/ui/src/views/image/RegisterOrUploadIso.vue @@ -227,29 +227,39 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
{{ $t('label.cancel') }} @@ -332,7 +342,8 @@ export default { this.form = reactive({ bootable: true, isextractable: false, - ispublic: false + ispublic: false, + isdynamicallyscalable: false }) this.rules = reactive({ url: [{ required: true, message: this.$t('label.upload.iso.from.local') }], diff --git a/ui/src/views/image/UpdateISO.vue b/ui/src/views/image/UpdateISO.vue index 4d7140df165..92386823c16 100644 --- a/ui/src/views/image/UpdateISO.vue +++ b/ui/src/views/image/UpdateISO.vue @@ -61,6 +61,12 @@ + + + + @@ -162,7 +168,7 @@ export default { displaytext: [{ required: true, message: this.$t('message.error.required.input') }], ostypeid: [{ required: true, message: this.$t('message.error.select') }] }) - const resourceFields = ['name', 'displaytext', 'ostypeid', 'userdataid', 'userdatapolicy'] + const resourceFields = ['name', 'displaytext', 'ostypeid', 'isdynamicallyscalable', 'userdataid', 'userdatapolicy'] for (var field of resourceFields) { var fieldValue = this.resource[field] From 57e67afdf0da26c35f754ba55f4b8ecf401172fc Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Mon, 27 May 2024 13:47:44 +0530 Subject: [PATCH 4/4] api,server: list autoscalevmgroups with keyword (#9046) Fixes #9042 Signed-off-by: Abhishek Kumar --- .../main/java/com/cloud/network/as/AutoScaleManagerImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java index c10ff89fa3d..468f238a0c5 100644 --- a/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java @@ -1174,6 +1174,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage Long profileId = cmd.getProfileId(); Long zoneId = cmd.getZoneId(); Boolean forDisplay = cmd.getDisplay(); + String keyword = cmd.getKeyword(); SearchWrapper searchWrapper = new SearchWrapper<>(autoScaleVmGroupDao, AutoScaleVmGroupVO.class, cmd, cmd.getId()); SearchBuilder sb = searchWrapper.getSearchBuilder(); @@ -1184,6 +1185,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage sb.and("profileId", sb.entity().getProfileId(), SearchCriteria.Op.EQ); sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.EQ); sb.and("display", sb.entity().isDisplay(), SearchCriteria.Op.EQ); + sb.and("keyword", sb.entity().getName(), SearchCriteria.Op.LIKE); if (policyId != null) { SearchBuilder asVmGroupPolicySearch = autoScaleVmGroupPolicyMapDao.createSearchBuilder(); @@ -1213,6 +1215,9 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScaleManage if (forDisplay != null) { sc.setParameters("display", forDisplay); } + if (StringUtils.isNotBlank(keyword)) { + sc.setParameters("keyword", "%" + keyword + "%"); + } return searchWrapper.search(); }