Labels named type are bad, mmmkay

This commit is contained in:
Vincent Fiduccia 2015-06-12 16:36:23 -07:00
parent ec6b308749
commit 10c0753a06
3 changed files with 23 additions and 0 deletions

View File

@ -49,6 +49,16 @@ var Container = Cattle.TransitioningResource.extend({
Container.reopenClass({ Container.reopenClass({
alwaysInclude: ['hosts'], alwaysInclude: ['hosts'],
mangleIn: function(data) {
if ( data.labels )
{
// Labels shouldn't be a model even if it has a key called 'type'
data.labels = JSON.parse(JSON.stringify(data.labels));
}
return data;
},
}); });
export default Container; export default Container;

View File

@ -29,6 +29,13 @@ Host.reopenClass({
mangleIn: function(data) { mangleIn: function(data) {
data['hostState'] = data['state']; data['hostState'] = data['state'];
delete data['state']; delete data['state'];
if ( data.labels )
{
// Labels shouldn't be a model even if it has a key called 'type'
data.labels = JSON.parse(JSON.stringify(data.labels));
}
return data; return data;
}, },
}); });

View File

@ -42,6 +42,12 @@ Machine.reopenClass({
data.hosts = []; data.hosts = [];
} }
if ( data.labels )
{
// Labels shouldn't be a model even if it has a key called 'type'
data.labels = JSON.parse(JSON.stringify(data.labels));
}
return data; return data;
}, },
}); });