public inbox for [email protected]
help / color / mirror / Atom feedFrom: Harshal Dhumal <[email protected]>
To: [email protected]
Subject: Variable js issue [pgAdmin4]
Date: Mon, 18 Jan 2016 13:24:19 +0530
Message-ID: <CAFiP3vxy0JjkZO-N+yJvyE-zO-M_zpsW9LTOOQRQ6wWSRT2Y5A@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
Here is patch for variable.js
Issues fixed:
1. Parsing variables values of type int and float/real [Ashesh Vashi].
2. variables tab header form control not found issue [Ashesh Vashi].
--
*Harshal Dhumal*
*Software Engineer *
EenterpriseDB <http://www.enterprisedb.com;
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[text/x-patch] variables_js_18_Jan.patch (2.7K, 3-variables_js_18_Jan.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index bb68951..ed46080 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -38,7 +38,7 @@
var VariableModel = pgNode.VariableModel = pgNode.Model.extend({
defaults: {
name: undefined,
- value: '',
+ value: undefined,
role: undefined,
database: undefined,
},
@@ -70,6 +70,7 @@
},
validate: function() {
if (_.isUndefined(this.get('value')) ||
+ _.isNull(this.get('value')) ||
String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') {
var msg = 'Please enter some value!';
@@ -166,7 +167,7 @@
var formatter = self.formatter;
- formatter.decimals = self.decimals;
+ formatter.decimals = 0;
formatter.decimalSeparator = self.decimalSeparator;
formatter.orderSeparator = self.orderSeparator;
@@ -291,12 +292,11 @@
var headerGroups = Backform.generateViewSchema(
self.field.get('node_info'), self.headerData, 'create',
node, self.field.get('node_data')
- );
+ ),
+ fields = [];
- var fields = [];
-
- _.each(headerGroups, function(val, key) {
- fields = fields.concat(headerGroups[key]);
+ _.each(headerGroups, function(o) {
+ fields = fields.concat(o.fields);
});
self.headerFields = new Backform.Fields(fields);
@@ -312,7 +312,6 @@
self.listenTo(self.headerData, "select2", self.headerDataChanged);
self.listenTo(self.collection, "remove", self.onRemoveVariable);
},
-
/*
* Get the variable data for this node.
*/
@@ -476,6 +475,30 @@
});
}
+ // Change format of each of the data
+ // Because - data coming from the server is in string format
+ self.collection.each(function(model){
+ var name = model.get("name");
+
+ if (name in self.availVariables) {
+ switch(self.availVariables[name].vartype) {
+ case 'real':
+ var v = parseFloat(model.get('value'));
+ model.set('value', (isNaN(v) ? undefined : v), {silent: true});
+
+ break;
+ case 'integer':
+ var v = parseInt(model.get('value'));
+ model.set('value', (isNaN(v) ? undefined : v), {silent: true});
+
+ break;
+ default:
+ break;
+ }
+ }
+ });
+ self.collection.startNewSession();
+
// Initialize a new Grid instance
var grid = self.grid = new Backgrid.Grid({
columns: gridSchema.columns,
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: Variable js issue [pgAdmin4]
In-Reply-To: <CAFiP3vxy0JjkZO-N+yJvyE-zO-M_zpsW9LTOOQRQ6wWSRT2Y5A@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