shwstppr commented on PR #7276:
URL: https://github.com/apache/cloudstack/pull/7276#issuecomment-1439494189

   Not sure if we can have a generic solution when a parameter value is 
explicitly set to empty,
   ```
   diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
   index 78e68ae34a..0d93992c3b 100644
   --- a/ui/src/views/AutogenView.vue
   +++ b/ui/src/views/AutogenView.vue
   @@ -510,7 +510,8 @@ export default {
          confirmDirty: false,
          firstIndex: 0,
          modalWidth: '30vw',
   -      promises: []
   +      promises: [],
   +      originalItemValuesBeforeEdit: {}
        }
      },
      beforeUnmount () {
   @@ -1226,6 +1227,7 @@ export default {
            fieldValue = this.resource[fieldName] ? this.resource[fieldName] : 
null
            if (fieldValue) {
              this.form[field.name] = fieldValue
   +          this.originalItemValuesBeforeEdit[field.name] = fieldValue
            }
          })
        },
   @@ -1351,6 +1353,12 @@ export default {
            resolve(false)
          })
        },
   +    paramValueClearedWithUpdate (param) {
   +      if (!this.originalItemValuesBeforeEdit || 
Object.keys(this.originalItemValuesBeforeEdit).length === 0) {
   +        return false
   +      }
   +      return this.originalItemValuesBeforeEdit[param] !== ''
   +    },
        execSubmit (e) {
          e.preventDefault()
          this.formRef.value.validate().then(() => {
   @@ -1367,15 +1375,12 @@ export default {
                  continue
                }
                if (input === undefined || input === null ||
   -              (input === '' && !['updateStoragePool', 'updateHost', 
'updatePhysicalNetwork', 'updateDiskOffering', 'updateNetworkOffering', 
'updateServiceOffering', 'updateZone'].includes(action.api))) {
   +              (input === '' && this.paramValueClearedWithUpdate(key))) {
                  if (param.type === 'boolean') {
                    params[key] = false
                  }
                  break
                }
   -            if (input === '' && !['tags', 'hosttags', 'storagetags', 
'dns2', 'ip6dns1', 'ip6dns2'].includes(key)) {
   -              break
   -            }
                if (action.mapping && key in action.mapping && 
action.mapping[key].options) {
                  params[key] = action.mapping[key].options[input]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to