1) Warn the user when connecting to a server that is older than pgAdmin supports.

2) Fixed Debugger API test cases.
This commit is contained in:
Akshay Joshi 2022-09-15 13:12:46 +05:30
parent 0cb00c7b4f
commit 01a9a41bd9
2 changed files with 17 additions and 10 deletions

View File

@ -272,6 +272,9 @@ define('pgadmin.node.server', [
// Call added method of node.js
pgAdmin.Browser.Node.callbacks.added.apply(this, arguments);
// Check the database server against supported version.
checkSupportedVersion(data.version);
if(data.was_connected) {
fetch_connection_status(this, data, pgBrowser.tree, item);
}
@ -575,6 +578,17 @@ define('pgadmin.node.server', [
},
});
let checkSupportedVersion = function (version, info) {
if (!_.isUndefined(version) && !_.isNull(version) && version < 100000) {
Notify.warning(gettext('You have connected to a server version that is older ' +
'than is supported by pgAdmin. This may cause pgAdmin to break in strange and ' +
'unpredictable ways. Or a plague of frogs. Either way, you have been warned!') +
'<br /><br />' + gettext('Server connected'), null);
} else if (!_.isUndefined(info) && !_.isNull(info)) {
Notify.success(info);
}
};
let connect_to_server = function(obj, data, tree, item, reconnect) {
// Open properties dialog in edit mode
let server_url = obj.generate_url(item, 'obj', data, true);
@ -665,15 +679,8 @@ define('pgadmin.node.server', [
pgBrowser.serverInfo || {};
serverInfo[_data._id] = _.extend({}, _data);
if (_data.version < 90500) {
Notify.warning(gettext('You have connected to a server version that is older ' +
'than is supported by pgAdmin. This may cause pgAdmin to break in strange and ' +
'unpredictable ways. Or a plague of frogs. Either way, you have been warned!') +
'<br /><br />' +
res.info, null);
} else {
Notify.success(res.info);
}
// Check the database server against supported version.
checkSupportedVersion(_data.version, res.info);
obj.trigger('connected', obj, _item, _data);

View File

@ -34,7 +34,7 @@ class DebuggerStartListener(BaseTestGenerator):
self.schema_id = self.schema_data['schema_id']
self.test_data['funcowner'] = self.server["username"]
funcs_utils.set_up(self)
function_info = debugger_utils.create_function(self, utils)
self.func_id = json.loads(function_info.data)['node']['_id']