From bc50ec11a6734f82096fed203276d3a7323f5539 Mon Sep 17 00:00:00 2001 From: Markus Grigull Date: Sat, 4 Feb 2017 15:31:57 +0100 Subject: [PATCH] Allow empty widget names Fix resetting widget dialog error message --- app/components/widget-label.js | 1 + app/components/widget-plot.js | 5 ----- app/components/widget-table.js | 6 +----- app/components/widget-value.js | 6 +----- app/templates/components/widget-plot.hbs | 10 ++++++---- app/templates/components/widget-value.hbs | 2 +- 6 files changed, 10 insertions(+), 20 deletions(-) diff --git a/app/components/widget-label.js b/app/components/widget-label.js index 732430e..5fd22fe 100644 --- a/app/components/widget-label.js +++ b/app/components/widget-label.js @@ -19,6 +19,7 @@ export default WidgetAbstract.extend({ if (this.get('editing') === true) { // prepare modal this.set('name', this.get('widget.name')); + this.set('errorMessage', null); // show modal this.set('isShowingModal', true); diff --git a/app/components/widget-plot.js b/app/components/widget-plot.js index 9b553d7..7574de0 100644 --- a/app/components/widget-plot.js +++ b/app/components/widget-plot.js @@ -188,11 +188,6 @@ export default WidgetAbstract.extend({ // verify properties let properties = this.getProperties('name'); - if (properties['name'] === null || properties['name'] === "") { - this.set('errorMessage', 'Widget name is missing'); - return; - } - // set simulator by simulation model name let simulationModelName = this.get('simulationModelName'); let self = this; diff --git a/app/components/widget-table.js b/app/components/widget-table.js index 8272310..74c14bd 100644 --- a/app/components/widget-table.js +++ b/app/components/widget-table.js @@ -83,6 +83,7 @@ export default WidgetAbstract.extend({ if (this.get('editing') === true) { // prepare modal this.set('name', this.get('widget.name')); + this.set('errorMessage', null); // get simlator name from id let self = this; @@ -117,11 +118,6 @@ export default WidgetAbstract.extend({ // verify properties let properties = this.getProperties('name'); - if (properties['name'] === null || properties['name'] === "") { - this.set('errorMessage', 'Widget name is missing'); - return; - } - // set simulator by simulation model name let simulationModelName = this.get('simulationModelName'); let self = this; diff --git a/app/components/widget-value.js b/app/components/widget-value.js index ed42fb8..efcbfbe 100644 --- a/app/components/widget-value.js +++ b/app/components/widget-value.js @@ -44,6 +44,7 @@ export default WidgetAbstract.extend({ if (this.get('editing') === true) { // prepare modal this.set('name', this.get('widget.name')); + this.set('errorMessage', null); // get signal mapping for simulation model let self = this; @@ -82,11 +83,6 @@ export default WidgetAbstract.extend({ // verify properties let properties = this.getProperties('name'); - if (properties['name'] === null || properties['name'] === "") { - this.set('errorMessage', 'Widget name is missing'); - return; - } - // set simulator by simulation model name let simulationModelName = this.get('simulationModelName'); let self = this; diff --git a/app/templates/components/widget-plot.hbs b/app/templates/components/widget-plot.hbs index 7fd4040..8e95dda 100644 --- a/app/templates/components/widget-plot.hbs +++ b/app/templates/components/widget-plot.hbs @@ -35,6 +35,12 @@ {{#modal-dialog attachment="middle center" translucentOverlay=true}}

Plot

+ {{#if errorMessage}} +

+ Error: {{errorMessage}} +

+ {{/if}} +
@@ -102,9 +108,5 @@
- - {{#if errorMessage}} -

Error: {{errorMessage}}

- {{/if}} {{/modal-dialog}} {{/if}} diff --git a/app/templates/components/widget-value.hbs b/app/templates/components/widget-value.hbs index 6bfb445..00c246b 100644 --- a/app/templates/components/widget-value.hbs +++ b/app/templates/components/widget-value.hbs @@ -1,4 +1,4 @@ -{{name}}: {{value}} +{{name}}{{#if name}}:{{/if}} {{value}} {{#if isShowingModal}} {{#modal-dialog attachment="middle center" translucentOverlay=true}}