Skip to content
Open
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
24 changes: 18 additions & 6 deletions ui/src/views/compute/AutoScaleDownPolicyTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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
Expand Down
16 changes: 12 additions & 4 deletions ui/src/views/compute/AutoScaleLoadBalancing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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
Expand Down
24 changes: 18 additions & 6 deletions ui/src/views/compute/AutoScaleUpPolicyTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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
Expand Down
45 changes: 36 additions & 9 deletions ui/src/views/compute/AutoScaleVmProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<div class="form__label">
<tooltip-label :title="$t('label.templatename')" :tooltip="createAutoScaleVmProfileApiParams.templateid.description"/>
</div>
{{ getTemplateName(templateid) }}
{{ templateName || templateid }}
</div>
</div>
<div class="form">
Expand Down Expand Up @@ -338,6 +338,7 @@ export default {
autoscaleuserid: null,
expungevmgraceperiod: null,
templateid: null,
templateName: null,
serviceofferingid: null,
userdata: null,
userdataid: null,
Expand Down Expand Up @@ -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 {
Expand All @@ -436,6 +440,9 @@ export default {
listall: 'true',
issystem: 'false'
}
if (this.resource.projectid) {
params.projectid = this.resource.projectid
}
if (isAdminOrDomainAdmin()) {
params.isrecursive = 'true'
}
Expand All @@ -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
Expand All @@ -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) {
Expand Down Expand Up @@ -576,16 +597,20 @@ 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(() => {
this.loading = false
})
},
updateAutoScaleVmProfile () {
if (this.loading) return
this.loading = true
const params = {
id: this.profileid,
expungevmgraceperiod: this.expungevmgraceperiod,
Expand All @@ -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: () => {
Expand All @@ -618,6 +644,7 @@ export default {
return decodedData.toString('utf-8')
},
closeModal () {
this.fetchData()
this.editProfileModalVisible = false
}
}
Expand Down
Loading