Add disconnect button to close active connection

This commit is contained in:
Dan Sosedoff 2016-02-04 23:13:54 -06:00
parent da43314332
commit f08c9d36a6
4 changed files with 207 additions and 269 deletions

File diff suppressed because one or more lines are too long

View File

@ -471,10 +471,13 @@
display: none;
}
#edit_connection {
.connection-actions {
position: fixed;
right: 8px;
top: 10px;
}
#edit_connection, #close_connection {
background: #79589f;
color: #fff;
border-color: #fff;

View File

@ -29,7 +29,10 @@
<li id="table_connection">Connection</li>
</ul>
<a href="#" id="edit_connection" class="btn btn-default btn-sm"><i class="fa fa-globe"></i> Edit Connection</a>
<div class="connection-actions">
<a href="#" id="edit_connection" class="btn btn-default btn-sm"><i class="fa fa-database"></i> Connect</a>
<a href="#" id="close_connection" class="btn btn-default btn-sm">Disconnect</a>
</div>
</div>
<div id="sidebar">
<div class="tables-list">

View File

@ -93,6 +93,7 @@ function getHistory(cb) { apiCall("get", "/history", {}, cb)
function getBookmarks(cb) { apiCall("get", "/bookmarks", {}, cb); }
function executeQuery(query, cb) { apiCall("post", "/query", { query: query }, cb); }
function explainQuery(query, cb) { apiCall("post", "/explain", { query: query }, cb); }
function disconnect(cb) { apiCall("post", "/disconnect", {}, cb); }
function encodeQuery(query) {
return window.btoa(query);
@ -883,6 +884,12 @@ $(document).ready(function() {
showConnectionSettings();
});
$("#close_connection").on("click", function() {
disconnect(function() {
showConnectionSettings();
});
});
$("#close_connection_window").on("click", function() {
$("#connection_window").hide();
});