mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Replace Alertify alert and confirm with React-based model dialog. Fixes #7053
This commit is contained in:
@@ -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')
|
||||
);
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user