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.
This commit is contained in:
Surinder Kumar authored and Dave Page committed 2016-10-21 14:26:12 +01:00
1 parent 406dab069d
commit 1e66119ef5
2 files changed
+29 -6

No files matched your search

@@ -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() {
@@ -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');
}
});
},