Skip to content

Commit

Permalink
Merge pull request #20 from stackhpc/fix/horizon-angular-rebased
Browse files Browse the repository at this point in the history
Fix/horizon angular rebased
  • Loading branch information
darmach authored May 25, 2023
2 parents 056336e + ad1dc9e commit 1bcb92c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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();

Expand Down

0 comments on commit 1bcb92c

Please sign in to comment.