From 49a16f3ea079ae86b1609a95347b8b76190721ef Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Thu, 14 Dec 2017 13:43:28 +0900 Subject: [PATCH] Enable to update Lables for cluster template This patch enables to update Labels for cluster template. This patch should be cherry-picked into stable/queens. Change-Id: Ie1bfcca8e7a8fd848972d082effff24b21ea3795 Closes-Bug: #1638863 --- magnum_ui/api/magnum.py | 12 ++++-------- .../cluster-templates/workflow/workflow.service.js | 4 +--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/magnum_ui/api/magnum.py b/magnum_ui/api/magnum.py index 23e6b7f9..3784e408 100644 --- a/magnum_ui/api/magnum.py +++ b/magnum_ui/api/magnum.py @@ -80,10 +80,6 @@ def _create_patches(old, new): patch = [] for key in new: - if key == 'labels': - # NOTE(shu-mutou): labels for cluster template and cluster - # are not updatable. - continue path = '/' + key if key in old and old[key] != new[key]: if new[key] is None or new[key] is '': @@ -95,14 +91,14 @@ def _create_patches(old, new): patch.append({'op': 'add', 'path': path, 'value': new[key]}) for key in old: - if key == 'labels': - # NOTE(shu-mutou): labels for cluster template and cluster - # are not updatable. - continue path = '/' + key if key not in new: patch.append({'op': 'remove', 'path': path}) + # convert dict value for labels into string + for p in patch: + if 'value' in p: + p['value'] = str(p['value']) return patch 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 c4ec8c50..44fad6c7 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 @@ -441,9 +441,7 @@ htmlClass: 'col-xs-12', items: [ { - key: 'labels', - // fixme: to be available, needs to fix bug/1638863 - readonly: action === 'update' + key: 'labels' } ] }