Fixed issue change 'Auto Commit' option from preferences not reflacted properly on UI and also not set the class variable
parent
1606f1d8e8
commit
216b6b16b5
|
@ -111,7 +111,7 @@ body {
|
|||
<li class="divider"></li>
|
||||
<li>
|
||||
<a id="btn-auto-commit" href="#">
|
||||
<i class="auto-commit fa fa-check" aria-hidden="true"></i>
|
||||
<i class="auto-commit fa fa-check visibility-hidden" aria-hidden="true"></i>
|
||||
<span> {{ _('Auto-Commit') }} </span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -321,13 +321,26 @@ def start_query_tool(trans_id):
|
|||
)
|
||||
|
||||
|
||||
@blueprint.route('/query_tool/preferences', methods=["GET", "PUT"])
|
||||
@blueprint.route('/query_tool/preferences/<int:trans_id>', methods=["GET", "PUT"])
|
||||
@login_required
|
||||
def get_preferences():
|
||||
def preferences(trans_id):
|
||||
"""
|
||||
This method is used to get/put explain options from/to preferences
|
||||
|
||||
Args:
|
||||
trans_id: unique transaction id
|
||||
"""
|
||||
if request.method == 'GET':
|
||||
|
||||
# Check the transaction and connection status
|
||||
status, error_msg, conn, trans_obj, session_obj = check_transaction_status(trans_id)
|
||||
if status and conn is not None \
|
||||
and trans_obj is not None and session_obj is not None:
|
||||
|
||||
# Call the set_auto_commit method of transaction object
|
||||
trans_obj.set_auto_commit(blueprint.auto_commit.get())
|
||||
trans_obj.set_auto_rollback(blueprint.auto_rollback.get())
|
||||
|
||||
return make_json_response(
|
||||
data={
|
||||
'explain_verbose': blueprint.explain_verbose.get(),
|
||||
|
|
|
@ -305,8 +305,10 @@ define(
|
|||
* values from preferences
|
||||
*/
|
||||
get_preferences: function() {
|
||||
var self = this;
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences/" + self.transId ,
|
||||
method: 'GET',
|
||||
async: false,
|
||||
success: function(res) {
|
||||
|
@ -863,7 +865,7 @@ define(
|
|||
el: self.container,
|
||||
handler: self
|
||||
});
|
||||
self.transId = self.container.data('transId');
|
||||
self.transId = self.gridView.transId = self.container.data('transId');
|
||||
|
||||
self.gridView.editor_title = editor_title;
|
||||
self.gridView.current_file = undefined;
|
||||
|
@ -2409,25 +2411,26 @@ define(
|
|||
var data = {
|
||||
'explain_verbose': self.explain_verbose
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting verbose option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting verbose option in explain') }}'
|
||||
'{{ _('Error occurred while setting verbose option in explain') }}'
|
||||
);
|
||||
return;
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting verbose option in explain') }}'
|
||||
);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// This function will toggle "costs" option in explain
|
||||
|
@ -2445,24 +2448,25 @@ define(
|
|||
var data = {
|
||||
'explain_costs': self.explain_costs
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting costs option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting costs option in explain') }}'
|
||||
'{{ _('Error occurred while setting costs option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting costs option in explain') }}'
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// This function will toggle "buffers" option in explain
|
||||
|
@ -2480,25 +2484,25 @@ define(
|
|||
var data = {
|
||||
'explain_buffers': self.explain_buffers
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting buffers option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting buffers option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting buffers option in explain') }}'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
// This function will toggle "timing" option in explain
|
||||
|
@ -2515,25 +2519,25 @@ define(
|
|||
var data = {
|
||||
'explain_timing': self.explain_timing
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
url: "{{ url_for('sqleditor.index') }}" + "query_tool/preferences" ,
|
||||
method: 'PUT',
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(data),
|
||||
success: function(res) {
|
||||
if(res.success == undefined || !res.success) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting timing option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting timing option in explain') }}'
|
||||
);
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
alertify.alert('Explain options error',
|
||||
'{{ _('Error occurred while setting timing option in explain') }}'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue