public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD
@ 2021-10-19 05:03 Aditya Toshniwal <[email protected]>
  2021-10-19 06:32 ` Re: [pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Aditya Toshniwal @ 2021-10-19 05:03 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Please review the attached patch which will not allow one to drop any node
except table on ERD.

-- 
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM6929.patch (1.4K, 3-RM6929.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/static/js/browser.js b/web/pgadmin/browser/static/js/browser.js
index f88fb6584..3d86c96f7 100644
--- a/web/pgadmin/browser/static/js/browser.js
+++ b/web/pgadmin/browser/static/js/browser.js
@@ -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,
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
index 106ba4989..cb5f1e2be 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/ui_components/BodyWidget.jsx
@@ -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.'));


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD
  2021-10-19 05:03 [pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD Aditya Toshniwal <[email protected]>
@ 2021-10-19 06:32 ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Akshay Joshi @ 2021-10-19 06:32 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

Thanks, the patch applied.

On Tue, Oct 19, 2021 at 10:33 AM Aditya Toshniwal <
[email protected]> wrote:

> Hi Hackers,
>
> Please review the attached patch which will not allow one to drop any node
> except table on ERD.
>
> --
> Thanks,
> Aditya Toshniwal
> pgAdmin Hacker | Software Architect | *edbpostgres.com*
> <http://edbpostgres.com;
> "Don't Complain about Heat, Plant a TREE"
>


-- 
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*

*Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-10-19 06:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19 05:03 [pgAdmin][RM6929] Error Message displayed if user drag sequence in ERD Aditya Toshniwal <[email protected]>
2021-10-19 06:32 ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox