Replace Alertify alert and confirm with React-based model dialog. Fixes #7053

This commit is contained in:
Akshay Joshi
2021-12-07 18:52:40 +05:30
parent e327066523
commit fd53e4f5f9
62 changed files with 393 additions and 398 deletions

View File

@@ -14,6 +14,7 @@ import url_for from 'sources/url_for';
import axios from 'axios/index';
import {retrieveAncestorOfTypeServer} from 'sources/tree/tree_utils';
import {hasBinariesConfiguration} from 'sources/utils';
import Notify from '../../../../static/js/helpers/Notifier';
export class RestoreDialog extends Dialog {
constructor(pgBrowser, $, alertify, RestoreModel, backform = Backform) {
@@ -29,12 +30,12 @@ export class RestoreDialog extends Dialog {
}
draw(action, aciTreeItem, width, height) {
const serverInformation = retrieveAncestorOfTypeServer(this.pgBrowser, aciTreeItem, gettext('Restore Error'), this.alertify);
const serverInformation = retrieveAncestorOfTypeServer(this.pgBrowser, aciTreeItem, gettext('Restore Error'));
if (!serverInformation) {
return;
}
if (!hasBinariesConfiguration(this.pgBrowser, serverInformation, this.alertify)) {
if (!hasBinariesConfiguration(this.pgBrowser, serverInformation)) {
return;
}
@@ -46,7 +47,7 @@ export class RestoreDialog extends Dialog {
baseUrl
).then(function(res) {
if (!res.data.success) {
that.alertify.alert(
Notify.alert(
gettext('Utility not found'),
res.data.errormsg
);
@@ -70,7 +71,7 @@ export class RestoreDialog extends Dialog {
that.alertify.pg_restore(title, aciTreeItem1, data, node)
.resizeTo(width, height);
}).catch(function() {
that.alertify.alert(
Notify.alert(
gettext('Utility not found'),
gettext('Failed to fetch Utility information')
);

View File

@@ -12,6 +12,7 @@ import _ from 'underscore';
import gettext from '../../../../static/js/gettext';
import url_for from '../../../../static/js/url_for';
import {DialogWrapper} from '../../../../static/js/alertify/dialog_wrapper';
import Notify from '../../../../static/js/helpers/Notifier';
export class RestoreDialogWrapper extends DialogWrapper {
constructor(dialogContainerSelector, dialogTitle, typeOfDialog,
@@ -156,10 +157,10 @@ export class RestoreDialogWrapper extends DialogWrapper {
this.view.model.toJSON()
).then(function (res) {
if (res.data.success) {
dialogWrapper.alertify.success(gettext('Restore job created.'), 5);
Notify.success(gettext('Restore job created.'), 5);
dialogWrapper.pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialogWrapper);
} else {
dialogWrapper.alertify.alert(
Notify.alert(
gettext('Restore job creation failed.'),
res.data.errormsg
);
@@ -167,7 +168,7 @@ export class RestoreDialogWrapper extends DialogWrapper {
}).catch(function (error) {
try {
const err = error.response.data;
dialogWrapper.alertify.alert(
Notify.alert(
gettext('Restore job failed.'),
err.errormsg
);