Skip to content

Commit 4f10dea

Browse files
committed
UI support for extraconfig in deploy and update instance
1 parent 23c9e83 commit 4f10dea

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

ui/public/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,8 @@
10511051
"label.externalid": "External Id",
10521052
"label.externalloadbalanceripaddress": "External load balancer IP address.",
10531053
"label.extra": "Extra arguments",
1054+
"label.extraconfig": "Additional Configuration",
1055+
"label.extraconfig.tooltip": "Additional configuration parameters (extraconfig) to pass to the instance in plain text",
10541056
"label.f5": "F5",
10551057
"label.f5.ip.loadbalancer": "F5 BIG-IP load balancer.",
10561058
"label.failed": "Failed",

ui/src/views/compute/DeployVM.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,12 @@
762762
</div>
763763
</a-card>
764764
</a-form-item>
765+
<a-form-item v-if="extraConfigEnabledValue" name="extraconfig" ref="extraconfig">
766+
<template #label>
767+
<tooltip-label :title="$t('label.extraconfig')" :tooltip="$t('label.extraconfig.tooltip')"/>
768+
</template>
769+
<a-textarea v-model:value="form.extraconfig"/>
770+
</a-form-item>
765771
<a-form-item :label="$t('label.affinity.groups')">
766772
<affinity-group-selection
767773
:items="options.affinityGroups"
@@ -1043,7 +1049,8 @@ export default {
10431049
keyboards: [],
10441050
bootTypes: [],
10451051
bootModes: [],
1046-
ioPolicyTypes: []
1052+
ioPolicyTypes: [],
1053+
extraConfigEnabled: []
10471054
},
10481055
rowCount: {},
10491056
loading: {
@@ -1091,6 +1098,7 @@ export default {
10911098
sshKeyPairs: [],
10921099
sshKeyPair: {},
10931100
userData: {},
1101+
extraConfig: {},
10941102
userDataParams: [],
10951103
userDataParamCols: [
10961104
{
@@ -1344,6 +1352,15 @@ export default {
13441352
name: 'enable.dynamic.scale.vm'
13451353
}
13461354
},
1355+
extraConfigEnabled: {
1356+
list: 'listConfigurations',
1357+
isLoad: true,
1358+
options: {
1359+
accountid: store.getters.userInfo.accountid,
1360+
name: 'enable.additional.vm.configuration'
1361+
},
1362+
field: 'value'
1363+
},
13471364
guestOsCategories: {
13481365
list: 'listOsCategories',
13491366
options: {
@@ -1510,6 +1527,9 @@ export default {
15101527
dynamicScalingVmConfigValue () {
15111528
return this.$store.getters.features.dynamicscalingenabled
15121529
},
1530+
extraConfigEnabledValue () {
1531+
return this.options.extraConfigEnabled?.[0]?.value === 'true'
1532+
},
15131533
isCustomizedDiskIOPS () {
15141534
return this.diskSelected?.iscustomizediops || false
15151535
},
@@ -2323,6 +2343,9 @@ export default {
23232343
if (isUserdataAllowed && values.userdata && values.userdata.length > 0) {
23242344
deployVmData.userdata = this.$toBase64AndURIEncoded(values.userdata)
23252345
}
2346+
if (values.extraconfig && values.extraconfig.length > 0) {
2347+
deployVmData.extraconfig = encodeURIComponent(values.extraconfig)
2348+
}
23262349
// step 2: select template/iso
23272350
if (this.imageType === 'templateid') {
23282351
deployVmData.templateid = values.templateid

ui/src/views/compute/EditVM.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@
9191
<a-textarea v-model:value="form.userdata">
9292
</a-textarea>
9393
</a-form-item>
94+
<a-form-item v-if="extraConfigEnabled">
95+
<template #label>
96+
<tooltip-label :title="$t('label.extraconfig')" :tooltip="$t('label.extraconfig.tooltip')"/>
97+
</template>
98+
<a-textarea v-model:value="form.extraconfig"/>
99+
</a-form-item>
94100
<a-form-item ref="securitygroupids" name="securitygroupids" :label="$t('label.security.groups')" v-if="securityGroupsEnabled">
95101
<a-select
96102
mode="multiple"
@@ -179,6 +185,7 @@ export default {
179185
serviceOffering: {},
180186
template: {},
181187
userDataEnabled: false,
188+
extraConfigEnabled: false,
182189
securityGroupsEnabled: false,
183190
loading: false,
184191
securitygroups: {
@@ -224,7 +231,8 @@ export default {
224231
userdata: '',
225232
haenable: this.resource.haenable,
226233
leaseduration: this.resource.leaseduration,
227-
leaseexpiryaction: this.resource.leaseexpiryaction
234+
leaseexpiryaction: this.resource.leaseexpiryaction,
235+
extraconfig: ''
228236
})
229237
this.rules = reactive({
230238
leaseduration: [this.naturalNumberRule]
@@ -239,6 +247,7 @@ export default {
239247
this.fetchServiceOfferingData()
240248
this.fetchTemplateData()
241249
this.fetchUserData()
250+
this.fetchExtraConfigEnabled()
242251
},
243252
fetchZoneDetails () {
244253
getAPI('listZones', {
@@ -371,6 +380,17 @@ export default {
371380
})
372381
})
373382
},
383+
fetchExtraConfigEnabled () {
384+
getAPI('listConfigurations', {
385+
accountid: this.$store.getters.userInfo.accountid,
386+
name: 'enable.additional.vm.configuration'
387+
}).then(json => {
388+
const configResponse = json.listconfigurationsresponse.configuration || []
389+
this.extraConfigEnabled = configResponse[0]?.value === 'true'
390+
}).catch(error => {
391+
this.$notifyError(error)
392+
})
393+
},
374394
handleSubmit () {
375395
this.formRef.value.validate().then(() => {
376396
const values = toRaw(this.form)
@@ -397,6 +417,9 @@ export default {
397417
if (values.userdata && values.userdata.length > 0) {
398418
params.userdata = this.$toBase64AndURIEncoded(values.userdata)
399419
}
420+
if (values.extraconfig && values.extraconfig.length > 0) {
421+
params.extraconfig = encodeURIComponent(values.extraconfig)
422+
}
400423
if (values.leaseduration !== undefined && (values.leaseduration === -1 || values.leaseduration > 0)) {
401424
params.leaseduration = values.leaseduration
402425
if (values.leaseexpiryaction !== undefined) {

0 commit comments

Comments
 (0)