public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError
@ 2022-04-26 10:32 Aditya Toshniwal <[email protected]>
2022-04-26 11:00 ` Re: [pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Toshniwal @ 2022-04-26 10:32 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Attached patch fixes the error when drag and drop table in ERD.
Please review.
--
Thanks,
Aditya Toshniwal
pgAdmin Hacker | Software Architect | *edbpostgres.com*
<http://edbpostgres.com;
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM7333.patch (2.6K, 3-RM7333.patch)
download | inline diff:
diff --git a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
index 8c3686f09..be4e2c9a9 100644
--- a/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
+++ b/web/pgadmin/tools/erd/static/js/erd_tool/nodes/TableNode.jsx
@@ -209,7 +209,7 @@ export class TableNodeWidget extends React.Component {
}
render() {
- let tableData = this.props.node.getData();
+ let tableData = this.props.node.getData() || {};
let tableMetaData = this.props.node.getMetadata();
let localFkCols = [];
(tableData.foreign_key||[]).forEach((fk)=>{
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 6a1586ff8..4132ae1e9 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
@@ -96,7 +96,7 @@ export default class BodyWidget extends React.Component {
_.bindAll(this, ['onLoadDiagram', 'onSaveDiagram', 'onSaveAsDiagram', 'onSQLClick',
'onImageClick', 'onAddNewNode', 'onEditTable', 'onCloneNode', 'onDeleteNode', 'onNoteClick',
'onNoteClose', 'onOneToManyClick', 'onManyToManyClick', 'onAutoDistribute', 'onDetailsToggle',
- 'onDetailsToggle', 'onHelpClick', 'onDropNode',
+ 'onDetailsToggle', 'onHelpClick', 'onDropNode', 'onBeforeUnload',
]);
this.diagram.zoomToFit = this.diagram.zoomToFit.bind(this.diagram);
@@ -223,6 +223,7 @@ export default class BodyWidget extends React.Component {
});
this.props.panel?.on(window.wcDocker?.EVENT.CLOSING, () => {
+ window.removeEventListener('beforeunload', this.onBeforeUnload);
if(this.state.dirty) {
this.closeOnSave = false;
this.confirmBeforeClose();
@@ -241,11 +242,11 @@ export default class BodyWidget extends React.Component {
await this.loadTablesData();
}
- window.addEventListener('beforeunload', this.onBeforeUnload.bind(this));
+ window.addEventListener('beforeunload', this.onBeforeUnload);
}
componentWillUnmount() {
- window.removeEventListener('beforeunload', this.onBeforeUnload.bind(this));
+ window.removeEventListener('beforeunload', this.onBeforeUnload);
}
componentDidUpdate() {
@@ -306,7 +307,6 @@ export default class BodyWidget extends React.Component {
}
closePanel() {
- window.onbeforeunload = null;
this.props.panel.off(window.wcDocker.EVENT.CLOSING);
this.props.pgWindow.pgAdmin.Browser.docker.removePanel(this.props.panel);
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError
2022-04-26 10:32 [pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError Aditya Toshniwal <[email protected]>
@ 2022-04-26 11:00 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2022-04-26 11:00 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Tue, Apr 26, 2022 at 4:03 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> Attached patch fixes the error when drag and drop table in ERD.
> Please review.
>
> --
> 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:[~2022-04-26 11:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 10:32 [pgAdmin][RM7333] ERD Tool: drag table throws Uncaught TypeError Aditya Toshniwal <[email protected]>
2022-04-26 11:00 ` 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