Add button to edit connection settings

This commit is contained in:
Dan Sosedoff
2014-11-01 20:06:15 -05:00
parent 7cbf8a0a84
commit 306dc2e4d8
3 changed files with 36 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
var editor;
var connected = false;
function apiCall(method, path, params, cb) {
$.ajax({
@@ -307,6 +308,10 @@ function addShortcutTooltips() {
}
}
function showConnectionSettings() {
$("#connection_window").show();
}
$(document).ready(function() {
$("#table_content").on("click", function() { showTableContent(); });
$("#table_structure").on("click", function() { showTableStructure(); });
@@ -339,6 +344,18 @@ $(document).ready(function() {
showTableInfo();
});
$("#edit_connection").on("click", function() {
if (connected) {
$("#close_connection_window").show();
}
showConnectionSettings();
});
$("#close_connection_window").on("click", function() {
$("#connection_window").hide();
})
$("#connection_form").on("submit", function(e) {
e.preventDefault();
@@ -361,9 +378,11 @@ $(document).ready(function() {
button.prop("disabled", false).text("Connect");
if (resp.error) {
connected = false;
$("#connection_error").text(resp.error).show();
}
else {
connected = true;
$("#connection_window").hide();
loadTables();
$("#main").show();
@@ -376,9 +395,11 @@ $(document).ready(function() {
apiCall("get", "/info", {}, function(resp) {
if (resp.error) {
$("#connection_window").show();
connected = false;
showConnectionSettings();
}
else {
connected = true;
loadTables();
$("#main").show();
}