diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js index cbfd68667..b9a86008d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/static/js/mview.js @@ -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.'), diff --git a/web/pgadmin/browser/static/css/wizard.css b/web/pgadmin/browser/static/css/wizard.css index 78a986f4d..a8d5fbd64 100644 --- a/web/pgadmin/browser/static/css/wizard.css +++ b/web/pgadmin/browser/static/css/wizard.css @@ -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; diff --git a/web/pgadmin/browser/static/js/wizard.js b/web/pgadmin/browser/static/js/wizard.js deleted file mode 100644 index c91587cbc..000000000 --- a/web/pgadmin/browser/static/js/wizard.js +++ /dev/null @@ -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( - '
' + - '
' + - '
' + - '
' + - '

<%= this.options.title %> -' + - ' <%= page_title %>

' + - '
' + - ' <% if (this.options.show_header_cancel_btn) { %>' + - '
' + - ' ' + - ' <% if (this.options.show_header_maximize_btn) { %>' + - ' ' + - ' <% } %>' + - '
' + - ' <% } %>' + - '
' + - '
' + - '
' + - ' <% if (this.options.show_left_panel) { %>' + - '
' + - ' ' + gettext('Left panel logo') + '
' + - ' <% } %>' + - '
' + - ' <% if ( typeof show_description != "undefined" && show_description != ""){ %>' + - '
' + - ' <%= show_description %>' + - '
' + - ' <% } %>' + - '
<% if (show_progress_bar) { %>' + - '

<%= show_progress_bar %>

<% } %>' + - '
' + - '
' + - '
' + - '
' + - '
' + - ' ' + - '
'), - 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; - -}); diff --git a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx index 25fda5a99..2255d6afc 100644 --- a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx +++ b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx @@ -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 }; diff --git a/web/pgadmin/misc/cloud/static/js/cloud.js b/web/pgadmin/misc/cloud/static/js/cloud.js index bf3f0e7b1..e8260eee7 100644 --- a/web/pgadmin/misc/cloud/static/js/cloud.js +++ b/web/pgadmin/misc/cloud/static/js/cloud.js @@ -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 = $('
'); - 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( - - - , - 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('
'); - }, - 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( + + { + panel.close(); + }}/> + , j[0]); }, - - }; return pgBrowser.Cloud; diff --git a/web/pgadmin/preferences/static/js/preferences.js b/web/pgadmin/preferences/static/js/preferences.js index 2aabaad00..249f331f3 100644 --- a/web/pgadmin/preferences/static/js/preferences.js +++ b/web/pgadmin/preferences/static/js/preferences.js @@ -59,5 +59,4 @@ export default class Preferences { }} closeModal={closeModal} />; }, { isFullScreen: false, isResizeable: true, showFullScreen: true, isFullWidth: true, dialogWidth: 900, dialogHeight: 550 }); } - -} +} \ No newline at end of file diff --git a/web/pgadmin/static/js/helpers/wizard/Wizard.jsx b/web/pgadmin/static/js/helpers/wizard/Wizard.jsx index 904041353..a4e5bd816 100644 --- a/web/pgadmin/static/js/helpers/wizard/Wizard.jsx +++ b/web/pgadmin/static/js/helpers/wizard/Wizard.jsx @@ -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 ( - {props.title}
diff --git a/web/pgadmin/static/scss/_alertify.overrides.scss b/web/pgadmin/static/scss/_alertify.overrides.scss index f70207be9..b2392adf2 100644 --- a/web/pgadmin/static/scss/_alertify.overrides.scss +++ b/web/pgadmin/static/scss/_alertify.overrides.scss @@ -301,12 +301,3 @@ outline: none !important; } } - -.wizard-header { - .ml-auto { - button { - @extend .btn-secondary; - outline: none !important; - } - } -} diff --git a/web/pgadmin/tools/backup/static/js/backup.js b/web/pgadmin/tools/backup/static/js/backup.js index 70befb58e..afe0c50a9 100644 --- a/web/pgadmin/tools/backup/static/js/backup.js +++ b/web/pgadmin/tools/backup/static/js/backup.js @@ -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){ diff --git a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx index b253c067c..2706432be 100644 --- a/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx +++ b/web/pgadmin/tools/grant_wizard/static/js/GrantWizard.jsx @@ -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 }; diff --git a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js index 5830db4be..8b2e00fdb 100644 --- a/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js +++ b/web/pgadmin/tools/grant_wizard/static/js/grant_wizard.js @@ -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 = $('
'); - 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( - - - , - 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('
'); - }, - 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( + + { + panel.close(); + }}/> + , j[0]); }, }; diff --git a/web/pgadmin/tools/import_export/static/js/import_export.js b/web/pgadmin/tools/import_export/static/js/import_export.js index 977d78df5..4cfebf480 100644 --- a/web/pgadmin/tools/import_export/static/js/import_export.js +++ b/web/pgadmin/tools/import_export/static/js/import_export.js @@ -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'); } }, diff --git a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx index bc86944fc..89c3fba30 100644 --- a/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx +++ b/web/pgadmin/tools/import_export_servers/static/js/ImportExportServers.jsx @@ -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() {
); } +ImportExportServers.propTypes = { + onClose: PropTypes.func +}; \ No newline at end of file diff --git a/web/pgadmin/tools/import_export_servers/static/js/import_export_servers.js b/web/pgadmin/tools/import_export_servers/static/js/import_export_servers.js index b436b79cf..b367c593a 100644 --- a/web/pgadmin/tools/import_export_servers/static/js/import_export_servers.js +++ b/web/pgadmin/tools/import_export_servers/static/js/import_export_servers.js @@ -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 = $('
'); - 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( - - - , - 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('
'); - }, - 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( + + { + panel.close(); + }}/> + , j[0]); } } diff --git a/web/pgadmin/tools/maintenance/static/js/maintenance.js b/web/pgadmin/tools/maintenance/static/js/maintenance.js index 4fcda6b33..cbf9388e0 100644 --- a/web/pgadmin/tools/maintenance/static/js/maintenance.js +++ b/web/pgadmin/tools/maintenance/static/js/maintenance.js @@ -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) { diff --git a/web/pgadmin/tools/restore/static/js/restore.js b/web/pgadmin/tools/restore/static/js/restore.js index 2504469e3..3ad192cf5 100644 --- a/web/pgadmin/tools/restore/static/js/restore.js +++ b/web/pgadmin/tools/restore/static/js/restore.js @@ -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) { diff --git a/web/webpack.shim.js b/web/webpack.shim.js index 14cc6ef91..d901421e8 100644 --- a/web/webpack.shim.js +++ b/web/webpack.shim.js @@ -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',