mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-23 01:06:31 -06:00
Store layout changes on each adjustment, rather than on unload which is unreliable. Fixes #1967
We also use an async request now, rather than a deprecated sync request.
This commit is contained in:
parent
024b664c21
commit
0d4bc0d27d
@ -300,6 +300,17 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
$obj_mnu.append(create_submenu.$el);
|
||||
}
|
||||
},
|
||||
save_current_layout: function(obj) {
|
||||
if(obj.docker) {
|
||||
state = obj.docker.save();
|
||||
settings = { setting: "Browser/Layout", value: state };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ url_for('settings.store') }}",
|
||||
data: settings
|
||||
});
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
var obj=this;
|
||||
if (obj.initialized) {
|
||||
@ -307,21 +318,6 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
}
|
||||
obj.initialized = true;
|
||||
|
||||
// Store the main browser layout
|
||||
$(window).bind('unload', function() {
|
||||
if(obj.docker) {
|
||||
state = obj.docker.save();
|
||||
settings = { setting: "Browser/Layout", value: state };
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: "{{ url_for('settings.store') }}",
|
||||
data: settings,
|
||||
async:false
|
||||
});
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// Initialize the Docker
|
||||
obj.docker = new wcDocker(
|
||||
'#dockerContainer', {
|
||||
@ -355,6 +351,19 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
|
||||
} else {
|
||||
obj.buildDefaultLayout()
|
||||
}
|
||||
|
||||
// Listen to panel attach/detach event so that last layout will be remembered
|
||||
_.each(obj.panels, function(panel, name) {
|
||||
panel.panel.on(wcDocker.EVENT.ATTACHED, function() {
|
||||
obj.save_current_layout(obj);
|
||||
});
|
||||
panel.panel.on(wcDocker.EVENT.DETACHED, function() {
|
||||
obj.save_current_layout(obj);
|
||||
});
|
||||
panel.panel.on(wcDocker.EVENT.MOVE_ENDED, function() {
|
||||
obj.save_current_layout(obj);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Syntax highlight the SQL Pane
|
||||
|
Loading…
Reference in New Issue
Block a user