On 07/08/2011 01:25 PM, Adam Young wrote:
On 07/08/2011 01:02 PM, Adam Young wrote:
On 07/08/2011 01:00 PM, Adam Young wrote:
On 07/08/2011 12:40 PM, Endi Sukma Dewata wrote:
On 7/8/2011 10:06 AM, Adam Young wrote:



Some issues:

1. The new code in IPA.widget.test_dirty() seems to be redundant.

    if ((that.values.length === 0) &&
        (values.length === 1) &&
        values[0] === ""){
        return false;
    }

It's already covered by a similar code above it.

Not quite. This happens when the widget defaults a blank field to [""].

2. The commented code in details.js:167 can be removed (and 158 too).
Done

3. Instead of returning empty array, the details_tests.js:173 should return the overridden method's return value.

    return widget.widget_save();

Just keeps the test from breaking.  Not really checking anything

But fixed anyway


_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
This time with a patch attached


_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
Removed code in is_dirty check, as it deson't seem to get triggered now.


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

From 34654c9825b49542515337c74ebc26e20715255d Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Fri, 8 Jul 2011 10:15:16 -0400
Subject: [PATCH] clear errors on reset

https://fedorahosted.org/freeipa/ticket/1446
---
 install/ui/details.js            |    2 --
 install/ui/test/details_tests.js |    2 +-
 install/ui/widget.js             |   10 +++++++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/install/ui/details.js b/install/ui/details.js
index 6a2def7fb5447aba59998876bb6257f2415900c5..7467697025250309dfa1bf2c5ff0e294f5947e2b 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -155,7 +155,6 @@ IPA.details_section = function(spec) {
 
         for (var j=0; j<fields.length; j++) {
             var field = fields[j];
-            var span = $('span[name='+field.name+']', this.container).first();
             field.load(record);
         }
     };
@@ -164,7 +163,6 @@ IPA.details_section = function(spec) {
         var fields = that.fields.values;
         for (var i=0; i<fields.length; i++) {
             var field = fields[i];
-            var span = $('span[name='+field.name+']', this.container).first();
             field.reset();
         }
     };
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 71e6bf98eb585b9d5a179842f68fc257dda5aa08..1b19f4b3e91d9b05f54243257801a2372afa13a2 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -170,7 +170,7 @@ test("Testing details lifecycle: create, setup, load.", function(){
 
         widget.save = function() {
             save_called = true;
-            widget.widget_save();
+            return widget.widget_save();
         };
         return widget;
     }
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 0ec9a968bf5415d3f21fd2d0a2d8cb01eec64797..5eb58f6344c2d05687c53366db50822b598b6cd0 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -140,6 +140,12 @@ IPA.widget = function(spec) {
         that.valid = true;
 
         var values = that.save();
+        if (!values){
+            return;
+        }
+        if (values.length ===0 ){
+            return;
+        }
         var value = values[0];
         if (!value) {
             return;
@@ -264,6 +270,7 @@ IPA.widget = function(spec) {
 
     that.reset = function() {
         that.update();
+        that.validate();
         that.set_dirty(false);
     };
 
@@ -1704,11 +1711,12 @@ IPA.entity_select_widget = function(spec) {
 
     that.reset = function() {
         that.entity_filter.val(that.values[0]);
-        that.set_dirty(false);
         populate_select(that.values[0]);
         if (editable){
             that.edit_box.val(that.values[0]);
         }
+        that.validate();
+        that.set_dirty(false);
     };
 
     that.load = function(record) {
-- 
1.7.5.2

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

Reply via email to