mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed issue of error message not getting displayed when filename is empty for backup, restore, and import/export. Fixes #3814.
This commit is contained in:
@@ -98,11 +98,22 @@ export class RestoreDialogWrapper extends DialogWrapper {
|
||||
const dialog = this.createDialog(node, treeInfo, $container);
|
||||
this.addAlertifyClassToRestoreNodeChildNodes();
|
||||
dialog.render();
|
||||
const statusBar = this.jquery(
|
||||
'<div class=\'pg-prop-status-bar pg-prop-status-bar-absolute pg-el-xs-12 d-none\'>' +
|
||||
' <div class="error-in-footer"> ' +
|
||||
' <div class="d-flex px-2 py-1"> ' +
|
||||
' <div class="pr-2"> ' +
|
||||
' <i class="fa fa-exclamation-triangle text-danger" aria-hidden="true"></i> ' +
|
||||
' </div> ' +
|
||||
' <div class="alert-text" role="alert"></div> ' +
|
||||
' </div> ' +
|
||||
' </div> ' +
|
||||
'</div>').appendTo($container);
|
||||
|
||||
this.elements.content.appendChild($container.get(0));
|
||||
|
||||
this.focusOnDialog(this);
|
||||
this.setListenersForFilenameChanges();
|
||||
this.setListenersForFilenameChanges(statusBar);
|
||||
}
|
||||
|
||||
callback(event) {
|
||||
@@ -218,16 +229,27 @@ export class RestoreDialogWrapper extends DialogWrapper {
|
||||
return treeInfo.server._id;
|
||||
}
|
||||
|
||||
setListenersForFilenameChanges() {
|
||||
setListenersForFilenameChanges(statusBar) {
|
||||
const self = this;
|
||||
|
||||
this.view.model.on('change', function () {
|
||||
const ctx = this;
|
||||
var errmsg;
|
||||
|
||||
const showError = function(errorField, errormsg) {
|
||||
ctx.errorModel.set(errorField, errormsg);
|
||||
statusBar.removeClass('d-none');
|
||||
statusBar.find('.alert-text').html(errormsg);
|
||||
};
|
||||
|
||||
if (!_.isUndefined(this.get('file')) && this.get('file') !== '') {
|
||||
this.errorModel.clear();
|
||||
statusBar.addClass('d-none');
|
||||
self.enableRestoreButton();
|
||||
} else {
|
||||
self.disableRestoreButton();
|
||||
this.errorModel.set('file', gettext('Please provide a filename'));
|
||||
errmsg = gettext('Please provide a filename');
|
||||
showError('file', errmsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user