Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aH3hp-0000KG-JW for pgadmin-hackers@arkaria.postgresql.org; Thu, 07 Jan 2016 06:05:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aH3ho-0002qW-Vk for pgadmin-hackers@arkaria.postgresql.org; Thu, 07 Jan 2016 06:05:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aH3hn-0002q3-QS for pgadmin-hackers@postgresql.org; Thu, 07 Jan 2016 06:05:52 +0000 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aH3hk-0007ai-I0 for pgadmin-hackers@postgresql.org; Thu, 07 Jan 2016 06:05:50 +0000 Received: by mail-pa0-x22b.google.com with SMTP id cy9so250269911pac.0 for ; Wed, 06 Jan 2016 22:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=0G+btfAVnc5/30Rn5HZ3iuV+GJBDnnkK+fdSDWit70Q=; b=MliD+nqfdxLKWKE14Q4hV3cxHuXSq5v6NYOJlz0w3ZOSP57Hf2yJyENnHsxOB0GgpH xl/Lo0xALWREU0PIqyMu4MMZ3PZvCCF4n+hf4sEv+jXmNvcjnLYXNyX/VICAudXuoEW9 sP+ZL6jt39WCRc0FOEgNUdK4/hji/LpJkLYWPcfyQLszqIr0uj2Ha/nqkgmyVjh/V/HT /yUzLo3S931ItQfcztK1I9xMz3LBxzebKU5VBV/1lNsVNP6oLugrhymuI//Mr5AOZuVL dtf6gcYSwg8yavFlTug050dYKVzSwPxfmAXNs+mhc33QxNVczeCrQvaOIJ38X0CRk/eC cOOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=0G+btfAVnc5/30Rn5HZ3iuV+GJBDnnkK+fdSDWit70Q=; b=Oe01DriFVkk/HtoohyCrqp4DcBq/O1fReNsplG8BaOxKcePaKsaFpfjfqT3O4f0+zz hT7e/I6qLJdpgxKdhThiaO8KQ/yP5ZZ0ahXd2qwLvCZim7L6Nzt4thqZkIr95jNRImDp cGHqWbq7bJZVNVcDnO/EbU0yu9aord+E8Sm/zs9iVvd8GJ0rA2LAkTUH/fidoQTcZjR9 HOIuRx1lQOnO/TST35cYbYyjgh1cj+6B1hTcqhEFyBxbxPGwcaLhOBLr7AnVs3YaXLE0 s3XHi7JlNauqzk0hGffB32ICGFCR6qPC0UQWnfzjfcRvdm2yzYfExil3ZxpRzM/sokon k8oQ== X-Gm-Message-State: ALoCoQknlmE0+LvME7Oim3gI7pBjXj/Ws9EME76Fa3z9SoCzOr+j0tL2rmLlWSFuioZ/6jtla9Jb+XcmFK5nGGJrUmeGiN674QHcXeVyxmdLfIZDSS7YWdwk30mHg+q50eOSQTgHMKGTwA4zloE0rMxnm4OcjPlqvjJZXyTGiNwYXj8Bgh4dIR2LvoEiSbLVXbZOtbmvhgqC1t36bieh+7Jou2XANF/NUA== X-Received: by 10.67.3.170 with SMTP id bx10mr114356748pad.34.1452146747603; Wed, 06 Jan 2016 22:05:47 -0800 (PST) Received: from [172.24.35.244] ([59.162.78.200]) by smtp.gmail.com with ESMTPSA id fc6sm148343332pac.44.2016.01.06.22.05.45 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Jan 2016 22:05:46 -0800 (PST) Subject: Re: PATCH: Minor patch to fix issue in Integer Control [ pgAdmin4 ] To: pgadmin-hackers@postgresql.org References: <568DF2B7.3070105@enterprisedb.com> From: Murtuza Zabuawala Message-ID: <568DF866.2030701@enterprisedb.com> Date: Thu, 7 Jan 2016 11:02:22 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <568DF2B7.3070105@enterprisedb.com> Content-Type: multipart/mixed; boundary="------------020306060304070503000808" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------020306060304070503000808 Content-Type: multipart/alternative; boundary="------------090904050204030509080307" --------------090904050204030509080307 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit +++ 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 --------------090904050204030509080307 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit +++ 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

--------------090904050204030509080307-- --------------020306060304070503000808 Content-Type: text/x-patch; name="IntgerControl_Backform.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="IntgerControl_Backform.patch" 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); } } }); --------------020306060304070503000808 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers --------------020306060304070503000808--