On Wed, Jun 25, 2014 at 06:58:52PM +0200, Petr Vobornik wrote:
> Patch 618 fixes a bug.
> 
> Patches 680 and 681 were implemented along with it. They address pspacek's
> usability rant :).
> 
> [PATCH] 680 webui: show notification instead of modal dialog on validation
> error
> [PATCH] 681 webui: fix required error notification in multivalued widget
> [PATCH] 682 webui: focus invalid widget on validation error
> -- 
> Petr Vobornik

ACK on 680 and 682.

On 681: diff makes sense; I'm not 100% sure my testing has covered
cases that were previously failing.  ACK if you're confident,
otherwise could you provide steps to verify?

Cheers,

Fraser

> From 5c3fcd240d61f378a8bb7e8cd4c2129cd11930df Mon Sep 17 00:00:00 2001
> From: Petr Vobornik <pvobo...@redhat.com>
> Date: Wed, 25 Jun 2014 15:17:26 +0200
> Subject: [PATCH] webui: focus invalid widget on validation error
> 
> ---
>  install/ui/src/freeipa/add.js     |  7 +++++--
>  install/ui/src/freeipa/details.js |  4 +++-
>  install/ui/src/freeipa/widget.js  | 22 ++++++++++++++++++++++
>  3 files changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/install/ui/src/freeipa/add.js b/install/ui/src/freeipa/add.js
> index 
> a4b5d3649d2df2933cb7eb7c8a24a18b7b789f50..78f3890ad2320cbc3afd5cb9ae1e4ae2359d8023
>  100644
> --- a/install/ui/src/freeipa/add.js
> +++ b/install/ui/src/freeipa/add.js
> @@ -20,7 +20,7 @@
>  */
>  
>  define(['./ipa', './jquery', './navigation', './rpc', './text', './field', 
> './widget', './dialog'],
> -       function(IPA, $, navigation, rpc, text) {
> +       function(IPA, $, navigation, rpc, text, field_mod, widget_mod) {
>  
>  /**
>   * Entity adder dialog
> @@ -219,7 +219,10 @@ IPA.entity_adder_dialog = function(spec) {
>       */
>      that.add = function(on_success, on_error) {
>  
> -        if (!that.validate()) return;
> +        if (!that.validate()) {
> +            widget_mod.focus_invalid(that);
> +            return;
> +        }
>  
>          var record = {};
>          that.save(record);
> diff --git a/install/ui/src/freeipa/details.js 
> b/install/ui/src/freeipa/details.js
> index 
> ed057e98c14e8ee72e5f1596ed24599eb27abfa5..7aa4c0ef6541900d6fa5b14b16ec964b50349015
>  100644
> --- a/install/ui/src/freeipa/details.js
> +++ b/install/ui/src/freeipa/details.js
> @@ -31,9 +31,10 @@ define([
>          './rpc',
>          './spec_util',
>          './text',
> +        './widget',
>          './facet',
>          './add'],
> -    function(lang, builder, IPA, $, phases, reg, rpc, su, text) {
> +    function(lang, builder, IPA, $, phases, reg, rpc, su, text, widget_mod) {
>  
>  /**
>   * Details module
> @@ -1436,6 +1437,7 @@ exp.update_action = IPA.update_action = function(spec) {
>  
>          if (!facet.validate()) {
>              facet.show_validation_error();
> +            widget_mod.focus_invalid(facet);
>              return;
>          }
>  
> diff --git a/install/ui/src/freeipa/widget.js 
> b/install/ui/src/freeipa/widget.js
> index 
> 3d3f427af43e429124f5e19a2604bd443a6e39c8..ab86c72d1abfae87984fa2212040a3e6c63f2f31
>  100644
> --- a/install/ui/src/freeipa/widget.js
> +++ b/install/ui/src/freeipa/widget.js
> @@ -5747,6 +5747,28 @@ exp.activity_widget = IPA.activity_widget = 
> function(spec) {
>  };
>  
>  /**
> + * Find and focus first focusable invalid widget
> + * @member widget
> + * @param {IPA.widget|facet.facet} widget Widget container
> + * @return {boolean} A widget was focused
> + */
> +exp.focus_invalid = function(widget) {
> +
> +    var widgets = widget.widgets.widgets;
> +    var focused = false;
> +    for (var i=0, l=widgets.length; i<l; i++) {
> +        var w = widgets.values[i];
> +        if (w.valid === false && w.focus_input) {
> +            w.focus_input();
> +            focused = true;
> +        }
> +        else if (w.widgets) focused = exp.focus_invalid(w);
> +        if (focused) break;
> +    }
> +    return focused;
> +};
> +
> +/**
>   * pre_op operations for widgets
>   * - sets facet and entity if present in context
>   * @member widget
> -- 
> 1.9.0
> 

> From 431dad35cbcb02351786fd75bd34aa86781d42fb Mon Sep 17 00:00:00 2001
> From: Petr Vobornik <pvobo...@redhat.com>
> Date: Wed, 25 Jun 2014 14:50:16 +0200
> Subject: [PATCH] webui: fix required error notification in multivalued widget
> 
> ---
>  install/ui/src/freeipa/widget.js | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/install/ui/src/freeipa/widget.js 
> b/install/ui/src/freeipa/widget.js
> index 
> a49c6282b1977008e80a9c02754df44de31c8b02..3d3f427af43e429124f5e19a2604bd443a6e39c8
>  100644
> --- a/install/ui/src/freeipa/widget.js
> +++ b/install/ui/src/freeipa/widget.js
> @@ -909,7 +909,7 @@ IPA.multivalued_widget = function(spec) {
>          var old = that.valid;
>          that.valid = result.valid;
>  
> -        if (!result.valid && result.errors) {
> +        if (!result.valid && result.results) {
>              var offset = 0;
>              for (var i=0; i<that.rows.length; i++) {
>  
> @@ -928,10 +928,9 @@ IPA.multivalued_widget = function(spec) {
>                  var error_link = that.get_error_link();
>                  error_link.css('display', 'none');
>                  error_link.html('');
> -            } else {
> -                that.show_error(result.message);
>              }
> -
> +        } else if (!result.valid) {
> +            that.show_error(result.message);
>          } else {
>              that.hide_error();
>          }
> -- 
> 1.9.0
> 

> From 65ce6fcd7578e0dbe03adf1ba8b9ae3fc67c09bb Mon Sep 17 00:00:00 2001
> From: Petr Vobornik <pvobo...@redhat.com>
> Date: Wed, 25 Jun 2014 14:49:26 +0200
> Subject: [PATCH] webui: show notification instead of modal dialog on
>  validation error
> 
> ---
>  install/ui/src/freeipa/details.js | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/install/ui/src/freeipa/details.js 
> b/install/ui/src/freeipa/details.js
> index 
> b7fa3646921dd8a3229d1bb397373d808877fa17..ed057e98c14e8ee72e5f1596ed24599eb27abfa5
>  100644
> --- a/install/ui/src/freeipa/details.js
> +++ b/install/ui/src/freeipa/details.js
> @@ -930,12 +930,7 @@ exp.details_facet = IPA.details_facet = function(spec, 
> no_init) {
>       * @protected
>       */
>      that.show_validation_error = function() {
> -        var dialog = IPA.message_dialog({
> -            name: 'validation_error',
> -            title: '@i18n:dialogs.validation_title',
> -            message: '@i18n:dialogs.validation_message'
> -        });
> -        dialog.open();
> +        IPA.notify('@i18n:dialogs.validation_message', 'error');
>      };
>  
>      /**
> -- 
> 1.9.0
> 

> _______________________________________________
> Freeipa-devel mailing list
> Freeipa-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/freeipa-devel

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to