[pgadmin-hackers] [PATCH] Fix of elapsed time string generation in query window

2016-02-11 Thread Иван Полещук
>From 5a5460dc2ec5491660dc8358e878eb9342fbc0f8 Mon Sep 17 00:00:00 2001
From: cyberj0g 
Date: Wed, 10 Feb 2016 00:24:52 +0500
Subject: [PATCH] Fix of elapsed time string generation in query window

For queries longer than 1 hour, time was displayed like that:
"01:25:3640 hours"
---
 pgadmin/utils/misc.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp
index b050dd7..f0047b3 100644
--- a/pgadmin/utils/misc.cpp
+++ b/pgadmin/utils/misc.cpp
@@ -226,7 +226,7 @@ wxString ElapsedTimeToStr(wxLongLong msec)
int days = tsMsec.GetDays();
int hours = (wxTimeSpan(tsMsec.GetHours(), 0, 0, 0) -
wxTimeSpan(days * 24)).GetHours();
int minutes = (wxTimeSpan(0, tsMsec.GetMinutes(), 0, 0) -
wxTimeSpan(hours)).GetMinutes();
-   long seconds = (wxTimeSpan(0, 0, tsMsec.GetSeconds(), 0) -
wxTimeSpan(0, minutes)).GetSeconds().ToLong();
+   long seconds = (wxTimeSpan(0, 0, tsMsec.GetSeconds(), 0) -
wxTimeSpan(hours, minutes)).GetSeconds().ToLong();
long milliseconds = (wxTimeSpan(0, 0, 0, tsMsec.GetMilliseconds()) -
wxTimeSpan(0, 0, seconds)).GetMilliseconds().ToLong();

if (days > 0)


Re: [pgadmin-hackers] [pgAdmin4] [Patch]: Language Module

2016-02-11 Thread Harshal Dhumal
Hi Akshay,

Please find the review comments below for Language node.

- On postgres9.1 language node failed with below error when clicked on
properties or sql tab.


*   function expression in FROM cannot refer to other relations of same
query level LINE 15: aclexplode(lanacl) d ^*
*- *Error when tried to update language name, owner, comment.

File "/home/edb/PRJ/pgadmin4/web/pgadmin/browser/utils.py", line 277, in
dispatch_request
return method(*args, **kwargs)
  File
"/home/edb/PRJ/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py",
line 139, in wrap
return f(*args, **kwargs)
  File
"/home/edb/PRJ/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py",
line 224, in update
sql = self.get_sql(gid, sid, data, did, lid)
TypeError: get_sql() takes from 2 to 3 positional arguments but 6 were given

*- *In pgadmin3 it shows drop down for language name while in pgadmin4 in
edit mode it shows input text
*.*
Need some clarification whether user is allowed to enter any language name
or can only select from predefined language names.

Regards,
~Harshal




-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB 

On Mon, Feb 8, 2016 at 6:17 PM, Akshay Joshi 
wrote:

> Hi All
>
> Attached is the patch for the Language Module. Please review it and if it
> looks good then please commit it.
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


[pgadmin-hackers] Event trigges node patch [pgadmin4]

2016-02-11 Thread Harshal Dhumal
Hi,

PFA patch event triggers node.


-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB 


event_triggers_12_Frb_1.parch
Description: Binary data

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


Re: [pgadmin-hackers] [pgAdmin4][Patch]: Foreign Data Wrapper

2016-02-11 Thread Akshay Joshi
Hi Neel

