From f26cbfe50c05ae4d91d2bf05b4216bcb2af19efd Mon Sep 17 00:00:00 2001 From: vishesh92 Date: Tue, 19 May 2026 13:01:00 +0530 Subject: [PATCH] Fix listing of resorces for ASG belonging to a project --- .../views/compute/AutoScaleDownPolicyTab.vue | 24 +++++++--- .../views/compute/AutoScaleLoadBalancing.vue | 16 +++++-- ui/src/views/compute/AutoScaleUpPolicyTab.vue | 24 +++++++--- ui/src/views/compute/AutoScaleVmProfile.vue | 45 +++++++++++++++---- 4 files changed, 84 insertions(+), 25 deletions(-) diff --git a/ui/src/views/compute/AutoScaleDownPolicyTab.vue b/ui/src/views/compute/AutoScaleDownPolicyTab.vue index 422d1ab1122a..b2944209a91f 100644 --- a/ui/src/views/compute/AutoScaleDownPolicyTab.vue +++ b/ui/src/views/compute/AutoScaleDownPolicyTab.vue @@ -425,10 +425,14 @@ export default { methods: { fetchInitData () { this.loading = true - api('listAutoScaleVmGroups', { + const params = { listAll: true, id: this.resource.id - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScaleVmGroups', params).then(response => { const lbruleid = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0]?.lbruleid this.policies = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0]?.scaledownpolicies if (this.selectedPolicyId) { @@ -437,10 +441,14 @@ export default { this.policy = this.policies?.[0] this.selectedPolicyId = this.policy.id } - api('listLoadBalancerRules', { + const lbParams = { listAll: true, id: lbruleid - }).then(response => { + } + if (this.resource.projectid) { + lbParams.projectid = this.resource.projectid + } + api('listLoadBalancerRules', lbParams).then(response => { const networkid = response.listloadbalancerrulesresponse?.loadbalancerrule?.[0]?.networkid api('listNetworks', { listAll: true, @@ -464,10 +472,14 @@ export default { }, fetchData () { this.loading = true - api('listAutoScalePolicies', { + const params = { listAll: true, id: this.selectedPolicyId - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScalePolicies', params).then(response => { this.policy = response.listautoscalepoliciesresponse?.autoscalepolicy[0] }).finally(() => { this.loading = false diff --git a/ui/src/views/compute/AutoScaleLoadBalancing.vue b/ui/src/views/compute/AutoScaleLoadBalancing.vue index 6091689bd356..53dc2bd1d90a 100644 --- a/ui/src/views/compute/AutoScaleLoadBalancing.vue +++ b/ui/src/views/compute/AutoScaleLoadBalancing.vue @@ -462,12 +462,16 @@ export default { this.lbRules = [] this.stickinessPolicies = [] - api('listLoadBalancerRules', { + const params = { listAll: true, id: this.resource.lbruleid, page: this.page, pageSize: this.pageSize - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listLoadBalancerRules', params).then(response => { this.lbRules = response.listloadbalancerrulesresponse.loadbalancerrule || [] this.totalCount = response.listloadbalancerrulesresponse.count || 0 }).then(() => { @@ -519,10 +523,14 @@ export default { fetchAutoScaleVMgroups () { this.loading = true this.lbRules.forEach(rule => { - api('listAutoScaleVmGroups', { + const params = { listAll: true, lbruleid: rule.id - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScaleVmGroups', params).then(response => { rule.autoscalevmgroup = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0] }).finally(() => { this.loading = false diff --git a/ui/src/views/compute/AutoScaleUpPolicyTab.vue b/ui/src/views/compute/AutoScaleUpPolicyTab.vue index 4ddd67a5d0a7..8f7089c3fd85 100644 --- a/ui/src/views/compute/AutoScaleUpPolicyTab.vue +++ b/ui/src/views/compute/AutoScaleUpPolicyTab.vue @@ -425,10 +425,14 @@ export default { methods: { fetchInitData () { this.loading = true - api('listAutoScaleVmGroups', { + const params = { listAll: true, id: this.resource.id - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScaleVmGroups', params).then(response => { const lbruleid = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0]?.lbruleid this.policies = response.listautoscalevmgroupsresponse?.autoscalevmgroup?.[0]?.scaleuppolicies if (this.selectedPolicyId) { @@ -437,10 +441,14 @@ export default { this.policy = this.policies?.[0] this.selectedPolicyId = this.policy.id } - api('listLoadBalancerRules', { + const lbParams = { listAll: true, id: lbruleid - }).then(response => { + } + if (this.resource.projectid) { + lbParams.projectid = this.resource.projectid + } + api('listLoadBalancerRules', lbParams).then(response => { const networkid = response.listloadbalancerrulesresponse?.loadbalancerrule?.[0]?.networkid api('listNetworks', { listAll: true, @@ -464,10 +472,14 @@ export default { }, fetchData () { this.loading = true - api('listAutoScalePolicies', { + const params = { listAll: true, id: this.selectedPolicyId - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScalePolicies', params).then(response => { this.policy = response.listautoscalepoliciesresponse?.autoscalepolicy[0] }).finally(() => { this.loading = false diff --git a/ui/src/views/compute/AutoScaleVmProfile.vue b/ui/src/views/compute/AutoScaleVmProfile.vue index 20a87065cf4e..d80edffb7774 100644 --- a/ui/src/views/compute/AutoScaleVmProfile.vue +++ b/ui/src/views/compute/AutoScaleVmProfile.vue @@ -62,7 +62,7 @@
- {{ getTemplateName(templateid) }} + {{ templateName || templateid }}
@@ -338,6 +338,7 @@ export default { autoscaleuserid: null, expungevmgraceperiod: null, templateid: null, + templateName: null, serviceofferingid: null, userdata: null, userdataid: null, @@ -422,6 +423,9 @@ export default { domainid: this.resource.domainid, account: this.resource.account } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } if (isAdmin()) { params.templatefilter = 'all' } else { @@ -436,6 +440,9 @@ export default { listall: 'true', issystem: 'false' } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } if (isAdminOrDomainAdmin()) { params.isrecursive = 'true' } @@ -446,15 +453,20 @@ export default { }, fetchData () { this.loading = true - api('listAutoScaleVmProfiles', { + const params = { listAll: true, id: this.resource.vmprofileid - }).then(response => { + } + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listAutoScaleVmProfiles', params).then(response => { this.profileid = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.id this.autoscaleuserid = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.autoscaleuserid this.expungevmgraceperiod = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.expungevmgraceperiod this.serviceofferingid = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.serviceofferingid this.templateid = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.templateid + this.fetchTemplate(this.templateid) this.userdata = this.decodeUserData(decodeURIComponent(response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.userdata || '')) this.userdataid = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.userdataid this.userdataname = response.listautoscalevmprofilesresponse?.autoscalevmprofile?.[0]?.userdataname @@ -468,13 +480,22 @@ export default { this.loading = false }) }, - getTemplateName (templateid) { - for (const template of this.templatesList) { - if (template.id === templateid) { - return template.name - } + fetchTemplate (templateid) { + if (!templateid) return + const params = { + id: templateid, + templatefilter: 'executable' } - return '' + if (this.resource.projectid) { + params.projectid = this.resource.projectid + } + api('listTemplates', params).then(json => { + if (json.listtemplatesresponse?.template?.[0]) { + this.templateName = json.listtemplatesresponse.template[0].name + } else { + this.templateName = templateid + } + }) }, getServiceOfferingName (serviceofferingid) { for (const serviceoffering of this.serviceOfferingsList) { @@ -576,9 +597,11 @@ export default { this.$pollJob({ jobId: response.updateautoscalevmprofileresponse.jobid, successMethod: (result) => { + this.fetchData() }, errorMessage: this.$t('message.update.autoscale.vm.profile.failed'), errorMethod: () => { + this.fetchData() } }) }).finally(() => { @@ -586,6 +609,8 @@ export default { }) }, updateAutoScaleVmProfile () { + if (this.loading) return + this.loading = true const params = { id: this.profileid, expungevmgraceperiod: this.expungevmgraceperiod, @@ -604,6 +629,7 @@ export default { this.$pollJob({ jobId: response.updateautoscalevmprofileresponse.jobid, successMethod: (result) => { + this.closeModal() }, errorMessage: this.$t('message.update.autoscale.vm.profile.failed'), errorMethod: () => { @@ -618,6 +644,7 @@ export default { return decodedData.toString('utf-8') }, closeModal () { + this.fetchData() this.editProfileModalVisible = false } }