diff --git a/static/css/app.css b/static/css/app.css index 9c94e0a..c9ea85b 100644 --- a/static/css/app.css +++ b/static/css/app.css @@ -129,12 +129,16 @@ box-shadow: none; background: #7eb54e; float: left; + margin-right: 10px; +} + +#input .actions .btn-default { + background: #aaa; } #input .actions #query_progress { display: none; float: left; - margin-left: 12px; line-height: 30px; height: 30px; color: #aaa; @@ -144,10 +148,15 @@ outline: 0 none; box-shadow: 0; } + #input .actions .btn:hover { background: #7eb154; } +#input .actions .btn-default:hover { + background: #bbb; +} + #output { position: absolute; left: 0px; diff --git a/static/index.html b/static/index.html index d600bcc..266a8ea 100644 --- a/static/index.html +++ b/static/index.html @@ -31,6 +31,8 @@
+ +
Please wait, query is executing...
diff --git a/static/js/app.js b/static/js/app.js index 4149674..54cf388 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -144,12 +144,46 @@ function runQuery() { setCurrentTab("table_query"); $("#run").attr("disabled", "disabled"); + $("#explain").attr("disabled", "disabled"); $("#query_progress").show(); - executeQuery(editor.getValue(), function(data) { + var query = $.trim(editor.getValue()); + + if (query.length == 0) { + return; + } + + executeQuery(query, function(data) { buildTable(data); $("#run").removeAttr("disabled"); + $("#explain").removeAttr("disabled"); + $("#query_progress").hide(); + $("#input").show(); + $("#output").removeClass("full"); + }); +} + +function runExplain() { + setCurrentTab("table_query"); + + $("#run").attr("disabled", "disabled"); + $("#explain").attr("disabled", "disabled"); + $("#query_progress").show(); + + var query = $.trim(editor.getValue()); + + if (query.length == 0) { + return; + } + + query = "EXPLAIN " + query; + + executeQuery(query, function(data) { + buildTable(data); + + $("#run").removeAttr("disabled"); + $("#explain").removeAttr("disabled"); $("#query_progress").hide(); $("#input").show(); $("#output").removeClass("full"); @@ -190,6 +224,10 @@ $(document).ready(function() { runQuery(); }); + $("#explain").on("click", function() { + runExplain(); + }); + $("#results").on("click", "tr", function() { $("#results tr.selected").removeClass(); $(this).addClass("selected");