public inbox for [email protected]
help / color / mirror / Atom feedRe: Re : [BUG #4943]
8+ messages / 3 participants
[nested] [flat]
* Re: Re : [BUG #4943]
@ 2019-12-09 09:54 Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Toshniwal @ 2019-12-09 09:54 UTC (permalink / raw)
To: Karan Takalkar <[email protected]>; +Cc: pgadmin-hackers
++pgadmin-hackers
Hi Karan,
It is good to know that you're contributing.
I would suggest {server name}/{db name} as name instead of did is better
for UX. You can get the db name from conn object and server name using the
sid (refer - web/pgadmin/browser/server_groups/servers/__init__.py)
On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]> wrote:
> Hi,
>
> I have been working on #4943 ("Database connected" success message itself
> is not enough) added by you on pgAdmin4 issues.
> I want to know what details of database should be included in success
> message.(i have added 'did')
>
> The success message can be modified by altering json response in the
> connect method in file
> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
> please have a look at the screenshots attached.
>
> original:
> info=_( "Database connected.")
> new:
> info=_("Postgres version/{0} Database connected.".format(did))
>
> Regards,
> Karan
>
--
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-09 15:05 Aditya Toshniwal <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Toshniwal @ 2019-12-09 15:05 UTC (permalink / raw)
To: Karan Takalkar <[email protected]>; +Cc: pgadmin-hackers
Hi Karan,
Kindly add a hyphen between the message and names, create a patch to
pgAdmin hackers(check cc).
Kindly also run the test cases and pep8 before sending.
On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]> wrote:
> I have updated the success message.
> Please check the screenshots attached.
> Should i make a patch?
>
> Regards,
> Karan
>
> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
> [email protected]> wrote:
>
>> ++pgadmin-hackers
>>
>> Hi Karan,
>>
>> It is good to know that you're contributing.
>> I would suggest {server name}/{db name} as name instead of did is better
>> for UX. You can get the db name from conn object and server name using the
>> sid (refer - web/pgadmin/browser/server_groups/servers/__init__.py)
>>
>>
>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> I have been working on #4943 ("Database connected" success message
>>> itself is not enough) added by you on pgAdmin4 issues.
>>> I want to know what details of database should be included in success
>>> message.(i have added 'did')
>>>
>>> The success message can be modified by altering json response in the
>>> connect method in file
>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>> please have a look at the screenshots attached.
>>>
>>> original:
>>> info=_( "Database connected.")
>>> new:
>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>
>>> Regards,
>>> Karan
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Sr. Software Engineer | EnterpriseDB India | Pune
>> "Don't Complain about Heat, Plant a TREE"
>>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-10 13:04 Aditya Toshniwal <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Toshniwal @ 2019-12-10 13:04 UTC (permalink / raw)
To: Karan Takalkar <[email protected]>; +Cc: pgadmin-hackers
[please use reply all to reply]
You can add more variables to the response along with info and use those in
the front end.
On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]> wrote:
> Hi
>
> I had been naively modifying jason response of connect function in
> databases __init__.py, later realized there are a lot of dependencies on it
> and most of regression tests use:
> if db_con["info"] == "Database connected.": .
>
> I am now modifying the Alertify.success script* directly responsible for
> the popup, i could append the database name in the message but am having
> trouble finding the *variable to supply server name.*
> The file and location of function is :
> *
> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
> line 523)
>
> the message should be:
> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+res.info")
>
> data.label contains database name
> res.info is the jason response coming from databases __init__.py connect
> function ; which is "Database connected."
>
> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Karan,
>>
>> Kindly add a hyphen between the message and names, create a patch to
>> pgAdmin hackers(check cc).
>> Kindly also run the test cases and pep8 before sending.
>>
>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]> wrote:
>>
>>> I have updated the success message.
>>> Please check the screenshots attached.
>>> Should i make a patch?
>>>
>>> Regards,
>>> Karan
>>>
>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>> [email protected]> wrote:
>>>
>>>> ++pgadmin-hackers
>>>>
>>>> Hi Karan,
>>>>
>>>> It is good to know that you're contributing.
>>>> I would suggest {server name}/{db name} as name instead of did is
>>>> better for UX. You can get the db name from conn object and server name
>>>> using the sid (refer
>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>
>>>>
>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I have been working on #4943 ("Database connected" success message
>>>>> itself is not enough) added by you on pgAdmin4 issues.
>>>>> I want to know what details of database should be included in success
>>>>> message.(i have added 'did')
>>>>>
>>>>> The success message can be modified by altering json response in the
>>>>> connect method in file
>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>> please have a look at the screenshots attached.
>>>>>
>>>>> original:
>>>>> info=_( "Database connected.")
>>>>> new:
>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>
>>>>> Regards,
>>>>> Karan
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks and Regards,
>>>> Aditya Toshniwal
>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>> "Don't Complain about Heat, Plant a TREE"
>>>>
>>>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-10 13:20 Karan Takalkar <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Karan Takalkar @ 2019-12-10 13:20 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Hi,
"add more variables to the response along with info and use those in the
front end"
i have already implemented that , but am still failing (7) test cases
particularly in the databases/extensions tests(5).
i had run regression tests for browser node.(and all it's sub directories).
Please check the patch attached.
On Tue, Dec 10, 2019 at 6:34 PM Aditya Toshniwal <
[email protected]> wrote:
> [please use reply all to reply]
>
> You can add more variables to the response along with info and use those
> in the front end.
>
> On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]> wrote:
>
>> Hi
>>
>> I had been naively modifying jason response of connect function in
>> databases __init__.py, later realized there are a lot of dependencies on it
>> and most of regression tests use:
>> if db_con["info"] == "Database connected.": .
>>
>> I am now modifying the Alertify.success script* directly responsible for
>> the popup, i could append the database name in the message but am having
>> trouble finding the *variable to supply server name.*
>> The file and location of function is :
>> *
>> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
>> line 523)
>>
>> the message should be:
>> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+res.info
>> ")
>>
>> data.label contains database name
>> res.info is the jason response coming from databases __init__.py connect
>> function ; which is "Database connected."
>>
>> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> Hi Karan,
>>>
>>> Kindly add a hyphen between the message and names, create a patch to
>>> pgAdmin hackers(check cc).
>>> Kindly also run the test cases and pep8 before sending.
>>>
>>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]> wrote:
>>>
>>>> I have updated the success message.
>>>> Please check the screenshots attached.
>>>> Should i make a patch?
>>>>
>>>> Regards,
>>>> Karan
>>>>
>>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>>> [email protected]> wrote:
>>>>
>>>>> ++pgadmin-hackers
>>>>>
>>>>> Hi Karan,
>>>>>
>>>>> It is good to know that you're contributing.
>>>>> I would suggest {server name}/{db name} as name instead of did is
>>>>> better for UX. You can get the db name from conn object and server name
>>>>> using the sid (refer
>>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>>
>>>>>
>>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have been working on #4943 ("Database connected" success message
>>>>>> itself is not enough) added by you on pgAdmin4 issues.
>>>>>> I want to know what details of database should be included in success
>>>>>> message.(i have added 'did')
>>>>>>
>>>>>> The success message can be modified by altering json response in the
>>>>>> connect method in file
>>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>>> please have a look at the screenshots attached.
>>>>>>
>>>>>> original:
>>>>>> info=_( "Database connected.")
>>>>>> new:
>>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>>
>>>>>> Regards,
>>>>>> Karan
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Thanks and Regards,
>>>>> Aditya Toshniwal
>>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>
>>>>
Attachments:
[text/x-patch] BUG_4943.diff (1.8K, 3-BUG_4943.diff)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 26fd5ccac..a07dcaf16 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -30,6 +30,7 @@ from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, internal_server_error, unauthorized
from pgadmin.utils.driver import get_driver
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
+from pgadmin.model import Server
class DatabaseModule(CollectionNodeModule):
@@ -468,7 +469,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database connected."),
data={
'icon': 'pg-icon-database',
- 'connected': True
+ 'connected': True,
+ 'svr': Server.query.filter_by(id=sid)[0].name,
+ 'db': conn.db
}
)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index ab0df6939..43029ce90 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -520,7 +520,7 @@ define('pgadmin.node.database', [
tree.addIcon(item, {icon: data.icon});
}
- Alertify.success(res.info);
+ Alertify.success(res.data.svr+'/'+res.data.db+' - '+res.info);
obj.trigger('connected', obj, item, data);
pgBrowser.Events.trigger(
'pgadmin:database:connected', item, data
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-11 09:32 Aditya Toshniwal <[email protected]>
parent: Karan Takalkar <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Toshniwal @ 2019-12-11 09:32 UTC (permalink / raw)
To: Karan Takalkar <[email protected]>; +Cc: pgadmin-hackers
Hi Karan,
I've updated your patch a bit. Kindly test and share the logs if test cases
fail.
Test cases seems to be working fine for me. Kindly also change disconnected
messages.
On Tue, Dec 10, 2019 at 6:51 PM Karan Takalkar <[email protected]>
wrote:
> Hi,
>
> "add more variables to the response along with info and use those in the
> front end"
> i have already implemented that , but am still failing (7) test cases
> particularly in the databases/extensions tests(5).
> i had run regression tests for browser node.(and all it's sub directories).
> Please check the patch attached.
>
> On Tue, Dec 10, 2019 at 6:34 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> [please use reply all to reply]
>>
>> You can add more variables to the response along with info and use those
>> in the front end.
>>
>> On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]> wrote:
>>
>>> Hi
>>>
>>> I had been naively modifying jason response of connect function in
>>> databases __init__.py, later realized there are a lot of dependencies on it
>>> and most of regression tests use:
>>> if db_con["info"] == "Database connected.": .
>>>
>>> I am now modifying the Alertify.success script* directly responsible for
>>> the popup, i could append the database name in the message but am having
>>> trouble finding the *variable to supply server name.*
>>> The file and location of function is :
>>> *
>>> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
>>> line 523)
>>>
>>> the message should be:
>>> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+res.info
>>> ")
>>>
>>> data.label contains database name
>>> res.info is the jason response coming from databases __init__.py
>>> connect function ; which is "Database connected."
>>>
>>> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
>>> [email protected]> wrote:
>>>
>>>> Hi Karan,
>>>>
>>>> Kindly add a hyphen between the message and names, create a patch to
>>>> pgAdmin hackers(check cc).
>>>> Kindly also run the test cases and pep8 before sending.
>>>>
>>>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]>
>>>> wrote:
>>>>
>>>>> I have updated the success message.
>>>>> Please check the screenshots attached.
>>>>> Should i make a patch?
>>>>>
>>>>> Regards,
>>>>> Karan
>>>>>
>>>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> ++pgadmin-hackers
>>>>>>
>>>>>> Hi Karan,
>>>>>>
>>>>>> It is good to know that you're contributing.
>>>>>> I would suggest {server name}/{db name} as name instead of did is
>>>>>> better for UX. You can get the db name from conn object and server name
>>>>>> using the sid (refer
>>>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>>>
>>>>>>
>>>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have been working on #4943 ("Database connected" success message
>>>>>>> itself is not enough) added by you on pgAdmin4 issues.
>>>>>>> I want to know what details of database should be included in
>>>>>>> success message.(i have added 'did')
>>>>>>>
>>>>>>> The success message can be modified by altering json response in the
>>>>>>> connect method in file
>>>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>>>> please have a look at the screenshots attached.
>>>>>>>
>>>>>>> original:
>>>>>>> info=_( "Database connected.")
>>>>>>> new:
>>>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>>>
>>>>>>> Regards,
>>>>>>> Karan
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks and Regards,
>>>>>> Aditya Toshniwal
>>>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>
>>>>>
--
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] BUG_4943_updated.patch (1.8K, 3-BUG_4943_updated.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 26fd5ccac..0417c4bb7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -30,6 +30,7 @@ from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, internal_server_error, unauthorized
from pgadmin.utils.driver import get_driver
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
+from pgadmin.model import Server
class DatabaseModule(CollectionNodeModule):
@@ -468,7 +469,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database connected."),
data={
'icon': 'pg-icon-database',
- 'connected': True
+ 'connected': True,
+ 'info_prefix': '{0}/{1}'.
+ format(Server.query.filter_by(id=sid)[0].name, conn.db)
}
)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index ab0df6939..e18c55a85 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -520,6 +520,10 @@ define('pgadmin.node.database', [
tree.addIcon(item, {icon: data.icon});
}
+ if(res.data.info_prefix) {
+ res.info = `${res.data.info_prefix} - ${res.info}`;
+ }
+
Alertify.success(res.info);
obj.trigger('connected', obj, item, data);
pgBrowser.Events.trigger(
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-11 11:49 Karan Takalkar <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Karan Takalkar @ 2019-12-11 11:49 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Hi,
I have updated the disconnect messages.
Databases/extension tests are failing , i have attached the log below.
They are also failing if i undo the modifications.
i do not know if this a problem with my setup or i maybe not following a
convention.
Please check the updated patch.
Regards,
Karan
On Wed, Dec 11, 2019 at 3:03 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi Karan,
>
> I've updated your patch a bit. Kindly test and share the logs if test
> cases fail.
> Test cases seems to be working fine for me. Kindly also change
> disconnected messages.
>
> On Tue, Dec 10, 2019 at 6:51 PM Karan Takalkar <[email protected]>
> wrote:
>
>> Hi,
>>
>> "add more variables to the response along with info and use those in the
>> front end"
>> i have already implemented that , but am still failing (7) test cases
>> particularly in the databases/extensions tests(5).
>> i had run regression tests for browser node.(and all it's sub
>> directories).
>> Please check the patch attached.
>>
>> On Tue, Dec 10, 2019 at 6:34 PM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> [please use reply all to reply]
>>>
>>> You can add more variables to the response along with info and use those
>>> in the front end.
>>>
>>> On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]>
>>> wrote:
>>>
>>>> Hi
>>>>
>>>> I had been naively modifying jason response of connect function in
>>>> databases __init__.py, later realized there are a lot of dependencies on it
>>>> and most of regression tests use:
>>>> if db_con["info"] == "Database connected.": .
>>>>
>>>> I am now modifying the Alertify.success script* directly responsible
>>>> for the popup, i could append the database name in the message but am
>>>> having trouble finding the *variable to supply server name.*
>>>> The file and location of function is :
>>>> *
>>>> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
>>>> line 523)
>>>>
>>>> the message should be:
>>>> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+
>>>> res.info")
>>>>
>>>> data.label contains database name
>>>> res.info is the jason response coming from databases __init__.py
>>>> connect function ; which is "Database connected."
>>>>
>>>> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Karan,
>>>>>
>>>>> Kindly add a hyphen between the message and names, create a patch to
>>>>> pgAdmin hackers(check cc).
>>>>> Kindly also run the test cases and pep8 before sending.
>>>>>
>>>>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> I have updated the success message.
>>>>>> Please check the screenshots attached.
>>>>>> Should i make a patch?
>>>>>>
>>>>>> Regards,
>>>>>> Karan
>>>>>>
>>>>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> ++pgadmin-hackers
>>>>>>>
>>>>>>> Hi Karan,
>>>>>>>
>>>>>>> It is good to know that you're contributing.
>>>>>>> I would suggest {server name}/{db name} as name instead of did is
>>>>>>> better for UX. You can get the db name from conn object and server name
>>>>>>> using the sid (refer
>>>>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I have been working on #4943 ("Database connected" success message
>>>>>>>> itself is not enough) added by you on pgAdmin4 issues.
>>>>>>>> I want to know what details of database should be included in
>>>>>>>> success message.(i have added 'did')
>>>>>>>>
>>>>>>>> The success message can be modified by altering json response in
>>>>>>>> the connect method in file
>>>>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>>>>> please have a look at the screenshots attached.
>>>>>>>>
>>>>>>>> original:
>>>>>>>> info=_( "Database connected.")
>>>>>>>> new:
>>>>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Karan
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks and Regards,
>>>>>>> Aditya Toshniwal
>>>>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>
>>>>>>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Sr. Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>
Attachments:
[text/x-patch] BUG_4943_updated-2.diff (3.0K, 3-BUG_4943_updated-2.diff)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 26fd5ccac..905401fa7 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -30,7 +30,7 @@ from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, internal_server_error, unauthorized
from pgadmin.utils.driver import get_driver
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
-
+from pgadmin.model import Server
class DatabaseModule(CollectionNodeModule):
NODE_TYPE = 'database'
@@ -468,7 +468,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database connected."),
data={
'icon': 'pg-icon-database',
- 'connected': True
+ 'connected': True,
+ 'info_prefix': '{0}/{1}'.
+ format(Server.query.filter_by(id=sid)[0].name, conn.db)
}
)
@@ -478,7 +480,7 @@ class DatabaseView(PGChildNodeView):
# Release Connection
from pgadmin.utils.driver import get_driver
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
-
+ conn = manager.connection(did=did, auto_reconnect=True)
status = manager.release(did=did)
if not status:
@@ -489,7 +491,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database disconnected."),
data={
'icon': 'icon-database-not-connected',
- 'connected': False
+ 'connected': False,
+ 'info_prefix': '{0}/{1}'.
+ format(Server.query.filter_by(id=sid)[0].name, conn.db)
}
)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index ab0df6939..838977016 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -200,6 +200,9 @@ define('pgadmin.node.database', [
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
+ if(res.data.info_prefix) {
+ res.info = `${res.data.info_prefix} - ${res.info}`;
+ }
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
@@ -519,6 +522,9 @@ define('pgadmin.node.database', [
data.icon = res.data.icon;
tree.addIcon(item, {icon: data.icon});
}
+ if(res.data.info_prefix) {
+ res.info = `${res.data.info_prefix} - ${res.info}`;
+ }
Alertify.success(res.info);
obj.trigger('connected', obj, item, data);
[text/x-log] regression.log (20.0K, 4-regression.log)
download | inline:
2019-12-11 17:11:17,161: ERROR STDERR:
2019-12-11 17:11:17,162: ERROR STDERR: =============Running the test cases for 'PostgreSQL 9.4'=============
2019-12-11 17:11:21,415: ERROR STDERR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_add.ExtensionsAddTestCase)
2019-12-11 17:11:21,416: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,416: ERROR STDERR: ...
2019-12-11 17:11:21,423: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,436: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,439: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 1654263):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,446: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,451: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,451: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 7388287):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,459: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 4011244):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,465: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,478: SQL flask.app: Execute (dict) for server #2 - DB:test_db_0c23a (Query-id: 2911315):
CREATE EXTENSION cube
SCHEMA test_schema_51b4d
2019-12-11 17:11:21,479: ERROR flask.app: Failed to execute query (execute_dict) for the server #2- DB:test_db_0c23a (Query-id: 2911315):
Error Message:ERROR: could not open extension control file "/usr/local/pgsql/share/extension/cube.control": No such file or directory
2019-12-11 17:11:21,492: ERROR STDERR: FAIL
2019-12-11 17:11:21,492: ERROR STDERR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_delete.ExtensionsDeleteTestCase)
2019-12-11 17:11:21,492: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,492: ERROR STDERR: ...
2019-12-11 17:11:21,496: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,503: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,503: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 6121767):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,508: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,508: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/utils.py", line 53, in create_extension
2019-12-11 17:11:21,508: ERROR STDERR: schema_name))
2019-12-11 17:11:21,508: ERROR STDERR: psycopg2.errors.UndefinedFile: could not open extension control file "/usr/local/pgsql/share/extension/cube.control": No such file or directory
2019-12-11 17:11:21,512: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,518: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,518: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 3682222):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,526: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 7905093):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,532: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,547: ERROR STDERR: ERROR
2019-12-11 17:11:21,547: ERROR STDERR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_delete_multiple.ExtensionsDeleteMultipleTestCase)
2019-12-11 17:11:21,547: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,547: ERROR STDERR: ...
2019-12-11 17:11:21,553: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,558: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,558: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 3689145):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,562: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,562: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/utils.py", line 53, in create_extension
2019-12-11 17:11:21,562: ERROR STDERR: schema_name))
2019-12-11 17:11:21,562: ERROR STDERR: psycopg2.errors.UndefinedFile: could not open extension control file "/usr/local/pgsql/share/extension/dblink.control": No such file or directory
2019-12-11 17:11:21,565: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,565: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/utils.py", line 53, in create_extension
2019-12-11 17:11:21,565: ERROR STDERR: schema_name))
2019-12-11 17:11:21,565: ERROR STDERR: psycopg2.errors.UndefinedFile: could not open extension control file "/usr/local/pgsql/share/extension/hstore.control": No such file or directory
2019-12-11 17:11:21,569: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,574: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,575: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 6440306):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,583: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 2989925):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,588: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,603: ERROR STDERR: ERROR
2019-12-11 17:11:21,604: ERROR STDERR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_get.ExtensionsGetTestCase)
2019-12-11 17:11:21,604: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,604: ERROR STDERR: ...
2019-12-11 17:11:21,608: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,613: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,613: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 3369218):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,617: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,617: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/utils.py", line 53, in create_extension
2019-12-11 17:11:21,617: ERROR STDERR: schema_name))
2019-12-11 17:11:21,617: ERROR STDERR: psycopg2.errors.UndefinedFile: could not open extension control file "/usr/local/pgsql/share/extension/cube.control": No such file or directory
2019-12-11 17:11:21,621: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,626: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,626: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 8463607):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,634: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 9189113):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,640: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,648: ERROR flask.app: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
Traceback (most recent call last):
File "/home/karan/altpg/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/karan/altpg/lib/python3.6/site-packages/flask/app.py", line 1791, in dispatch_request
self.raise_routing_exception(req)
File "/home/karan/altpg/lib/python3.6/site-packages/flask/app.py", line 1774, in raise_routing_exception
raise request.routing_exception
File "/home/karan/altpg/lib/python3.6/site-packages/flask/ctx.py", line 336, in match_request
self.url_adapter.match(return_rule=True)
File "/home/karan/altpg/lib/python3.6/site-packages/werkzeug/routing.py", line 1799, in match
raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
2019-12-11 17:11:21,663: ERROR STDERR: FAIL
2019-12-11 17:11:21,663: ERROR STDERR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_put.ExtensionsPutTestCase)
2019-12-11 17:11:21,663: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,663: ERROR STDERR: ...
2019-12-11 17:11:21,668: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,673: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,673: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 7671887):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,677: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,677: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/utils.py", line 53, in create_extension
2019-12-11 17:11:21,678: ERROR STDERR: schema_name))
2019-12-11 17:11:21,678: ERROR STDERR: psycopg2.errors.UndefinedFile: could not open extension control file "/usr/local/pgsql/share/extension/cube.control": No such file or directory
2019-12-11 17:11:21,683: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,688: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,688: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 4962219):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,698: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 2280705):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,704: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,722: ERROR STDERR: ERROR
2019-12-11 17:11:21,722: ERROR STDERR: runTest (regression.re_sql.tests.test_resql.ReverseEngineeredSQLTestCases)
2019-12-11 17:11:21,722: ERROR STDERR: Reverse Engineered SQL Test Cases
2019-12-11 17:11:21,722: ERROR STDERR: ...
2019-12-11 17:11:21,727: INFO flask.app: Connection Request for server#2
2019-12-11 17:11:21,732: INFO flask.app: Connection Established for server: 2 - PostgreSQL 9.4
2019-12-11 17:11:21,732: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 9178306):
SELECT CASE WHEN usesuper
THEN pg_is_in_recovery()
ELSE FALSE
END as inrecovery,
CASE WHEN usesuper AND pg_is_in_recovery()
THEN pg_is_wal_replay_paused()
ELSE FALSE
END as isreplaypaused
FROM pg_user WHERE usename=current_user
2019-12-11 17:11:21,741: SQL flask.app: Execute (dict) for server #2 - DB:postgres (Query-id: 2349296):
SELECT
db.oid as did, db.datname, db.datallowconn,
pg_encoding_to_char(db.encoding) AS serverencoding,
has_database_privilege(db.oid, 'CREATE') as cancreate, datlastsysoid
FROM
pg_database db
WHERE db.oid = 24606
2019-12-11 17:11:21,747: INFO flask.app: Connection Established for Database Id: 24606
2019-12-11 17:11:21,764: ERROR STDERR: ok
2019-12-11 17:11:21,765: ERROR STDERR: ======================================================================
2019-12-11 17:11:21,765: ERROR STDERR: ERROR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_delete.ExtensionsDeleteTestCase)
2019-12-11 17:11:21,765: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,765: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,765: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,765: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/test_extension_delete.py", line 50, in runTest
2019-12-11 17:11:21,765: ERROR STDERR: raise Exception("Could not find extension.")
2019-12-11 17:11:21,765: ERROR STDERR: Exception: Could not find extension.
2019-12-11 17:11:21,765: ERROR STDERR: ======================================================================
2019-12-11 17:11:21,765: ERROR STDERR: ERROR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_delete_multiple.ExtensionsDeleteMultipleTestCase)
2019-12-11 17:11:21,765: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,765: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,765: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,765: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/test_extension_delete_multiple.py", line 57, in runTest
2019-12-11 17:11:21,765: ERROR STDERR: raise Exception("Could not find extension.")
2019-12-11 17:11:21,765: ERROR STDERR: Exception: Could not find extension.
2019-12-11 17:11:21,765: ERROR STDERR: ======================================================================
2019-12-11 17:11:21,765: ERROR STDERR: ERROR: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_put.ExtensionsPutTestCase)
2019-12-11 17:11:21,765: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,765: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,765: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,766: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/test_extension_put.py", line 52, in runTest
2019-12-11 17:11:21,766: ERROR STDERR: raise Exception("Could not find extension.")
2019-12-11 17:11:21,766: ERROR STDERR: Exception: Could not find extension.
2019-12-11 17:11:21,766: ERROR STDERR: ======================================================================
2019-12-11 17:11:21,766: ERROR STDERR: FAIL: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_add.ExtensionsAddTestCase)
2019-12-11 17:11:21,766: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,766: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,766: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,766: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/test_extension_add.py", line 50, in runTest
2019-12-11 17:11:21,766: ERROR STDERR: self.assertEquals(response.status_code, 200)
2019-12-11 17:11:21,766: ERROR STDERR: AssertionError: 500 != 200
2019-12-11 17:11:21,766: ERROR STDERR: ======================================================================
2019-12-11 17:11:21,766: ERROR STDERR: FAIL: runTest (pgadmin.browser.server_groups.servers.databases.extensions.tests.test_extension_get.ExtensionsGetTestCase)
2019-12-11 17:11:21,766: ERROR STDERR: Check Extension Node
2019-12-11 17:11:21,766: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,766: ERROR STDERR: Traceback (most recent call last):
2019-12-11 17:11:21,766: ERROR STDERR: File "/home/karan/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/extensions/tests/test_extension_get.py", line 52, in runTest
2019-12-11 17:11:21,767: ERROR STDERR: self.assertEquals(response.status_code, 200)
2019-12-11 17:11:21,767: ERROR STDERR: AssertionError: 404 != 200
2019-12-11 17:11:21,767: ERROR STDERR: ----------------------------------------------------------------------
2019-12-11 17:11:21,767: ERROR STDERR: Ran 6 tests in 0.349s
2019-12-11 17:11:21,767: ERROR STDERR: FAILED
2019-12-11 17:11:21,767: ERROR STDERR: (failures=2, errors=3)
2019-12-11 17:11:23,196: ERROR STDERR:
2019-12-11 17:11:23,196: ERROR STDERR: ======================================================================
2019-12-11 17:11:23,197: ERROR STDERR: Test Result Summary
2019-12-11 17:11:23,197: ERROR STDERR: ======================================================================
2019-12-11 17:11:23,197: ERROR STDERR: PostgreSQL 9.4:
2019-12-11 17:11:23,198: ERROR STDERR:
2019-12-11 17:11:23,198: ERROR STDERR: 1 test passed
2019-12-11 17:11:23,198: ERROR STDERR: 5 tests failed:
2019-12-11 17:11:23,198: ERROR STDERR: ExtensionsAddTestCase (Check Extension Node)
2019-12-11 17:11:23,198: ERROR STDERR: ExtensionsGetTestCase (Check Extension Node)
2019-12-11 17:11:23,198: ERROR STDERR: ExtensionsDeleteTestCase (Check Extension Node)
2019-12-11 17:11:23,198: ERROR STDERR: ExtensionsDeleteMultipleTestCase (Check Extension Node)
2019-12-11 17:11:23,198: ERROR STDERR: ExtensionsPutTestCase (Check Extension Node)
2019-12-11 17:11:23,199: ERROR STDERR: 0 tests skipped
2019-12-11 17:11:23,200: ERROR STDERR: ======================================================================
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-11 12:11 Aditya Toshniwal <[email protected]>
parent: Karan Takalkar <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Toshniwal @ 2019-12-11 12:11 UTC (permalink / raw)
To: Karan Takalkar <[email protected]>; +Cc: pgadmin-hackers
Hi,
I've updated your patch further to escape the info prefix so that it
doesn't break if db name is something like - "<script>alert(1)</script>".
Fixed a pep8 issue.
Otherwise, the patch looks good to me and test cases works fine.
On Wed, Dec 11, 2019 at 5:19 PM Karan Takalkar <[email protected]>
wrote:
> Hi,
>
> I have updated the disconnect messages.
> Databases/extension tests are failing , i have attached the log below.
> They are also failing if i undo the modifications.
> i do not know if this a problem with my setup or i maybe not following a
> convention.
> Please check the updated patch.
>
> Regards,
> Karan
>
> On Wed, Dec 11, 2019 at 3:03 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Karan,
>>
>> I've updated your patch a bit. Kindly test and share the logs if test
>> cases fail.
>> Test cases seems to be working fine for me. Kindly also change
>> disconnected messages.
>>
>> On Tue, Dec 10, 2019 at 6:51 PM Karan Takalkar <[email protected]>
>> wrote:
>>
>>> Hi,
>>>
>>> "add more variables to the response along with info and use those in the
>>> front end"
>>> i have already implemented that , but am still failing (7) test cases
>>> particularly in the databases/extensions tests(5).
>>> i had run regression tests for browser node.(and all it's sub
>>> directories).
>>> Please check the patch attached.
>>>
>>> On Tue, Dec 10, 2019 at 6:34 PM Aditya Toshniwal <
>>> [email protected]> wrote:
>>>
>>>> [please use reply all to reply]
>>>>
>>>> You can add more variables to the response along with info and use
>>>> those in the front end.
>>>>
>>>> On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I had been naively modifying jason response of connect function in
>>>>> databases __init__.py, later realized there are a lot of dependencies on it
>>>>> and most of regression tests use:
>>>>> if db_con["info"] == "Database connected.": .
>>>>>
>>>>> I am now modifying the Alertify.success script* directly responsible
>>>>> for the popup, i could append the database name in the message but am
>>>>> having trouble finding the *variable to supply server name.*
>>>>> The file and location of function is :
>>>>> *
>>>>> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
>>>>> line 523)
>>>>>
>>>>> the message should be:
>>>>> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+
>>>>> res.info")
>>>>>
>>>>> data.label contains database name
>>>>> res.info is the jason response coming from databases __init__.py
>>>>> connect function ; which is "Database connected."
>>>>>
>>>>> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Karan,
>>>>>>
>>>>>> Kindly add a hyphen between the message and names, create a patch to
>>>>>> pgAdmin hackers(check cc).
>>>>>> Kindly also run the test cases and pep8 before sending.
>>>>>>
>>>>>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>> I have updated the success message.
>>>>>>> Please check the screenshots attached.
>>>>>>> Should i make a patch?
>>>>>>>
>>>>>>> Regards,
>>>>>>> Karan
>>>>>>>
>>>>>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> ++pgadmin-hackers
>>>>>>>>
>>>>>>>> Hi Karan,
>>>>>>>>
>>>>>>>> It is good to know that you're contributing.
>>>>>>>> I would suggest {server name}/{db name} as name instead of did is
>>>>>>>> better for UX. You can get the db name from conn object and server name
>>>>>>>> using the sid (refer
>>>>>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I have been working on #4943 ("Database connected" success
>>>>>>>>> message itself is not enough) added by you on pgAdmin4 issues.
>>>>>>>>> I want to know what details of database should be included in
>>>>>>>>> success message.(i have added 'did')
>>>>>>>>>
>>>>>>>>> The success message can be modified by altering json response in
>>>>>>>>> the connect method in file
>>>>>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>>>>>> please have a look at the screenshots attached.
>>>>>>>>>
>>>>>>>>> original:
>>>>>>>>> info=_( "Database connected.")
>>>>>>>>> new:
>>>>>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Karan
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Thanks and Regards,
>>>>>>>> Aditya Toshniwal
>>>>>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>
>>>>>>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Sr. Software Engineer | EnterpriseDB India | Pune
>> "Don't Complain about Heat, Plant a TREE"
>>
>
--
Thanks and Regards,
Aditya Toshniwal
Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] BUG_4943_updated_v3.patch (3.0K, 3-BUG_4943_updated_v3.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 26fd5ccac..c4cb71a11 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -30,6 +30,7 @@ from pgadmin.utils.ajax import make_json_response, \
make_response as ajax_response, internal_server_error, unauthorized
from pgadmin.utils.driver import get_driver
from pgadmin.tools.sqleditor.utils.query_history import QueryHistory
+from pgadmin.model import Server
class DatabaseModule(CollectionNodeModule):
@@ -468,7 +469,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database connected."),
data={
'icon': 'pg-icon-database',
- 'connected': True
+ 'connected': True,
+ 'info_prefix': '{0}/{1}'.
+ format(Server.query.filter_by(id=sid)[0].name, conn.db)
}
)
@@ -478,7 +481,7 @@ class DatabaseView(PGChildNodeView):
# Release Connection
from pgadmin.utils.driver import get_driver
manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
-
+ conn = manager.connection(did=did, auto_reconnect=True)
status = manager.release(did=did)
if not status:
@@ -489,7 +492,9 @@ class DatabaseView(PGChildNodeView):
info=_("Database disconnected."),
data={
'icon': 'icon-database-not-connected',
- 'connected': False
+ 'connected': False,
+ 'info_prefix': '{0}/{1}'.
+ format(Server.query.filter_by(id=sid)[0].name, conn.db)
}
)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index ab0df6939..12e519ec4 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -200,6 +200,9 @@ define('pgadmin.node.database', [
.done(function(res) {
if (res.success == 1) {
var prv_i = t.parent(i);
+ if(res.data.info_prefix) {
+ res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`;
+ }
Alertify.success(res.info);
t.removeIcon(i);
data.connected = false;
@@ -519,6 +522,9 @@ define('pgadmin.node.database', [
data.icon = res.data.icon;
tree.addIcon(item, {icon: data.icon});
}
+ if(res.data.info_prefix) {
+ res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`;
+ }
Alertify.success(res.info);
obj.trigger('connected', obj, item, data);
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Re : [BUG #4943]
@ 2019-12-12 05:43 Akshay Joshi <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Akshay Joshi @ 2019-12-12 05:43 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: Karan Takalkar <[email protected]>; pgadmin-hackers
Thanks, patch applied.
On Wed, Dec 11, 2019 at 5:41 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi,
>
> I've updated your patch further to escape the info prefix so that it
> doesn't break if db name is something like - "<script>alert(1)</script>".
> Fixed a pep8 issue.
> Otherwise, the patch looks good to me and test cases works fine.
>
>
> On Wed, Dec 11, 2019 at 5:19 PM Karan Takalkar <[email protected]>
> wrote:
>
>> Hi,
>>
>> I have updated the disconnect messages.
>> Databases/extension tests are failing , i have attached the log below.
>> They are also failing if i undo the modifications.
>> i do not know if this a problem with my setup or i maybe not following a
>> convention.
>> Please check the updated patch.
>>
>> Regards,
>> Karan
>>
>> On Wed, Dec 11, 2019 at 3:03 PM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> Hi Karan,
>>>
>>> I've updated your patch a bit. Kindly test and share the logs if test
>>> cases fail.
>>> Test cases seems to be working fine for me. Kindly also change
>>> disconnected messages.
>>>
>>> On Tue, Dec 10, 2019 at 6:51 PM Karan Takalkar <[email protected]>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> "add more variables to the response along with info and use those in
>>>> the front end"
>>>> i have already implemented that , but am still failing (7) test cases
>>>> particularly in the databases/extensions tests(5).
>>>> i had run regression tests for browser node.(and all it's sub
>>>> directories).
>>>> Please check the patch attached.
>>>>
>>>> On Tue, Dec 10, 2019 at 6:34 PM Aditya Toshniwal <
>>>> [email protected]> wrote:
>>>>
>>>>> [please use reply all to reply]
>>>>>
>>>>> You can add more variables to the response along with info and use
>>>>> those in the front end.
>>>>>
>>>>> On Tue, Dec 10, 2019, 18:24 Karan Takalkar <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I had been naively modifying jason response of connect function in
>>>>>> databases __init__.py, later realized there are a lot of dependencies on it
>>>>>> and most of regression tests use:
>>>>>> if db_con["info"] == "Database connected.": .
>>>>>>
>>>>>> I am now modifying the Alertify.success script* directly responsible
>>>>>> for the popup, i could append the database name in the message but am
>>>>>> having trouble finding the *variable to supply server name.*
>>>>>> The file and location of function is :
>>>>>> *
>>>>>> (web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
>>>>>> line 523)
>>>>>>
>>>>>> the message should be:
>>>>>> Alertify.success("(?server_name_variable?}+'/'+data.label+' - '+
>>>>>> res.info")
>>>>>>
>>>>>> data.label contains database name
>>>>>> res.info is the jason response coming from databases __init__.py
>>>>>> connect function ; which is "Database connected."
>>>>>>
>>>>>> On Mon, Dec 9, 2019 at 8:35 PM Aditya Toshniwal <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Karan,
>>>>>>>
>>>>>>> Kindly add a hyphen between the message and names, create a patch to
>>>>>>> pgAdmin hackers(check cc).
>>>>>>> Kindly also run the test cases and pep8 before sending.
>>>>>>>
>>>>>>> On Mon, Dec 9, 2019, 20:17 Karan Takalkar <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I have updated the success message.
>>>>>>>> Please check the screenshots attached.
>>>>>>>> Should i make a patch?
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Karan
>>>>>>>>
>>>>>>>> On Mon, 9 Dec, 2019, 3:25 PM Aditya Toshniwal, <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> ++pgadmin-hackers
>>>>>>>>>
>>>>>>>>> Hi Karan,
>>>>>>>>>
>>>>>>>>> It is good to know that you're contributing.
>>>>>>>>> I would suggest {server name}/{db name} as name instead of did is
>>>>>>>>> better for UX. You can get the db name from conn object and server name
>>>>>>>>> using the sid (refer
>>>>>>>>> - web/pgadmin/browser/server_groups/servers/__init__.py)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, Dec 9, 2019 at 3:11 PM Karan Takalkar <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I have been working on #4943 ("Database connected" success
>>>>>>>>>> message itself is not enough) added by you on pgAdmin4 issues.
>>>>>>>>>> I want to know what details of database should be included in
>>>>>>>>>> success message.(i have added 'did')
>>>>>>>>>>
>>>>>>>>>> The success message can be modified by altering json response in
>>>>>>>>>> the connect method in file
>>>>>>>>>> PGADMIN_SRC/web/pgadmin/browser/server_groups/servers/databases/__init__.py.
>>>>>>>>>> please have a look at the screenshots attached.
>>>>>>>>>>
>>>>>>>>>> original:
>>>>>>>>>> info=_( "Database connected.")
>>>>>>>>>> new:
>>>>>>>>>> info=_("Postgres version/{0} Database connected.".format(did))
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Karan
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Thanks and Regards,
>>>>>>>>> Aditya Toshniwal
>>>>>>>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>>>>>>>> "Don't Complain about Heat, Plant a TREE"
>>>>>>>>>
>>>>>>>>
>>>
>>> --
>>> Thanks and Regards,
>>> Aditya Toshniwal
>>> Sr. Software Engineer | EnterpriseDB India | Pune
>>> "Don't Complain about Heat, Plant a TREE"
>>>
>>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Sr. Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>
--
*Thanks & Regards*
*Akshay Joshi*
*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2019-12-12 05:43 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 09:54 Re: Re : [BUG #4943] Aditya Toshniwal <[email protected]>
2019-12-09 15:05 ` Aditya Toshniwal <[email protected]>
2019-12-10 13:04 ` Aditya Toshniwal <[email protected]>
2019-12-10 13:20 ` Karan Takalkar <[email protected]>
2019-12-11 09:32 ` Aditya Toshniwal <[email protected]>
2019-12-11 11:49 ` Karan Takalkar <[email protected]>
2019-12-11 12:11 ` Aditya Toshniwal <[email protected]>
2019-12-12 05:43 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox