mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Code improvements to handle API errors gracefully in tree code. #6308
This commit is contained in:
@@ -543,6 +543,9 @@ export default function PreferencesComponent({ ...props }) {
|
||||
method: 'PUT',
|
||||
data: save_data,
|
||||
}).then(() => {
|
||||
let requiresTreeRefresh = save_data.some((s)=>{
|
||||
return s.name=='show_system_objects'||s.name=='show_empty_coll_nodes'||s.name.startsWith('show_node_')||s.name=='hide_shared_server';
|
||||
});
|
||||
let requires_refresh = false;
|
||||
/* Find the modules changed */
|
||||
let modulesChanged = {};
|
||||
@@ -559,25 +562,6 @@ export default function PreferencesComponent({ ...props }) {
|
||||
|
||||
requires_refresh = checkRefreshRequired(pref, requires_refresh);
|
||||
|
||||
if (pref.name == 'hide_shared_server') {
|
||||
Notify.confirm(
|
||||
gettext('Object explorer tree refresh required'),
|
||||
gettext('The object explorer tree refresh is required. Do you wish to refresh the tree?'),
|
||||
function () {
|
||||
pgAdmin.Browser.tree.destroy({
|
||||
success: function () {
|
||||
pgAdmin.Browser.initializeBrowserTree(pgAdmin.Browser);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
},
|
||||
function () {
|
||||
return true;
|
||||
},
|
||||
gettext('Refresh'),
|
||||
gettext('Later')
|
||||
);
|
||||
}
|
||||
// Sync the lock layout menu with preferences
|
||||
if (pref.name == 'lock_layout') {
|
||||
let fileMenu = pgAdmin.Browser.MainMenus.find((menu) => menu.name == 'file');
|
||||
@@ -593,6 +577,26 @@ export default function PreferencesComponent({ ...props }) {
|
||||
}
|
||||
}
|
||||
|
||||
if (requiresTreeRefresh) {
|
||||
Notify.confirm(
|
||||
gettext('Object explorer tree refresh required'),
|
||||
gettext('The object explorer tree refresh is required. Do you wish to refresh the tree?'),
|
||||
function () {
|
||||
pgAdmin.Browser.tree.destroy({
|
||||
success: function () {
|
||||
pgAdmin.Browser.initializeBrowserTree(pgAdmin.Browser);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
},
|
||||
function () {
|
||||
return true;
|
||||
},
|
||||
gettext('Refresh'),
|
||||
gettext('Later')
|
||||
);
|
||||
}
|
||||
|
||||
if (requires_refresh) {
|
||||
Notify.confirm(
|
||||
gettext('Refresh required'),
|
||||
|
||||
Reference in New Issue
Block a user