From 10c0753a068e93e1376fed64d751276d079dca6d Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Fri, 12 Jun 2015 16:36:23 -0700 Subject: [PATCH] Labels named type are bad, mmmkay --- app/container/model.js | 10 ++++++++++ app/host/model.js | 7 +++++++ app/machine/model.js | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/app/container/model.js b/app/container/model.js index 2418715ab..fa7bd93ee 100644 --- a/app/container/model.js +++ b/app/container/model.js @@ -49,6 +49,16 @@ var Container = Cattle.TransitioningResource.extend({ Container.reopenClass({ 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; diff --git a/app/host/model.js b/app/host/model.js index fccf6a75f..642cfed58 100644 --- a/app/host/model.js +++ b/app/host/model.js @@ -29,6 +29,13 @@ Host.reopenClass({ mangleIn: function(data) { data['hostState'] = 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; }, }); diff --git a/app/machine/model.js b/app/machine/model.js index fc7255af3..795c4d602 100644 --- a/app/machine/model.js +++ b/app/machine/model.js @@ -42,6 +42,12 @@ Machine.reopenClass({ 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; }, });