diff --git a/web/pgadmin/tools/import_export/__init__.py b/web/pgadmin/tools/import_export/__init__.py index 4c1ac043d..931e86fb9 100644 --- a/web/pgadmin/tools/import_export/__init__.py +++ b/web/pgadmin/tools/import_export/__init__.py @@ -53,6 +53,13 @@ class ImportExportModule(PgAdminModule): return scripts + def get_exposed_url_endpoints(self): + """ + Returns: + list: URL endpoints for backup module + """ + return ['import_export.create_job'] + blueprint = ImportExportModule(MODULE_NAME, __name__) @@ -186,7 +193,7 @@ def filename_with_file_manager_path(_file, _present=False): return fs_short_path(_file) -@blueprint.route('/create_job/', methods=['POST']) +@blueprint.route('/job/', methods=['POST'], endpoint="create_job") @login_required def create_import_export_job(sid): """ diff --git a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js index d8a8c1374..a8eac3c18 100644 --- a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js +++ b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js @@ -1,9 +1,9 @@ define([ - 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui' ], function( - gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform + gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform ) { pgAdmin = pgAdmin || window.pgAdmin || {}; @@ -408,15 +408,14 @@ define([ 'schema': treeInfo.schema._label, 'table': treeInfo.table._label }); - var self = this, - baseUrl = "{{ url_for('import_export.index') }}" + - "create_job/" + treeInfo.server._id, - args = this.view.model.toJSON(); + var self = this; $.ajax({ - url: baseUrl, + url: url_for( + 'import_export.create_job', {'sid': treeInfo.server._id} + ), method: 'POST', - data:{ 'data': JSON.stringify(args) }, + data:{ 'data': JSON.stringify(this.view.model.toJSON()) }, success: function(res) { if (res.success) { Alertify.notify(gettext('Import/export job created.'), 'success', 5);