Remove Alertify dialog from Grant Wizard, Import/Export Servers and Cloud.
parent
81f52a82c8
commit
81b0d1138b
|
@ -205,7 +205,7 @@ define('pgadmin.node.mview', [
|
|||
if (refreshed_res.data && refreshed_res.data.status) {
|
||||
//Do nothing as we are creating the job and exiting from the main dialog
|
||||
Notify.success(refreshed_res.data.info);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', obj);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created');
|
||||
} else {
|
||||
Notify.alert(
|
||||
gettext('Failed to create materialized view refresh job.'),
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
/** CSS for Wizard **/
|
||||
|
||||
.wizard-header h3 {
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.wizard_dlg {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
@ -47,23 +40,6 @@
|
|||
margin: 0 -6px 3px -6px;
|
||||
}
|
||||
|
||||
.wizard-header button {
|
||||
padding: 10px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.wizard-header .ajs-close.wizard-cancel-event {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAdklEQVQ4jd2SwQnAIAxF36GH0pOTFHEgF3IkR5LO0F4SCGJVEHroAy/f/E+igV+yAa6hO7nrcgAZuIBg9CBalppXEnDL0RA1q556ASdQqhBrLlLTxVch1uxHZiU2AuKs2Vdt23GGHSy/wfIvzOzBPhpjaRO/5wG/szevJ+ZXzAAAAABJRU5ErkJggg==) no-repeat center center;
|
||||
}
|
||||
|
||||
.wizard-header .ajs-maximize.wizard-maximize-event {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAZklEQVQ4jcWTuw2AMAxEn5jBs7B/e0gpmAiKEGRS5QDBSS7v+Q8fSsCWQgDTA+DsGgJYuypumTNkWCWZg9q/HIAOSDim/xTUcu0exXXaxQG0teRVWQPLx2Gbe8B55yNqv7C4GV/TDq//J11odoZgAAAAAElFTkSuQmCC) no-repeat center center;
|
||||
}
|
||||
|
||||
.wizard-header .ajs-maximized.wizard-maximize-event {
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA8klEQVQ4jZ3QMUpDQRCH8V+ewULQE4iERTyCrQiDCpbaCKKljbV4A89gqVgGrCMDWlpaWwVPoFYiIjYv8hBJXjLN7s7u9+3wZ4aKiOWI2IJOi8dHuM7MXxj3WMHe3CRBKeUGvVJKllJG8CrmoNty6jMsYKeGoY/jtgI4bez7OMjMr2oKwaieRzDMIljDRUSgXQZPeG2cv7GOffQ7ETGPcyw2HozWQWY+jLN3M/MzIu4wwNKf+zeMFVSQmY/YbfzeuiqIiAonZgi1quErHNa9F7xPM8FlAx5iA9ttJRVu8VHDm5k5rDNpLRERWxHR+6c/MZMfLIJDwzY66IkAAAAASUVORK5CYII=) no-repeat center center;
|
||||
}
|
||||
|
||||
/* Wizard Status bar CSS */
|
||||
.pgadmin-wizard .wizard-description {
|
||||
padding: 0.5rem 0rem;
|
||||
|
|
|
@ -1,319 +0,0 @@
|
|||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin 4 - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2013 - 2022, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
define([
|
||||
'underscore', 'jquery', 'backbone', 'sources/pgadmin', 'pgadmin.browser',
|
||||
'sources/gettext', 'sources/utils',
|
||||
], function(_, $, Backbone, pgAdmin, pgBrowser, gettext, commonUtils) {
|
||||
|
||||
/* Wizard individual Page Model */
|
||||
pgBrowser.WizardPage = Backbone.Model.extend({
|
||||
defaults: {
|
||||
id: undefined,
|
||||
/* Id */
|
||||
page_title: undefined,
|
||||
/* Page Title */
|
||||
view: undefined,
|
||||
/* A Backbone View */
|
||||
html: undefined,
|
||||
/* HTML tags to be rendered */
|
||||
image: undefined,
|
||||
/* Left hand side image */
|
||||
disable_prev: false,
|
||||
/* Previous Button Flag */
|
||||
disable_next: false,
|
||||
/* Next Button Flag */
|
||||
disable_cancel: false,
|
||||
/* Cancel Button Flag */
|
||||
show_progress_bar: '',
|
||||
/* Callback for OnLoad */
|
||||
onLoad: function() {
|
||||
return true;
|
||||
},
|
||||
/* Callback for before Next */
|
||||
beforeNext: function() {
|
||||
return true;
|
||||
},
|
||||
onNext: function() {/*This is intentional (SonarQube)*/},
|
||||
onBefore: function() {/*This is intentional (SonarQube)*/},
|
||||
/* Callback for before Previous */
|
||||
beforePrev: function() {
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
pgBrowser.Wizard = Backbone.View.extend({
|
||||
options: {
|
||||
title: 'Wizard',
|
||||
/* Main Wizard Title */
|
||||
image: 'left_panel.png',
|
||||
/* TODO:: We can use default image here */
|
||||
curr_page: 0,
|
||||
/* Current Page to Load */
|
||||
disable_next: false,
|
||||
disable_prev: false,
|
||||
disable_finish: false,
|
||||
disable_cancel: false,
|
||||
show_header_cancel_btn: false,
|
||||
/* show cancel button at wizard header */
|
||||
show_header_maximize_btn: false,
|
||||
/* show maximize button at wizard header */
|
||||
dialog_api: null,
|
||||
height: 400,
|
||||
width: 650,
|
||||
show_left_panel: true,
|
||||
wizard_help: '',
|
||||
},
|
||||
tmpl: _.template(
|
||||
' <div class="pgadmin-wizard" style="height: <%= this.options.height %>px;' +
|
||||
' width: <%= this.options.width %>px">' +
|
||||
' <div class="wizard-header wizard-badge">' +
|
||||
' <div class="d-flex">' +
|
||||
' <div>' +
|
||||
' <h3><span id="main-title"><%= this.options.title %></span> -' +
|
||||
' <span id="step-title"><%= page_title %></span></h3>' +
|
||||
' </div>' +
|
||||
' <% if (this.options.show_header_cancel_btn) { %>' +
|
||||
' <div class="ml-auto">' +
|
||||
' <button aria-label="' + gettext('Close') +'" tabindex="0" class="ajs-close wizard-cancel-event pull-right"' +
|
||||
' title="' + gettext('Close') + '"></button>' +
|
||||
' <% if (this.options.show_header_maximize_btn) { %>' +
|
||||
' <button aria-label="' + gettext('Maximize') + '" tabindex="0" class="ajs-maximize wizard-maximize-event mr-1 pull-right"' +
|
||||
' title="' + gettext('Maximize') + '"></button>' +
|
||||
' <% } %>' +
|
||||
' </div>' +
|
||||
' <% } %>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <div class="wizard-content row m-0">' +
|
||||
' <% if (this.options.show_left_panel) { %>' +
|
||||
' <div class="col-sm-3 wizard-left-panel">' +
|
||||
' <img src="<%= this.options.image %>"' +
|
||||
' alt="' + gettext('Left panel logo') + '"></div>' +
|
||||
' <% } %>' +
|
||||
' <div class="col-sm-<% if (this.options.show_left_panel) { %>9<% }' +
|
||||
' else { %>12<% } %> wizard-right-panel">' +
|
||||
' <% if ( typeof show_description != "undefined" && show_description != ""){ %>' +
|
||||
' <div class="wizard-description">' +
|
||||
' <%= show_description %>' +
|
||||
' </div>' +
|
||||
' <% } %>' +
|
||||
' <div class="wizard-progress-bar"><% if (show_progress_bar) { %>' +
|
||||
' <p role="status" class="alert alert-info col-sm-12"><%= show_progress_bar %></p><% } %>' +
|
||||
' </div>' +
|
||||
' <div class="wizard-right-panel_content">' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' <div class="wizard-footer pg-prop-footer">' +
|
||||
' <div class="pg-prop-status-bar" style="visibility:hidden">' +
|
||||
' <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" role="img"></i> ' +
|
||||
' </div> ' +
|
||||
' <div role="alert" class="alert-text"></div> ' +
|
||||
' <div class="ml-auto close-error-bar"> ' +
|
||||
' <a aria-label="' + gettext('Close error bar') + '" class="close-error fa fa-times text-danger"></a> ' +
|
||||
' </div> ' +
|
||||
' </div> ' +
|
||||
' </div> ' +
|
||||
' </div>' +
|
||||
' <div class="wizard-buttons d-flex">' +
|
||||
' <div>' +
|
||||
' <button tabindex="0" aria-label="' + gettext('Help') + '" title = "' + gettext('Help for this dialog.') + '"' +
|
||||
' class="btn btn-primary-icon pull-left wizard-help" <%=this.options.wizard_help ? "" : "disabled" %>>' +
|
||||
' <span class="fa fa-lg fa-question" role="img"></span></button>' +
|
||||
' </div>' +
|
||||
' <div class="ml-auto">' +
|
||||
' <button class="btn btn-secondary wizard-cancel" <%=this.options.disable_cancel ? "disabled" : ""%>>' +
|
||||
' <i class="fa fa-times" role="img"></i> ' + gettext('Cancel') + '</button>' +
|
||||
' <button class="btn btn-secondary wizard-back" <%=this.options.disable_prev ? "disabled" : ""%>>' +
|
||||
' <i class="fa fa-backward" role="img"></i> ' + gettext('Back') + '</button>' +
|
||||
' <button class="btn btn-secondary wizard-next" <%=this.options.disable_next ? "disabled" : ""%>>' +
|
||||
' ' + gettext('Next') +
|
||||
' <i class="fa fa-forward"></i></button>' +
|
||||
' <button class="btn btn-primary wizard-finish" <%=this.options.disable_finish ? "disabled" : ""%>>' +
|
||||
' <i class="fa fa-check" role="img"></i> ' + gettext('Finish') + '</button>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
' </div>'),
|
||||
events: {
|
||||
'click button.wizard-next': 'nextPage',
|
||||
'click button.wizard-back': 'prevPage',
|
||||
'click button.wizard-cancel': 'onCancel',
|
||||
'click button.wizard-cancel-event': 'onCancel',
|
||||
'click button.wizard-maximize-event': 'onMaximize',
|
||||
'click button.wizard-finish': 'finishWizard',
|
||||
'click button.wizard-help': 'onDialogHelp',
|
||||
'click a.close-error': 'closeErrorMsg',
|
||||
'keydown': 'keydownHandler',
|
||||
},
|
||||
initialize: function(options) {
|
||||
this.options = _.extend({}, this.options, options.options);
|
||||
this.currPage = this.collection.at(this.options.curr_page).toJSON();
|
||||
},
|
||||
render: function() {
|
||||
var self = this,
|
||||
data = this.currPage;
|
||||
|
||||
/* Check Status of the buttons */
|
||||
this.options.disable_next = (this.options.disable_next ? true : this.evalASFunc(this.currPage.disable_next));
|
||||
this.options.disable_prev = (this.options.disable_prev ? true : this.evalASFunc(this.currPage.disable_prev));
|
||||
this.options.disable_cancel = (this.currPage.canCancel ? true : this.evalASFunc(this.currPage.disable_cancel));
|
||||
|
||||
/* HTML Content */
|
||||
if (data.html) {
|
||||
data.content = data.html;
|
||||
}
|
||||
/* Backbone View */
|
||||
else if (data.view) {
|
||||
data.content = data.view.render().el;
|
||||
}
|
||||
|
||||
$(this.el).html(this.tmpl(data));
|
||||
$(this.el).find('.wizard-right-panel_content').html(data.content);
|
||||
|
||||
/* OnLoad Callback */
|
||||
this.onLoad();
|
||||
setTimeout(function() {
|
||||
var container = $(self.el);
|
||||
commonUtils.findAndSetFocus(container);
|
||||
}, 500);
|
||||
|
||||
return this;
|
||||
},
|
||||
nextPage: function() {
|
||||
if (!this.beforeNext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var page_id = this.onNext();
|
||||
|
||||
if (page_id) {
|
||||
this.currPage = this.collection.get(page_id).toJSON();
|
||||
this.options.curr_page = this.collection.indexOf(this.collection.get(page_id));
|
||||
} else if (this.options.curr_page < (this.collection.length - 1)) {
|
||||
this.options.curr_page = this.options.curr_page + 1;
|
||||
this.currPage = this.collection.at(this.options.curr_page).toJSON();
|
||||
}
|
||||
|
||||
this.enableDisableNext();
|
||||
this.enableDisablePrev();
|
||||
|
||||
return this.render();
|
||||
},
|
||||
prevPage: function() {
|
||||
if (!this.beforePrev()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var page_id = this.onPrev();
|
||||
|
||||
if (page_id) {
|
||||
this.currPage = this.collection.get(page_id).toJSON();
|
||||
this.options.curr_page = this.collection.indexOf(this.collection.get(page_id));
|
||||
} else if (this.options.curr_page > 0) {
|
||||
this.options.curr_page = this.options.curr_page - 1;
|
||||
this.currPage = this.collection.at(this.options.curr_page).toJSON();
|
||||
}
|
||||
|
||||
this.enableDisableNext();
|
||||
this.enableDisablePrev();
|
||||
|
||||
return this.render();
|
||||
},
|
||||
finishWizard: function() {
|
||||
this.onFinish();
|
||||
this.remove(); // Remove view from DOM
|
||||
this.off(); // Unbind all local event bindings
|
||||
delete this.$el; // Delete the jQuery wrapped object variable
|
||||
delete this.el; // Delete the variable reference to this node
|
||||
return true;
|
||||
},
|
||||
keydownHandler: function(event) {
|
||||
commonUtils.handleKeyNavigation(event);
|
||||
},
|
||||
enableDisableNext: function(disable) {
|
||||
if (typeof(disable) != 'undefined') {
|
||||
this.options.disable_next = disable;
|
||||
} else if (this.options.curr_page >= (this.collection.length - 1)) {
|
||||
this.options.disable_next = true;
|
||||
} else {
|
||||
this.options.disable_next = false;
|
||||
}
|
||||
},
|
||||
enableDisablePrev: function(disable) {
|
||||
if (typeof(disable) != 'undefined') {
|
||||
this.options.disable_prev = disable;
|
||||
} else if (this.options.curr_page <= 0) {
|
||||
this.options.disable_prev = true;
|
||||
} else {
|
||||
this.options.disable_prev = false;
|
||||
}
|
||||
},
|
||||
closeErrorMsg: function() {
|
||||
$(this.el).find('.pg-prop-status-bar .alert-text').empty();
|
||||
$(this.el).find('.pg-prop-status-bar').css('visibility', 'hidden');
|
||||
},
|
||||
beforeNext: function() {
|
||||
return this.evalASFunc(this.currPage.beforeNext);
|
||||
},
|
||||
beforePrev: function() {
|
||||
return this.evalASFunc(this.currPage.beforePrev);
|
||||
},
|
||||
onPrev: function() {
|
||||
return this.evalASFunc(this.currPage.onPrev);
|
||||
},
|
||||
onNext: function() {
|
||||
return this.evalASFunc(this.currPage.onNext);
|
||||
},
|
||||
onLoad: function() {
|
||||
return this.evalASFunc(this.currPage.onLoad);
|
||||
},
|
||||
onFinish: function() {
|
||||
return true;
|
||||
},
|
||||
onCancel: function() {
|
||||
this.$el.remove();
|
||||
return true;
|
||||
},
|
||||
onMaximize: function() {
|
||||
var dialog_api = this.options.dialog_api,
|
||||
_el = this.$el.find('.wizard-maximize-event');
|
||||
|
||||
// If no dialog api found then return
|
||||
if (!dialog_api) return;
|
||||
|
||||
if (dialog_api.isMaximized()) {
|
||||
// toggle the icon
|
||||
_el.removeClass('ajs-maximized');
|
||||
dialog_api.restore();
|
||||
} else {
|
||||
// toggle the icon
|
||||
_el.addClass('ajs-maximized ' + _el.attr('class'));
|
||||
dialog_api.maximize();
|
||||
}
|
||||
},
|
||||
evalASFunc: function(func, ctx) {
|
||||
var self = this;
|
||||
ctx = ctx || self.currPage;
|
||||
|
||||
return (_.isFunction(func) ? func.apply(ctx, [self]) : func);
|
||||
},
|
||||
onDialogHelp: function() {
|
||||
window.open(this.options.wizard_help, 'pgadmin_help');
|
||||
},
|
||||
});
|
||||
|
||||
return pgBrowser;
|
||||
|
||||
});
|
|
@ -16,7 +16,7 @@ import Wizard from '../../../../static/js/helpers/wizard/Wizard';
|
|||
import WizardStep from '../../../../static/js/helpers/wizard/WizardStep';
|
||||
import {FormFooterMessage, MESSAGE_TYPE } from '../../../../static/js/components/FormComponents';
|
||||
import getApiInstance from '../../../../static/js/api_instance';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import Notifier from '../../../../static/js/helpers/Notifier';
|
||||
import PropTypes from 'prop-types';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import {ToggleButtons, FinalSummary} from './cloud_components';
|
||||
|
@ -62,7 +62,7 @@ const useStyles = makeStyles(() =>
|
|||
export const CloudWizardEventsContext = React.createContext();
|
||||
|
||||
|
||||
export default function CloudWizard({ nodeInfo, nodeData }) {
|
||||
export default function CloudWizard({ nodeInfo, nodeData, onClose}) {
|
||||
const classes = useStyles();
|
||||
|
||||
const eventBus = React.useRef(new EventBus());
|
||||
|
@ -112,7 +112,7 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
|
|||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
Alertify.error(gettext(`Error while getting the host ip: ${error.response.data.errormsg}`));
|
||||
Notifier.error(gettext(`Error while getting the host ip: ${error.response.data.errormsg}`));
|
||||
});
|
||||
}, [cloudProvider]);
|
||||
|
||||
|
@ -153,11 +153,11 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
|
|||
axiosApi.post(_url, post_data)
|
||||
.then((res) => {
|
||||
pgAdmin.Browser.Events.trigger('pgadmin:browser:tree:add', res.data.data.node, {'server_group': nodeInfo['server_group']});
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-bgprocess:created', Alertify.cloudWizardDialog());
|
||||
Alertify.cloudWizardDialog().close();
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-bgprocess:created');
|
||||
onClose();
|
||||
})
|
||||
.catch((error) => {
|
||||
Alertify.error(gettext(`Error while saving cloud wizard data: ${error.response.data.errormsg}`));
|
||||
Notifier.error(gettext(`Error while saving cloud wizard data: ${error.response.data.errormsg}`));
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -450,4 +450,5 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
|
|||
CloudWizard.propTypes = {
|
||||
nodeInfo: PropTypes.object,
|
||||
nodeData: PropTypes.object,
|
||||
onClose: PropTypes.func
|
||||
};
|
||||
|
|
|
@ -11,16 +11,15 @@ import ReactDOM from 'react-dom';
|
|||
import Theme from 'sources/Theme';
|
||||
import CloudWizard from './CloudWizard';
|
||||
import getApiInstance from '../../../../static/js/api_instance';
|
||||
import Notifier from '../../../../static/js/helpers/Notifier';
|
||||
|
||||
|
||||
// Cloud Wizard
|
||||
define('pgadmin.misc.cloud', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'pgadmin.alertifyjs',
|
||||
'sources/gettext', 'sources/url_for',
|
||||
'pgadmin.browser',
|
||||
'pgadmin.browser.wizard',
|
||||
], function(
|
||||
gettext, url_for, $, _, Alertify, pgBrowser
|
||||
gettext, url_for, pgBrowser
|
||||
) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
|
@ -70,92 +69,35 @@ define('pgadmin.misc.cloud', [
|
|||
|
||||
// Callback to draw Wizard Dialog
|
||||
start_cloud_wizard: function() {
|
||||
let t = pgBrowser.tree,
|
||||
i = t.selected(),
|
||||
d = this.d = i ? t.itemData(i) : undefined,
|
||||
info = this.info = pgBrowser.tree.getTreeNodeHierarchy(i);
|
||||
|
||||
// Declare Wizard dialog
|
||||
if (!Alertify.cloudWizardDialog) {
|
||||
Alertify.dialog('cloudWizardDialog', function factory() {
|
||||
// Register dialog panel
|
||||
pgBrowser.Node.registerUtilityPanel();
|
||||
let panel = pgBrowser.Node.addUtilityPanel(920, 650),
|
||||
j = panel.$container.find('.obj_properties').first();
|
||||
panel.title(gettext('Deploy Cloud Instance'));
|
||||
|
||||
// Generate wizard main container
|
||||
var $container = $('<div class=\'wizard_dlg\' id=\'cloudWizardDlg\'></div>');
|
||||
return {
|
||||
main: function () {
|
||||
/*This is intentional (SonarQube)*/
|
||||
},
|
||||
setup: function () {
|
||||
return {
|
||||
// Set options for dialog
|
||||
options: {
|
||||
frameless: true,
|
||||
resizable: true,
|
||||
autoReset: false,
|
||||
maximizable: true,
|
||||
closable: true,
|
||||
closableByDimmer: false,
|
||||
modal: true,
|
||||
pinnable: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
build: function () {
|
||||
this.elements.content.appendChild($container.get(0));
|
||||
Alertify.pgDialogBuild.apply(this);
|
||||
var t = pgBrowser.tree,
|
||||
i = t.selected(),
|
||||
d = this.d = i ? t.itemData(i) : undefined,
|
||||
info = this.info = pgBrowser.tree.getTreeNodeHierarchy(i);
|
||||
panel.on(window.wcDocker.EVENT.CLOSED, function() {
|
||||
const axiosApi = getApiInstance();
|
||||
let _url = url_for('cloud.clear_cloud_session');
|
||||
axiosApi.post(_url)
|
||||
.then(() => {})
|
||||
.catch((error) => {
|
||||
Notifier.error(gettext(`Error while clearing cloud wizard data: ${error.response.data.errormsg}`));
|
||||
});
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
if (document.getElementById('cloudWizardDlg')) {
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<CloudWizard nodeInfo={info} nodeData={d} />
|
||||
</Theme>,
|
||||
document.getElementById('cloudWizardDlg'));
|
||||
Alertify.cloudWizardDialog().elements.modal.style.maxHeight=0;
|
||||
Alertify.cloudWizardDialog().elements.modal.style.maxWidth='none';
|
||||
Alertify.cloudWizardDialog().elements.modal.style.overflow='visible';
|
||||
Alertify.cloudWizardDialog().elements.dimmer.style.display='none';
|
||||
}
|
||||
}, 500);
|
||||
|
||||
},
|
||||
prepare: function () {
|
||||
$container.empty().append('<div class=\'cloud_wizard_container\'></div>');
|
||||
},
|
||||
hooks: {
|
||||
// Triggered when the dialog is closed
|
||||
onclose: function () {
|
||||
if(event.target instanceof Object && event.target.className == 'ajs-close'){
|
||||
const axiosApi = getApiInstance();
|
||||
let _url = url_for('cloud.clear_cloud_session');
|
||||
axiosApi.post(_url)
|
||||
.then(() => {})
|
||||
.catch((error) => {
|
||||
Alertify.error(gettext(`Error while clearing cloud wizard data: ${error.response.data.errormsg}`));
|
||||
});
|
||||
}
|
||||
// Clear the view and remove the react component.
|
||||
return setTimeout((function () {
|
||||
ReactDOM.unmountComponentAtNode(document.getElementById('cloudWizardDlg'));
|
||||
return Alertify.cloudWizardDialog().destroy();
|
||||
}), 10);
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
// Call Grant Wizard Dialog and set dimensions for wizard
|
||||
Alertify.cloudWizardDialog('').set({
|
||||
onmaximize:function(){
|
||||
Alertify.cloudWizardDialog().elements.modal.style.maxHeight='initial';
|
||||
},
|
||||
onrestore:function(){
|
||||
Alertify.cloudWizardDialog().elements.modal.style.maxHeight=0;
|
||||
},
|
||||
}).resizeTo(920, 650);
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<CloudWizard nodeInfo={info} nodeData={d}
|
||||
onClose={() => {
|
||||
panel.close();
|
||||
}}/>
|
||||
</Theme>, j[0]);
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
return pgBrowser.Cloud;
|
||||
|
|
|
@ -59,5 +59,4 @@ export default class Preferences {
|
|||
}} closeModal={closeModal} />;
|
||||
}, { isFullScreen: false, isResizeable: true, showFullScreen: true, isFullWidth: true, dialogWidth: 900, dialogHeight: 550 });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -27,7 +27,8 @@ const useStyles = makeStyles((theme) =>
|
|||
wizardBase: {
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column'
|
||||
flexDirection: 'column',
|
||||
backgroundColor: theme.palette.background.default
|
||||
},
|
||||
root: {
|
||||
display: 'flex',
|
||||
|
@ -172,7 +173,6 @@ function Wizard({ stepList, onStepChange, onSave, className, ...props }) {
|
|||
|
||||
return (
|
||||
<Box className={classes.wizardBase}>
|
||||
<Box className={clsx('wizard-header')}>{props.title}</Box>
|
||||
<div className={clsx(classes.root, props?.rootClass)}>
|
||||
<div className={clsx(classes.wizard, className)}>
|
||||
<Box className={classes.leftPanel}>
|
||||
|
|
|
@ -301,12 +301,3 @@
|
|||
outline: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wizard-header {
|
||||
.ml-auto {
|
||||
button {
|
||||
@extend .btn-secondary;
|
||||
outline: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,14 +174,14 @@ define([
|
|||
var extraData = this.setExtraParameters(typeOfDialog);
|
||||
this.showBackupDialog(schema, treeItem, j, data, panel, typeOfDialog, serverIdentifier, extraData);
|
||||
},
|
||||
saveCallBack: function(data, dialog) {
|
||||
saveCallBack: function(data) {
|
||||
if(data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext(data.errormsg)
|
||||
);
|
||||
} else {
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialog);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created');
|
||||
}
|
||||
},
|
||||
url_for_utility_exists(id, params){
|
||||
|
|
|
@ -21,7 +21,6 @@ import { InputSQL, FormFooterMessage, MESSAGE_TYPE } from '../../../../static/js
|
|||
import getApiInstance from '../../../../static/js/api_instance';
|
||||
import SchemaView from '../../../../static/js/SchemaView';
|
||||
import clsx from 'clsx';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import PropTypes from 'prop-types';
|
||||
import PrivilegeSchema from './privilege_schema.ui';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
@ -59,7 +58,7 @@ const useStyles = makeStyles(() =>
|
|||
}),
|
||||
);
|
||||
|
||||
export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
||||
export default function GrantWizard({ sid, did, nodeInfo, nodeData, onClose }) {
|
||||
const classes = useStyles();
|
||||
var columns = [
|
||||
{
|
||||
|
@ -224,7 +223,7 @@ export default function GrantWizard({ sid, did, nodeInfo, nodeData }) {
|
|||
api.post(_url, post_data)
|
||||
.then(() => {
|
||||
setLoaderText('');
|
||||
Alertify.grantWizardDialog().close();
|
||||
onClose();
|
||||
})
|
||||
.catch((error) => {
|
||||
setLoaderText('');
|
||||
|
@ -361,6 +360,7 @@ GrantWizard.propTypes = {
|
|||
did: PropTypes.number,
|
||||
nodeInfo: PropTypes.object,
|
||||
nodeData: PropTypes.object,
|
||||
onClose: PropTypes.func
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -14,15 +14,11 @@ import GrantWizard from './GrantWizard';
|
|||
|
||||
// Grant Wizard
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore',
|
||||
'pgadmin.alertifyjs', 'pgadmin.browser',
|
||||
'sources/gettext', 'pgadmin.browser',
|
||||
'tools/grant_wizard/static/js/menu_utils',
|
||||
'sources/nodes/supported_database_node',
|
||||
'backgrid.select.all',
|
||||
'backgrid.filter', 'pgadmin.browser.server.privilege',
|
||||
'pgadmin.browser.wizard',
|
||||
], function(
|
||||
gettext, $, _, Alertify, pgBrowser, menuUtils, supportedNodes
|
||||
gettext, pgBrowser, menuUtils, supportedNodes
|
||||
) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
|
@ -79,83 +75,27 @@ define([
|
|||
|
||||
// Callback to draw Wizard Dialog
|
||||
start_grant_wizard: function() {
|
||||
let t = pgBrowser.tree,
|
||||
i = t.selected(),
|
||||
d = this.d = i ? t.itemData(i) : undefined,
|
||||
info = this.info = pgBrowser.tree.getTreeNodeHierarchy(i);
|
||||
|
||||
// Declare Wizard dialog
|
||||
if (!Alertify.grantWizardDialog) {
|
||||
Alertify.dialog('grantWizardDialog', function factory() {
|
||||
// Register dialog panel
|
||||
pgBrowser.Node.registerUtilityPanel();
|
||||
let panel = pgBrowser.Node.addUtilityPanel(pgBrowser.stdW.lg, pgBrowser.stdH.lg),
|
||||
j = panel.$container.find('.obj_properties').first();
|
||||
panel.title(gettext('Grant Wizard'));
|
||||
|
||||
// Generate wizard main container
|
||||
var $container = $('<div class=\'wizard_dlg\' id=\'grantWizardDlg\'></div>');
|
||||
return {
|
||||
main: function () {
|
||||
/*This is intentional (SonarQube)*/
|
||||
},
|
||||
setup: function () {
|
||||
return {
|
||||
// Set options for dialog
|
||||
options: {
|
||||
frameless: true,
|
||||
resizable: true,
|
||||
autoReset: false,
|
||||
maximizable: true,
|
||||
closable: true,
|
||||
closableByDimmer: false,
|
||||
modal: true,
|
||||
pinnable: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
build: function () {
|
||||
this.elements.content.appendChild($container.get(0));
|
||||
Alertify.pgDialogBuild.apply(this);
|
||||
var t = pgBrowser.tree,
|
||||
i = t.selected(),
|
||||
d = this.d = i ? t.itemData(i) : undefined,
|
||||
info = this.info = pgBrowser.tree.getTreeNodeHierarchy(i);
|
||||
let sid = info.server._id,
|
||||
did = info.database._id;
|
||||
|
||||
var sid = info.server._id,
|
||||
did = info.database._id;
|
||||
|
||||
setTimeout(function () {
|
||||
if (document.getElementById('grantWizardDlg')) {
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<GrantWizard sid={sid} did={did} nodeInfo={info} nodeData={d} />
|
||||
</Theme>,
|
||||
document.getElementById('grantWizardDlg'));
|
||||
Alertify.grantWizardDialog().elements.modal.style.maxHeight=0;
|
||||
Alertify.grantWizardDialog().elements.modal.style.maxWidth='none';
|
||||
Alertify.grantWizardDialog().elements.modal.style.overflow='visible';
|
||||
Alertify.grantWizardDialog().elements.dimmer.style.display='none';
|
||||
}
|
||||
}, 10);
|
||||
|
||||
},
|
||||
prepare: function () {
|
||||
$container.empty().append('<div class=\'grant_wizard_container\'></div>');
|
||||
},
|
||||
hooks: {
|
||||
// Triggered when the dialog is closed
|
||||
onclose: function () {
|
||||
// Clear the view and remove the react component.
|
||||
return setTimeout((function () {
|
||||
ReactDOM.unmountComponentAtNode(document.getElementById('grantWizardDlg'));
|
||||
return Alertify.grantWizardDialog().destroy();
|
||||
}), 500);
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
// Call Grant Wizard Dialog and set dimensions for wizard
|
||||
Alertify.grantWizardDialog('').set({
|
||||
onmaximize:function(){
|
||||
Alertify.grantWizardDialog().elements.modal.style.maxHeight='initial';
|
||||
},
|
||||
onrestore:function(){
|
||||
Alertify.grantWizardDialog().elements.modal.style.maxHeight=0;
|
||||
},
|
||||
}).resizeTo(pgBrowser.stdW.lg, pgBrowser.stdH.lg);
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<GrantWizard sid={sid} did={did} nodeInfo={info} nodeData={d}
|
||||
onClose={() => {
|
||||
panel.close();
|
||||
}}/>
|
||||
</Theme>, j[0]);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ define([
|
|||
);
|
||||
},
|
||||
|
||||
importExportCallBack: function(data, dialog) {
|
||||
importExportCallBack: function(data) {
|
||||
if(data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
|
@ -83,7 +83,7 @@ define([
|
|||
);
|
||||
} else {
|
||||
Notify.success(gettext('Import/Export job created.'));
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialog);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import Loader from 'sources/components/Loader';
|
|||
import ImportExportSelectionSchema from './import_export_selection.ui';
|
||||
import CheckBoxTree from '../../../../static/js/components/CheckBoxTree';
|
||||
import getApiInstance from '../../../../static/js/api_instance';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import PropTypes from 'prop-types';
|
||||
import { commonTableStyles } from '../../../../static/js/Theme';
|
||||
import clsx from 'clsx';
|
||||
import Notify from '../../../../static/js/helpers/Notifier';
|
||||
|
@ -53,7 +53,7 @@ const useStyles = makeStyles(() =>
|
|||
}),
|
||||
);
|
||||
|
||||
export default function ImportExportServers() {
|
||||
export default function ImportExportServers({onClose}) {
|
||||
const classes = useStyles();
|
||||
const tableClasses = commonTableStyles();
|
||||
|
||||
|
@ -109,7 +109,7 @@ export default function ImportExportServers() {
|
|||
});
|
||||
}
|
||||
|
||||
Alertify.importExportWizardDialog().close();
|
||||
onClose();
|
||||
};
|
||||
|
||||
const disableNextCheck = (stepId) => {
|
||||
|
@ -265,3 +265,6 @@ export default function ImportExportServers() {
|
|||
</Box>
|
||||
);
|
||||
}
|
||||
ImportExportServers.propTypes = {
|
||||
onClose: PropTypes.func
|
||||
};
|
|
@ -10,10 +10,9 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import gettext from 'sources/gettext';
|
||||
import Alertify from 'pgadmin.alertifyjs';
|
||||
import Theme from 'sources/Theme';
|
||||
import ImportExportServers from './ImportExportServers';
|
||||
import $ from 'jquery';
|
||||
import pgBrowser from 'top/browser/static/js/browser';
|
||||
|
||||
export default class ImportExportServersModule {
|
||||
static instance;
|
||||
|
@ -52,73 +51,18 @@ export default class ImportExportServersModule {
|
|||
|
||||
// This is a callback function to show import/export servers when user click on menu item.
|
||||
showImportExportServers() {
|
||||
// Declare Wizard dialog
|
||||
if (!Alertify.importExportWizardDialog) {
|
||||
Alertify.dialog('importExportWizardDialog', function factory() {
|
||||
// Register dialog panel
|
||||
pgBrowser.Node.registerUtilityPanel();
|
||||
let panel = pgBrowser.Node.addUtilityPanel(880, 550),
|
||||
j = panel.$container.find('.obj_properties').first();
|
||||
panel.title(gettext('Import/Export Servers'));
|
||||
|
||||
// Generate wizard main container
|
||||
var $container = $('<div class=\'wizard_dlg\' id=\'importExportServersDlg\'></div>');
|
||||
return {
|
||||
main: function () {
|
||||
/*This is intentional (SonarQube)*/
|
||||
},
|
||||
setup: function () {
|
||||
return {
|
||||
// Set options for dialog
|
||||
options: {
|
||||
frameless: true,
|
||||
resizable: true,
|
||||
autoReset: false,
|
||||
maximizable: true,
|
||||
closable: true,
|
||||
closableByDimmer: false,
|
||||
modal: true,
|
||||
pinnable: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
build: function () {
|
||||
this.elements.content.appendChild($container.get(0));
|
||||
Alertify.pgDialogBuild.apply(this);
|
||||
|
||||
setTimeout(function () {
|
||||
if (document.getElementById('importExportServersDlg')) {
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<ImportExportServers />
|
||||
</Theme>,
|
||||
document.getElementById('importExportServersDlg'));
|
||||
Alertify.importExportWizardDialog().elements.modal.style.maxHeight=0;
|
||||
Alertify.importExportWizardDialog().elements.modal.style.maxWidth='none';
|
||||
Alertify.importExportWizardDialog().elements.modal.style.overflow='visible';
|
||||
Alertify.importExportWizardDialog().elements.dimmer.style.display='none';
|
||||
}
|
||||
}, 10);
|
||||
|
||||
},
|
||||
prepare: function () {
|
||||
$container.empty().append('<div class=\'import_export_servers_container\'></div>');
|
||||
},
|
||||
hooks: {
|
||||
// Triggered when the dialog is closed
|
||||
onclose: function () {
|
||||
// Clear the view and remove the react component.
|
||||
return setTimeout((function () {
|
||||
ReactDOM.unmountComponentAtNode(document.getElementById('importExportServersDlg'));
|
||||
return Alertify.importExportWizardDialog().destroy();
|
||||
}), 500);
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
Alertify.importExportWizardDialog('').set({
|
||||
onmaximize:function(){
|
||||
Alertify.importExportWizardDialog().elements.modal.style.maxHeight='initial';
|
||||
},
|
||||
onrestore:function(){
|
||||
Alertify.importExportWizardDialog().elements.modal.style.maxHeight=0;
|
||||
},
|
||||
}).resizeTo(880, 550);
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<ImportExportServers
|
||||
onClose={() => {
|
||||
panel.close();
|
||||
}}/>
|
||||
</Theme>, j[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ define([
|
|||
}
|
||||
);
|
||||
},
|
||||
saveCallBack: function(data, dialog) {
|
||||
saveCallBack: function(data) {
|
||||
if(data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
|
@ -93,7 +93,7 @@ define([
|
|||
);
|
||||
} else {
|
||||
Notify.success(data.data.info);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialog);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created');
|
||||
}
|
||||
},
|
||||
setExtraParameters(treeInfo) {
|
||||
|
|
|
@ -90,14 +90,14 @@ define('tools.restore', [
|
|||
pgBrowser
|
||||
);
|
||||
},
|
||||
saveCallBack: function(data, dialog) {
|
||||
saveCallBack: function(data) {
|
||||
if(data.errormsg) {
|
||||
Notify.alert(
|
||||
gettext('Error'),
|
||||
gettext(data.errormsg)
|
||||
);
|
||||
} else {
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created', dialog);
|
||||
pgBrowser.Events.trigger('pgadmin-bgprocess:created');
|
||||
}
|
||||
},
|
||||
setExtraParameters: function(treeInfo, nodeData) {
|
||||
|
|
|
@ -202,7 +202,6 @@ var webpackShimConfig = {
|
|||
'pgadmin.browser.server.privilege': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/privilege'),
|
||||
'pgadmin.browser.server.variable': path.join(__dirname, './pgadmin/browser/server_groups/servers/static/js/variable'),
|
||||
'pgadmin.browser.utils': '/browser/js/utils',
|
||||
'pgadmin.browser.wizard': path.join(__dirname, './pgadmin/browser/static/js/wizard'),
|
||||
'pgadmin.dashboard': path.join(__dirname, './pgadmin/dashboard/static/js/Dashboard'),
|
||||
'pgadmin.help': path.join(__dirname, './pgadmin/help/static/js/help'),
|
||||
'pgadmin.misc.explain': path.join(__dirname, './pgadmin/misc/static/explain/js/explain'),
|
||||
|
@ -308,7 +307,7 @@ var webpackShimConfig = {
|
|||
// Define list of pgAdmin common libraries to bundle them separately
|
||||
// into commons JS from app.bundle.js
|
||||
pgLibs: [
|
||||
'pgadmin.browser.wizard', 'pgadmin.browser.error', 'pgadmin.browser.server.privilege',
|
||||
'pgadmin.browser.error', 'pgadmin.browser.server.privilege',
|
||||
'pgadmin.browser.server.variable', 'pgadmin.browser.collection', 'pgadmin.browser.node.ui',
|
||||
'pgadmin.browser.datamodel', 'pgadmin.browser.menu', 'pgadmin.browser.panel', 'pgadmin',
|
||||
'pgadmin.browser.frame', 'slick.pgadmin.editors', 'slick.pgadmin.formatters',
|
||||
|
|
Loading…
Reference in New Issue