Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIb1e-0003dS-LQ for pgadmin-hackers@arkaria.postgresql.org; Wed, 07 Jun 2017 13:29:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dIb1e-0006mo-88 for pgadmin-hackers@arkaria.postgresql.org; Wed, 07 Jun 2017 13:29:30 +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_2) (envelope-from ) id 1dIb1O-0005cp-Ip for pgadmin-hackers@postgresql.org; Wed, 07 Jun 2017 13:29:14 +0000 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dIb1L-0000F0-Hm for pgadmin-hackers@postgresql.org; Wed, 07 Jun 2017 13:29:13 +0000 Received: by mail-it0-x235.google.com with SMTP id m47so6623960iti.0 for ; Wed, 07 Jun 2017 06:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Te9J/KKU+zXlgjPPnPreViG8k23Re3v9L5t8HrTxhrE=; b=gxxhJm3PxFykQcK98DB9Op3XQZpHt4KGv/IInaQs9RUCuNQ3nNi14UUnyFELrgsh8T cI85Q/S0tJWdAwqXDlX840Q2CVXz2Yi7lE95zO//dqWl6jk3DhiWUIcilfqy+CYegz7V Fu27qS7L2PwXsdVmj77ijtukJosOLvnEZiIlQPw44ODqNjRRTBlDDrknFV9I3oLhv8RZ 08dbP8FYT178DTQi/1HcgWhxQ2h8Bzwr7UN96OVqdWkef9yRVGIFL5tuEyQEN8IeTGhf EXb4ObsCBu7IXl5ExquRSELZlaYZvpNIZpzi4iXXfKDcK976TeWST9VwYfKNzg01Oysi GZjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Te9J/KKU+zXlgjPPnPreViG8k23Re3v9L5t8HrTxhrE=; b=IBH/c4MwTAEIokq/P0kvPEF8ed5VOxnEpsKHnUGM2n+X+2r55tUX2auOybiEKFyrF9 p1dGjRmOYoYL7xOvVM0Pi4rpbhEAtoWOc0KLHN12aowaxNK3moU5uBw0MHXBMW3zbTue Ajci+St57+irTV1Jf8xlmvQ9fPBNf8G/6Fksc9TjqvGsZ4IsWCyf+gWeBPrxWFQ8jfgn A2cbw/ORaDWW6s6RzPfMJASNC3AdLE+C6+LvmPvAKg6eEGujfUaeZjpYstKtT+A5K9uz QFa6XQ+BLJWjRE6LOOtwtuih+MdJx2a30FqAO1czyTY9QVMDApy2WtudPEAV6sqVaVUD wf1A== X-Gm-Message-State: AODbwcBi13ESbaYIc5/owSG7aavzqWf5WAYWhgwsD9exCEfrb14EDDD2 4mv3eqq+MsfUE+AMIDAPLCpzEundZe6i X-Received: by 10.36.74.3 with SMTP id k3mr1861116itb.28.1496842150489; Wed, 07 Jun 2017 06:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.174.147 with HTTP; Wed, 7 Jun 2017 06:29:09 -0700 (PDT) In-Reply-To: References: From: Dave Page Date: Wed, 7 Jun 2017 14:29:09 +0100 Message-ID: Subject: Re: Fix for RM2421 [pgAdmin4][patch] To: Harshal Dhumal Cc: pgadmin-hackers Content-Type: text/plain; charset="UTF-8" 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 Can you rebase this please? I think Ashesh broke it :-p On Tue, Jun 6, 2017 at 7:42 AM, Harshal Dhumal wrote: > Hi, > > On Mon, Jun 5, 2017 at 9:25 PM, Dave Page wrote: >> >> Hi >> >> With this patch applied, it uses the field names instead of the labels >> in error messages - e.g. >> >> 'dirty_rate_limit' must be numeric >> >> instead of: >> >> 'Dirty Rate Limit (KB)' must be numeric. > > Fixed. Please find attached updated patch. > >> >> >> Thanks. >> >> On Tue, May 30, 2017 at 8:28 AM, Harshal Dhumal >> wrote: >> > Hi, >> > >> > Please find updated patch. >> > >> > -- >> > Harshal Dhumal >> > Sr. Software Engineer >> > >> > EnterpriseDB India: http://www.enterprisedb.com >> > The Enterprise PostgreSQL Company >> > >> > On Tue, May 30, 2017 at 12:30 PM, Harshal Dhumal >> > wrote: >> >> >> >> Hi, >> >> >> >> Please ignore this patch as I forgot to include few changes. I'll send >> >> updated one. >> >> >> >> -- >> >> Harshal Dhumal >> >> Sr. Software Engineer >> >> >> >> EnterpriseDB India: http://www.enterprisedb.com >> >> The Enterprise PostgreSQL Company >> >> >> >> On Mon, May 29, 2017 at 3:18 PM, Harshal Dhumal >> >> wrote: >> >>> >> >>> Hi, >> >>> >> >>> Here is updated patch for RM2421. >> >>> >> >>> Now I have moved all Numeric control level validations to datamodel. >> >>> As >> >>> existing implementation was causing >> >>> issues with error messages in create/edit dialog when schema contains >> >>> two >> >>> or more Numeric controls. >> >>> >> >>> This is generic issue and not related to resource group. Also I have >> >>> updated all other nodes which uses Numeric controls >> >>> >> >>> >> >>> >> >>> -- >> >>> Harshal Dhumal >> >>> Sr. Software Engineer >> >>> >> >>> EnterpriseDB India: http://www.enterprisedb.com >> >>> The Enterprise PostgreSQL Company >> >>> >> >>> On Fri, May 19, 2017 at 12:22 PM, Harshal Dhumal >> >>> wrote: >> >>>> >> >>>> Hi, >> >>>> >> >>>> On Thu, May 18, 2017 at 7:57 PM, Joao Pedro De Almeida Pereira >> >>>> wrote: >> >>>>> >> >>>>> Hello Harshal, >> >>>>> >> >>>>> We review the patch and have some questions: >> >>>>> 1) Is there any particular reason to initialize variables and >> >>>>> functions >> >>>>> in the same place? We believe that it would be more readable there >> >>>>> were no >> >>>>> chaining of variable creation, specially if those variables are >> >>>>> functions. >> >>>>> Check line: >> >>>> >> >>>> That function is only going to be used in checkNumeric function (in >> >>>> case >> >>>> of Number control) and checkInt function (in case of Integer control) >> >>>> so >> >>>> declared them locally. >> >>>> Anyway I'm going to refactor both the controls as Number and Integer >> >>>> shares some common properties. >> >>>> >> >>>>> +++ b/web/pgadmin/static/js/backform.pgadmin.js >> >>>>> @@ -1528,7 +1528,18 @@ >> >>>>> max_value = field.max, >> >>>>> isValid = true, >> >>>>> intPattern = new RegExp("^-?[0-9]*$"), >> >>>>> - isMatched = intPattern.test(value); >> >>>>> + isMatched = intPattern.test(value), >> >>>>> + trigger_invalid_event = function(msg) { >> >>>>> >> >>>>> 2) The functions added in both places look very similar, can they be >> >>>>> merged and extracted? We are talking about the trigger_invalid_event >> >>>>> function. >> >>>> >> >>>> Yes they can be merged. As of now both NumericControl and >> >>>> IntegerControl >> >>>> are derived from InputControl. Ideally >> >>>> only NumericControl should be derived from InputControl and >> >>>> IntegerControl should be derive from NumericControl. >> >>>> >> >>>> >> >>>>> >> >>>>> 3) The following change is very similar to the >> >>>>> trigger_invalid_event, >> >>>>> was there a reason not to use it? >> >>>> >> >>>> Below code triggers "model valid" event; opposite to "model invalid" >> >>>> event (trigger_invalid_event) >> >>>>> >> >>>>> +++ b/web/pgadmin/static/js/backform.pgadmin.js >> >>>>> @@ -1573,25 +1584,23 @@ >> >>>>> this.model.errorModel.unset(name); >> >>>>> this.model.set(name, value); >> >>>>> this.listenTo(this.model, "change:" + name, this.render); >> >>>>> - if (this.model.collection || this.model.handler) { >> >>>>> - (this.model.collection || this.model.handler).trigger( >> >>>>> - 'pgadmin-session:model:valid', this.model, >> >>>>> (this.model.collection || this.model.handler) >> >>>>> - ); >> >>>>> + // Check if other fields of same model are valid before >> >>>>> + // triggering 'session:valid' event >> >>>>> + if(_.size(this.model.errorModel.attributes) == 0) { >> >>>>> + if (this.model.collection || this.model.handler) { >> >>>>> + (this.model.collection || this.model.handler).trigger( >> >>>>> + 'pgadmin-session:model:valid', this.model, >> >>>>> (this.model.collection || this.model.handler) >> >>>>> + ); >> >>>>> + } else { >> >>>>> + (this.model).trigger( >> >>>>> + 'pgadmin-session:valid', this.model.sessChanged(), >> >>>>> this.model >> >>>>> + ); >> >>>>> + } >> >>>>> >> >>>>> 4) We also noticed that the following change sets look very >> >>>>> similiar. >> >>>>> Is there any reason to have this code duplicated? If not this could >> >>>>> be a >> >>>>> good time to refactor it. >> >>>> >> >>>> As said earlier in response of point 2 code duplication is because >> >>>> the >> >>>> way controls are derived. >> >>>> >> >>>>> >> >>>>> +++ b/web/pgadmin/static/js/backform.pgadmin.js >> >>>>> @@ -1528,7 +1528,18 @@ >> >>>>> >> >>>>> @@ -1573,25 +1584,23 @@ >> >>>>> >> >>>>> @@ -1631,7 +1640,18 @@ >> >>>>> >> >>>>> @@ -1676,25 +1696,23 @@ >> >>>>> >> >>>>> >> >>>>> Thanks >> >>>>> Joao & Shruti >> >>>>> >> >>>>> On Thu, May 18, 2017 at 6:01 AM, Harshal Dhumal >> >>>>> wrote: >> >>>>>> >> >>>>>> Hi, >> >>>>>> >> >>>>>> Please find attached patch for RM2421 >> >>>>>> >> >>>>>> Issue fixed: 1. Integer/numeric Validation is not working properly. >> >>>>>> 2. Wrong CPU rate unit >> >>>>>> -- >> >>>>>> Harshal Dhumal >> >>>>>> Sr. Software Engineer >> >>>>>> >> >>>>>> EnterpriseDB India: http://www.enterprisedb.com >> >>>>>> The Enterprise PostgreSQL Company >> >>>>>> >> >>>>>> >> >>>>>> -- >> >>>>>> Sent via pgadmin-hackers mailing list >> >>>>>> (pgadmin-hackers@postgresql.org) >> >>>>>> To make changes to your subscription: >> >>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers >> >>>>>> >> >>>>> >> >>>> >> >>> >> >> >> > >> > >> > >> > -- >> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) >> > To make changes to your subscription: >> > http://www.postgresql.org/mailpref/pgadmin-hackers >> > >> >> >> >> -- >> Dave Page >> Blog: http://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EnterpriseDB UK: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company > > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers