Ensure that the master password dialog is popped up if the crypt key is missing. Fixes #6960

This commit is contained in:
Akshay Joshi committed 2022-04-04 17:00:18 +05:30
1 parent ae7059aec1
commit 38278c179e
6 files changed
+51 -23

No files matched your search

@@ -190,14 +190,27 @@ export default function Statistics({ nodeData, item, node, ...props }) {
}
setLoaderText('');
})
.catch((e) => {
Notify.alert(
gettext('Failed to retrieve data from the server.'),
gettext(e.message)
);
.catch((err) => {
// show failed message.
setLoaderText('');
setMsg(gettext('Failed to retrieve data from the server.'));
if (err?.response?.data?.info == 'CRYPTKEY_MISSING') {
Notify.pgNotifier('error', err.request, 'The master password is not set', function(msg) {
setTimeout(function() {
if (msg == 'CRYPTKEY_SET') {
setMsg('No statistics are available for the selected object.');
} else if (msg == 'CRYPTKEY_NOT_SET') {
setMsg(gettext('The master password is not set.'));
}
}, 100);
});
} else {
Notify.alert(
gettext('Failed to retrieve data from the server.'),
gettext(err.message)
);
setMsg(gettext('Failed to retrieve data from the server.'));
}
});
} else {
setLoaderText('');