Below are my review comments

   - For the consistency order in the privileges control should be Grantee,
   Privileges and Granter.
   - Correct the SQL from "DROP Foreign Data Wrapper" to "DROP FOREIGN DATA
   WRAPPER" in sql pane.
   - For Owner control there should a validation like "Owner can't be
   empty" when user tries to modify owner for Foreign data wrapper, Foreign
   Servers.
   - Correct the SQL from "DROP Foreign Server" to "DROP SERVER" in sql
   pane when click on any Foreign Server node.
   - When click on database node it should show menu for "Create-> Foreign
   Data Wrapper", when click on any Foreign data wrapper node it should show
   menu for "Create-> Foreign Data Wrapper" and "Create-> Foreign Server",
   when click on any Foreign Server node it should show menu for
   "Create-> Foreign Server" and "Create-> User Mapping".
   - Correct the SQL from "DROP User Mapping enterprisedb" to "DROP USER
   MAPPING FOR enterprisedb SERVER fs1" in sql pane when click on any User
   Mapping node.
   - On postgresql 9.1 and 9.2 Foreign Data wrapper node failed with below
   error when clicked on properties or sql tab.
   *   function expression in FROM cannot refer to other relations of same
   query level LINE 15: aclexplode(fdwacl) d ^*

Apart from the above please fixed warning as much as possible using pep8
tool.

On Fri, Feb 5, 2016 at 5:29 PM, Neel Patel 
wrote:

> Hi All,
>
> Please find attached patch file that include the below three nodes under
> the database node.
>
> - Foreign Data Wrappers
> - Foreign Servers
> - User Mappings
>
> Do review it and let me know for any comments.
>
> Thanks,
> Neel Patel
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Re: [pgadmin-hackers] [pgAdmin4] [Patch]: Language Module

2016-02-11 Thread Akshay Joshi
Hi All

Attached is the modified patch, please review it.

On Thu, Feb 11, 2016 at 2:06 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi Akshay,
>
> Please find the review comments below for Language node.
>
> - On postgres9.1 language node failed with below error when clicked on
> properties or sql tab.
>
> *   function expression in FROM cannot refer to other relations of same
> query level LINE 15: aclexplode(lanacl) d ^*
>

   Fixed.

>
> *- *Error when tried to update language name, owner, comment.
>
> File "/home/edb/PRJ/pgadmin4/web/pgadmin/browser/utils.py", line 277, in
> dispatch_request
> return method(*args, **kwargs)
>   File
> "/home/edb/PRJ/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py",
> line 139, in wrap
> return f(*args, **kwargs)
>   File
> "/home/edb/PRJ/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/languages/__init__.py",
> line 224, in update
> sql = self.get_sql(gid, sid, data, did, lid)
> TypeError: get_sql() takes from 2 to 3 positional arguments but 6 were
> given
>

   Fixed.

>
>
> *- *In pgadmin3 it shows drop down for language name while in pgadmin4 in
> edit mode it shows input text
> *.*
> Need some clarification whether user is allowed to enter any language
> name or can only select from predefined language names.
>

   User can give any language name. In pgAdmin3 it shows drop down but in
disabled state user can't see any predefine value, so its better to have
input control instead of drop down.

>
> Regards,
> ~Harshal
>
>
>
>
> --
> *Harshal Dhumal*
> *Software Engineer *
>
>
>
> EenterpriseDB 
>
> On Mon, Feb 8, 2016 at 6:17 PM, Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi All
>>
>> Attached is the patch for the Language Module. Please review it and if it
>> looks good then please commit it.
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>>
>


-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Languages_v1.patch
Description: Binary data

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


[pgadmin-hackers] pgAdmin III commit: Fix the display of elapsed query time for queries o

2016-02-11 Thread Dave Page
Fix the display of elapsed query time for queries over 1 hour.
Change the encoding of the CHANGELOG so we can properly credit the author.

Branch
--
master

Details
---
http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=656855672c9cc1d75cb42786c4e847fdcb942125
Author: Иван Полещук 

Modified Files
--
CHANGELOG  | 14 --
pgadmin/utils/misc.cpp |  2 +-
2 files changed, 9 insertions(+), 7 deletions(-)


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


[pgadmin-hackers] pgAdmin III commit: Fix the display of elapsed query time for queries o

2016-02-11 Thread Dave Page
Fix the display of elapsed query time for queries over 1 hour.
Change the encoding of the CHANGELOG so we can properly credit the author.

