mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-20 11:48:31 -06:00
- Loading 'pgadmin' as 'sources/pgadmin', as found under the 'sources' reference directory to be consistent with other files. - Removed the 'pgadmin' reference from the base.html template. - Renamed 'pgadmin.slickgrid.editors.js', and 'pgadmin.slickgrid.formatters.js' as 'editors.js', and 'formatters.js' respectively, as they're already in the 'pgadmin/static/js/slickgrid' directory. - Removed the duplicate entry of 'translations' from the webpack.shim.js
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
define('pgadmin.settings',
|
|
[
|
|
'jquery', 'alertify', 'sources/pgadmin', 'underscore', 'backform',
|
|
'sources/gettext', 'sources/url_for', 'pgadmin.backform'
|
|
],
|
|
// This defines the Preference/Options Dialog for pgAdmin IV.
|
|
function($, alertify, pgAdmin, _, Backform, gettext, url_for) {
|
|
pgAdmin = pgAdmin || window.pgAdmin || {};
|
|
|
|
/*
|
|
* Hmm... this module is already been initialized, we can refer to the old
|
|
* object from here.
|
|
*/
|
|
if (pgAdmin.Settings)
|
|
return pgAdmin.Settings;
|
|
|
|
pgAdmin.Settings = {
|
|
init: function() {
|
|
if (this.initialized)
|
|
return;
|
|
|
|
this.initialized = true;
|
|
},
|
|
// We will force unload method to not to save current layout
|
|
// and reload the window
|
|
show: function() {
|
|
var obj = this;
|
|
alertify.confirm(gettext('Reset layout'),
|
|
gettext('Are you sure you want to reset the current layout? This will cause the application to reload and any un-saved data will be lost.'),
|
|
function() {
|
|
var reloadingIndicator = $('<div id="reloading-indicator"></div>');
|
|
$('body').append(reloadingIndicator);
|
|
// Delete the record from database as well, then only reload page
|
|
$.ajax({
|
|
url: url_for('settings.reset_layout'),
|
|
type: 'DELETE',
|
|
async: false,
|
|
success: function() {
|
|
// Prevent saving layout on server for next page reload.
|
|
$(window).unbind('unload');
|
|
window.onbeforeunload = null;
|
|
// Now reload page
|
|
location.reload(true);
|
|
},
|
|
error: function() {
|
|
console.log('Something went wrong on server while resetting layout');
|
|
}
|
|
});
|
|
|
|
},
|
|
function() {
|
|
// Do nothing as user canceled the operation.
|
|
}
|
|
);
|
|
}
|
|
};
|
|
|
|
return pgAdmin.Settings;
|
|
});
|