Skip to content

ui: allow clearing dns during zone update - #7276

Merged
yadvr merged 3 commits into
apache:4.17from
shapeblue:fix-updatezone-dnsclear
Apr 11, 2023
Merged

yadvr merged 3 commits into
apache:4.17from
shapeblue:fix-updatezone-dnsclear

Conversation

@shwstppr

Copy link
Copy Markdown
Contributor

Description

Fixes #7273

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Fixes apache#7273

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
Contributor Author

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]

@kiranchavala

Copy link
Copy Markdown
Member

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@kiranchavala a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/7276 (QA-JID-55)

@kiranchavala

Copy link
Copy Markdown
Member

@shwstppr Able to clear DNS2, IPV6 DNS1, IPV6 DNS2

Not able to clear the internal dns 2
dns

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/7276 (QA-JID-56)

@codecov

codecov Bot commented Feb 27, 2023

Copy link
Copy Markdown

Codecov Report

Merging #7276 (0cfeedc) into 4.17 (dd51534) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               4.17    #7276   +/-   ##
=========================================
  Coverage     10.38%   10.38%           
  Complexity     6651     6651           
=========================================
  Files          2453     2453           
  Lines        242444   242444           
  Branches      37941    37941           
=========================================
  Hits          25168    25168           
  Misses       214159   214159           
  Partials       3117     3117           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kiranchavala

Copy link
Copy Markdown
Member

@shwstppr tested the changes LGTM

@shwstppr
shwstppr marked this pull request as ready for review April 3, 2023 10:06
@shwstppr

shwstppr commented Apr 3, 2023

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

shwstppr added a commit to shapeblue/cloudstack that referenced this pull request Apr 3, 2023
Fixes apache#7276

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build failed: ✖️
(SL-JID-74)

@shwstppr

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/7276 (QA-JID-78)

@shwstppr
shwstppr requested review from nvazquez and yadvr April 11, 2023 06:27
@shwstppr

Copy link
Copy Markdown
Contributor Author

This has been manually tested and LGTM'd by @kiranchavala #7276 (comment)

@rohityadavcloud @harikrishna-patnala @weizhouapache @nvazquez can you please review

@yadvr yadvr added this to the 4.18.1.0 milestone Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants