From 1e66119ef58e4d310daaece697e3546ec1380712 Mon Sep 17 00:00:00 2001 From: Surinder Kumar Date: Fri, 21 Oct 2016 14:26:12 +0100 Subject: [PATCH] Ensure the File Manager honours the file type while traversing the directories. Fixes #1858 When a File Manager is closed by clicking cancel button. Its dom element not destroyed.. So on traversing into directories, when it tries to get currently selected file type, it looks into the dom element but it gets dom of previous dialogs not of currently dialog. Now whenever an instance of File Manager is closed. its dom elements are also destroyed. --- .../templates/file_manager/js/file_manager.js | 28 +++++++++++++++---- .../templates/sqleditor/js/sqleditor.js | 7 +++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js index 9e8a0804c..473a05f92 100644 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js @@ -141,8 +141,12 @@ define([ var newFile = $('.currentpath').val() + sel_file; pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:storage_dialog', newFile); + } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + if (removeTransId(trans_id)) { + this.destroy(); + return; + } } - removeTransId(trans_id); }, build: function() { this.elements.content.appendChild($container.get(0)); @@ -253,8 +257,13 @@ define([ var newFile = $('.currentpath').val() + sel_file; pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:select_file', newFile); + removeTransId(trans_id); + } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + if (removeTransId(trans_id)) { + this.destroy(); + return; + } } - removeTransId(trans_id); }, build: function() { this.elements.content.appendChild($container.get(0)); @@ -365,8 +374,13 @@ define([ var newFile = $('.currentpath').val() + sel_file; pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:select_folder', newFile); + removeTransId(trans_id); + } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + if (removeTransId(trans_id)) { + this.destroy(); + return; + } } - removeTransId(trans_id); }, build: function() { this.elements.content.appendChild($container.get(0)); @@ -522,9 +536,11 @@ define([ pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:create_file', newFile); removeTransId(trans_id); } - } - if (closeEvent.button.text == "{{ _('Cancel') }}") { - removeTransId(trans_id); + } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + if (removeTransId(trans_id)) { + this.destroy(); + return; + } } }, build: function() { diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 83c70f29f..d0cc3d696 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -2325,6 +2325,9 @@ define( 'pgadmin-sqleditor:loading-icon:show', '{{ _('Loading the file...') }}' ); + // set cursor to progress before file load + var $busy_icon_div = $('.sql-editor-busy-fetching'); + $busy_icon_div.addClass('show_progress'); // Make ajax call to load the data from file $.ajax({ @@ -2339,11 +2342,15 @@ define( self.setTitle(self.gridView.current_file.replace(/^\/|\/$/g, '')); } self.trigger('pgadmin-sqleditor:loading-icon:hide'); + // hide cursor + $busy_icon_div.removeClass('show_progress'); }, error: function(e) { var errmsg = $.parseJSON(e.responseText).errormsg; alertify.error(errmsg); self.trigger('pgadmin-sqleditor:loading-icon:hide'); + // hide cursor + $busy_icon_div.removeClass('show_progress'); } }); },