414414 @change =" val => { dynamicscalingenabled = val }" />
415415 </a-form-item >
416416 </a-form-item >
417- <a-form-item :label =" $t('label.userdata')" >
418- <a-card >
419- <div v-if =" this.template && this.template.userdataid" >
420- <a-text type =" primary" >
421- Userdata "{{ $t(this.template.userdataname) }}" is linked with template "{{ $t(this.template.name) }}" with override policy "{{ $t(this.template.userdatapolicy) }}"
422- </a-text ><br /><br />
423- <div v-if =" templateUserDataParams.length > 0 && !doUserdataOverride" >
424- <a-text type =" primary" v-if =" this.template && this.template.userdataid && templateUserDataParams.length > 0" >
425- Enter the values for the variables in userdata
426- </a-text >
427- <a-input-group >
428- <a-table
429- size =" small"
430- style =" overflow-y : auto "
431- :columns =" userDataParamCols"
432- :dataSource =" templateUserDataParams"
433- :pagination =" false"
434- :rowKey =" record => record.key" >
435- <template #bodyCell =" { column , record } " >
436- <template v-if =" column .key === ' value' " >
437- <a-input v-model:value =" templateUserDataValues[record.key]" />
438- </template >
439- </template >
440- </a-table >
441- </a-input-group >
442- </div >
443- </div >
444- <div v-if =" userdataDefaultOverridePolicy === 'ALLOWOVERRIDE' || userdataDefaultOverridePolicy === 'APPEND' || !userdataDefaultOverridePolicy" >
445- <span v-if =" userdataDefaultOverridePolicy === 'ALLOWOVERRIDE'" >
446- {{ $t('label.userdata.do.override') }}
447- <a-switch v-model:checked =" doUserdataOverride" style =" margin-left : 10px " />
448- </span >
449- <span v-if =" userdataDefaultOverridePolicy === 'APPEND'" >
450- {{ $t('label.userdata.do.append') }}
451- <a-switch v-model:checked =" doUserdataAppend" style =" margin-left : 10px " />
452- </span >
453- <a-step
454- :status =" zoneSelected ? 'process' : 'wait'" >
455- <template #description >
456- <div v-if =" doUserdataOverride || doUserdataAppend || !userdataDefaultOverridePolicy" style =" margin-top : 15px " >
457- <a-card
458- :tabList =" userdataTabList"
459- :activeTabKey =" userdataTabKey"
460- @tabChange =" key => onUserdataTabChange(key, 'userdataTabKey')" >
461- <div v-if =" userdataTabKey === 'userdataregistered'" >
462- <a-step
463- v-if =" isUserAllowedToListUserDatas"
464- :status =" zoneSelected ? 'process' : 'wait'" >
465- <template #description >
466- <div v-if =" zoneSelected" >
467- <user-data-selection
468- :items =" options.userDatas"
469- :row-count =" rowCount.userDatas"
470- :zoneId =" zoneId"
471- :disabled =" template.userdatapolicy === 'DENYOVERRIDE'"
472- :loading =" loading.userDatas"
473- :preFillContent =" dataPreFill"
474- @select-user-data-item =" ($event) => updateUserData($event)"
475- @handle-search-filter =" ($event) => handleSearchFilter('userData', $event)"
476- />
477- <div v-if =" userDataParams.length > 0" >
478- <a-input-group >
479- <a-table
480- size =" small"
481- style =" overflow-y : auto "
482- :columns =" userDataParamCols"
483- :dataSource =" userDataParams"
484- :pagination =" false"
485- :rowKey =" record => record.key" >
486- <template #bodyCell =" { column , record } " >
487- <template v-if =" column .key === ' value' " >
488- <a-input v-model:value =" userDataValues[record.key]" />
489- </template >
490- </template >
491- </a-table >
492- </a-input-group >
493- </div >
494- </div >
495- </template >
496- </a-step >
497- </div >
498- <div v-else >
499- <a-form-item name =" userdata" ref =" userdata" >
500- <a-textarea
501- placeholder =" Userdata"
502- v-model:value =" form.userdata" >
503- </a-textarea >
504- </a-form-item >
505- </div >
506- </a-card >
507- </div >
508- </template >
509- </a-step >
510- </div >
511- </a-card >
512- </a-form-item >
513417 <a-form-item :label =" $t('label.affinity.groups')" >
514418 <affinity-group-selection
515419 :items =" options.affinityGroups"
@@ -712,7 +616,6 @@ export default {
712616 showRegisteredUserdata: true ,
713617 doUserdataOverride: false ,
714618 doUserdataAppend: false ,
715- userdataDefaultOverridePolicy: ' ALLOWOVERRIDE' ,
716619 vm: {
717620 name: null ,
718621 zoneid: null ,
@@ -760,7 +663,6 @@ export default {
760663 affinityGroups: false ,
761664 networks: false ,
762665 sshKeyPairs: false ,
763- userDatas: false ,
764666 zones: false ,
765667 groups: false
766668 },
@@ -787,32 +689,6 @@ export default {
787689 zone: {},
788690 sshKeyPairs: [],
789691 sshKeyPair: {},
790- userData: {},
791- userDataParams: [],
792- userDataParamCols: [
793- {
794- title: this .$t (' label.key' ),
795- dataIndex: ' key'
796- },
797- {
798- title: this .$t (' label.value' ),
799- dataIndex: ' value' ,
800- key: ' value'
801- }
802- ],
803- userDataValues: {},
804- templateUserDataCols: [
805- {
806- title: this .$t (' label.userdata' ),
807- dataIndex: ' userdata'
808- },
809- {
810- title: this .$t (' label.userdatapolicy' ),
811- dataIndex: ' userdataoverridepolicy'
812- }
813- ],
814- templateUserDataParams: [],
815- templateUserDataValues: {},
816692 overrideDiskOffering: {},
817693 templateFilter: [
818694 ' featured' ,
@@ -824,7 +700,6 @@ export default {
824700 defaultnetworkid: ' ' ,
825701 networkConfig: [],
826702 dataNetworkCreated: [],
827- userdataTabKey: ' userdataregistered' ,
828703 dataPreFill: {},
829704 showDetails: false ,
830705 showRootDiskSizeChanger: false ,
@@ -965,15 +840,6 @@ export default {
965840 listall: false
966841 }
967842 },
968- userDatas: {
969- list: ' listUserData' ,
970- options: {
971- page: 1 ,
972- pageSize: 10 ,
973- keyword: undefined ,
974- listall: false
975- }
976- },
977843 networks: {
978844 list: ' listNetworks' ,
979845 options: {
@@ -1044,19 +910,6 @@ export default {
1044910 networkId () {
1045911 return this .$route .query .networkid || null
1046912 },
1047- userdataTabList () {
1048- let tabList = []
1049- tabList = [{
1050- key: ' userdataregistered' ,
1051- tab: this .$t (' label.userdata.registered' )
1052- },
1053- {
1054- key: ' userdatatext' ,
1055- tab: this .$t (' label.userdata.text' )
1056- }]
1057-
1058- return tabList
1059- },
1060913 showSecurityGroupSection () {
1061914 if (this .networks .length < 1 ) {
1062915 return false
@@ -1333,7 +1186,7 @@ export default {
13331186 this .fetchInstaceGroups ()
13341187 this .fetchIoPolicyTypes ()
13351188 nextTick ().then (() => {
1336- [' name' , ' keyboard' , ' boottype' , ' bootmode' , ' userdata ' , ' iothreadsenabled' , ' iodriverpolicy' , ' nicmultiqueuenumber' , ' nicpackedvirtqueues' ].forEach (this .fillValue )
1189+ [' name' , ' keyboard' , ' boottype' , ' bootmode' , ' iothreadsenabled' , ' iodriverpolicy' , ' nicmultiqueuenumber' , ' nicpackedvirtqueues' ].forEach (this .fillValue )
13371190 this .form .boottype = this .defaultBootType ? this .defaultBootType : this .options .bootTypes && this .options .bootTypes .length > 0 ? this .options .bootTypes [0 ].id : undefined
13381191 this .form .bootmode = this .defaultBootMode ? this .defaultBootMode : this .options .bootModes && this .options .bootModes .length > 0 ? this .options .bootModes [0 ].id : undefined
13391192 this .instanceConfig = toRaw (this .form )
@@ -1450,8 +1303,6 @@ export default {
14501303 if (template) {
14511304 var size = template .size / (1024 * 1024 * 1024 ) || 0 // bytes to GB
14521305 this .dataPreFill .minrootdisksize = Math .ceil (size)
1453- this .updateTemplateLinkedUserData (template .userdataid )
1454- this .userdataDefaultOverridePolicy = template .userdatapolicy
14551306 this .form .dynamicscalingenabled = template .isdynamicallyscalable
14561307 this .defaultBootType = template .details ? .UEFI ? ' UEFI' : ' BIOS'
14571308 this .form .boottype = this .defaultBootType
@@ -1508,54 +1359,6 @@ export default {
15081359 this .form .keypairs = names
15091360 this .sshKeyPairs = names .map ((sshKeyPair ) => { return sshKeyPair .name })
15101361 },
1511- updateUserData (id ) {
1512- if (id === ' 0' ) {
1513- this .form .userdataid = undefined
1514- return
1515- }
1516-
1517- this .form .userdataid = id
1518- this .userDataParams = []
1519- api (' listUserData' , { id: id }).then (json => {
1520- const resp = json? .listuserdataresponse ? .userdata || []
1521- if (resp[0 ]) {
1522- const params = resp[0 ].params
1523- const dataParams = params ? params .split (' ,' ) : []
1524- dataParams .forEach ((val , index ) => {
1525- this .userDataParams .push ({
1526- id: index,
1527- key: val
1528- })
1529- })
1530- }
1531- })
1532- },
1533- updateTemplateLinkedUserData (id ) {
1534- if (id === ' 0' ) {
1535- return
1536- }
1537- this .templateUserDataParams = []
1538-
1539- api (' listUserData' , { id: id }).then (json => {
1540- const resp = json .listuserdataresponse .userdata || []
1541- if (resp .length > 0 ) {
1542- var params = resp[0 ].params
1543- if (params) {
1544- var dataParams = params .split (' ,' )
1545- }
1546- var that = this
1547- that .templateUserDataParams = []
1548- if (dataParams) {
1549- dataParams .forEach (function (val , index ) {
1550- that .templateUserDataParams .push ({
1551- id: index,
1552- key: val
1553- })
1554- })
1555- }
1556- }
1557- })
1558- },
15591362 escapePropertyKey (key ) {
15601363 return key .split (' .' ).join (' \\ 002E' )
15611364 },
@@ -1613,10 +1416,7 @@ export default {
16131416 deployVmData .iodriverpolicy = values .iodriverpolicy
16141417 deployVmData .nicmultiqueuenumber = values .nicmultiqueuenumber
16151418 deployVmData .nicpackedvirtqueuesenabled = values .nicpackedvirtqueuesenabled
1616- const isUserdataAllowed = ! this .userdataDefaultOverridePolicy || (this .userdataDefaultOverridePolicy === ' ALLOWOVERRIDE' && this .doUserdataOverride ) || (this .userdataDefaultOverridePolicy === ' APPEND' && this .doUserdataAppend )
1617- if (isUserdataAllowed && values .userdata && values .userdata .length > 0 ) {
1618- deployVmData .userdata = this .$toBase64AndURIEncoded (values .userdata )
1619- }
1419+
16201420 // step 2: select template
16211421 deployVmData .templateid = values .templateid
16221422 values .hypervisor = null
@@ -1744,9 +1544,6 @@ export default {
17441544 }
17451545 // step 7: select ssh key pair
17461546 deployVmData .keypairs = this .sshKeyPairs .join (' ,' )
1747- if (isUserdataAllowed) {
1748- deployVmData .userdataid = values .userdataid
1749- }
17501547
17511548 if (values .name ) {
17521549 deployVmData .name = values .name
@@ -1783,25 +1580,7 @@ export default {
17831580 deployVmData = Object .fromEntries (
17841581 Object .entries (deployVmData).filter (([key , value ]) => value !== undefined ))
17851582
1786- var idx = 0
1787- if (this .templateUserDataValues ) {
1788- for (const [key , value ] of Object .entries (this .templateUserDataValues )) {
1789- deployVmData[' userdatadetails[' + idx + ' ].' + ` ${ key} ` ] = value
1790- idx++
1791- }
1792- }
1793- if (isUserdataAllowed && this .userDataValues ) {
1794- for (const [key , value ] of Object .entries (this .userDataValues )) {
1795- deployVmData[' userdatadetails[' + idx + ' ].' + ` ${ key} ` ] = value
1796- idx++
1797- }
1798- }
1799-
1800- const httpMethod = deployVmData .userdata ? ' POST' : ' GET'
1801- const args = httpMethod === ' POST' ? {} : deployVmData
1802- const data = httpMethod === ' POST' ? deployVmData : {}
1803-
1804- api (' createVMFromBackup' , args, httpMethod, data).then (response => {
1583+ api (' createVMFromBackup' , deployVmData, ' GET' , {}).then (response => {
18051584 const jobId = response .deployvirtualmachineresponse .jobid
18061585 if (jobId) {
18071586 this .$pollJob ({
@@ -2069,10 +1848,6 @@ export default {
20691848 onTabChange (key , type ) {
20701849 this [type] = key
20711850 },
2072- onUserdataTabChange (key , type ) {
2073- this [type] = key
2074- this .userDataParams = []
2075- },
20761851 fetchTemplateNics (template ) {
20771852 var nics = []
20781853 this .nicToNetworkSelection = []
0 commit comments