Re: [pgAdmin][RM6385]: Backup on a shared server doesn't seem to work

2021-04-22 Thread Pradip Parkale
Hi Akshay,

Please find the updated patch. I did some modifications as some cases were
failing due to my initial changes.
Sorry for the inconvenience.

On Wed, Apr 14, 2021 at 12:13 PM Akshay Joshi 
wrote:

> Thanks, patch applied.
>
> On Tue, Apr 13, 2021 at 10:35 PM Pradip Parkale <
> pradip.park...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch for #6385 Backup on a shared server
>> doesn't seem to work.
>>
>>
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres *
>
> *Mobile: +91 976-788-8246*
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
diff --git a/web/migrations/versions/c6974f64df08_.py b/web/migrations/versions/c6974f64df08_.py
new file mode 100644
index 0..277853631
--- /dev/null
+++ b/web/migrations/versions/c6974f64df08_.py
@@ -0,0 +1,28 @@
+
+"""empty message
+
+Revision ID: c6974f64df08
+Revises: a39bd015b644
+Create Date: 2021-04-22 10:06:21.282770
+
+"""
+from pgadmin.model import db
+
+
+
+# revision identifiers, used by Alembic.
+revision = 'c6974f64df08'
+down_revision = 'a39bd015b644'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+db.engine.execute(
+'ALTER TABLE sharedserver ADD COLUMN osid INTEGER'
+)
+
+
+def downgrade():
+# pgAdmin only upgrades, downgrade not implemented.
+pass
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 00025196b..233ea07f8 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -339,6 +339,7 @@ class ServerModule(sg.ServerGroupPluginModule):
 db.session.rollback()
 user = User.query.filter_by(id=data.user_id).first()
 shared_server = SharedServer(
+osid=data.id,
 user_id=current_user.id,
 server_owner=user.username,
 servergroup_id=gid,
@@ -388,14 +389,14 @@ class ServerModule(sg.ServerGroupPluginModule):
 """
 shared_server = SharedServer.query.filter_by(
 name=server.name, user_id=current_user.id,
-servergroup_id=gid).first()
+servergroup_id=gid, osid=server.id).first()
 
 if shared_server is None:
 ServerModule.create_shared_server(server, gid)
 
 shared_server = SharedServer.query.filter_by(
 name=server.name, user_id=current_user.id,
-servergroup_id=gid).first()
+servergroup_id=gid, osid=server.id).first()
 
 return shared_server
 
diff --git a/web/pgadmin/model/__init__.py b/web/pgadmin/model/__init__.py
index d1f498181..d849b8c26 100644
--- a/web/pgadmin/model/__init__.py
+++ b/web/pgadmin/model/__init__.py
@@ -29,7 +29,7 @@ from flask_sqlalchemy import SQLAlchemy
 #
 ##
 
-SCHEMA_VERSION = 27
+SCHEMA_VERSION = 28
 
 ##
 #
@@ -361,6 +361,11 @@ class SharedServer(db.Model):
 
 __tablename__ = 'sharedserver'
 id = db.Column(db.Integer, primary_key=True)
+osid = db.Column(
+db.Integer,
+db.ForeignKey('server.id'),
+nullable=False
+)
 user_id = db.Column(
 db.Integer,
 db.ForeignKey(USER_ID)
diff --git a/web/pgadmin/tools/backup/__init__.py b/web/pgadmin/tools/backup/__init__.py
index aacb2e5d4..2e166b5b4 100644
--- a/web/pgadmin/tools/backup/__init__.py
+++ b/web/pgadmin/tools/backup/__init__.py
@@ -20,7 +20,7 @@ from flask_babelex import gettext as _
 from flask_security import login_required, current_user
 from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
 from pgadmin.utils import PgAdminModule, get_storage_directory, html, \
-fs_short_path, document_dir, does_utility_exist
+fs_short_path, document_dir, does_utility_exist, get_server
 from pgadmin.utils.ajax import make_json_response, bad_request
 
 from config import PG_DEFAULT_DRIVER
@@ -115,15 +115,7 @@ class BackupMessage(IProcessDesc):
 self.cmd += cmd_arg(arg)
 
 def get_server_details(self):
-if Server.query.filter_by(id=self.sid,
-  user_id=current_user.id).first():
-s = Server.query.filter_by(
-id=self.sid, user_id=current_user.id
-).first()
-else:
-s = SharedServer.query.filter_by(
-id=self.sid, user_id=current_user.id
-).first()
+s = get_server(self.sid)
 
 from pgadmin.utils.driver import get_driver
 driver = get_driver(PG_DEFAULT_DRIVER)
@@ -422,14 +414,7 @@ def create_backup_objects_job(sid):
 retu

Re: pgAdmin4 v5.2 candidate builds

2021-04-22 Thread Fahar Abbas
@Akshay Joshi 

One round of sanity testing has been done. Can you please publish pgadmin4
5.2?

On Mon, Apr 19, 2021 at 5:06 PM Akshay Joshi 
wrote:

> Hi All,
>
> pgAdmin4 v5.2 candidate builds and source can be found at
> https://developer.pgadmin.org/builds/2021-04-19-1/
>
> Fahar, can you please verify it for release on Thursday.
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres *
>
> *Mobile: +91 976-788-8246*
>


-- 
Fahar Abbas
EnterpriseDB Corporation
Phone Office: +92-51-835-8874
Phone Direct: +92-51-8466803
Mobile: +92-333-5409707
Skype ID: *live:fahar.abbas*
Website: www.enterprisedb.com


Re: [pgAdmin]:SonarQube Fixes

2021-04-22 Thread Pradip Parkale
Hi,

Please ignore my previous patch. PFA attachment of my updated patch.

On Tue, Apr 20, 2021 at 1:49 PM Pradip Parkale <
pradip.park...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Please find attached the patch for some SonarQube fixes.
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js
index b35422c8d..fcd514f19 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/languages/static/js/language.js
@@ -189,12 +189,7 @@ define('pgadmin.node.language', [
   });
 }
 return res;
-  }, disabled: function(m) {
-if (m.isNew()) {
-  return m.get('template_list').indexOf(m.get('name')) != -1;
-}
-return false;
-  },
+  }, disabled: 'isDisabled',
   readonly: function(m) {return !m.isNew();},
 },{
   id: 'laninl', label: gettext('Inline function'), type: 'text', control: 'node-ajax-options',
@@ -214,12 +209,7 @@ define('pgadmin.node.language', [
   });
 }
 return res;
-  }, disabled: function(m) {
-if (m.isNew()) {
-  return m.get('template_list').indexOf(m.get('name')) != -1;
-}
-return false;
-  },
+  }, disabled: 'isDisabled',
   readonly: function(m) {return !m.isNew();},
 },{
   id: 'lanval', label: gettext('Validator function'), type: 'text', control: 'node-ajax-options',
@@ -239,12 +229,7 @@ define('pgadmin.node.language', [
   });
 }
 return res;
-  }, disabled: function(m) {
-if (m.isNew()) {
-  return m.get('template_list').indexOf(m.get('name')) != -1;
-}
-return false;
-  },
+  }, disabled: 'isDisabled',
   readonly: function(m) {return !m.isNew();},
 }, {
   id: 'lanacl', label: gettext('Privileges'), type: 'collection',
@@ -292,6 +277,12 @@ define('pgadmin.node.language', [
 
   return null;
 },
+isDisabled: function(m){
+  if (m.isNew()) {
+return m.get('template_list').indexOf(m.get('name')) != -1;
+  }
+  return false;
+},
   }),
 });
   }
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js
index 97005db23..09ef94a75 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/static/js/column.js
@@ -600,12 +600,7 @@ define('pgadmin.node.column', [
 },{
   id: 'seqstart', label: gettext('Start'), type: 'int',
   mode: ['properties', 'create', 'edit'], group: gettext('Constraints'),
-  disabled: function(m) {
-let isIdentity = m.get('attidentity');
-if(!_.isUndefined(isIdentity) && !_.isNull(isIdentity) && !_.isEmpty(isIdentity))
-  return false;
-return true;
-  }, deps: ['attidentity', 'colconstype'],
+  disabled: 'isIdentityColumn', deps: ['attidentity', 'colconstype'],
   visible: 'isTypeIdentity',
 },{
   id: 'seqmin', label: gettext('Minimum'), type: 'int',
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
index e8d04e336..71b5270f6 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/static/js/foreign_key.js
@@ -737,15 +737,7 @@ define('pgadmin.node.foreign_key', [
 },{
   id: 'condeferrable', label: gettext('Deferrable?'),
   type: 'switch', group: gettext('Definition'),
-  readonly: function(m) {
-// If we are in table edit mode then
-if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
-  // If OID is undefined then user is trying to add
-  // new constraint which should allowed for Unique
-  return !_.isUndefined(m.get('oid'));
-}
-return !m.isNew();
-  },
+  readonly: 'isReadonly',
 },{
   id: 'condeferred', label: ge

pgAdmin 4 v5.2 Released

2021-04-22 Thread Akshay Joshi
The pgAdmin Development Team is pleased to announce pgAdmin 4 version 5.2.

This release of pgAdmin 4 includes 24 bug fixes. For more details please
see the release notes at:

https://www.pgadmin.org/docs/pgadmin4/5.2/release_notes_5_2.html.

pgAdmin is the leading Open Source graphical management tool for
PostgreSQL. For more information, please see:

https://www.pgadmin.org/

Notable changes in this release include:

 Bugs/Housekeeping:

   -

   Ensure that the query tool tab should be closed after server
   disconnection when auto-commit/auto-rollback is set to false.
   -

   Fixed flickering issue of the input box on check constraints.
   -

   Corrected the syntax for 'CREATE TRIGGER', use 'EXECUTE FUNCTION'
   instead of 'EXECUTE PROCEDURE' from v11 onwards.
   -

   Ensure that the strings in the LDAP auth module are translatable.
   -

   Ensure that while comparing domains check function dependencies should
   be considered in schema diff.
   -

   Added missing dependency 'xdg-utils' for the desktop packages in RPM and
   Debian.
   -

   Fixed cannot unpack non-iterable response object error when selecting
   any partition.
   -

   Mark the Apache HTTPD config file as such in the web DEB and RPM
   packages.
   -

   Fixed an issue where users are unable to see data of the partitions
   using the View/Edit data option.
   -

   Fixed an issue where foreign data wrapper properties are not visible if
   the host option contains two host addresses.
   -

   Fixed an issue where a connection warning should be displayed on the
   user clicks on to explain or explain analyze and the database server is
   disconnected from the browser tree.

Builds for Windows and macOS are available now, along with a Python Wheel,
Docker Container, RPM, DEB Package, and source code tarball from:

https://www.pgadmin.org/download/

--
Akshay Joshi
pgAdmin Project


pgAdmin 4 commit: Tag REL-5_2 has been created.

2021-04-22 Thread Akshay Joshi
Tag REL-5_2 has been created.
View: https://git.postgresql.org/gitweb?p=pgadmin4.git;a=tag;h=refs/tags/REL-5_2

Log Message
---
Tag v5.2

pgAdmin 4 commit: Fixed an issue where CSV download quotes the numeric

2021-04-22 Thread Akshay Joshi
Fixed an issue where CSV download quotes the numeric columns. Fixes #6341

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=5894001eb24218ef7265a5ed4b04908a5b9db17e
Author: Pradip Parkale 

Modified Files
--
docs/en_US/release_notes_5_3.rst| 1 +
web/pgadmin/utils/driver/psycopg2/connection.py | 5 -
web/pgadmin/utils/driver/psycopg2/typecast.py   | 9 +
3 files changed, 14 insertions(+), 1 deletion(-)



pgAdmin 4 commit: Fixed some SonarQube issues.

2021-04-22 Thread Akshay Joshi
Fixed some SonarQube issues.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=abdd3190fe53bef115343f2c5e7d30dd9e8079f8
Author: Pradip Parkale 

Modified Files
--
.../databases/languages/static/js/language.js  |  27 ++---
.../schemas/tables/columns/static/js/column.js |   7 +-
.../foreign_key/static/js/foreign_key.js   |  20 +---
.../tables/partitions/static/js/partition.js   |   1 -
.../databases/schemas/tables/static/js/table.js| 125 ++---
.../server_groups/servers/roles/static/js/role.js  |  23 ++--
web/pgadmin/browser/static/js/node.js  |   1 -
7 files changed, 56 insertions(+), 148 deletions(-)



pgAdmin 4 commit: Ensure that Backup and Restore should work on shared

2021-04-22 Thread Akshay Joshi
Ensure that Backup and Restore should work on shared servers as some cases were 
failing due to initial changes.

Fixes #6385

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=8ae8fea6d2c4198af96e7bf380c2f5c108a32ed9
Author: Pradip Parkale 

Modified Files
--
docs/en_US/release_notes.rst   |  1 +
docs/en_US/release_notes_5_2.rst   |  3 +-
docs/en_US/release_notes_5_3.rst   | 20 +
web/migrations/versions/c6974f64df08_.py   | 28 ++
.../browser/server_groups/servers/__init__.py  |  5 ++--
web/pgadmin/model/__init__.py  |  7 -
web/pgadmin/tools/backup/__init__.py   | 34 --
web/pgadmin/tools/maintenance/__init__.py  | 28 --
web/pgadmin/tools/restore/__init__.py  | 33 -
web/pgadmin/utils/__init__.py  | 11 +++
10 files changed, 88 insertions(+), 82 deletions(-)



Re: [pgAdmin][RM6341] CSV download quotes numeric columns

2021-04-22 Thread Akshay Joshi
Thanks, patch applied.

On Tue, Apr 20, 2021 at 10:54 AM Pradip Parkale <
pradip.park...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Please find the attached patch for #6341 CSV download quotes numeric
> columns.
> Initially, the double-precision value was getting typecast to a string.
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres *

*Mobile: +91 976-788-8246*


Re: [pgAdmin]:SonarQube Fixes

2021-04-22 Thread Akshay Joshi
Thanks, patch applied.

On Thu, Apr 22, 2021 at 4:21 PM Pradip Parkale <
pradip.park...@enterprisedb.com> wrote:

> Hi,
>
> Please ignore my previous patch. PFA attachment of my updated patch.
>
> On Tue, Apr 20, 2021 at 1:49 PM Pradip Parkale <
> pradip.park...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Please find attached the patch for some SonarQube fixes.
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres *

*Mobile: +91 976-788-8246*


Re: [pgAdmin][RM6385]: Backup on a shared server doesn't seem to work

2021-04-22 Thread Akshay Joshi
Thanks, patch applied.

On Thu, Apr 22, 2021 at 2:37 PM Pradip Parkale <
pradip.park...@enterprisedb.com> wrote:

> Hi Akshay,
>
> Please find the updated patch. I did some modifications as some cases were
> failing due to my initial changes.
> Sorry for the inconvenience.
>
> On Wed, Apr 14, 2021 at 12:13 PM Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Thanks, patch applied.
>>
>> On Tue, Apr 13, 2021 at 10:35 PM Pradip Parkale <
>> pradip.park...@enterprisedb.com> wrote:
>>
>>> Hi Hackers,
>>>
>>> Please find the attached patch for #6385 Backup on a shared server
>>> doesn't seem to work.
>>>
>>>
>>>
>>> --
>>> Thanks & Regards,
>>> Pradip Parkale
>>> Software Engineer | EnterpriseDB Corporation
>>>
>>
>>
>> --
>> *Thanks & Regards*
>> *Akshay Joshi*
>> *pgAdmin Hacker | Principal Software Architect*
>> *EDB Postgres *
>>
>> *Mobile: +91 976-788-8246*
>>
>
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres *

*Mobile: +91 976-788-8246*