Fix existing metadata display in metadata widget

The metadata widget displays both available and existing
metadata for a given resource. For example, on images
you can click "Update Metadata" and it will show you
all of the metadata that you can apply on the left
and all the metadata that is already on the image
on the right. This is basically a vertical transfer
table.

Available metadata is structure as a tree and the
actual properties are "leaf" nodes. When you
transfer from left to right it is only supposed to
show actual properties and not the "folders". These
are the leaf nodes.

This was handled by filtering with the built in
angular filter [0] and was relying on a property
"leaf" to be set to null. However, in doing research,
I found that the way angular handles null in filtering
changes between angular versions [0]. I tried various
options and could not seem to make it work, so this
patch changes from setting leaf from null to false.

This fix removes the console log, but also removes
an issue where sometimes you couldn't remove metadata
item that had previously been saved.

[0] http://stackoverflow.com/questions/18644412/angularjs-filter-not-null

Change-Id: Ib93890d40b8103c378bb806015e50f3baa2b4fc6
Closes-Bug: 1572686
This commit is contained in:
Travis Tripp 2016-05-11 16:58:47 -06:00
parent dba17d6915
commit 6ad36e0e57
2 changed files with 2 additions and 2 deletions

View File

@ -97,7 +97,7 @@
</div>
</div>
<ul class="list-group metadata-list-group" ng-form="ctrl.metadataForm" ng-cloak>
<li ng-repeat="item in existingList = (ctrl.tree.flatTree | filter:{$:ctrl.filterText.existing, added:true, leaf:'!null'} | orderBy:'leaf.name')"
<li ng-repeat="item in existingList = (ctrl.tree.flatTree | filter:{$:ctrl.filterText.existing, added:true, leaf:'!false'} | orderBy:'leaf.name')"
ng-class="{'active': ctrl.tree.selected===item}"
ng-class-odd="'dark-stripe'"
ng-class-even="'light-stripe'"

View File

@ -132,7 +132,7 @@
this.addedCount = 0;
this.custom = false;
// Leaf properties
this.leaf = null;
this.leaf = false;
this.added = false;
}