diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/generate/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/form/generate/index.hbs index a5422d1568..0e4e63a658 100644 --- a/ui/packages/consul-peerings/app/components/consul/peer/form/generate/index.hbs +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/generate/index.hbs @@ -17,7 +17,20 @@ id={{id}} > - + + + + +

+ Error
+ {{fsm.state.context.error.message}} +

+
+
+
{{yield (hash Fieldsets=(component "consul/peer/form/generate/fieldsets" item=@item @@ -43,6 +56,9 @@ @onchange (pick 'data' (fn fsm.dispatch 'SUCCESS')) }} + @onerror={{queue + (fn fsm.dispatch 'ERROR') + }} />
diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs index a0b1294bf4..8b29c46b8c 100644 --- a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs @@ -17,6 +17,19 @@ @label={{'peer'}} @onchange={{fn (optional @onsubmit) @item}} as |writer|> + + + +

+ Error
+ {{error.message}} +

+
+
+
{{#let (unique-id) @@ -27,15 +40,15 @@ as |id|}} > {{yield (hash Fieldsets=(component "consul/peer/form/initiate/fieldsets" - item=@item + item=@item ) Actions=(component "consul/peer/form/initiate/actions" - item=@item - id=id + item=@item + id=id ) )}} {{/let}} - + diff --git a/ui/packages/consul-ui/app/components/data-writer/index.hbs b/ui/packages/consul-ui/app/components/data-writer/index.hbs index 53af6c8565..5f0ecdfcdb 100644 --- a/ui/packages/consul-ui/app/components/data-writer/index.hbs +++ b/ui/packages/consul-ui/app/components/data-writer/index.hbs @@ -19,7 +19,7 @@ @item={{data}} @data={{null}} @onchange={{action dispatch "SUCCESS"}} - @onerror={{queue (action (mut error) value="error.errors.firstObject") (action dispatch "ERROR")}} + @onerror={{action "error"}} /> @@ -28,7 +28,7 @@ @sink={{sink}} @item={{data}} @onchange={{action dispatch "SUCCESS"}} - @onerror={{queue (action (mut error) value="error.errors.firstObject") (action dispatch "ERROR")}} + @onerror={{action "error"}} /> diff --git a/ui/packages/consul-ui/app/components/data-writer/index.js b/ui/packages/consul-ui/app/components/data-writer/index.js index 86b3452421..3dd1f8ab94 100644 --- a/ui/packages/consul-ui/app/components/data-writer/index.js +++ b/ui/packages/consul-ui/app/components/data-writer/index.js @@ -21,5 +21,17 @@ export default Component.extend(Slotted, { set(this, 'data', data); this.dispatch('PERSIST'); }, + error: function(data, e) { + if (e && typeof e.preventDefault === 'function') { + e.preventDefault(); + } + set( + this, + 'error', + typeof data.error.errors !== 'undefined' ? + data.error.errors.firstObject : data.error + ); + this.dispatch('ERROR'); + }, }, });