public inbox for [email protected]  
help / color / mirror / Atom feed
From: Yogesh Mahajan <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][Patch] - Bug #7015 - Unable to add new server on startup
Date: Fri, 26 Nov 2021 16:18:39 +0530
Message-ID: <CAMa=N=NxAP2J=MnSuDH0KVrwmvAN9+5ggbZ9qa3ojwvUs=bqxw@mail.gmail.com> (raw)

Hi,

Please find the attached patch which fixes errors thrown while creating a
new server via Add New Server from dashboard &  tree item is not selected.
Also fixes errors shown in console while startup.


Thanks,
Yogesh Mahajan
EnterpriseDB


Attachments:

  [application/octet-stream] RM7015_v1.patch (1.1K, 3-RM7015_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index 6e6228304..51425a679 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -394,9 +394,9 @@ define('pgadmin.dashboard', [
     // Handler function to support the "Add Server" link
     add_new_server: function() {
       if (pgBrowser && pgBrowser.tree) {
-        var i = pgBrowser.tree.selected().length != 0 ?
-            pgBrowser.tree.selected() :
-            pgBrowser.tree.first(null, false),
+        var i = _.isUndefined(pgBrowser.tree.selected()) ?
+            pgBrowser.tree.first(null, false):
+            pgBrowser.tree.selected(),
           serverModule = require('pgadmin.node.server'),
           itemData = pgBrowser.tree.itemData(i);
 
@@ -1141,7 +1141,7 @@ define('pgadmin.dashboard', [
         this.chartsDomObj && this.chartsDomObj.unmount();
       } else {
         var t = pgBrowser.tree,
-          i = t.selected(),
+          i = t ? t.selected() : 0,
           d = i && t.itemData(i);
 
         this.chartsDomObj && this.chartsDomObj.setPageVisible(dashboardVisible);


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][Patch] - Bug #7015 - Unable to add new server on startup
  In-Reply-To: <CAMa=N=NxAP2J=MnSuDH0KVrwmvAN9+5ggbZ9qa3ojwvUs=bqxw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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