Fixed issue only coming in the runtime.

* Do not need to translate an empty string. (that results into the
  translation header inclusion in the javacript module).
* String.prototype.StartsWith is not an well received function, it has
  not been available in the QWebkit for linux.
This commit is contained in:
Ashesh Vashi
2016-06-02 13:15:24 +05:30
parent fddc30c99f
commit 486da5e12c
5 changed files with 80 additions and 29 deletions

View File

@@ -128,14 +128,14 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) {
type: 'text', disabled: true, mode: ['properties']
},
{
id: 'schema', label:'{{ _("") }}',
id: 'schema', label:'',
type: 'text', visible: false, disabled: function(m) {
// It is used while generating sql
m.set('schema', m.node_info.schema.label);
}
},
{
id: 'view', label:'{{ _("") }}',
id: 'view', label:'',
type: 'text', visible: false, disabled: function(m){
// It is used while generating sql

View File

@@ -392,7 +392,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) {
mode: ['edit', 'create'],
visible: function(m) {
return m.get('typtype') === 'r';
}, deps: ['typtype'], label: '{{ _('') }}',
}, deps: ['typtype'], label: '',
schema:[{
id: 'typname', label:'{{ _('Sub-type') }}', cell: 'string',
control: 'node-ajax-options',

View File

@@ -156,7 +156,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) {
id: 'comment', label:'{{ _("Comment") }}', cell: 'string',
type: 'multiline'
},{
id: 'definition', label:'{{ _("") }}', cell: 'string',
id: 'definition', label:'', cell: 'string',
type: 'text', mode: ['create', 'edit'], group: 'Definition',
control: Backform.SqlFieldControl, extraClasses:['sql_field_width_full']
},{

View File

@@ -170,12 +170,12 @@ var imageMapper = {
command = data['Command'];
if(strategy == "Hashed") {
if(command.startsWith("Intersect")) {
if(S.startsWith(command, "Intersect")) {
if(command == "Intersect All")
return {"image":"ex_hash_setop_intersect_all.png","image_text":"Hashed Intersect All"};
return {"image":"ex_hash_setop_intersect.png","image_text":"Hashed Intersect"};
}
else if (command.startsWith("Except")) {
else if (S.startsWith(command, "Except")) {
if(command == "Except All")
return {"image":"ex_hash_setop_except_all.png","image_text":"Hashed Except All"};
return {"image":"ex_hash_setop_except.png","image_text":"Hash Except"};
@@ -254,7 +254,7 @@ var PlanModel = Backbone.Model.extend({
ypos += yMargin;
}
if(node_type.startsWith("(slice"))
if(S.startsWith(node_type, "(slice"))
node_type = node_type.substring(0,7);
// Get the image information for current node

View File

@@ -565,10 +565,28 @@ define(
);
},
_stopEventPropogation: function(ev) {
ev = ev || window.event;
ev.cancelBubble = true;
ev.stopPropagation();
ev.stopImmediatePropagation();
ev.preventDefault();
},
_closeDropDown: function(ev) {
var target = ev && (ev.currentTarget || ev.target);
if (target) {
$(target).closest('.open').removeClass('open').find('.dropdown-backdrop').remove();
}
},
// Callback function for Save button click.
on_save: function() {
on_save: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the save signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:save',
@@ -590,9 +608,12 @@ define(
},
// Callback function for include filter button click.
on_include_filter: function() {
on_include_filter: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the include_filter signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:include_filter',
@@ -602,9 +623,12 @@ define(
},
// Callback function for exclude filter button click.
on_exclude_filter: function() {
on_exclude_filter: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the exclude_filter signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:exclude_filter',
@@ -614,9 +638,12 @@ define(
},
// Callback function for remove filter button click.
on_remove_filter: function() {
on_remove_filter: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the remove_filter signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:remove_filter',
@@ -716,25 +743,31 @@ define(
},
// Callback function for the clear button click.
on_clear: function() {
var self = this;
self.query_tool_obj.setValue('');
on_clear: function(ev) {
ev = ev || window.event;
ev.cancelBubble = true;
ev.stopPropagation();
this.query_tool_obj.setValue('');
},
// Callback function for the clear history button click.
on_clear_history: function() {
var self = this;
on_clear_history: function(ev) {
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Remove any existing grid first
if (self.history_grid) {
self.history_collection.reset();
if (this.history_grid) {
this.history_collection.reset();
}
},
// Callback function for the auto commit button click.
on_auto_commit: function() {
on_auto_commit: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the auto-commit signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:auto_commit',
@@ -744,9 +777,11 @@ define(
},
// Callback function for the auto rollback button click.
on_auto_rollback: function() {
on_auto_rollback: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the download signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:auto_rollback',
@@ -756,9 +791,12 @@ define(
},
// Callback function for explain button click.
on_explain: function() {
on_explain: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the explain signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain',
@@ -768,9 +806,12 @@ define(
},
// Callback function for explain analyze button click.
on_explain_analyze: function() {
on_explain_analyze: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the explain analyze signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain-analyze',
@@ -780,9 +821,11 @@ define(
},
// Callback function for explain option "verbose" button click
on_explain_verbose: function() {
on_explain_verbose: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the explain "verbose" signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain-verbose',
@@ -792,9 +835,11 @@ define(
},
// Callback function for explain option "costs" button click
on_explain_costs: function() {
on_explain_costs: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the explain "costs" signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain-costs',
@@ -804,9 +849,11 @@ define(
},
// Callback function for explain option "buffers" button click
on_explain_buffers: function() {
on_explain_buffers: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the explain "buffers" signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain-buffers',
@@ -816,9 +863,11 @@ define(
},
// Callback function for explain option "timing" button click
on_explain_timing: function() {
on_explain_timing: function(ev) {
var self = this;
this._stopEventPropogation(ev);
// Trigger the explain "timing" signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:explain-timing',
@@ -832,17 +881,19 @@ define(
},
// callback function for load file button click.
on_file_load: function() {
on_file_load: function(ev) {
var self = this;
this._stopEventPropogation(ev);
this._closeDropDown(ev);
// Trigger the save signal to the SqlEditorController class
self.handler.trigger(
'pgadmin-sqleditor:button:load_file',
self,
self.handler
);
},
}
});
/* Defining controller class for data grid, which actually