mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Webpack all the things! Fixes #2135
This significantly speeds up loading of the application; in an average of 3 tests, v1.6 loaded in 11.5s in the runtime on a Mac, whilst the webpacked version of the code loaded in 5.53s.
This commit is contained in:
committed by
Dave Page
parent
d04ac7656a
commit
4a91bcde30
@@ -2,7 +2,7 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
'sources/alerts/alertify_wrapper'
|
||||
], function(gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode, AlertifyWrapper) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
@@ -280,7 +280,7 @@ TODO LIST FOR BACKUP:
|
||||
menu will be enabled otherwise disabled.
|
||||
Also, hide it for system view in catalogs
|
||||
*/
|
||||
menu_enabled = function(itemData, item, data) {
|
||||
var menu_enabled = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
var parent_item = t.hasParent(i) ? t.parent(i): null,
|
||||
parent_data = parent_item ? t.itemData(parent_item) : null;
|
||||
@@ -301,7 +301,7 @@ TODO LIST FOR BACKUP:
|
||||
return false;
|
||||
};
|
||||
|
||||
menu_enabled_server = function(itemData, item, data) {
|
||||
var menu_enabled_server = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
var parent_item = t.hasParent(i) ? t.parent(i): null,
|
||||
parent_data = parent_item ? t.itemData(parent_item) : null;
|
||||
@@ -628,7 +628,7 @@ TODO LIST FOR BACKUP:
|
||||
return;
|
||||
}
|
||||
|
||||
var title = S('{{ 'Backup (%s: %s)' }}'),
|
||||
var title = S(gettext('Backup (%s: %s)')),
|
||||
tree = pgBrowser.tree,
|
||||
item = treeItem || tree.selected(),
|
||||
data = item && item.length == 1 && tree.itemData(item),
|
||||
|
@@ -257,13 +257,13 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block init_script %}require(
|
||||
['jquery', 'pgadmin', 'require', 'underscore.string'],
|
||||
function($, pgAdmin, R, S) {
|
||||
R(['pgadmin.sqleditor'], function() {
|
||||
var editorPanel = $('.sql-editor'),
|
||||
loadingDiv = $('#fetching_data'),
|
||||
msgDiv = loadingDiv.find('.sql-editor-busy-text');
|
||||
{% block init_script %}
|
||||
require(['sources/generated/sqleditor'], function(ctx) {
|
||||
var $ = pgAdmin.SqlEditor.jquery,
|
||||
S = pgAdmin.SqlEditor.S,
|
||||
editorPanel = $('.sql-editor'),
|
||||
loadingDiv = $('#fetching_data'),
|
||||
msgDiv = loadingDiv.find('.sql-editor-busy-text');
|
||||
|
||||
// Register unload event on window close.
|
||||
window.onbeforeunload = function(ev) {
|
||||
@@ -272,6 +272,7 @@ function($, pgAdmin, R, S) {
|
||||
method: 'GET'
|
||||
});
|
||||
};
|
||||
|
||||
// Get the controller object from pgAdmin.SqlEditor
|
||||
var sqlEditorController = pgAdmin.SqlEditor.create(editorPanel);
|
||||
|
||||
@@ -319,6 +320,5 @@ function($, pgAdmin, R, S) {
|
||||
// Start the query tool.
|
||||
sqlEditorController.start({{ is_query_tool }}, "{{ editor_title }}",
|
||||
script_sql, {{ is_new_browser_tab }});
|
||||
});
|
||||
});
|
||||
{% endblock %}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery','alertify', 'pgadmin','codemirror',
|
||||
'sources/sqleditor_utils', 'pgadmin.browser', 'wcdocker',
|
||||
'codemirror/addon/edit/matchbrackets', 'codemirror/addon/edit/closebrackets'
|
||||
|
||||
], function(gettext, url_for, $, alertify, pgAdmin, codemirror, sqlEditorUtils) {
|
||||
define('tools.datagrid', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'alertify', 'pgadmin',
|
||||
'bundled_codemirror',
|
||||
'sources/sqleditor_utils', 'wcdocker'
|
||||
], function(gettext, url_for, $, _, alertify, pgAdmin, CodeMirror, sqlEditorUtils) {
|
||||
// Some scripts do export their object in the window only.
|
||||
// Generally the one, which do no have AMD support.
|
||||
var wcDocker = window.wcDocker,
|
||||
@@ -42,14 +41,7 @@ define([
|
||||
return (_.indexOf(supported_nodes, obj._type) !== -1 ? true: false);
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
// Define list of nodes on which Query tool option doesn't appears
|
||||
var unsupported_nodes = pgAdmin.unsupported_nodes = [
|
||||
'server-group', 'server', 'coll-tablespace', 'tablespace',
|
||||
'coll-role', 'role', 'coll-resource_group', 'resource_group',
|
||||
'coll-database'
|
||||
],
|
||||
},
|
||||
|
||||
/* Enable/disable Query tool menu in tools based
|
||||
* on node selected. if selected node is present
|
||||
@@ -58,7 +50,7 @@ define([
|
||||
*/
|
||||
query_tool_menu_enabled = function(obj) {
|
||||
if(!_.isUndefined(obj) && !_.isNull(obj)) {
|
||||
if(_.indexOf(unsupported_nodes, obj._type) == -1) {
|
||||
if(_.indexOf(pgAdmin.unsupported_nodes, obj._type) == -1) {
|
||||
if (obj._type == 'database' && obj.allowConn)
|
||||
return true;
|
||||
else if(obj._type != 'database')
|
||||
@@ -427,7 +419,7 @@ define([
|
||||
show_query_tool: function(url, i, panel_title) {
|
||||
var self = this,
|
||||
sURL = url || '',
|
||||
panel_title = panel_title || '';
|
||||
panel_title = panel_title || '',
|
||||
d = pgAdmin.Browser.tree.itemData(i);
|
||||
if (d === undefined) {
|
||||
alertify.alert(
|
||||
|
@@ -69,10 +69,29 @@ class DebuggerModule(PgAdminModule):
|
||||
'will be opened in a new browser tab.')
|
||||
)
|
||||
|
||||
|
||||
def get_exposed_url_endpoints(self):
|
||||
"""
|
||||
Returns the list of URLs exposed to the client.
|
||||
"""
|
||||
return ['debugger.index','debugger.init_for_function',
|
||||
'debugger.init_for_trigger',
|
||||
'debugger.direct', 'debugger.initialize_target_for_function',
|
||||
'debugger.initialize_target_for_trigger', 'debugger.close',
|
||||
'debugger.restart',
|
||||
'debugger.start_listener', 'debugger.execute_query',
|
||||
'debugger.messages',
|
||||
'debugger.start_execution', 'debugger.set_breakpoint',
|
||||
'debugger.clear_all_breakpoint', 'debugger.deposit_value',
|
||||
'debugger.select_frame', 'debugger.get_arguments',
|
||||
'debugger.set_arguments',
|
||||
'debugger.poll_end_execution_result', 'debugger.poll_result'
|
||||
]
|
||||
|
||||
blueprint = DebuggerModule(MODULE_NAME, __name__)
|
||||
|
||||
|
||||
@blueprint.route("/")
|
||||
@blueprint.route("/", endpoint='index')
|
||||
@login_required
|
||||
def index():
|
||||
return bad_request(errormsg=gettext("This URL cannot be called directly!"))
|
||||
@@ -120,8 +139,14 @@ def update_session_function_transaction(trans_id, data):
|
||||
session['functionData'] = function_data
|
||||
|
||||
|
||||
@blueprint.route('/init/<node_type>/<int:sid>/<int:did>/<int:scid>/<int:fid>', methods=['GET'])
|
||||
@blueprint.route('/init/<node_type>/<int:sid>/<int:did>/<int:scid>/<int:fid>/<int:trid>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/init/<node_type>/<int:sid>/<int:did>/<int:scid>/<int:fid>',
|
||||
methods=['GET'], endpoint='init_for_function'
|
||||
)
|
||||
@blueprint.route(
|
||||
'/init/<node_type>/<int:sid>/<int:did>/<int:scid>/<int:fid>/<int:trid>',
|
||||
methods=['GET'], endpoint='init_for_trigger'
|
||||
)
|
||||
@login_required
|
||||
def init_function(node_type, sid, did, scid, fid, trid=None):
|
||||
"""
|
||||
@@ -291,7 +316,7 @@ def init_function(node_type, sid, did, scid, fid, trid=None):
|
||||
)
|
||||
|
||||
|
||||
@blueprint.route('/direct/<int:trans_id>', methods=['GET'])
|
||||
@blueprint.route('/direct/<int:trans_id>', methods=['GET'], endpoint='direct')
|
||||
@login_required
|
||||
def direct_new(trans_id):
|
||||
debugger_data = session['debuggerData']
|
||||
@@ -333,10 +358,16 @@ def direct_new(trans_id):
|
||||
)
|
||||
|
||||
|
||||
@blueprint.route('/initialize_target/<debug_type>/<int:sid>/<int:did>/<int:scid>/<int:func_id>',
|
||||
methods=['GET', 'POST'])
|
||||
@blueprint.route('/initialize_target/<debug_type>/<int:sid>/<int:did>/<int:scid>/<int:func_id>/<int:tri_id>',
|
||||
methods=['GET', 'POST'])
|
||||
@blueprint.route(
|
||||
'/initialize_target/<debug_type>/<int:sid>/<int:did>/<int:scid>/<int:func_id>',
|
||||
methods=['GET', 'POST'],
|
||||
endpoint='initialize_target_for_function'
|
||||
)
|
||||
@blueprint.route(
|
||||
'/initialize_target/<debug_type>/<int:sid>/<int:did>/<int:scid>/<int:func_id>/<int:tri_id>',
|
||||
methods=['GET', 'POST'],
|
||||
endpoint='initialize_target_for_trigger'
|
||||
)
|
||||
@login_required
|
||||
def initialize_target(debug_type, sid, did, scid, func_id, tri_id=None):
|
||||
"""
|
||||
@@ -524,7 +555,7 @@ def initialize_target(debug_type, sid, did, scid, func_id, tri_id=None):
|
||||
'newBrowserTab': new_browser_tab})
|
||||
|
||||
|
||||
@blueprint.route('/close/<int:trans_id>', methods=["DELETE"])
|
||||
@blueprint.route('/close/<int:trans_id>', methods=["DELETE"], endpoint='close')
|
||||
def close(trans_id):
|
||||
"""
|
||||
close(trans_id)
|
||||
@@ -564,7 +595,7 @@ def close(trans_id):
|
||||
return internal_server_error(errormsg=str(e))
|
||||
|
||||
|
||||
@blueprint.route('/restart/<int:trans_id>', methods=['GET'])
|
||||
@blueprint.route('/restart/<int:trans_id>', methods=['GET'], endpoint='restart')
|
||||
@login_required
|
||||
def restart_debugging(trans_id):
|
||||
"""
|
||||
@@ -623,7 +654,10 @@ def restart_debugging(trans_id):
|
||||
return make_json_response(data={'status': status})
|
||||
|
||||
|
||||
@blueprint.route('/start_listener/<int:trans_id>', methods=['GET', 'POST'])
|
||||
@blueprint.route(
|
||||
'/start_listener/<int:trans_id>', methods=['GET', 'POST'],
|
||||
endpoint='start_listener'
|
||||
)
|
||||
@login_required
|
||||
def start_debugger_listener(trans_id):
|
||||
"""
|
||||
@@ -810,8 +844,10 @@ def start_debugger_listener(trans_id):
|
||||
|
||||
return make_json_response(data={'status': status, 'result': result})
|
||||
|
||||
|
||||
@blueprint.route('/execute_query/<int:trans_id>/<query_type>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/execute_query/<int:trans_id>/<query_type>', methods=['GET'],
|
||||
endpoint='execute_query'
|
||||
)
|
||||
@login_required
|
||||
def execute_debugger_query(trans_id, query_type):
|
||||
"""
|
||||
@@ -892,7 +928,7 @@ def execute_debugger_query(trans_id, query_type):
|
||||
)
|
||||
|
||||
|
||||
@blueprint.route('/messages/<int:trans_id>/', methods=["GET"])
|
||||
@blueprint.route('/messages/<int:trans_id>/', methods=["GET"],endpoint='messages')
|
||||
@login_required
|
||||
def messages(trans_id):
|
||||
"""
|
||||
@@ -957,9 +993,10 @@ def messages(trans_id):
|
||||
return internal_server_error(errormsg=str(result))
|
||||
|
||||
|
||||
|
||||
|
||||
@blueprint.route('/start_execution/<int:trans_id>/<int:port_num>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/start_execution/<int:trans_id>/<int:port_num>', methods=['GET'],
|
||||
endpoint='start_execution'
|
||||
)
|
||||
@login_required
|
||||
def start_execution(trans_id, port_num):
|
||||
"""
|
||||
@@ -1027,7 +1064,10 @@ def start_execution(trans_id, port_num):
|
||||
return make_json_response(data={'status': 'Success', 'result': res_port['rows'][0]['pldbg_attach_to_port']})
|
||||
|
||||
|
||||
@blueprint.route('/set_breakpoint/<int:trans_id>/<int:line_no>/<int:set_type>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/set_breakpoint/<int:trans_id>/<int:line_no>/<int:set_type>',
|
||||
methods=['GET'], endpoint='set_breakpoint'
|
||||
)
|
||||
@login_required
|
||||
def set_clear_breakpoint(trans_id, line_no, set_type):
|
||||
"""
|
||||
@@ -1096,7 +1136,10 @@ def set_clear_breakpoint(trans_id, line_no, set_type):
|
||||
return make_json_response(data={'status': status, 'result': result['rows']})
|
||||
|
||||
|
||||
@blueprint.route('/clear_all_breakpoint/<int:trans_id>', methods=['POST'])
|
||||
@blueprint.route(
|
||||
'/clear_all_breakpoint/<int:trans_id>', methods=['POST'],
|
||||
endpoint='clear_all_breakpoint'
|
||||
)
|
||||
@login_required
|
||||
def clear_all_breakpoint(trans_id):
|
||||
"""
|
||||
@@ -1148,7 +1191,9 @@ def clear_all_breakpoint(trans_id):
|
||||
return make_json_response(data={'status': status, 'result': result['rows']})
|
||||
|
||||
|
||||
@blueprint.route('/deposit_value/<int:trans_id>', methods=['POST'])
|
||||
@blueprint.route(
|
||||
'/deposit_value/<int:trans_id>', methods=['POST'], endpoint='deposit_value'
|
||||
)
|
||||
@login_required
|
||||
def deposit_parameter_value(trans_id):
|
||||
"""
|
||||
@@ -1206,7 +1251,10 @@ def deposit_parameter_value(trans_id):
|
||||
return make_json_response(data={'status': status, 'result': result})
|
||||
|
||||
|
||||
@blueprint.route('/select_frame/<int:trans_id>/<int:frame_id>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/select_frame/<int:trans_id>/<int:frame_id>', methods=['GET'],
|
||||
endpoint='select_frame'
|
||||
)
|
||||
@login_required
|
||||
def select_frame(trans_id, frame_id):
|
||||
"""
|
||||
@@ -1256,7 +1304,10 @@ def select_frame(trans_id, frame_id):
|
||||
return make_json_response(data={'status': status, 'result': result['rows']})
|
||||
|
||||
|
||||
@blueprint.route('/get_arguments/<int:sid>/<int:did>/<int:scid>/<int:func_id>', methods=['GET'])
|
||||
@blueprint.route(
|
||||
'/get_arguments/<int:sid>/<int:did>/<int:scid>/<int:func_id>',
|
||||
methods=['GET'], endpoint='get_arguments'
|
||||
)
|
||||
@login_required
|
||||
def get_arguments_sqlite(sid, did, scid, func_id):
|
||||
"""
|
||||
@@ -1305,7 +1356,10 @@ def get_arguments_sqlite(sid, did, scid, func_id):
|
||||
return make_json_response(data={'result': 'result', 'args_count': DbgFuncArgsCount})
|
||||
|
||||
|
||||
@blueprint.route('/set_arguments/<int:sid>/<int:did>/<int:scid>/<int:func_id>', methods=['POST'])
|
||||
@blueprint.route(
|
||||
'/set_arguments/<int:sid>/<int:did>/<int:scid>/<int:func_id>',
|
||||
methods=['POST'], endpoint='set_arguments'
|
||||
)
|
||||
@login_required
|
||||
def set_arguments_sqlite(sid, did, scid, func_id):
|
||||
"""
|
||||
@@ -1382,6 +1436,7 @@ def set_arguments_sqlite(sid, did, scid, func_id):
|
||||
|
||||
return make_json_response(data={'status': True, 'result': 'Success'})
|
||||
|
||||
|
||||
def convert_data_to_dict(conn, result):
|
||||
"""
|
||||
This function helps us to convert result set into dict
|
||||
@@ -1422,7 +1477,10 @@ def convert_data_to_dict(conn, result):
|
||||
return columns, result
|
||||
|
||||
|
||||
@blueprint.route('/poll_end_execution_result/<int:trans_id>/', methods=["GET"])
|
||||
@blueprint.route(
|
||||
'/poll_end_execution_result/<int:trans_id>/',
|
||||
methods=["GET"], endpoint='poll_end_execution_result'
|
||||
)
|
||||
@login_required
|
||||
def poll_end_execution_result(trans_id):
|
||||
"""
|
||||
@@ -1518,7 +1576,9 @@ def poll_end_execution_result(trans_id):
|
||||
return make_json_response(data={'status': status, 'result': result})
|
||||
|
||||
|
||||
@blueprint.route('/poll_result/<int:trans_id>/', methods=["GET"])
|
||||
@blueprint.route(
|
||||
'/poll_result/<int:trans_id>/', methods=["GET"], endpoint='poll_result'
|
||||
)
|
||||
@login_required
|
||||
def poll_result(trans_id):
|
||||
"""
|
||||
|
@@ -4,10 +4,12 @@
|
||||
|
||||
try {
|
||||
require(
|
||||
['pgadmin', 'pgadmin.tools.debugger.direct'],
|
||||
function(pgAdmin, pgDirectDebug) {
|
||||
pgDirectDebug.init({{ uniqueId }}, {{ debug_type }});
|
||||
['sources/generated/debugger_direct'],
|
||||
function(pgDirectDebug) {
|
||||
var pgDirectDebug = pgDirectDebug || pgAdmin.Tools.DirectDebug;
|
||||
var $ = pgDirectDebug.jquery;
|
||||
|
||||
pgDirectDebug.init({{ uniqueId }}, {{ debug_type }});
|
||||
window.onbeforeunload = function(ev) {
|
||||
$.ajax({
|
||||
url: "{{ url_for('debugger.index') }}close/{{ uniqueId }}",
|
||||
|
@@ -1,9 +1,9 @@
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror',
|
||||
'backform', 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
|
||||
'backform', 'tools.debugger.ui', 'wcdocker', 'pgadmin.backform',
|
||||
'pgadmin.backgrid', 'pgadmin.browser.frame'
|
||||
], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) {
|
||||
], function(gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) {
|
||||
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
|
||||
@@ -173,7 +173,7 @@ define([
|
||||
|
||||
var args = {
|
||||
'URL': _url,
|
||||
'BASEURL': '{{ url_for('debugger.index')}}',
|
||||
'BASEURL': url_for('debugger.index'),
|
||||
'REF': ref,
|
||||
'OBJTYPE': encodeURI(node.type)
|
||||
};
|
||||
@@ -229,33 +229,68 @@ define([
|
||||
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
|
||||
|
||||
if (d._type == "function") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "indirect/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'indirect',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.function._id
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (d._type == "procedure") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "indirect/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'indirect',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.procedure._id
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (d._type == "trigger_function") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "indirect/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.trigger_function._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'indirect',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.trigger_function._id
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (d._type == "trigger" && "table" in treeInfo) {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "indirect/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.table._id +
|
||||
"/" + treeInfo.trigger._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_trigger', {
|
||||
'debug_type': 'indirect',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.table._id,
|
||||
'tri_id': treeInfo.trigger._id
|
||||
}
|
||||
);
|
||||
}
|
||||
else if (d._type == "trigger" && "view" in treeInfo) {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "indirect/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.view._id +
|
||||
"/" + treeInfo.trigger._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_trigger', {
|
||||
'debug_type': 'indirect',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.view._id,
|
||||
'tri_id': treeInfo.trigger._id
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
success: function(res) {
|
||||
var url = "{{ url_for('debugger.index') }}" + "direct/" + res.data.debuggerTransId;
|
||||
var url = url_for('debugger.direct', {'trans_id': res.data.debuggerTransId});
|
||||
|
||||
if (res.data.newBrowserTab) {
|
||||
window.open(url, '_blank');
|
||||
@@ -277,7 +312,7 @@ define([
|
||||
|
||||
// Panel Closed event
|
||||
panel.on(wcDocker.EVENT.CLOSED, function() {
|
||||
var closeUrl = "{{ url_for('debugger.index') }}" + "close/" + res.data.debuggerTransId;
|
||||
var closeUrl = url_for('debugger.close', {'trans_id': res.data.debuggerTransId});
|
||||
$.ajax({
|
||||
url: closeUrl,
|
||||
method: 'DELETE'
|
||||
@@ -339,12 +374,26 @@ define([
|
||||
var treeInfo = node.getTreeNodeHierarchy.apply(node, [i]);
|
||||
|
||||
if (d._type == "function") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.function._id
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
|
||||
var baseUrl = url_for(
|
||||
'debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.procedure._id
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@@ -352,7 +401,7 @@ define([
|
||||
method: 'GET',
|
||||
success: function(res) {
|
||||
|
||||
var url = "{{ url_for('debugger.index') }}" + "direct/" + res.data.debuggerTransId;
|
||||
var url = url_for('debugger.direct', {'trans_id': res.data.debuggerTransId});
|
||||
|
||||
if (res.data.newBrowserTab) {
|
||||
window.open(url, '_blank');
|
||||
@@ -374,7 +423,7 @@ define([
|
||||
|
||||
// Register Panel Closed event
|
||||
panel.on(wcDocker.EVENT.CLOSED, function() {
|
||||
var closeUrl = "{{ url_for('debugger.index') }}" + "close/" + res.data.debuggerTransId;
|
||||
var closeUrl = url_for('debugger.close', {'trans_id': res.data.debuggerTransId});
|
||||
$.ajax({
|
||||
url: closeUrl,
|
||||
method: 'DELETE'
|
||||
|
@@ -1,9 +1,9 @@
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror',
|
||||
'backform', 'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid',
|
||||
'pgadmin.browser.panel'
|
||||
], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) {
|
||||
], function(gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) {
|
||||
|
||||
/*
|
||||
* Function used to return the respective Backgrid control based on the data type
|
||||
@@ -147,31 +147,50 @@ define([
|
||||
|
||||
if (d._type == "function") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
|
||||
var _Url = url_for('debugger.get_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.function._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "procedure") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
|
||||
var _Url = url_for('debugger.get_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.procedure._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbfunc") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
|
||||
var _Url = url_for('debugger.get_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbfunc._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbproc") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
|
||||
var _Url = url_for('debugger.get_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbproc._id
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "get_arguments/" + this.data.server_id +
|
||||
"/" + this.data.database_id + "/" + this.data.schema_id + "/" + this.data.function_id;
|
||||
var _Url = url_for('debugger.get_arguments', {
|
||||
'sid': this.data.server_id,
|
||||
'did': this.data.database_id,
|
||||
'scid': this.data.schema_id,
|
||||
'func_id': this.data.function_id
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: _Url,
|
||||
method: 'GET',
|
||||
@@ -221,16 +240,16 @@ define([
|
||||
// Below will calculate the input argument id required to store in sqlite database
|
||||
var input_arg_id = this.input_arg_id = [];
|
||||
if (this.data['proargmodes'] != null) {
|
||||
argmode_1 = this.data['proargmodes'].split(",");
|
||||
for (k = 0; k < argmode_1.length; k++) {
|
||||
var argmode_1 = this.data['proargmodes'].split(",");
|
||||
for (var k = 0; k < argmode_1.length; k++) {
|
||||
if (argmode_1[k] == 'i' || argmode_1[k] == 'b') {
|
||||
input_arg_id.push(k)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
argtype_1 = this.data['proargtypenames'].split(",");
|
||||
for (k = 0; k < argtype_1.length; k++) {
|
||||
var argtype_1 = this.data['proargtypenames'].split(",");
|
||||
for (var k = 0; k < argtype_1.length; k++) {
|
||||
input_arg_id.push(k)
|
||||
}
|
||||
}
|
||||
@@ -251,7 +270,7 @@ define([
|
||||
argname = this.data['proargnames'].split(",");
|
||||
|
||||
// It will assign default values to "Default value" column
|
||||
for (j = (argname.length - 1);j >= 0; j--) {
|
||||
for (var j = (argname.length - 1); j >= 0; j--) {
|
||||
if (this.data['proargmodes'] != null) {
|
||||
if (arg_cnt && (argmode[j] == 'i' || argmode[j] == 'b')) {
|
||||
arg_cnt = arg_cnt - 1;
|
||||
@@ -340,7 +359,7 @@ define([
|
||||
else {
|
||||
// If there is default arguments
|
||||
//Below logic will assign default values to "Default value" column
|
||||
for (j = (myargname.length - 1);j >= 0; j--) {
|
||||
for (var j = (myargname.length - 1);j >= 0; j--) {
|
||||
if (this.data['proargmodes'] == null) {
|
||||
if (arg_cnt) {
|
||||
arg_cnt = arg_cnt - 1;
|
||||
@@ -528,21 +547,42 @@ define([
|
||||
|
||||
// If debugging is not started again then we should initialize the target otherwise not
|
||||
if (self.restart_debug == 0) {
|
||||
var baseUrl;
|
||||
if (d._type == "function") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
|
||||
baseUrl = url_for('debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.function._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "procedure") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
|
||||
baseUrl = url_for('debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.procedure._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbfunc") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
|
||||
baseUrl = url_for('debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbfunc._id
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbproc") {
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "initialize_target/" + "direct/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
|
||||
baseUrl = url_for('debugger.initialize_target_for_function', {
|
||||
'debug_type': 'direct',
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbproc._id
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@@ -551,7 +591,7 @@ define([
|
||||
data:{'data':JSON.stringify(args_value_list)},
|
||||
success: function(res) {
|
||||
|
||||
var url = "{{ url_for('debugger.index') }}" + "direct/" + res.data.debuggerTransId;
|
||||
var url = url_for('debugger.direct', {'trans_id': res.data.debuggerTransId});
|
||||
|
||||
if (res.data.newBrowserTab) {
|
||||
window.open(url, '_blank');
|
||||
@@ -571,31 +611,47 @@ define([
|
||||
|
||||
// Panel Closed event
|
||||
panel.on(wcDocker.EVENT.CLOSED, function() {
|
||||
var closeUrl = "{{ url_for('debugger.index') }}" + "close/" + res.data.debuggerTransId;
|
||||
var closeUrl = url_for('debugger.close', {'trans_id': res.data.debuggerTransId});
|
||||
$.ajax({
|
||||
url: closeUrl,
|
||||
method: 'GET'
|
||||
method: 'DELETE'
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (d._type == "function") {
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.function._id;
|
||||
var _Url = url_for('debugger.set_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.function._id,
|
||||
});
|
||||
}
|
||||
else if (d._type == "procedure") {
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.procedure._id;
|
||||
var _Url = url_for('debugger.set_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.procedure._id,
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbfunc") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbfunc._id;
|
||||
var _Url = url_for('debugger.set_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbfunc._id,
|
||||
});
|
||||
}
|
||||
else if (d._type == "edbproc") {
|
||||
// Get the existing function parameters available from sqlite database
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + treeInfo.server._id +
|
||||
"/" + treeInfo.database._id + "/" + treeInfo.schema._id + "/" + treeInfo.edbproc._id;
|
||||
var _Url = url_for('debugger.set_arguments', {
|
||||
'sid': treeInfo.server._id,
|
||||
'did': treeInfo.database._id,
|
||||
'scid': treeInfo.schema._id,
|
||||
'func_id': treeInfo.edbproc._id,
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@@ -621,7 +677,7 @@ define([
|
||||
}
|
||||
else {
|
||||
// If the debugging is started again then we should only set the arguments and start the listener again
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "start_listener/" + self.data.trans_id;
|
||||
var baseUrl = url_for('debugger.start_listener', {'trans_id': self.data.trans_id});
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -638,9 +694,12 @@ define([
|
||||
});
|
||||
|
||||
// Set the new input arguments given by the user during debugging
|
||||
var _Url = "{{ url_for('debugger.index') }}" + "set_arguments/" + self.data.server_id +
|
||||
"/" + self.data.database_id + "/" + self.data.schema_id + "/" + self.data.function_id;
|
||||
|
||||
var _Url = url_for('debugger.set_arguments', {
|
||||
'sid': self.data.server_id,
|
||||
'did': self.data.database_id,
|
||||
'scid': self.data.schema_id,
|
||||
'func_id': self.data.function_id
|
||||
});
|
||||
$.ajax({
|
||||
url: _Url,
|
||||
method: 'POST',
|
||||
@@ -690,7 +749,7 @@ define([
|
||||
var self = this;
|
||||
var enable_btn = false;
|
||||
|
||||
for (i = 0; i < this.collection.length; i++ ) {
|
||||
for (var i = 0; i < this.collection.length; i++ ) {
|
||||
|
||||
// TODO: Need to check the "NULL" and "Expression" column value to enable/disable the "Debug" button
|
||||
if (this.collection.models[i].get('value') == "" ||
|
||||
|
@@ -1,20 +1,18 @@
|
||||
define([
|
||||
'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform',
|
||||
'pgadmin.tools.debugger.ui',
|
||||
'sources/gettext', 'sources/url_for' ,'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'sources/../bundle/codemirror', 'backform',
|
||||
'tools.debugger.ui',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
|
||||
'wcdocker', 'pgadmin.backform',
|
||||
'pgadmin.backgrid', 'codemirror/addon/selection/active-line',
|
||||
'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode',
|
||||
'pgadmin-sqlfoldcode', 'codemirror/addon/edit/matchbrackets',
|
||||
'codemirror/addon/edit/closebrackets',
|
||||
'pgadmin.backgrid'
|
||||
|
||||
], function(
|
||||
gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
|
||||
CodeMirror, Backform, debug_function_again, AlertifyWrapper
|
||||
gettext, url_for, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid,
|
||||
codemirror, Backform, debug_function_again, AlertifyWrapper
|
||||
) {
|
||||
|
||||
var CodeMirror = codemirror.default;
|
||||
if (pgAdmin.Browser.tree != null) {
|
||||
pgAdmin = pgAdmin || window.pgAdmin || {};
|
||||
}
|
||||
@@ -41,8 +39,11 @@ define([
|
||||
var self = this;
|
||||
|
||||
// Make ajax call to set/clear the break point by user
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "set_breakpoint/" + trans_id + "/" + line_no + "/" + set_type;
|
||||
|
||||
var baseUrl = url_for('debugger.set_breakpoint', {
|
||||
'trans_id': trans_id,
|
||||
'line_no': line_no,
|
||||
'set_type': set_type
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -72,13 +73,13 @@ define([
|
||||
|
||||
var breakpoint_list = new Array();
|
||||
|
||||
for (i = 0; i < br_list.length; i++) {
|
||||
for (var i = 0; i < br_list.length; i++) {
|
||||
if (br_list[i].linenumber != -1) {
|
||||
breakpoint_list.push(br_list[i].linenumber)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0;i< breakpoint_list.length;i++) {
|
||||
for (var i = 0;i< breakpoint_list.length;i++) {
|
||||
var info = pgTools.DirectDebug.editor.lineInfo((breakpoint_list[i] - 1));
|
||||
|
||||
if (info.gutterMarkers != undefined) {
|
||||
@@ -101,8 +102,10 @@ define([
|
||||
var result = '';
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "get_breakpoints";
|
||||
|
||||
var baseUrl = url_for('debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'get_breakpoints'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -133,8 +136,11 @@ define([
|
||||
start_execution: function(trans_id, port_num) {
|
||||
var self = this;
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "start_execution/" + trans_id + "/" + port_num;
|
||||
|
||||
var baseUrl = url_for(
|
||||
'debugger.start_execution', {
|
||||
'trans_id': trans_id,
|
||||
'port_num': port_num
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -163,8 +169,11 @@ define([
|
||||
execute_query: function(trans_id) {
|
||||
var self = this;
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "wait_for_breakpoint";
|
||||
|
||||
var baseUrl = url_for(
|
||||
'debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'wait_for_breakpoint'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -173,7 +182,7 @@ define([
|
||||
// set the return code to the code editor text area
|
||||
if (res.data.result[0].src != null && res.data.result[0].linenumber != null) {
|
||||
pgTools.DirectDebug.editor.setValue(res.data.result[0].src);
|
||||
active_line_no = self.active_line_no = (res.data.result[0].linenumber - 2);
|
||||
var active_line_no = self.active_line_no = (res.data.result[0].linenumber - 2);
|
||||
pgTools.DirectDebug.editor.addLineClass((res.data.result[0].linenumber - 2), 'wrap', 'CodeMirror-activeline-background');
|
||||
}
|
||||
|
||||
@@ -204,8 +213,11 @@ define([
|
||||
var self = this;
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "get_variables";
|
||||
|
||||
var baseUrl = url_for(
|
||||
'debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'get_variables'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -243,8 +255,11 @@ define([
|
||||
var self = this;
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "get_stack_info";
|
||||
|
||||
var baseUrl = url_for(
|
||||
'debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'get_stack_info'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -283,7 +298,7 @@ define([
|
||||
}
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "poll_result/" + trans_id;
|
||||
var baseUrl = url_for('debugger.poll_result', {'trans_id': trans_id});
|
||||
|
||||
/*
|
||||
During the execution we should poll the result in minimum seconds but once the execution is completed
|
||||
@@ -434,7 +449,7 @@ define([
|
||||
}
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "poll_end_execution_result/" + trans_id;
|
||||
var baseUrl = url_for('debugger.poll_end_execution_result', {'trans_id': trans_id});
|
||||
|
||||
/*
|
||||
During the execution we should poll the result in minimum seconds but once the execution is completed
|
||||
@@ -592,7 +607,7 @@ define([
|
||||
Restart: function(trans_id) {
|
||||
|
||||
var self = this,
|
||||
baseUrl = "{{ url_for('debugger.index') }}" + "restart/" + trans_id;
|
||||
baseUrl = url_for('debugger.restart', {'trans_id': trans_id});
|
||||
self.enable('stop', false);
|
||||
self.enable('step_over', false);
|
||||
self.enable('step_into', false);
|
||||
@@ -629,7 +644,7 @@ define([
|
||||
}
|
||||
else {
|
||||
// Debugging of void function is started again so we need to start the listener again
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "start_listener/" + trans_id;
|
||||
var baseUrl = url_for('debugger.start_listener', {'trans_id': trans_id});
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -676,8 +691,10 @@ define([
|
||||
}
|
||||
else {
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "continue";
|
||||
|
||||
var baseUrl = url_for('debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'continue'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -712,8 +729,10 @@ define([
|
||||
self.enable('continue', false);
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_over";
|
||||
|
||||
var baseUrl = url_for('debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'step_over'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -747,8 +766,10 @@ define([
|
||||
self.enable('continue', false);
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "step_into";
|
||||
|
||||
var baseUrl = url_for('debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'step_into'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -782,8 +803,11 @@ define([
|
||||
self.enable('continue', false);
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "execute_query/" + trans_id + "/" + "abort_target";
|
||||
|
||||
var baseUrl = url_for(
|
||||
'debugger.execute_query', {
|
||||
'trans_id': trans_id,
|
||||
'query_type': 'abort_target'
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -838,10 +862,18 @@ define([
|
||||
// If gutterMarker is undefined that means there is no marker defined previously
|
||||
// So we need to set the breakpoint command here...
|
||||
if (info.gutterMarkers == undefined) {
|
||||
baseUrl = "{{ url_for('debugger.index') }}" + "set_breakpoint/" + trans_id + "/" + (self.active_line_no + 1) + "/" + "1";
|
||||
baseUrl = url_for('debugger.set_breakpoint', {
|
||||
'trans_id': trans_id,
|
||||
'line_no': self.active_line_no + 1,
|
||||
'set_type': '1'
|
||||
});
|
||||
}
|
||||
else {
|
||||
baseUrl = "{{ url_for('debugger.index') }}" + "set_breakpoint/" + trans_id + "/" + (self.active_line_no + 1) + "/" + "0";
|
||||
baseUrl = url_for('debugger.set_breakpoint', {
|
||||
'trans_id': trans_id,
|
||||
'line_no': self.active_line_no + 1,
|
||||
'set_type': '0'
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@@ -903,14 +935,14 @@ define([
|
||||
|
||||
var breakpoint_list = new Array();
|
||||
|
||||
for (i = 0; i < br_list.length; i++) {
|
||||
for (var i = 0; i < br_list.length; i++) {
|
||||
if (br_list[i].linenumber != -1) {
|
||||
breakpoint_list.push(br_list[i].linenumber)
|
||||
}
|
||||
}
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "clear_all_breakpoint/" + trans_id;
|
||||
var baseUrl = url_for('debugger.clear_all_breakpoint', {'trans_id': trans_id});
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -918,7 +950,7 @@ define([
|
||||
data: { 'breakpoint_list': breakpoint_list.join() },
|
||||
success: function(res) {
|
||||
if (res.data.status) {
|
||||
for (i = 0;i< breakpoint_list.length;i++) {
|
||||
for (var i = 0; i < breakpoint_list.length; i++) {
|
||||
var info = pgTools.DirectDebug.editor.lineInfo((breakpoint_list[i] - 1));
|
||||
|
||||
if (info) {
|
||||
@@ -966,7 +998,7 @@ define([
|
||||
model: DebuggerStackModel
|
||||
});
|
||||
|
||||
stackGridCols = [
|
||||
var stackGridCols = [
|
||||
{name: 'name', label:'Name', type:'text', editable: false, cell:'string'},
|
||||
{name: 'value', label:'Value', type:'text', editable: false, cell:'string'},
|
||||
{name: 'line_no', label:'Line No.', type:'text', editable: false, cell:'string'}
|
||||
@@ -975,7 +1007,7 @@ define([
|
||||
var my_obj = [];
|
||||
if (result.length != 0)
|
||||
{
|
||||
for (i = 0; i < result.length; i++) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
my_obj.push({ "name": result[i].targetname, "value": result[i].args, "line_no": result[i].linenumber });
|
||||
}
|
||||
}
|
||||
@@ -994,7 +1026,7 @@ define([
|
||||
},
|
||||
rowClick: function(e) {
|
||||
//Find which row is selected and depending on that send the frame id
|
||||
for (i = 0; i < this.model.collection.length; i++) {
|
||||
for (var i = 0; i < this.model.collection.length; i++) {
|
||||
if (this.model.collection.models[i].get('name') == this.model.get('name')) {
|
||||
self.frame_id_ = i;
|
||||
break;
|
||||
@@ -1085,7 +1117,7 @@ define([
|
||||
model: DebuggerVariablesModel
|
||||
});
|
||||
|
||||
gridCols = [
|
||||
var gridCols = [
|
||||
{name: 'name', label:'Name', type:'text', editable: false, cell:'string'},
|
||||
{name: 'type', label:'Type', type: 'text', editable: false, cell:'string'},
|
||||
{name: 'value', label:'Value', type: 'text', cell: 'string'}
|
||||
@@ -1094,7 +1126,7 @@ define([
|
||||
var my_obj = [];
|
||||
if (result.length != 0)
|
||||
{
|
||||
for (i = 0; i < result.length; i++) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
if (result[i].varclass == 'L') {
|
||||
my_obj.push({ "name": result[i].name, "type": result[i].dtype, "value": result[i].value});
|
||||
}
|
||||
@@ -1139,7 +1171,7 @@ define([
|
||||
|
||||
self.ParametersCollection.prototype.on('change', self.deposit_parameter_value, self);
|
||||
|
||||
paramGridCols = [
|
||||
var paramGridCols = [
|
||||
{name: 'name', label:'Name', type:'text', editable: false, cell:'string'},
|
||||
{name: 'type', label:'Type', type: 'text', editable: false, cell:'string'},
|
||||
{name: 'value', label:'Value', type: 'text', cell: 'string'}
|
||||
@@ -1148,7 +1180,7 @@ define([
|
||||
var param_obj = [];
|
||||
if (result.length != 0)
|
||||
{
|
||||
for (i = 0; i < result.length; i++) {
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
if (result[i].varclass == 'A') {
|
||||
param_obj.push({ "name": result[i].name, "type": result[i].dtype, "value": result[i].value});
|
||||
}
|
||||
@@ -1177,8 +1209,9 @@ define([
|
||||
name_value_list.push({ 'name': model.get('name'),'type': model.get('type'), 'value': model.get('value')});
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "deposit_value/" + pgTools.DirectDebug.trans_id;
|
||||
|
||||
var baseUrl = url_for('debugger.deposit_value', {
|
||||
'trans_id': pgTools.DirectDebug.trans_id
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'POST',
|
||||
@@ -1209,8 +1242,10 @@ define([
|
||||
var self = this;
|
||||
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "select_frame/" + pgTools.DirectDebug.trans_id + "/" + self.frame_id_;
|
||||
|
||||
var baseUrl = url_for('debugger.select_frame', {
|
||||
'trans_id': pgTools.DirectDebug.trans_id,
|
||||
'frame_id': self.frame_id_
|
||||
});
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
method: 'GET',
|
||||
@@ -1376,7 +1411,7 @@ define([
|
||||
'#container', {
|
||||
allowContextMenu: false,
|
||||
allowCollapse: false,
|
||||
themePath: '{{ url_for("static", filename="css") }}',
|
||||
themePath: url_for('static', {'filename': 'css'}),
|
||||
theme: 'webcabin.overrides.css'
|
||||
});
|
||||
|
||||
@@ -1386,7 +1421,7 @@ define([
|
||||
// indirect debugging - 0 and for direct debugging - 1
|
||||
if (trans_id != undefined && !debug_type) {
|
||||
// Make ajax call to execute the and start the target for execution
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "start_listener/" + trans_id;
|
||||
var baseUrl = url_for('debugger.start_listener', {'trans_id': trans_id });
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -1408,7 +1443,7 @@ define([
|
||||
else if (trans_id != undefined && debug_type)
|
||||
{
|
||||
// Make ajax call to execute the and start the target for execution
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "start_listener/" + trans_id;
|
||||
var baseUrl = url_for('debugger.start_listener', {'trans_id': trans_id });
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -1434,7 +1469,7 @@ define([
|
||||
messages: function(trans_id) {
|
||||
var self = this;
|
||||
// Make ajax call to listen the database message
|
||||
var baseUrl = "{{ url_for('debugger.index') }}" + "messages/" + trans_id;
|
||||
var baseUrl = url_for('debugger.messages', {'trans_id': trans_id });
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl,
|
||||
@@ -1658,6 +1693,7 @@ define([
|
||||
});
|
||||
|
||||
pgTools.DirectDebug = new DirectDebug();
|
||||
pgTools.DirectDebug['jquery'] = $;
|
||||
|
||||
return pgTools.DirectDebug;
|
||||
});
|
||||
|
@@ -493,7 +493,7 @@ define([
|
||||
}
|
||||
|
||||
coll.sort();
|
||||
dbObjectFilter = this.dbObjectFilter = this.DbObjectFilter(coll);
|
||||
var dbObjectFilter = this.dbObjectFilter = this.DbObjectFilter(coll);
|
||||
|
||||
/**
|
||||
privArray holds objects selected which further helps
|
||||
|
@@ -81,7 +81,7 @@ define([
|
||||
if (_.isFunction(options)) {
|
||||
try {
|
||||
var all_cols = options.apply(self);
|
||||
for(idx in all_cols) {
|
||||
for(var idx in all_cols) {
|
||||
op_vals.push((all_cols[idx])['value']);
|
||||
}
|
||||
} catch(e) {
|
||||
@@ -276,7 +276,7 @@ define([
|
||||
Enable/disable import menu in tools based on node selected
|
||||
Import menu will be enabled only when user select table node.
|
||||
*/
|
||||
menu_enabled = function(itemData, item, data) {
|
||||
var menu_enabled = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
var parent_item = t.hasParent(i) ? t.parent(i): null,
|
||||
parent_data = parent_item ? t.itemData(parent_item) : null;
|
||||
|
@@ -86,18 +86,18 @@ define([
|
||||
{
|
||||
type: 'nested', control: 'fieldset', label: gettext('Vacuum'), group: gettext('Options'),
|
||||
schema:[{
|
||||
id: 'vacuum_full', disabled: false, group: gettext('Vacuum'), disabled: 'isDisabled',
|
||||
id: 'vacuum_full', group: gettext('Vacuum'), disabled: 'isDisabled',
|
||||
control: Backform.CustomSwitchControl, label: gettext('FULL'), deps: ['op']
|
||||
},{
|
||||
id: 'vacuum_freeze', disabled: false, deps: ['op'], disabled: 'isDisabled',
|
||||
id: 'vacuum_freeze', deps: ['op'], disabled: 'isDisabled',
|
||||
control: Backform.CustomSwitchControl, label: gettext('FREEZE'), group: gettext('Vacuum')
|
||||
},{
|
||||
id: 'vacuum_analyze', disabled: false, deps: ['op'], disabled: 'isDisabled',
|
||||
id: 'vacuum_analyze', deps: ['op'], disabled: 'isDisabled',
|
||||
control: Backform.CustomSwitchControl, label: gettext('ANALYZE'), group: gettext('Vacuum')
|
||||
}]
|
||||
},
|
||||
{
|
||||
id: 'verbose', disabled: false, group: gettext('Options'), deps: ['op'],
|
||||
id: 'verbose', group: gettext('Options'), deps: ['op'],
|
||||
control: Backform.CustomSwitchControl, label: gettext('Verbose Messages'), disabled: 'isDisabled'
|
||||
}
|
||||
],
|
||||
@@ -157,7 +157,7 @@ define([
|
||||
Enable/disable Maintenance menu in tools based on node selected.
|
||||
Maintenance menu will be enabled only when user select table and database node.
|
||||
*/
|
||||
menu_enabled = function(itemData, item, data) {
|
||||
var menu_enabled = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
var parent_item = t.hasParent(i) ? t.parent(i): null,
|
||||
parent_data = parent_item ? t.itemData(parent_item) : null;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// Restore dialog
|
||||
define([
|
||||
define('tools.restore', [
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
|
||||
'underscore.string', 'alertify', 'pgadmin.browser', 'backbone', 'backgrid',
|
||||
'backform', 'pgadmin.browser.node',
|
||||
@@ -239,7 +239,7 @@ define([
|
||||
menu will be enabled otherwise disabled.
|
||||
Also, hide it for system view in catalogs
|
||||
*/
|
||||
menu_enabled = function(itemData, item, data) {
|
||||
var menu_enabled = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
var parent_item = t.hasParent(i) ? t.parent(i): null,
|
||||
parent_data = parent_item ? t.itemData(parent_item) : null;
|
||||
@@ -260,7 +260,7 @@ define([
|
||||
return false;
|
||||
};
|
||||
|
||||
is_parent_catalog = function(itemData, item, data) {
|
||||
var is_parent_catalog = function(itemData, item, data) {
|
||||
var t = pgBrowser.tree, i = item, d = itemData;
|
||||
// To iterate over tree to check parent node
|
||||
while (i) {
|
||||
@@ -342,7 +342,7 @@ define([
|
||||
return;
|
||||
}
|
||||
|
||||
var title = S('{{ 'Restore (%s: %s)' }}'),
|
||||
var title = S(gettext('Restore (%s: %s)')),
|
||||
tree = pgBrowser.tree,
|
||||
item = treeItem || tree.selected(),
|
||||
data = item && item.length == 1 && tree.itemData(item),
|
||||
|
@@ -25,7 +25,7 @@ from pgadmin.utils.ajax import make_json_response, bad_request, \
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from pgadmin.utils.sqlautocomplete.autocomplete import SQLAutoComplete
|
||||
from pgadmin.misc.file_manager import Filemanager
|
||||
|
||||
from pgadmin.utils.menu import MenuItem
|
||||
|
||||
from config import PG_DEFAULT_DRIVER, ON_DEMAND_RECORD_COUNT
|
||||
|
||||
@@ -61,7 +61,14 @@ class SqlEditorModule(PgAdminModule):
|
||||
LABEL = gettext("SQL Editor")
|
||||
|
||||
def get_own_menuitems(self):
|
||||
return {}
|
||||
return {'tools': [
|
||||
MenuItem(name='mnu_query_tool',
|
||||
label=gettext('Query tool'),
|
||||
priority=100,
|
||||
callback='show_query_tool',
|
||||
icon='fa fa-question',
|
||||
url=url_for('help.static', filename='index.html'))
|
||||
]}
|
||||
|
||||
def get_own_javascripts(self):
|
||||
return [{
|
||||
@@ -70,6 +77,7 @@ class SqlEditorModule(PgAdminModule):
|
||||
'when': None
|
||||
}]
|
||||
|
||||
|
||||
def get_panels(self):
|
||||
return []
|
||||
|
||||
|
@@ -497,7 +497,6 @@ input.editor-checkbox:focus {
|
||||
bottom: 4px;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.slick-cell, .slick-headerrow-column {
|
||||
border-right: 1px solid #ccc;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
define([
|
||||
define('tools.querytool', [
|
||||
'sources/gettext','sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin', 'backbone', 'backgrid', 'codemirror', 'pgadmin.misc.explain',
|
||||
'pgadmin', 'backbone', 'sources/../bundle/codemirror', 'pgadmin.misc.explain',
|
||||
'sources/selection/grid_selector',
|
||||
'sources/selection/active_cell_capture',
|
||||
'sources/selection/clipboard',
|
||||
@@ -10,36 +10,25 @@ define([
|
||||
'sources/selection/xcell_selection_model',
|
||||
'sources/selection/set_staged_rows',
|
||||
'sources/sqleditor_utils',
|
||||
'sources/history/index.js',
|
||||
'sources/../jsx/history/query_history',
|
||||
'react', 'react-dom',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
|
||||
'sources/generated/history',
|
||||
'sources/generated/reactComponents',
|
||||
|
||||
'slickgrid', 'bootstrap', 'pgadmin.browser', 'wcdocker',
|
||||
'codemirror/mode/sql/sql', 'codemirror/addon/selection/mark-selection',
|
||||
'codemirror/addon/selection/active-line', 'codemirror/addon/fold/foldcode',
|
||||
'codemirror/addon/fold/foldgutter', 'codemirror/addon/hint/show-hint',
|
||||
'codemirror/addon/hint/sql-hint', 'pgadmin.file_manager',
|
||||
'pgadmin-sqlfoldcode',
|
||||
'codemirror/addon/scroll/simplescrollbars',
|
||||
'codemirror/addon/dialog/dialog',
|
||||
'codemirror/addon/search/search',
|
||||
'codemirror/addon/search/searchcursor',
|
||||
'codemirror/addon/search/jump-to-line',
|
||||
'codemirror/addon/edit/matchbrackets',
|
||||
'codemirror/addon/edit/closebrackets',
|
||||
|
||||
'sources/../bundle/slickgrid',
|
||||
'misc.file_manager',
|
||||
'backgrid.sizeable.columns',
|
||||
'slick.pgadmin.formatters',
|
||||
'slick.pgadmin.editors',
|
||||
'pgadmin.browser'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror,
|
||||
gettext, url_for, $, _, S, alertify, pgAdmin, Backbone, codemirror,
|
||||
pgExplain, GridSelector, ActiveCellCapture, clipboard, copyData, RangeSelectionHelper, handleQueryOutputKeyboardEvent,
|
||||
XCellSelectionModel, setStagedRows, SqlEditorUtils, AlertifyWrapper, HistoryBundle, reactComponents
|
||||
XCellSelectionModel, setStagedRows, SqlEditorUtils, HistoryBundle, queryHistory, React, ReactDOM, AlertifyWrapper
|
||||
) {
|
||||
/* Return back, this has been called more than once */
|
||||
if (pgAdmin.SqlEditor)
|
||||
return pgAdmin.SqlEditor;
|
||||
var CodeMirror = codemirror.default;
|
||||
|
||||
// Some scripts do export their object in the window only.
|
||||
// Generally the one, which do no have AMD support.
|
||||
@@ -1013,9 +1002,9 @@ define([
|
||||
|
||||
self.history_collection = new HistoryBundle.HistoryCollection([]);
|
||||
|
||||
var queryHistoryElement = reactComponents.React.createElement(
|
||||
reactComponents.QueryHistory, {historyCollection: self.history_collection});
|
||||
reactComponents.render(queryHistoryElement, $('#history_grid')[0]);
|
||||
var queryHistoryElement = React.createElement(
|
||||
queryHistory.QueryHistory, {historyCollection: self.history_collection});
|
||||
ReactDOM.render(queryHistoryElement, $('#history_grid')[0]);
|
||||
},
|
||||
|
||||
// Callback function for Add New Row button click.
|
||||
@@ -1990,7 +1979,9 @@ define([
|
||||
// To show column label and data type in multiline,
|
||||
// The elements should be put inside the div.
|
||||
// Create column label and type.
|
||||
var col_type = column_label = '';
|
||||
var col_type = '',
|
||||
column_label = '',
|
||||
col_cell;
|
||||
var type = pg_types[c.type_code] ?
|
||||
pg_types[c.type_code][0] :
|
||||
// This is the case where user might
|
||||
@@ -2290,7 +2281,7 @@ define([
|
||||
);
|
||||
|
||||
// Add the columns to the data so the server can remap the data
|
||||
req_data = self.data_store
|
||||
var req_data = self.data_store;
|
||||
req_data.columns = view ? view.handler.columns : self.columns;
|
||||
|
||||
// Make ajax call to save the data
|
||||
@@ -2327,7 +2318,7 @@ define([
|
||||
} else {
|
||||
dataView.beginUpdate();
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
item = grid.getDataItem(rows[i]);
|
||||
var item = grid.getDataItem(rows[i]);
|
||||
data.push(item);
|
||||
dataView.deleteItem(item[self.client_primary_key]);
|
||||
}
|
||||
@@ -2376,7 +2367,7 @@ define([
|
||||
if(_row_index in self.data_store.added_index) {
|
||||
// Remove new row index from temp_list if save operation
|
||||
// fails
|
||||
var index = self.handler.temp_new_rows.indexOf(_rowid);
|
||||
var index = self.handler.temp_new_rows.indexOf(res.data._rowid);
|
||||
if (index > -1) {
|
||||
self.handler.temp_new_rows.splice(index, 1);
|
||||
}
|
||||
@@ -2569,11 +2560,11 @@ define([
|
||||
|
||||
// read data from codemirror and write to file
|
||||
_save_file_handler: function(e) {
|
||||
var self = this;
|
||||
data = {
|
||||
'file_name': decodeURI(e),
|
||||
'file_content': self.gridView.query_tool_obj.getValue()
|
||||
}
|
||||
var self = this,
|
||||
data = {
|
||||
'file_name': decodeURI(e),
|
||||
'file_content': self.gridView.query_tool_obj.getValue()
|
||||
};
|
||||
self.trigger(
|
||||
'pgadmin-sqleditor:loading-icon:show',
|
||||
gettext("Saving the queries in the file...")
|
||||
@@ -2937,7 +2928,7 @@ define([
|
||||
|
||||
// This function will apply the filter.
|
||||
_apply_filter: function() {
|
||||
var self = this;
|
||||
var self = this,
|
||||
sql = self.gridView.filter_obj.getValue();
|
||||
|
||||
self.trigger(
|
||||
@@ -3064,7 +3055,7 @@ define([
|
||||
|
||||
// This function will set the limit for SQL query
|
||||
_set_limit: function() {
|
||||
var self = this;
|
||||
var self = this,
|
||||
limit = parseInt($(".limit").val());
|
||||
|
||||
self.trigger(
|
||||
@@ -3382,7 +3373,7 @@ define([
|
||||
},
|
||||
|
||||
_auto_rollback: function() {
|
||||
var self = this;
|
||||
var self = this,
|
||||
auto_rollback = true;
|
||||
|
||||
if ($('.auto-rollback').hasClass('visibility-hidden') === true)
|
||||
@@ -3730,7 +3721,9 @@ define([
|
||||
// This function is used to create and return the object of grid controller.
|
||||
create: function(container) {
|
||||
return new SqlEditorController(container);
|
||||
}
|
||||
},
|
||||
jquery: $,
|
||||
S: S
|
||||
};
|
||||
|
||||
return pgAdmin.SqlEditor;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
define(function () {
|
||||
var translations = {{ translations|tojson }};
|
||||
return translations;
|
||||
return [];
|
||||
});
|
@@ -1,11 +1,11 @@
|
||||
// Backup dialog
|
||||
define([
|
||||
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'underscore.string', 'alertify',
|
||||
'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node',
|
||||
'sources/alerts/alertify_wrapper',
|
||||
'sources/alerts/alertify_wrapper', 'pgadmin.user_management.current_user',
|
||||
'backgrid.select.all', 'backgrid.filter'
|
||||
], function(
|
||||
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode, AlertifyWrapper
|
||||
gettext, url_for, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform,
|
||||
pgNode, AlertifyWrapper, userInfo
|
||||
) {
|
||||
|
||||
// if module is already initialized, refer to that.
|
||||
@@ -36,11 +36,10 @@ define([
|
||||
this.initialized = true;
|
||||
|
||||
return this;
|
||||
}
|
||||
{% if is_admin %},
|
||||
|
||||
},
|
||||
// Callback to draw User Management Dialog.
|
||||
show_users: function(action, item, params) {
|
||||
if (!userInfo['is_admin']) return;
|
||||
var Roles = [];
|
||||
|
||||
var UserModel = pgAdmin.Browser.Node.Model.extend({
|
||||
@@ -97,7 +96,7 @@ define([
|
||||
if(m instanceof Backbone.Collection) {
|
||||
return true;
|
||||
}
|
||||
if (m.get("id") == {{user_id}}){
|
||||
if (m.get("id") == userInfo['user_id']){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -111,7 +110,7 @@ define([
|
||||
if(m instanceof Backbone.Collection) {
|
||||
return true;
|
||||
}
|
||||
if (m.get("id") == {{user_id}}){
|
||||
if (m.get("id") == userInfo['user_id']){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@@ -284,7 +283,7 @@ define([
|
||||
self = this;
|
||||
e.preventDefault();
|
||||
|
||||
if (self.model.get("id") == {{user_id}}) {
|
||||
if (self.model.get("id") == userInfo['user_id']) {
|
||||
alertify.alert(
|
||||
gettext('Cannot delete user.'),
|
||||
gettext('Cannot delete currently logged in user.'),
|
||||
@@ -468,7 +467,7 @@ define([
|
||||
}
|
||||
},
|
||||
saveUser: function(m) {
|
||||
d = m.toJSON(true);
|
||||
var d = m.toJSON(true);
|
||||
|
||||
if(m.isNew() && (!m.get('email') || !m.get('role') ||
|
||||
!m.get('newPassword') || !m.get('confirmPassword') ||
|
||||
@@ -636,7 +635,7 @@ define([
|
||||
});
|
||||
}
|
||||
alertify.UserManagement(true).resizeTo('680px','400px');
|
||||
}{% endif %}
|
||||
}
|
||||
|
||||
};
|
||||
return pgBrowser.UserManagement;
|
||||
|
Reference in New Issue
Block a user