Subject: patch for issue RM1418 and RM1434 [pgadmin4]

From: Harshal Dhumal <[email-masked]>
Date: Tue, 5 Jul 2016 17:09:53 +0530

Hi,

PFA patch for Issue RM1418 and RM1434

Issues fixed: 1. Select2 control fixed for multi-select mode.
2. Index constrains (primary and unique key) fixed column listing issue.
3. Table node "inherited from" (Select2 control) was not showing table name
with public schema

-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js
index 1e45cad..73a563b 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js
@@ -227,6 +227,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
                 }
               }
             ),
+            keyPathAccessor: function(obj, path) {
+              var res = obj;
+              if(_.isArray(res)) {
+                return _.map(res, function(o) { return o['column']
+                });
+              }
+              path = path.split('.');
+              for (var i = 0; i < path.length; i++) {
+                if (_.isNull(res)) return null;
+                if (_.isEmpty(path[i])) continue;
+                if (!_.isUndefined(res[path[i]])) res = res[path[i]];
+              }
+              return _.isObject(res) && !_.isArray(res) ? null : res;
+            },
             initialize: function() {
             // Here we will decide if we need to call URL
             // Or fetch the data from parent columns collection
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
index 99727c9..2f53a2e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.1_plus/properties.sql
@@ -8,7 +8,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
 			JOIN pg_proc pc ON pc.pronamespace=pt.pronamespace AND pc.proname='slonyversion'
 			WHERE tgrelid=rel.oid) AS isrepl,
 	(SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE) AS triggercount,
-	(SELECT ARRAY(SELECT CASE WHEN (nspname NOT LIKE E'pg\_%' AND nspname <> 'public') THEN
+	(SELECT ARRAY(SELECT CASE WHEN (nspname NOT LIKE E'pg\_%') THEN
             quote_ident(nspname)||'.'||quote_ident(c.relname)
             ELSE quote_ident(c.relname) END AS inherited_tables
     FROM pg_inherits i
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
index 99727c9..2f53a2e 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/sql/9.5_plus/properties.sql
@@ -8,7 +8,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
 			JOIN pg_proc pc ON pc.pronamespace=pt.pronamespace AND pc.proname='slonyversion'
 			WHERE tgrelid=rel.oid) AS isrepl,
 	(SELECT count(*) FROM pg_trigger WHERE tgrelid=rel.oid AND tgisinternal = FALSE) AS triggercount,
-	(SELECT ARRAY(SELECT CASE WHEN (nspname NOT LIKE E'pg\_%' AND nspname <> 'public') THEN
+	(SELECT ARRAY(SELECT CASE WHEN (nspname NOT LIKE E'pg\_%') THEN
             quote_ident(nspname)||'.'||quote_ident(c.relname)
             ELSE quote_ident(c.relname) END AS inherited_tables
     FROM pg_inherits i
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 1370698..973b60b 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1790,7 +1790,11 @@
       return encodeURIComponent(rawData);
     },
     toRaw: function(formattedData, model) {
-      return decodeURIComponent(formattedData);
+      if (_.isArray(formattedData)) {
+        return _.map(formattedData, decodeURIComponent);
+      } else {
+        return decodeURIComponent(formattedData);
+      }
     }
   });

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

---

From: Dave Page <[email-masked]>
Date: Tue, 5 Jul 2016 12:59:05 +0100

Thanks, applied.

On Tue, Jul 5, 2016 at 12:39 PM, Harshal Dhumal
<[email-masked]> wrote:
> Harshal Dhumal
> Software Engineer

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company