Branch
--
REL-1_22_0_PATCHES

Details
---
http://git.postgresql.org/gitweb?p=pgadmin3.git;a=commitdiff;h=c1d1cde76bf8ae40bb05bb58e67221bac3ba35e6
Author: Иван Полещук 

Modified Files
--
CHANGELOG  | 14 --
pgadmin/utils/misc.cpp |  2 +-
2 files changed, 9 insertions(+), 7 deletions(-)


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


Re: [pgadmin-hackers] [PATCH] Fix of elapsed time string generation in query window

2016-02-11 Thread Dave Page
Thanks - patch applied.

On Thu, Feb 11, 2016 at 6:48 AM, Иван Полещук  wrote:

> From 5a5460dc2ec5491660dc8358e878eb9342fbc0f8 Mon Sep 17 00:00:00 2001
> From: cyberj0g 
> Date: Wed, 10 Feb 2016 00:24:52 +0500
> Subject: [PATCH] Fix of elapsed time string generation in query window
>
> For queries longer than 1 hour, time was displayed like that:
> "01:25:3640 hours"
> ---
>  pgadmin/utils/misc.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp
> index b050dd7..f0047b3 100644
> --- a/pgadmin/utils/misc.cpp
> +++ b/pgadmin/utils/misc.cpp
> @@ -226,7 +226,7 @@ wxString ElapsedTimeToStr(wxLongLong msec)
>   int days = tsMsec.GetDays();
>   int hours = (wxTimeSpan(tsMsec.GetHours(), 0, 0, 0) - wxTimeSpan(days * 
> 24)).GetHours();
>   int minutes = (wxTimeSpan(0, tsMsec.GetMinutes(), 0, 0) - 
> wxTimeSpan(hours)).GetMinutes();
> - long seconds = (wxTimeSpan(0, 0, tsMsec.GetSeconds(), 0) - 
> wxTimeSpan(0, minutes)).GetSeconds().ToLong();
> + long seconds = (wxTimeSpan(0, 0, tsMsec.GetSeconds(), 0) - 
> wxTimeSpan(hours, minutes)).GetSeconds().ToLong();
>   long milliseconds = (wxTimeSpan(0, 0, 0, tsMsec.GetMilliseconds()) - 
> wxTimeSpan(0, 0, seconds)).GetMilliseconds().ToLong();
>
>   if (days > 0)
>
>


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

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


Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-11 Thread Sergey Busel
Added the query name to history entries. Please note that history entries
are not modified if user saves [Query 1] to file [foo.sql]. I don't think
that would be practical.


On Wed, Feb 10, 2016 at 8:28 AM, Dave Page  wrote:

