From 7cc76c7d2d2f4b84f54c0d5f2f9baa35d1e49e32 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Thu, 6 Jan 2022 20:01:25 +0530 Subject: [PATCH] Fixed import/export server issues reported while testing. --- web/pgadmin/tools/import_export_servers/__init__.py | 7 +++++-- .../static/js/ImportExportServers.jsx | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/web/pgadmin/tools/import_export_servers/__init__.py b/web/pgadmin/tools/import_export_servers/__init__.py index cbc0e392d..cf562d0c9 100644 --- a/web/pgadmin/tools/import_export_servers/__init__.py +++ b/web/pgadmin/tools/import_export_servers/__init__.py @@ -107,8 +107,11 @@ def get_servers(): for server in servers: children.append({'value': server.id, 'label': server.name}) - all_servers.append( - {'value': group.name, 'label': group.name, 'children': children}) + # Add server group only when some servers are there. + if len(children) > 0: + all_servers.append( + {'value': group.name, 'label': group.name, + 'children': children}) return make_json_response(success=1, data=all_servers) diff --git a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx index e80258fde..bc58071f2 100644 --- a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx +++ b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx @@ -80,7 +80,7 @@ export default function ImportExportServers() { Notify.alert(gettext('Export Servers'), gettext('The selected servers were exported successfully.')); }) .catch((err) => { - Notify.alert(err.response.data.errormsg); + Notify.alert(gettext('Export Error'), err.response.data.errormsg); }); } else if (selectionFormData.imp_exp == 'i') { // Remove the random number added to create unique tree item, @@ -105,10 +105,10 @@ export default function ImportExportServers() { Notify.alert(gettext('Import Servers'), msg); }) .catch((err) => { - Notify.alert(err.response.data.errormsg); + Notify.alert(gettext('Import error'), err.response.data.errormsg); }); } - + Alertify.importExportWizardDialog().close(); }; @@ -174,6 +174,7 @@ export default function ImportExportServers() { api.get(get_servers_url) .then(res => { setLoaderText(''); + setErrMsg(''); setServerData(res.data.data); resolve(); }) @@ -190,6 +191,7 @@ export default function ImportExportServers() { api.post(load_servers_url, post_data) .then(res => { setLoaderText(''); + setErrMsg(''); setServerData(res.data.data); resolve(); }) @@ -261,10 +263,10 @@ export default function ImportExportServers() { - {selectionFormData.imp_exp == 'i' && + {selectionFormData.imp_exp == 'i' && } ); -} \ No newline at end of file +}