|
603 | 603 | @change="val => { dynamicscalingenabled = val }"/> |
604 | 604 | </a-form-item> |
605 | 605 | </a-form-item> |
606 | | - <a-row :gutter="12" v-if="isLeaseFeatureEnabled"> |
| 606 | + <a-form-item name="showLeaseOptions" ref="showLeaseOptions" v-if="isLeaseFeatureEnabled"> |
| 607 | + <template #label> |
| 608 | + <tooltip-label :title="$t('label.isLeaseFeatureEnabled')" /> |
| 609 | + </template> |
| 610 | + <a-switch v-model:checked="showLeaseOptions" @change="onToggleLeaseData"/> |
| 611 | + </a-form-item> |
| 612 | + <a-row :gutter="12" v-if="showLeaseOptions"> |
607 | 613 | <a-col :md="12" :lg="12"> |
608 | 614 | <a-form-item name="leaseduration" ref="leaseduration"> |
609 | 615 | <template #label> |
@@ -1125,9 +1131,11 @@ export default { |
1125 | 1131 | ] |
1126 | 1132 | }, |
1127 | 1133 | isLeaseFeatureEnabled: false, |
1128 | | - leaseduration: -1, |
| 1134 | + showLeaseOptions: false, |
| 1135 | + leaseduration: undefined, |
1129 | 1136 | leaseexpiryaction: '', |
1130 | | - expiryActions: ['STOP', 'DESTROY'] |
| 1137 | + expiryActions: ['STOP', 'DESTROY'], |
| 1138 | + defaultLeaseDuration: undefined |
1131 | 1139 | } |
1132 | 1140 | }, |
1133 | 1141 | computed: { |
@@ -1684,21 +1692,18 @@ export default { |
1684 | 1692 | var leasedurationParams = { name: 'instance.lease.duration', accountid: store.getters.userInfo.accountid } |
1685 | 1693 | api('listConfigurations', leasedurationParams).then(json => { |
1686 | 1694 | var value = json?.listconfigurationsresponse?.configuration?.[0].value || null |
1687 | | - this.leaseduration = value |
1688 | | -
|
| 1695 | + this.defaultLeaseDuration = value |
1689 | 1696 | if (value > -1) { |
1690 | 1697 | var leaseActionParams = { name: 'instance.lease.expiryaction', accountid: store.getters.userInfo.accountid } |
1691 | 1698 | api('listConfiguration', leaseActionParams).then(json => { |
1692 | 1699 | var value = json?.listconfigurationsresponse?.configuration?.[0].value || null |
1693 | | - this.leaseexpiryaction = value |
| 1700 | + this.defaultLeaseExpiryaction = value |
1694 | 1701 | }).catch(() => { |
1695 | | - this.leaseexiryaction = 'STOP' |
| 1702 | + this.defaultLeaseExpiryaction = 'STOP' |
1696 | 1703 | }) |
1697 | 1704 | } |
1698 | 1705 | }).catch(() => { |
1699 | | - this.leaseduration = -1 |
1700 | | - }).finally(() => { |
1701 | | - this.form.leaseduration = this.leaseduration |
| 1706 | + this.defaultLeaseDuration = -1 |
1702 | 1707 | }) |
1703 | 1708 | } |
1704 | 1709 | }).catch((error) => { |
@@ -1800,13 +1805,13 @@ export default { |
1800 | 1805 | this.fetchBootModes() |
1801 | 1806 | this.fetchInstaceGroups() |
1802 | 1807 | this.fetchIoPolicyTypes() |
| 1808 | + this.populateLeaseFeatureProps() |
1803 | 1809 | nextTick().then(() => { |
1804 | 1810 | ['name', 'keyboard', 'boottype', 'bootmode', 'userdata', 'iothreadsenabled', 'iodriverpolicy', 'nicmultiqueuenumber', 'nicpackedvirtqueues'].forEach(this.fillValue) |
1805 | 1811 | this.form.boottype = this.defaultBootType ? this.defaultBootType : this.options.bootTypes && this.options.bootTypes.length > 0 ? this.options.bootTypes[0].id : undefined |
1806 | 1812 | this.form.bootmode = this.defaultBootMode ? this.defaultBootMode : this.options.bootModes && this.options.bootModes.length > 0 ? this.options.bootModes[0].id : undefined |
1807 | 1813 | this.instanceConfig = toRaw(this.form) |
1808 | 1814 | }) |
1809 | | - this.populateLeaseFeatureProps() |
1810 | 1815 | }, |
1811 | 1816 | isDynamicallyScalable () { |
1812 | 1817 | return this.serviceOffering && this.serviceOffering.dynamicscalingenabled && this.template && this.template.isdynamicallyscalable && this.dynamicScalingVmConfigValue |
@@ -2897,14 +2902,16 @@ export default { |
2897 | 2902 | this.showRootDiskSizeChanger = false |
2898 | 2903 | } |
2899 | 2904 | if (offering && offering.leaseduration > -1) { |
| 2905 | + this.leaseduration = offering.leaseduration |
2900 | 2906 | this.form.leaseduration = offering.leaseduration |
2901 | | -
|
2902 | 2907 | if (offering.leaseexpiryaction !== undefined) { |
| 2908 | + this.leaseexpiryaction = offering.leaseexpiryaction |
2903 | 2909 | this.form.leaseexpiryaction = offering.leaseexpiryaction |
2904 | 2910 | } |
| 2911 | + this.showLeaseOptions = true |
2905 | 2912 | } else { |
2906 | | - this.form.leaseduration = this.leaseduration |
2907 | | - this.form.leaseexpiryaction = this.leaseexpiryaction |
| 2913 | + this.showLeaseOptions = false |
| 2914 | + this.onToggleLeaseData() |
2908 | 2915 | } |
2909 | 2916 | this.form.rootdisksizeitem = this.showRootDiskSizeChanger && this.rootDiskSizeFixed > 0 |
2910 | 2917 | this.formModel = toRaw(this.form) |
@@ -2949,6 +2956,15 @@ export default { |
2949 | 2956 | parent.$message.success(parent.$t('label.copied.clipboard')) |
2950 | 2957 | } |
2951 | 2958 | }) |
| 2959 | + }, |
| 2960 | + onToggleLeaseData () { |
| 2961 | + if (this.showLeaseOptions === false) { |
| 2962 | + this.form.leaseduration = undefined |
| 2963 | + this.form.leaseexpiryaction = undefined |
| 2964 | + } else { |
| 2965 | + this.form.leaseduration = this.leaseduration === undefined ? this.defaultLeaseDuration : this.leaseduration |
| 2966 | + this.form.leaseexpiryaction = this.leaseexpiryaction |
| 2967 | + } |
2952 | 2968 | } |
2953 | 2969 | } |
2954 | 2970 | } |
|
0 commit comments