diff --git a/horizon/static/framework/widgets/metadata/tree/metadata-tree-item.controller.js b/horizon/static/framework/widgets/metadata/tree/metadata-tree-item.controller.js index 2713540942f..4aca18f32ac 100644 --- a/horizon/static/framework/widgets/metadata/tree/metadata-tree-item.controller.js +++ b/horizon/static/framework/widgets/metadata/tree/metadata-tree-item.controller.js @@ -17,6 +17,7 @@ 'use strict'; var READONLY_PROPERTIES = ['os_hash_algo', 'os_hash_value']; + var DUPLICATE_PROPERTIES = ['description']; angular .module('horizon.framework.widgets.metadata.tree') @@ -34,13 +35,18 @@ ctrl.formatErrorMessage = formatErrorMessage; ctrl.opened = false; - if ('item' in ctrl && 'leaf' in ctrl.item && - READONLY_PROPERTIES.includes(ctrl.item.leaf.name)) { - ctrl.item.leaf.readonly = true; - ctrl.item.leaf.required = false; - } - this.$onInit = function init() { + if ('item' in ctrl && 'leaf' in ctrl.item && + READONLY_PROPERTIES.includes(ctrl.item.leaf.name)) { + ctrl.item.leaf.readonly = true; + ctrl.item.leaf.required = false; + } + + if ('item' in ctrl && 'leaf' in ctrl.item && + DUPLICATE_PROPERTIES.includes(ctrl.item.leaf.name)) { + delete ctrl.item; + } + if ('item' in ctrl && 'leaf' in ctrl.item && ctrl.item.leaf.type === 'array') { ctrl.values = ctrl.item.leaf.items.enum.filter(filter).sort();