From 6d55e33c31b3d06bcbf7e6a016b3bc5b3ad6c125 Mon Sep 17 00:00:00 2001 From: anotherchrisberry Date: Tue, 24 Oct 2017 15:55:38 -0700 Subject: [PATCH] fix(core): handle spel expressions in map editors --- .../core/src/forms/mapEditor/mapEditor.component.html | 5 ++++- .../core/src/forms/mapEditor/mapEditor.component.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.html b/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.html index 504e11e46f8..6ed98648c2e 100644 --- a/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.html +++ b/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.html @@ -2,7 +2,10 @@
{{$ctrl.label}}
- + +
diff --git a/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.js b/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.js index f1d2f4618bd..b6a8d60a8b1 100644 --- a/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.js +++ b/app/scripts/modules/core/src/forms/mapEditor/mapEditor.component.js @@ -1,6 +1,7 @@ 'use strict'; const angular = require('angular'); +import { isString } from 'lodash'; import './mapEditor.component.less'; @@ -32,6 +33,7 @@ module.exports = angular this.tableClass = (this.label ? '' : 'no-border-top'); this.columnCount = (this.labelsLeft ? 5 : 3); this.model = this.model || {}; + this.isParameterized = isString(this.model); let modelKeys = () => Object.keys(this.model); @@ -48,6 +50,9 @@ module.exports = angular // Clears existing values from model, then replaces them this.synchronize = () => { + if (this.isParameterized) { + return; + } let modelStart = JSON.stringify(this.model); let allKeys = this.backingModel.map((pair) => pair.key); modelKeys().forEach((key) => delete this.model[key]); @@ -63,9 +68,8 @@ module.exports = angular } }; - // if defined, the $onInit method will automatically be called when components are initialized this.$onInit = () => { - if (this.model) { + if (this.model && !this.isParameterized) { modelKeys().forEach((key) => { this.backingModel.push({key: key, value: this.model[key]}); });