public inbox for [email protected]  
help / color / mirror / Atom feed
PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ]
2+ messages / 1 participants
[nested] [flat]

* PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ]
@ 2016-01-07 05:08 Murtuza Zabuawala <[email protected]>
  2016-01-07 05:32 ` Re: PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Murtuza Zabuawala @ 2016-01-07 05:08 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,

Please find minor patch to fix Backform Integer-Control.

_Issue:__
_    After validation of input value, value was not getting updated in 
model, hence it was taking default value from schema.


Regards,
Murtuza Zabuawala


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] Fix_IntegerControl.patch (552B, 3-Fix_IntegerControl.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 708b7fb..b5e5962 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1070,6 +1070,12 @@
               ).value()
             );
       }
+
+      //After validation we need to set that value into model
+      this.stopListening(this.model, "change:" + name, this.render);
+      this.model.set(name, value);
+      this.listenTo(this.model, "change:" + name, this.render);
+
     }
   });
 


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ]
  2016-01-07 05:08 PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
@ 2016-01-07 05:32 ` Murtuza Zabuawala <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Murtuza Zabuawala @ 2016-01-07 05:32 UTC (permalink / raw)
  To: pgadmin-hackers

+++ Updated patch file.

Hi,

I have added fix for server drop issue & added min & max value for 
'port' when we add db server in pgAdmin4.
I have also added flags to make sure we enter correct value in model 
when we use Integer Control.


Thanks,
Murtuza Zabuawala



On Thursday 07 January 2016 10:38 AM, Murtuza Zabuawala wrote:
> Hi,
>
> Please find minor patch to fix Backform Integer-Control.
>
> _Issue:__
> _    After validation of input value, value was not getting updated in 
> model, hence it was taking default value from schema.
>
>
> Regards,
> Murtuza Zabuawala



-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [text/x-patch] IntgerControl_Backform.patch (3.5K, 3-IntgerControl_Backform.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
index 667e1ad..bd932d6 100644
--- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
+++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js
@@ -7,6 +7,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
       parent_type: 'server-group',
       type: 'server',
       label: '{{ _('Server') }}',
+      canDrop: true,
       Init: function() {
 
         /* Avoid multiple registration of same menus */
@@ -26,11 +27,6 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
           category: 'create', priority: 3, label: '{{ _('Server...') }}',
           data: {action: 'create'}, icon: 'wcTabIcon icon-server'
         },{
-          name: 'drop_server', node: 'server', module: this,
-          applies: ['object', 'context'], callback: 'delete_obj',
-          category: 'drop', priority: 3, label: '{{ _('Drop Server...') }}',
-          icon: 'fa fa-trash', enable: 'is_not_connected'
-        },{
           name: 'connect_server', node: 'server', module: this,
           applies: ['object', 'context'], callback: 'connect_server',
           category: 'connect', priority: 4, label: '{{ _('Connect Server...') }}',
@@ -166,7 +162,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
           mode: ['properties', 'edit', 'create'], disabled: 'isConnected'
         },{
           id: 'port', label:'{{ _('Port') }}', type: 'int', group: "Connection",
-          mode: ['properties', 'edit', 'create'], disabled: 'isConnected'
+          mode: ['properties', 'edit', 'create'], disabled: 'isConnected', min: 1024, max: 65534
         },{
           id: 'db', label:'{{ _('Maintenance Database') }}', type: 'text', group: "Connection",
           mode: ['properties', 'edit', 'create'], disabled: 'isConnected'
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 708b7fb..3ce8061 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1034,6 +1034,9 @@
           value = this.getValueFromDOM(),
           min_value = field.min,
           max_value = field.max,
+          valid_int = false,
+          valid_min = false,
+          valid_max = false,
           intPattern = new RegExp("^-?[0-9]*$"),
           isMatched = intPattern.test(value);
 
@@ -1046,6 +1049,9 @@
               field.label
               ).value()
             );
+      } else {
+        //We have valid int hence set the falg to true
+        valid_int = true;
       }
 
       // Below will check if entered value is in-between min & max range
@@ -1058,6 +1064,9 @@
               min_value
               ).value()
             );
+      } else {
+        //We have valid value when compare to min hence set the falg to true
+        valid_min = true;
       }
 
       if (!_.isUndefined(max_value) && value > max_value) {
@@ -1069,6 +1078,16 @@
               max_value
               ).value()
             );
+      } else {
+        //We have valid value when compare to max hence set the falg to true
+        valid_max = true;
+      }
+
+      //After validation we need to set that value into model (only if all falgs are true)
+      if (valid_int && valid_min && valid_max) {
+      this.stopListening(this.model, "change:" + name, this.render);
+      this.model.set(name, value);
+      this.listenTo(this.model, "change:" + name, this.render);
       }
     }
   });


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-01-07 05:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 05:08 PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ] Murtuza Zabuawala <[email protected]>
2016-01-07 05:32 ` Murtuza Zabuawala <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox