Skip to content

Commit

Permalink
前端细节体验优化
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo authored and lihuanhuan committed Apr 16, 2018
1 parent 2c6b88a commit cce0ab7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions sql/static/slowquery.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
</li>
<div class="form-inline pull-right">
<div class="form-group">
<select id=cluster_name class="form-control selectpicker" name="cluster_name_list" data-live-search="true">
<select id=cluster_name class="form-control selectpicker" name="cluster_name_list"
data-live-search="true">
<option value="is-empty" disabled="" selected="selected">请选择集群</option>
{% for cluster_name in cluster_name_list %}
<option value="{{ cluster_name }}">{{ cluster_name }}</option>
Expand Down Expand Up @@ -177,6 +178,7 @@

//保留如果已选择cluster_name,进入页面自动加载
$(document).ready(function () {
sessionStorage.removeItem('SQLId');
sessionStorage.setItem('slowsql_active_li_id', 'slowsql_tab');
if (sessionStorage.getItem('slow_query_cluster_name')) {
$("#cluster_name").val(sessionStorage.getItem('slow_query_cluster_name'));
Expand All @@ -200,8 +202,8 @@
if ($("#cluster_name").val()) {
if (active_li_id === 'slowsql_tab') {
$("#sqladvisor-toolbar").hide();
slowquery_review()

sessionStorage.removeItem('SQLId');
slowquery_review();
}
else if (active_li_id === 'slowsqlinfo_tab') {
$("#sqladvisor-toolbar").show();
Expand Down
4 changes: 2 additions & 2 deletions sql/static/sqladvisor.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<select id="verbose" name="verbose"
class="form-control selectpicker show-tick bs-select-hidden" data-name="是否查看优化过程"
data-placeholder="是否查看优化过程:" required>
<option value="is-empty" disabled="" selected="selected">是否查看优化过程:</option>
<option value="1"></option>
<option value="is-empty" disabled="">是否查看优化过程:</option>
<option value="1" selected="selected"></option>
<option value="0"></option>
</select>
</div>
Expand Down
5 changes: 3 additions & 2 deletions sql/views_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,6 @@ def sqladvisorcheck(request):
clusterName = request.POST['cluster_name']
dbName = request.POST.POST['db_name']
verbose = request.POST.POST['verbose']
if verbose is None:
verbose = 1
finalResult = {'status': 0, 'msg': 'ok', 'data': []}

# 服务器端参数验证
Expand All @@ -441,6 +439,9 @@ def sqladvisorcheck(request):
finalResult['msg'] = 'SQL语句结尾没有以;结尾,请重新修改并提交!'
return HttpResponse(json.dumps(finalResult), content_type='application/json')

if verbose is None or verbose == '':
verbose = 1

# 取出主库的连接信息
cluster_info = master_config.objects.get(cluster_name=clusterName)

Expand Down

0 comments on commit cce0ab7

Please sign in to comment.