diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index 3ad189bd..4cafcd34 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -34,14 +34,17 @@ CLUSTER_CREATE_ATTRS = clusters.CREATION_ATTRIBUTES CERTIFICATE_CREATE_ATTRS = certificates.CREATION_ATTRIBUTES -def _cleanup_params(attrs, check, **params): +def _cleanup_params(attrs, create, **params): args = {} for (key, value) in params.items(): if key in attrs: if value is None: - value = '' + if create: + value = '' + else: + continue args[str(key)] = str(value) - elif check: + elif create: raise exceptions.BadRequest( "Key must be in %s" % ",".join(attrs)) if key == "labels": @@ -66,6 +69,7 @@ def _create_patches(old, new): # new = {'a': 'A', 'c': 'c', 'd': None, 'e': '', 'f': 'F'} # patch = [ # {'op': 'add', 'path': '/f', 'value': 'F'} + # {'op': 'remove', 'path': '/b'}, # {'op': 'remove', 'path': '/e'}, # {'op': 'remove', 'path': '/d'}, # {'op': 'replace', 'path': '/c', 'value': 'c'} @@ -84,6 +88,11 @@ def _create_patches(old, new): elif key not in old: patch.append({'op': 'add', 'path': path, 'value': new[key]}) + for key in old: + path = '/' + key + if key not in new: + patch.append({'op': 'remove', 'path': path}) + return patch diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/update/update.service.js b/magnum_ui/static/dashboard/container-infra/cluster-templates/update/update.service.js index c261716d..e9cd0643 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/update/update.service.js +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/update/update.service.js @@ -67,6 +67,8 @@ ? response.data.name : ""; config.model.coe = response.data.coe ? response.data.coe : ""; + config.model.server_type = response.data.server_type + ? response.data.server_type : ""; config.model.public = response.data.public ? response.data.public : false; config.model.registry_enabled = response.data.registry_enabled diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/workflow/workflow.service.js b/magnum_ui/static/dashboard/container-infra/cluster-templates/workflow/workflow.service.js index 16d562e6..dd4aefe9 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/workflow/workflow.service.js +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/workflow/workflow.service.js @@ -445,6 +445,7 @@ model = { name: "", coe: "", + server_type: "", public: "", registry_enabled: "", tls_disabled: "",