> Hi
>
> On Wed, Feb 10, 2016 at 12:14 AM, Sergey Busel  wrote:
>
>> Dave,
>>
>> Here is a patch that does display the query tab name in the title bar of
>> the output pane. It seems to work with loading and saving the perspective,
>> too. The trick is to restore the original text on the output pane before
>> loading and saving the perspective, and put the query name back in there
>> right after.
>>
>> Attached is the full patch, not the diff from the previous patch I sent.
>> Let me know if you have other suggestions.
>>
>
> That seems to solve the problem nicely :-) - Thanks!
>
> It does lead to one other issue that I can see - the History tab on the
> results pane now shows the history for all query tabs, which seems a little
> odd given that the other 3 tabs on the results panel are query tab
> specific. Unless there are better ideas, I think the best way to fix this
> is to include the current tab name in the history, e.g.
>
> -- Executing query [Query 1]:
> SELECT version();
> Total query runtime: 16 msec
> 1 row retrieved.
>
> -- Executing query [Query 2]:
> SELECT * FROM pg_class
> Total query runtime: 53 msec
> 311 rows retrieved.
>
> -- Executing query [foo.sql]:
> SELECT * from pg_attribute
> Total query runtime: 245 msec
> 2399 rows retrieved.
>
> What do you think?
>
>
>> Regards.
>>
>> On Fri, Feb 5, 2016 at 7:46 AM, Dave Page  wrote:
>>
>>> On Wed, Feb 3, 2016 at 3:07 AM, Sergey Busel  wrote:
>>> > - Removed unused/commented code.
>>> > - Tab names now reflect the file name, if such is associated with a
>>> tab.
>>> > - Removed the "Close Tab" menu item. Added X button to the active tab.
>>> > - To tell the user which tab results are related to and to avoid
>>> messing
>>> > with perspective, the name of the related tab is now displayed as "Data
>>> > Output [Query 1]" in the output pane. If the tab is named after a
>>> file, file
>>> > name will display in the square brackets. If the file name is longer
>>> then 15
>>> > chars, it will be truncated to 15 chars.
>>> >
>>> > Let me know any other suggestions you may have.
>>>
>>> Thanks - this seems to be working nicely for me. It would be good if
>>> the query name could be displayed in the title bar of the output pane
>>> rather than on the results tab (because it really does apply to all
>>> tabs), but I don't see any sensible way to do that given the weird way
>>> that wxAUI stores it's perspectives.
>>>
>>> Ashesh, any ideas?
>>>
>>> --
>>> 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
>
diff -aur --exclude-from expats /home/sergey/c/pgadmin3-1.22.0/pgadmin/ctl/ctlSQLBox.cpp /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/ctl/ctlSQLBox.cpp
--- /home/sergey/c/pgadmin3-1.22.0/pgadmin/ctl/ctlSQLBox.cpp	2016-01-04 07:03:33.0 -0600
+++ /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/ctl/ctlSQLBox.cpp	2016-02-09 17:27:05.177452723 -0600
@@ -184,6 +184,87 @@
 	m_database = db;
 }
 
+void ctlSQLBox::SetChanged(bool b)
+{
+	if (m_changed != b)
+	{
+		m_changed = b;
+		UpdateTitle();
+	}
+}
+
+bool ctlSQLBox::IsChanged()
+{
+	return m_changed;
+}
+
+void ctlSQLBox::SetOrigin(int origin)
+{
+	m_origin = origin;
+}
+
+int ctlSQLBox::GetOrigin()
+{
+	return m_origin;
+}
+
+void ctlSQLBox::SetFilename(wxString )
+{
+	m_filename = filename;
+	UpdateTitle();
+}
+
+wxString ctlSQLBox::GetFilename()
+{
+	return m_filename;
+}
+
+void ctlSQLBox::SetTitle(wxString )
+{
+	m_title = title;
+}
+
+wxString ctlSQLBox::GetTitle(bool withChangeInd)
+{
+	wxString title = m_title;
+	wxString chStr;
+	if (!withChangeInd)
+	{
+		chStr = GetChangeIndicator();
+		if (title.EndsWith(chStr))
+			title = title.Mid(0, title.Len() - chStr.Len());
+	}
+	return title;
+}
+
+wxString ctlSQLBox::GetChangeIndicator()
+{
+	if (m_changestr.IsEmpty())
+		m_changestr = _("*");
+	return m_changestr;
+}
+
+void ctlSQLBox::UpdateTitle()
+{
+	bool hasCh = false;
+	wxString chStr = GetChangeIndicator();
+	wxString title = GetFilename();
+
+	if (!title.IsEmpty())
+		title = wxFileName::FileName(title).GetFullName();
+	else
+		title = GetTitle();
+
+	hasCh = title.EndsWith(chStr);
+
+	if (IsChanged() && !hasCh)
+		title = title + chStr;
+	else if (!IsChanged() && hasCh)
+		title = title.Mid(0, title.Len() - chStr.Len());
+
+	SetTitle(title);
+}
+
 void ctlSQLBox::OnSearchReplace(wxCommandEvent )
 {
 	if (!m_dlgFindReplace)
diff -aur --exclude-from expats /home/sergey/c/pgadmin3-1.22.0/pgadmin/frm/frmQuery.cpp