Ensure that only the table node should be allowed to drop on the ERD tool. Fixes #6929

This commit is contained in:
Aditya Toshniwal 2021-10-19 12:01:43 +05:30 committed by Akshay Joshi
parent 9e3165c0ff
commit 9de1489322
3 changed files with 3 additions and 1 deletions

View File

@ -41,4 +41,5 @@ Bug fixes
| `Issue #6912 <https://redmine.postgresql.org/issues/6912>`_ - Fixed browser tree sort order regression issue.
| `Issue #6915 <https://redmine.postgresql.org/issues/6915>`_ - Fixed an issue where the blank string is stored instead of NULL in the server table of SQLite database.
| `Issue #6928 <https://redmine.postgresql.org/issues/6928>`_ - Ensure that the master password should be prompt when MASTER_PASSWORD_REQUIRED is set to True and AUTHENTICATION_SOURCES is webserver.
| `Issue #6929 <https://redmine.postgresql.org/issues/6929>`_ - Ensure that only the table node should be allowed to drop on the ERD tool.
| `Issue #6930 <https://redmine.postgresql.org/issues/6930>`_ - Fixed an issue where the existing server group is disappeared on rename it.

View File

@ -68,6 +68,7 @@ define('pgadmin.browser', [
return {
text: text,
objUrl: generateNodeUrl.call(pgBrowser.Nodes[data._type], treeNodeInfo, 'properties', data, true),
nodeType: data._type,
cur: {
from: text.length,
to: text.length,

View File

@ -371,7 +371,7 @@ export default class BodyWidget extends React.Component {
onDropNode(e) {
let nodeDropData = JSON.parse(e.dataTransfer.getData('text'));
if(nodeDropData.objUrl) {
if(nodeDropData.objUrl && nodeDropData.nodeType === 'table') {
let matchUrl = `/${this.props.params.sgid}/${this.props.params.sid}/${this.props.params.did}/`;
if(nodeDropData.objUrl.indexOf(matchUrl) == -1) {
this.props.alertify.error(gettext('Cannot drop table from outside of the current database.'));