public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin]: Patch for SonarQube fixes.
Date: Mon, 1 Mar 2021 16:42:39 +0530
Message-ID: <CAOBg0APj74-4QGoq5+xs+d2Qq3ynVPQMQnnfPdXzXtSCTOJvYQ@mail.gmail.com> (raw)
In-Reply-To: <CANxoLDfWcLzFg7EgJ6SW9qdzuGQngzHvbeS2qCN7ftnj4iaKBw@mail.gmail.com>
References: <CAOBg0AO5-Px-G4y=aMRaeAa8T8A-mWtaBhKgh4GHPiN2cSPyhg@mail.gmail.com>
	<CANxoLDfWcLzFg7EgJ6SW9qdzuGQngzHvbeS2qCN7ftnj4iaKBw@mail.gmail.com>

Hi Akshay,

Sorry for the inconvenience, Please find the attached patch.

Regards,
Nikhil Mohite.

On Mon, Mar 1, 2021 at 4:37 PM Akshay Joshi <[email protected]>
wrote:

> Hi Nikhil
>
> You forgot to attach the patch :)
>
> On Mon, Mar 1, 2021 at 4:12 PM Nikhil Mohite <
> [email protected]> wrote:
>
>> Hi Team,
>>
>> I have fixed a few sonarQube issues, PFA patch
>> Details as follows:
>>
>> 1. Back-form  (backform.pgadmin.js):
>>
>>    - TypeError can be thrown as "$tabContent" might be null or undefined
>>    here.
>>
>> 2. User Management (user_management.js):
>>
>>    - 'self' is already declared in the upper scope.
>>    - 'res' is already declared in the upper scope.
>>    - 'self' is already declared in the upper scope.
>>    - 'ownershipModel' is already declared in the upper scope.
>>
>>
>> --
>> *Thanks & Regards,*
>> *Nikhil Mohite*
>> *Software Engineer.*
>> *EDB Postgres* <https://www.enterprisedb.com/;
>> *Mob.No: +91-7798364578.*
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
> *pgAdmin Hacker | Principal Software Architect*
> *EDB Postgres <http://edbpostgres.com>*
>
> *Mobile: +91 976-788-8246*
>


Attachments:

  [application/octet-stream] SonarQubeCodeSmellFixes.patch (4.9K, 3-SonarQubeCodeSmellFixes.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 1611cb59..91a3df4c 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1901,8 +1901,8 @@ define([
             'height: ' + ($tabContent.height() + 8) + 'px !important;'
           );
         }
+        this.sqlCtrl.setSize($tabContent.width() + 'px', $tabContent.height() + 'px');
       }
-      this.sqlCtrl.setSize($tabContent.width() + 'px', $tabContent.height() + 'px');
     },
     remove: function() {
       if (this.sqlCtrl) {
diff --git a/web/pgadmin/tools/user_management/static/js/user_management.js b/web/pgadmin/tools/user_management/static/js/user_management.js
index 531c8c59..cfa6e5a2 100644
--- a/web/pgadmin/tools/user_management/static/js/user_management.js
+++ b/web/pgadmin/tools/user_management/static/js/user_management.js
@@ -612,8 +612,8 @@ define([
 
             let ownershipSelect2Control = Backform.Select2Control.extend({
               fetchData: function(){
-                let self = this;
-                let url = self.field.get('url');
+                let that = this;
+                let url = that.field.get('url');
 
                 url = url_for(url, {'uid': uid});
 
@@ -622,24 +622,24 @@ define([
                   headers: {
                     'Cache-Control' : 'no-cache',
                   },
-                }).done(function (res) {
-                  var transform = self.field.get('transform');
-                  if(res.data.status){
-                    let data = res.data.result.data;
+                }).done(function (res_data) {
+                  var transform = that.field.get('transform');
+                  if(res_data.data.status){
+                    let data = res_data.data.result.data;
 
                     if (transform && _.isFunction(transform)) {
-                      self.field.set('options', transform.bind(self, data));
+                      that.field.set('options', transform.bind(that, data));
                     } else {
-                      self.field.set('options', data);
+                      that.field.set('options', data);
                     }
                   } else {
                     if (transform && _.isFunction(transform)) {
-                      self.field.set('options', transform.bind(self, []));
+                      that.field.set('options', transform.bind(that, []));
                     } else {
-                      self.field.set('options', []);
+                      that.field.set('options', []);
                     }
                   }
-                  Backform.Select2Control.prototype.render.apply(self, arguments);
+                  Backform.Select2Control.prototype.render.apply(that, arguments);
                 }).fail(function(e){
                   let msg = '';
                   if(e.status == 404) {
@@ -728,15 +728,15 @@ define([
                     };
                   },
                   prepare: function() {
-                    let self = this;
+                    let that = this;
                     $container.html('');
 
-                    self.ownershipModel = new ownershipModel();
-                    let fields = pgBackform.generateViewSchema(null, self.ownershipModel, 'create', null, null, true, null);
+                    that.ownershipModel = new ownershipModel();
+                    let fields = pgBackform.generateViewSchema(null, that.ownershipModel, 'create', null, null, true, null);
 
                     let view = this.view = new pgBackform.Dialog({
                       el: '<div></div>',
-                      model: self.ownershipModel,
+                      model: that.ownershipModel,
                       schema: fields,
                     });
                     //Render change ownership dialog.
@@ -745,8 +745,8 @@ define([
                   callback: function(e) {
                     if(e.button['data-btn-name'] === 'ok') {
                       e.cancel = true; // Do not close dialog
-                      let ownershipModel = this.ownershipModel.toJSON();
-                      if (ownershipModel.user == '' || ownershipModel.user == undefined) {
+                      let newOwnershipModel = this.ownershipModel.toJSON();
+                      if (newOwnershipModel.user == '' || newOwnershipModel.user == undefined) {
                         alertify.confirm(
                           gettext('Delete user?'),
                           gettext('The shared servers owned by <b>'+ self.model.get('username') +'</b> will be deleted. Do you wish to continue?'),
@@ -772,7 +772,7 @@ define([
                           }
                         );
                       } else {
-                        self.changeOwner(ownershipModel.user, uid);
+                        self.changeOwner(newOwnershipModel.user, uid);
                       }
                     } else {
                       alertify.changeOwnershipDialog().destroy();


view thread (10+ 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], [email protected]
  Subject: Re: [pgAdmin]: Patch for SonarQube fixes.
  In-Reply-To: <CAOBg0APj74-4QGoq5+xs+d2Qq3ynVPQMQnnfPdXzXtSCTOJvYQ@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