Issues resolved related to connection management and collection nodes:
- Allow to release connection using the database OID (did). - Generate correct url for the collection nodes. - Removed the server-type from the collection node module, from the generate_browser_collection_node(...) function. - Show version string, and not version integer in the server properties (when connected).pull/3/head
parent
e52fd0d349
commit
9bc9025075
|
@ -13,7 +13,7 @@ from flask import url_for, render_template
|
|||
from flask.ext.babel import gettext
|
||||
from pgadmin.browser.utils import PgAdminModule, PGChildModule
|
||||
from pgadmin.browser import BrowserPluginModule
|
||||
from pgadmin.browser.utils import NodeView, PGChildNode, PGChildNodeView
|
||||
from pgadmin.browser.utils import PGChildNodeView
|
||||
|
||||
@six.add_metaclass(ABCMeta)
|
||||
class CollectionNodeModule(PgAdminModule, PGChildModule):
|
||||
|
@ -86,7 +86,7 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
|
|||
|
||||
@property
|
||||
def node_type(self):
|
||||
return '%s-%s' % (self.SERVER_TYPE, self.NODE_TYPE)
|
||||
return '%s' % (self.NODE_TYPE)
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
|
@ -171,7 +171,7 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
|
|||
return []
|
||||
|
||||
|
||||
class CollectionNodeView(NodeView, PGChildNode):
|
||||
class CollectionNodeView(PGChildNodeView):
|
||||
"""
|
||||
A PostgreSQL Collection node has specific functions needs to address
|
||||
i.e.
|
||||
|
|
|
@ -62,7 +62,7 @@ class ServerModule(sg.ServerGroupPluginModule):
|
|||
self.NODE_TYPE,
|
||||
connected=connected,
|
||||
server_type=manager.server_type if connected else "pg",
|
||||
server_version=manager.sversion if connected else 0
|
||||
version=manager.version
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -137,7 +137,7 @@ class ServerNode(PGChildNodeView):
|
|||
self.node_type,
|
||||
connected=connected,
|
||||
server_type=manager.server_type if connected else 'PG',
|
||||
version=manager.sversion
|
||||
version=manager.version
|
||||
)
|
||||
)
|
||||
return make_json_response(result=res)
|
||||
|
@ -295,7 +295,7 @@ class ServerNode(PGChildNodeView):
|
|||
'comment': server.comment,
|
||||
'role': server.role,
|
||||
'connected': connected,
|
||||
'version': manager.sversion,
|
||||
'version': manager.ver,
|
||||
'server_type': manager.server_type if connected else 'PG'
|
||||
}
|
||||
)
|
||||
|
@ -522,7 +522,7 @@ class ServerNode(PGChildNodeView):
|
|||
),
|
||||
'connected': True,
|
||||
'type': manager.server_type,
|
||||
'version': manager.sversion
|
||||
'version': manager.version
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -86,7 +86,15 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
|
|||
j.append(content);
|
||||
|
||||
// Fetch Data
|
||||
collections.fetch({reset: true});
|
||||
collections.fetch({reset: true})
|
||||
.error(function(jqxhr, error, message) {
|
||||
Alertify.pgNotifier(
|
||||
error, jqxhr,
|
||||
S(
|
||||
"{{ _("Error fetching the properties - %%s!") }}"
|
||||
).sprintf(message).value()
|
||||
);
|
||||
});
|
||||
},
|
||||
generate_url: function(item, type, d) {
|
||||
var url = pgAdmin.Browser.URL + '{TYPE}/{REDIRECT}{REF}',
|
||||
|
@ -114,7 +122,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
|
|||
});
|
||||
|
||||
var args = {
|
||||
'TYPE': self.type,
|
||||
'TYPE': self.node,
|
||||
'REDIRECT': (type in opURL ? opURL[type] : type),
|
||||
'REF': S('%s/').sprintf(ref).value()
|
||||
};
|
||||
|
|
|
@ -479,7 +479,15 @@ WHERE db.oid = {0}""".format(did))
|
|||
|
||||
return self.connections[my_id]
|
||||
|
||||
def release(self, database=None, conn_id=None):
|
||||
def release(self, database=None, conn_id=None, did=None):
|
||||
if did is not None:
|
||||
if did in self.db_info and 'datname' in self.db_info[did]:
|
||||
database = self.db_info[did]['datname']
|
||||
if database is None:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
my_id = ('CONN:' + str(conn_id)) if conn_id is not None else \
|
||||
('DB:' + str(database)) if database is not None else None
|
||||
|
@ -501,7 +509,6 @@ WHERE db.oid = {0}""".format(did))
|
|||
|
||||
return True
|
||||
|
||||
|
||||
class Driver(BaseDriver):
|
||||
"""
|
||||
class Driver(BaseDriver):
|
||||
|
|
Loading…
Reference in New Issue