Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aIc8J-0000LJ-5e for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jan 2016 13:03:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aIc8I-0002Th-Kf for pgadmin-hackers@arkaria.postgresql.org; Mon, 11 Jan 2016 13:03:38 +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 1aIc8I-0002TX-28 for pgadmin-hackers@postgresql.org; Mon, 11 Jan 2016 13:03:38 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aIc8E-00023T-UD for pgadmin-hackers@postgresql.org; Mon, 11 Jan 2016 13:03:36 +0000 Received: by mail-pa0-x230.google.com with SMTP id uo6so304273557pac.1 for ; Mon, 11 Jan 2016 05:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-type; bh=q6XJdES3eyjra7WzATEylV8I5AVMt7UV4Mq0aEzxHUo=; b=QRBUD6TRriYixq/d5XLc7+ZShNAVn6322gd4H49RBNInW0bTiDgKn/SDeJIjrvOI9D yxVPlmxllmuJvZba+rc4OGGZAJ0scSj6S32KoeqR6Ftl5qEeLDTMuL3Sc+X2KC+h6bZs N5j55ygpD7803AFXj0wUlygqmDY5OeFnioggZSyL8wECekSqSa2fzYavaO5vJqKiRiZO 41IrCVxSEbIv19r8K9wgia5r5PkXwLP+BwqxqNMj+Q8Eb5jGzwBrG9EyG1N8rjnjquJl 7OPEDKEQxqrcnhIP5bvhEbEX0qkLiz0974n92Xk9O59Q9G10qa8Sn6r+6bhlZcMhJ75H xFUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-type; bh=q6XJdES3eyjra7WzATEylV8I5AVMt7UV4Mq0aEzxHUo=; b=QEHCMSF0bg9JWIuB9NAOiTEpGZd+AivOgJmO9D7ue0iIl9NvByT/nQjOrxf8A066T4 wTt2TmpiVP04jmAMczFFtpJiHkR8Fm/EPWaR68H0SJzPAsTf8tk/Zwts4kESbtnkrbO8 OgSVjpoehfVIbwk8UOpJT38NtTrk0TiYtHcuoVNasxxOuhE5InQp3XOvD0PH7eflun6L FHeG4bjDwt+nZ9nzlstqhSQEadBZbNGI6A+3z0zd9DLgWvtDkmn/IuQTNNcrkcrc4xVw XgZmupzqFdEgOWBPfa3MZfDiWZDK1j5FWtP9nZ3aq14qCDsfjVY/+4sMz3GOL79L66TK CbMg== X-Gm-Message-State: ALoCoQkQK6lYh0AoTWXChbrjJECL+5t/xn6EXgWeVlH+x3oGsft+Fud62wOo6q8CWzC5w9mdIKvphIp9KBA+v8UvuzNNMVPaIV+zIuSINfwh6otP7PXUhM5bEdLkXvLw5CzCMPpqpT3NXkDU8g2UqqMWjE05u9zH+UKWeVGBkS9481gcVAbMLrqSEDJGAL1tJTp41zmPOsOZRFhCwNO+ZAW0J16Gjp4gRg== X-Received: by 10.66.236.129 with SMTP id uu1mr76069404pac.158.1452517413551; Mon, 11 Jan 2016 05:03:33 -0800 (PST) Received: from [172.24.35.244] ([59.162.78.200]) by smtp.gmail.com with ESMTPSA id o81sm7305146pfi.92.2016.01.11.05.03.31 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jan 2016 05:03:32 -0800 (PST) To: pgadmin-hackers@postgresql.org From: Murtuza Zabuawala Subject: PATCH: Select2 control fix [ pgAdmin4 ] Message-ID: <56939D79.60805@enterprisedb.com> Date: Mon, 11 Jan 2016 17:48:01 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090701060908050207020108" 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. --------------090701060908050207020108 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Please find minor patch to fix issue in select2 control. Issue: We were not able to apply 'disabled' property from schema model on select2 control. Regards, Murtuza --------------090701060908050207020108 Content-Type: text/x-patch; name="Fix_select2_disabled_property.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Fix_select2_disabled_property.patch" diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js index 76839c6..b5fa3e2 100644 --- a/web/pgadmin/browser/static/js/node.ui.js +++ b/web/pgadmin/browser/static/js/node.ui.js @@ -139,7 +139,21 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { Backform.SelectControl.prototype.render.apply(this, arguments); var d = this.field.toJSON(), - select2_opts = _.defaults({}, d.select2, this.defaults.select2); + select2_opts = _.defaults({}, d.select2, this.defaults.select2), + evalF = function(f, d, m) { + return (_.isFunction(f) ? !!f.apply(d, [m]) : !!f); + }; + + /* + * If select2 options do not have any disabled property on this field + * and schema has disabled property then we need to apply it + */ + + if(!_.has(select2_opts, 'disabled') && (d && d.disabled)) { + _.extend(select2_opts, { + disabled: evalF(d.disabled, d, this.model) + }); + } /* * Add empty option as Select2 requires any empty '