Ensure that the browser tree should be refreshed after changing the ownership. Fixes #7607

This commit is contained in:
Akshay Joshi 2022-09-14 15:08:05 +05:30
parent 2de965d710
commit 16bcb7d4a2
4 changed files with 30 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -30,6 +30,7 @@ Bug fixes
*********
| `Issue #7580 <https://redmine.postgresql.org/issues/7580>`_ - Fixed an issue where backup does not work due to parameter 'preexec_fn' no longer being supported.
| `Issue #7607 <https://redmine.postgresql.org/issues/7607>`_ - Ensure that the browser tree should be refreshed after changing the ownership.
| `Issue #7644 <https://redmine.postgresql.org/issues/7644>`_ - Ensure that the dump servers functionality works from setup.py.
| `Issue #7646 <https://redmine.postgresql.org/issues/7646>`_ - Ensure that the Import/Export server menu option is visible.
| `Issue #7648 <https://redmine.postgresql.org/issues/7648>`_ - Fixed API test case for change password in the server mode.

View File

@ -30,12 +30,11 @@ class ChangeOwnershipSchema extends BaseUISchema {
return [
{
id: 'note', type: 'note',
text: gettext('Select the user that will take ownership of the shared servers created by <b>' + self.deletedUser + '</b>. <b>' + self.noOfSharedServers + '</b> shared servers are currently owned by this user.'),
text: gettext('Select the user that will take ownership of the shared servers created by <b>' + self.deletedUser + '</b>. <b>' + self.noOfSharedServers + '</b> shared servers are currently owned by this user. </br></br> Clicking on the “Change” button will either change ownership if a user is selected or delete any shared servers if no user is selected. There is no way to reverse this action.'),
}, {
id: 'newUser', label: gettext('User'),
type: 'select', controlProps: {allowClear: true},
options: self.adminUserList,
helpMessage: gettext('Note: If no user is selected, the shared servers will be deleted.')
options: self.adminUserList
}
];
}

View File

@ -215,8 +215,9 @@ class UserManagementCollection extends BaseUISchema {
class UserManagementSchema extends BaseUISchema {
constructor(authSources, roleOptions) {
super();
super({refreshBrowserTree: false});
this.userManagementCollObj = new UserManagementCollection(authSources, roleOptions);
this.changeOwnership = false;
}
deleteUser(deleteRow) {
@ -251,7 +252,10 @@ class UserManagementSchema extends BaseUISchema {
result?.data?.data?.result?.data,
res?.data?.data?.shared_servers,
deletedUser,
deleteRow
()=> {
this.changeOwnership = true;
deleteRow();
}
);
})
.catch((err)=>{
@ -268,6 +272,12 @@ class UserManagementSchema extends BaseUISchema {
},
canSearch: true
},
{
id: 'refreshBrowserTree', visible: false, type: 'boolean',
deps: ['userManagement'], depChange: ()=> {
return { refreshBrowserTree: this.changeOwnership }
}
}
];
}
}
@ -310,6 +320,21 @@ function UserManagementDialog({onClose}) {
const onSaveClick = (_isNew, changeData)=>{
return new Promise((resolve, reject)=>{
try {
if (changeData['refreshBrowserTree']) {
// Confirmation dialog to refresh the browser tree.
Notify.confirm(
gettext('Browser tree refresh required'),
gettext('The ownership of the shared server was changed or the shared server was deleted, so a browser tree refresh is required. Do you wish to refresh the tree?'),
function () {
pgAdmin.Browser.tree.destroy();
},
function () {
return true;
},
gettext('Refresh'),
gettext('Later')
);
}
api.post(url_for('user_management.save'), changeData['userManagement'])
.then(()=>{
Notify.success('Users Saved Successfully');