diff --git a/docs/en_US/release_notes_4_28.rst b/docs/en_US/release_notes_4_28.rst index 3aaf0f0e2..0aeb28373 100644 --- a/docs/en_US/release_notes_4_28.rst +++ b/docs/en_US/release_notes_4_28.rst @@ -10,6 +10,7 @@ New features ************ | `Issue #3318 `_ - Added support to download utility files at the client-side. +| `Issue #4230 `_ - Added support to rename query tool and debugger tabs title. | `Issue #4232 `_ - Added tab title placeholder for Query Tool, View/Edit Data, and Debugger. Housekeeping @@ -25,3 +26,4 @@ Bug fixes | `Issue #5895 `_ - Fixed an issue where the suffix for Toast table size is not visible in the Statistics tab. | `Issue #5911 `_ - Ensure that macros should be run on the older version of Safari and Chrome. | `Issue #5919 `_ - Added security related enhancements. +| `Issue #5923 `_ - Fixed an issue where non-closeable tabs are getting closed. diff --git a/web/package.json b/web/package.json index 2602d07c5..b77776569 100644 --- a/web/package.json +++ b/web/package.json @@ -107,7 +107,7 @@ "tempusdominus-core": "^5.0.3", "underscore": "^1.9.1", "watchify": "~3.11.1", - "webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker/#8298a57d875dce51a4d3707c68a1a2b82f2e6c03", + "webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker/#c4a3398b89588408dc705895675bce7bd7660d36", "wkx": "^0.4.6" }, "scripts": { diff --git a/web/pgadmin/browser/static/js/frame.js b/web/pgadmin/browser/static/js/frame.js index 2ced09867..82d99392f 100644 --- a/web/pgadmin/browser/static/js/frame.js +++ b/web/pgadmin/browser/static/js/frame.js @@ -30,6 +30,7 @@ define([ height: 600, showTitle: true, isClosable: true, + isRenamable: true, isPrivate: false, url: '', icon: '', @@ -52,6 +53,7 @@ define([ myPanel.icon(that.icon); myPanel.closeable(!!that.isCloseable); + myPanel.renamable(that.isRenamable); var $frameArea = $('
'); myPanel.layout().addItem($frameArea); diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js index bb4d333ca..7ea546146 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js @@ -6,7 +6,6 @@ // This software is released under the PostgreSQL Licence // ////////////////////////////////////////////////////////////// - define('pgadmin.datagrid', [ 'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'pgadmin.alertifyjs', 'sources/pgadmin', 'bundled_codemirror', @@ -181,6 +180,7 @@ define('pgadmin.datagrid', [ name: 'frm_datagrid', showTitle: true, isCloseable: true, + isRenameable: true, isPrivate: true, url: 'about:blank', }); @@ -259,6 +259,35 @@ define('pgadmin.datagrid', [ }); }); + // Listen on the panelRename event. + queryToolPanel.on(wcDocker.EVENT.RENAME, function(panel_data) { + alertify.prompt('', panel_data.$titleText[0].textContent, + // We will execute this function when user clicks on the OK button + function(evt, value) { + if(value) { + + var is_file = false; + if(panel_data.$titleText[0].innerHTML.includes('File - ')) { + is_file = true; + } + var selected_item = pgBrowser.treeMenu.selected(); + var panel_titles = ''; + + if(is_query_tool) { + panel_titles = panelTitleFunc.getPanelTitle(pgBrowser, selected_item, value); + } else { + panel_titles = showData.generateDatagridTitle(pgBrowser, selected_item, value); + } + // Set title to the selected tab. + panelTitleFunc.setQueryToolDockerTitle(queryToolPanel, is_query_tool, _.unescape(panel_titles), is_file); + } + }, + // We will execute this function when user clicks on the Cancel + // button. Do nothing just close it. + function(evt) { evt.cancel = false; } + ).set({'title': gettext('Rename Panel')}); + }); + var openQueryToolURL = function(j) { // add spinner element let $spinner_el = diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js index f92c64a96..3ddcfade4 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js @@ -19,7 +19,7 @@ function isServerInformationAvailable(parentData) { return parentData.server === undefined; } -export function getPanelTitle(pgBrowser, selected_item=null) { +export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null) { var preferences = pgBrowser.get_preferences_for_module('sqleditor'); if(selected_item == null) { selected_item = pgBrowser.treeMenu.selected(); @@ -32,8 +32,13 @@ export function getPanelTitle(pgBrowser, selected_item=null) { } const db_label = getDatabaseLabel(parentData); + var qt_title_placeholder = ''; + if (custom_title) { + qt_title_placeholder = custom_title; + } else { + qt_title_placeholder = preferences['qt_tab_title_placeholder']; + } - var qt_title_placeholder = preferences['qt_tab_title_placeholder']; var placeholders = qt_title_placeholder.split('%'); var title = ''; placeholders.forEach(function(placeholder) { diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js index 401af2bb7..75371f764 100644 --- a/web/pgadmin/tools/datagrid/static/js/show_data.js +++ b/web/pgadmin/tools/datagrid/static/js/show_data.js @@ -278,7 +278,7 @@ function hasSchemaOrCatalogOrViewInformation(parentData) { parentData.catalog !== undefined; } -export function generateDatagridTitle(pgBrowser, aciTreeIdentifier) { +export function generateDatagridTitle(pgBrowser, aciTreeIdentifier, custom_title=null) { //const baseTitle = getPanelTitle(pgBrowser, aciTreeIdentifier); var preferences = pgBrowser.get_preferences_for_module('sqleditor'); const parentData = getTreeNodeHierarchyFromIdentifier.call( @@ -290,7 +290,13 @@ export function generateDatagridTitle(pgBrowser, aciTreeIdentifier) { const db_label = getDatabaseLabel(parentData); const node = pgBrowser.treeMenu.findNodeByDomElement(aciTreeIdentifier); - var dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder']; + var dtg_title_placeholder = ''; + if(custom_title) { + dtg_title_placeholder = custom_title; + } else { + dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder']; + } + var placeholders = dtg_title_placeholder.split('%'); var title = ''; placeholders.forEach(function(placeholder) { diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js index b638347a6..61056f2fa 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger.js +++ b/web/pgadmin/tools/debugger/static/js/debugger.js @@ -441,6 +441,21 @@ define([ method: 'DELETE', }); }); + + // Panel Rename event + panel.on(wcDocker.EVENT.RENAME, function(panel_data) { + Alertify.prompt('', panel_data.$titleText[0].textContent, + // We will execute this function when user clicks on the OK button + function(evt, value) { + if(value) { + debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label, value); + } + }, + // We will execute this function when user clicks on the Cancel + // button. Do nothing just close it. + function(evt) { evt.cancel = false; } + ).set({'title': gettext('Rename Panel')}); + }); } }) .fail(function(xhr) { diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js index 2caf387c2..667e70a0a 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js +++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js @@ -787,6 +787,21 @@ define([ method: 'DELETE', }); }); + + // Panel Rename event + panel.on(wcDocker.EVENT.RENAME, function(panel_data) { + Alertify.prompt('', panel_data.$titleText[0].textContent, + // We will execute this function when user clicks on the OK button + function(evt, value) { + if(value) { + debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label, value); + } + }, + // We will execute this function when user clicks on the Cancel + // button. Do nothing just close it. + function(evt) { evt.cancel = false; } + ).set({'title': gettext('Rename Panel')}); + }); } var _url; diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js index 718c4391e..5525bfc21 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger_utils.js +++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js @@ -42,8 +42,14 @@ function getProcedureId(treeInfoObject) { return objectId; } -function setDebuggerTitle(panel, preferences, function_name, schema_name, database_name) { - var debugger_title_placeholder = preferences['debugger_tab_title_placeholder']; +function setDebuggerTitle(panel, preferences, function_name, schema_name, database_name, custom_title) { + var debugger_title_placeholder = ''; + if(custom_title) { + debugger_title_placeholder = custom_title; + } else { + debugger_title_placeholder = preferences['debugger_tab_title_placeholder']; + } + var placeholders = debugger_title_placeholder.split('%'); var title = ''; diff --git a/web/yarn.lock b/web/yarn.lock index c4ba0e2a0..c9450d755 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -3409,11 +3409,6 @@ domelementtype@1, domelementtype@^1.3.0, domelementtype@^1.3.1: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.1.tgz#d048c44b37b0d10a7f2a3d5fee3f4333d790481f" integrity sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w== -domelementtype@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.0.2.tgz#f3b6e549201e46f588b59463dd77187131fe6971" - integrity sha512-wFwTwCVebUrMgGeAwRL/NhZtHAUyT9n9yg4IMDwf10+6iCMxSkVq9MGCVEH+QZWo1nNidy8kNvwmv4zWHDTqvA== - domhandler@^2.3.0: version "2.4.2" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.2.tgz#8805097e933d65e85546f726d60f5eb88b44f803" @@ -3625,11 +3620,6 @@ entities@^1.1.1, entities@~1.1.1: resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== -entities@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.3.tgz#5c487e5742ab93c15abb5da22759b8590ec03b7f" - integrity sha512-MyoZ0jgnLvB2X3Lg5HqpFmn1kybDiIfEQmKzTb5apr51Rb+T3KdmMiqa70T+bhGnyv7bQ6WMj2QMHpGMmlrUYQ== - enzyme-adapter-react-16@^1.15.2: version "1.15.5" resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.5.tgz#7a6f0093d3edd2f7025b36e7fbf290695473ee04" @@ -9688,9 +9678,9 @@ watchpack@^1.7.4: chokidar "^3.4.1" watchpack-chokidar2 "^2.0.0" -"webcabin-docker@git+https://github.com/EnterpriseDB/wcDocker/#8298a57d875dce51a4d3707c68a1a2b82f2e6c03": +"webcabin-docker@git+https://github.com/EnterpriseDB/wcDocker/#c4a3398b89588408dc705895675bce7bd7660d36": version "2.2.4-dev" - resolved "git+https://github.com/EnterpriseDB/wcDocker.git#8298a57d875dce51a4d3707c68a1a2b82f2e6c03" + resolved "git+https://github.com/EnterpriseDB/wcDocker/#c4a3398b89588408dc705895675bce7bd7660d36" dependencies: "@fortawesome/fontawesome-free" "^5.14.0" FileSaver "^0.10.0"