Change Metadata Display widget to case insensitive
The metadata-display should match properties using case insensitive.
I've found that if you pass in extra metadata properties to
Glance v1 at create time, it takes all the properties and stores
them as lower case. So when you create an image with metadata of
FOO=BAR, it will store as foo=bar.
There are some properties "CIM_PASD_InstructionSet" that when
create at the same time as creating the image get changed to
cim_pasd_instructionset". When this gets subsequently retrieved
from Glance and displayed in the metadata-display widget,
it doesn't recognize them and won't show them.
To test, you need: https://review.openstack.org/#/c/236042/
Create an Image using the CIM Instruction Set metadata.
Go to image row and expand. You won't see the metadata.
Apply this patch git review -x 315295
Then do the same steps. You'll see the metadata displayed:
http://imgur.com/eMfLd9H
Change-Id: I5127283e90505f3580af6afea3eb992a91b8dfc8
Closes-Bug: 1580790
(cherry picked from commit 802ec1f77a
)
This commit is contained in:
parent
f0964a7fcc
commit
cdde60c315
|
@ -102,8 +102,10 @@
|
|||
*/
|
||||
Property.prototype.getValue = function () {
|
||||
switch (this.type) {
|
||||
case 'array': return this.operator + ' ' + this.value.join(',');
|
||||
default: return '' + this.value;
|
||||
case 'array':
|
||||
return this.operator + ' ' + this.value.join(',');
|
||||
default:
|
||||
return '' + this.value;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -408,13 +410,18 @@
|
|||
var itemsMapping = {};
|
||||
|
||||
angular.forEach(this.flatTree, function (item) {
|
||||
if (item.leaf && item.leaf.name in existing) {
|
||||
itemsMapping[item.leaf.name] = item;
|
||||
if (item.leaf) {
|
||||
angular.forEach(existing, function caseInsensitiveCompare(value, key) {
|
||||
var caseInsensitiveLeafName = item.leaf.name.toLocaleLowerCase();
|
||||
if (caseInsensitiveLeafName === key.toLocaleLowerCase()) {
|
||||
itemsMapping[caseInsensitiveLeafName] = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
angular.forEach(existing, function (value, key) {
|
||||
var item = itemsMapping[key];
|
||||
var item = itemsMapping[key.toLocaleLowerCase()];
|
||||
if (angular.isUndefined(item)) {
|
||||
item = new Item().customProperty(key);
|
||||
this.flatTree.push(item);
|
||||
|
|
|
@ -111,7 +111,8 @@
|
|||
$scope = $injector.get('$rootScope').$new();
|
||||
|
||||
$scope.available = namespaces;
|
||||
$scope.existing = { 'test:B:A:1':'foo' };
|
||||
// Purposely use different case to ensure it still matches.
|
||||
$scope.existing = { 'test:B:a:1':'foo' };
|
||||
|
||||
var markup = '<metadata-tree' +
|
||||
' available="available"' +
|
||||
|
|
Loading…
Reference in New Issue